Archive
Everything published so far, newest first.
Serving a 7B model on a single consumer GPU
Nov 19, 2026 · serving, quantization
The card had 24 GB. The weights, in bf16, wanted 14. Three things decided the rest of the budget.
KV cache dominates at long context. At 8k tokens with 32 layers and GQA, the cache for a single sequence can approach the size of the quantized weights. Batch two long sequences and you are no longer compute bound — you are allocator bound. Paged attention with a block size of 16 kept fragmentation under control; a naive pre-allocation scheme wasted about 30% of the cache.
Quantization moves the bottleneck, it does not delete it. 4-bit weights cut the footprint roughly in half, but decode became memory-bandwidth bound well before it became compute bound. The practical takeaway: measure tokens/second against context length, in a table, or you will optimise the wrong axis.
The tokenizer is not free. On mixed English and code, tokenizer overhead sat around 6% of wall time — enough to matter when the sampler is already fast.
Numbers worth keeping: throughput fell from ~48 tok/s at 512 context to ~21 tok/s at 8k, single stream; batching four short requests recovered most of the gap.
Evaluation harnesses that catch regressions
Nov 12, 2026 · evaluation
A test suite for a model pipeline has a different job than a benchmark: it exists to fail. Three properties made ours useful.
- Cheap enough to run on every change. 120 golden cases, 40 seconds, no grader model. Anything slower gets skipped, and a skipped test is not a test.
- Pairwise, not absolute. Asking a judge "is B better than A" was markedly more stable than "score this 1–10". We kept a small absolute rubric only for the release gate.
- Exact-match metrics rot. Any check that compares strings breaks the moment the model rephrases. We moved to structural assertions — required fields, cited spans, refusal behaviour.
One habit that paid off: store every failure as a permanent case. The suite grew from 60 to 300 cases in four months and never regressed twice on the same input.
RAG is a retrieval problem, not a prompt problem
Nov 4, 2026 · retrieval, embeddings
When a system says the context is irrelevant, the usual cause is that the right chunk was never retrieved. Diagnose in this order.
- Print the top-20 retrieved chunks for the failing query. If the answer is not in them, stop editing the prompt.
- Check recall@k before precision. A reranker cannot recover a document that chunking destroyed.
- Chunk on structure, not on character count. Splitting mid-table produced plausible-looking text with the numbers detached from their headers.
- Keep a "no answer" path. Systems that must always answer hallucinate; systems allowed to abstain get measurably more trustworthy.
On our corpus, moving from fixed 512-token chunks to heading-aware chunks with 15% overlap lifted recall@10 from 0.61 to 0.79 with no model change.
Structured output: constrained decoding vs. retry loops
Oct 27, 2026 · tooling
Grammar-constrained sampling guarantees parseable output, which is not the same as correct output. We shipped both, in this order.
Start with a strict validator and a retry budget of two. It is boring, it is easy to observe, and the failure rate on well-specified schemas was about 1.5%. Add constrained decoding when the schema is large or nested — the retry tax scales with output length, and on 200-field records the loop was costing more latency than the generation itself.
The trap: constrained decoding makes malformed output impossible, so teams stop validating semantics. Keep the validator. It should reject valid JSON that says the wrong thing.
Small models, narrow domains
Oct 15, 2026 · fine-tuning
A 3B model fine-tuned on 400 curated examples beat a frontier model on our classification task — on accuracy, latency and cost. It also failed differently, which matters more than the score.
The small model was confidently wrong on inputs that resembled the training distribution but carried a negation. The frontier model hedged. If your product can tolerate "I am not sure" but not confident errors, the trade is not as simple as the benchmark table suggests.
Practical note: 400 examples was enough for a single narrow label set. As soon as we added a second task, interference appeared and the dataset need roughly tripled.
Measuring latency: p50 lies
Oct 2, 2026 · performance
Time-to-first-token is bimodal in most deployments: a fast path for warm prefix cache and a slow path for everything else. Reporting the mean reports the cache hit path.
Report at least p50, p90 and p99 per cache state, and log the cache state with the request. Our p50 was 180 ms; p99 was 2.4 s, and every user complaint came from the tail that the dashboard never showed.