ML coding
Machine learning algorithms and model parts written from scratch in NumPy and PyTorch, as ML coding rounds ask.
Machine learning algorithms and model parts written from scratch in NumPy and PyTorch, as ML coding rounds ask.
2 write-ups
| Title |
|---|
| KV Cache and Incremental Decoding A KV cache for a small decoder in PyTorch, from recomputing the prefix to a growing cache to a preallocated one, with prefill vs decode, offset masks, an exactness test and the memory math. |
| Decoding: Greedy, Sampling and Beam Search Turning next-token logits into text in PyTorch: greedy, temperature, top-k and top-p sampling as masks over a batch, beam search checked against exhaustive search, and repetition penalties. |