64Implement top-p (nucleus) sampling from a list of logits in pure Python.▼mediumOpenAIAnthropicHugging Face1 replies◆ premiumEvery chat model decodes with top-p, but few candidates can build it from logits: softmax, sort, take the smallest set of tokens whose cumulative probability crosses p, renormalize, sample. The screen for whether you understand decoding, not just call an API.Open full answer →
65Compute cross-entropy loss manually from logits and a target index, no framework.▼mediumOpenAIAnthropicHugging Face1 replies◆ premiumThe loss every language model trains on, built from logits with no torch in sight. The screen for whether you understand log-softmax and the numerical-stability trick, not just import nn.CrossEntropyLoss.Open full answer →
66Implement a minimal trainable byte-pair encoding tokenizer: learn merges, then encode and decode.▼hardOpenAIAnthropicHugging Face2 replies◆ premiumBPE is how GPT and most LLMs turn text into tokens, and building a tiny trainable version from a corpus is a favorite deep-dive. The screen for whether you understand the merge loop, deterministic tie-breaking, and round-trip decode, not just tiktoken.encode.Open full answer →