#llm
Model releases and internals: LLMs, embedding, OCR and classifier models, inference, caching, local models
Writing
- How Prompt Caching Works
What LLM APIs cache, what breaks the cache, and why long agent loops get 5–10× cheaper with it.
- My Local LLM On A 32 GB M1 Pro
How I adapted an M1 Max guide to half the machine by handing it to pi and letting it grill me first, plus the exact, reproducible steps that came out the other end.
TIL notes
- Oct 19, 2026
EmbeddingGemma 2 puts text, code, images, video and audio (or a mix) into one 768-dimension vector, from a 740M open model under Apache 2.0. Image, video and audio tokens are spliced into the text sequence and run through one encoder, so a text query can find a video moment or a scanned PDF page without captioning or transcribing first.
- It’s not the quality leader. Text is flat against v1; the gain is code (MTEB Code 68.8 to 78.7). Audio (49) and video (51) scores are modest. All numbers are Google’s own.
- Every major vendor ships one-space multimodal embeddings now: Amazon Nova, Gemini Embedding 2, Voyage, Cohere, and the open Qwen3-VL-Embedding, which reports higher image and document scores but has no audio. Pick by constraint. EmbeddingGemma 2’s niche is open weights plus audio.
- Matryoshka truncation isn’t free: its MMEB score falls from 59.0 at 768 dimensions to 45.7 at 128.
- The interesting part is the system around the model. DigUp is local file search on it: one vector per photo, PDF page, video shot and 30 s of audio, each pointing back to its page or second, next to an FTS5 keyword index, because no embedding holds an invoice number exactly.
- DigUp fuses the two by turning cosine into a per-query z-score (how far a match stands out for this query), gating on it, and adding a word-coverage bonus. It beat reciprocal-rank fusion on their evals (R@1 0.88 vs 0.73) and can honestly say “nothing found”. Small, author-run eval.
- It also pins llama.cpp, records the model version in the index, and checks every upgrade against stored reference vectors. Vectors from two runtimes don’t mix, and nothing errors when they do.
- Oct 11, 2026
Small on-device models are getting good enough to sit in front of the big ones. Rampart from the National Design Studio redacts PII in the browser before a prompt reaches any LLM: regexes with checksum or structural checks for cards (Luhn), SSNs, emails, URLs and IPs, plus a fine-tuned MiniLM for names, phones, account numbers, government IDs and street addresses.
- 14.7 MB Q4 ONNX (~15 MB with tokenizer), 98.4% private-term recall across seven Latin-script languages. p50 is 3.9 ms on WebGPU but 12.6 ms on the default WASM backend. OpenAI’s Privacy Filter is ~2.8 GB; Presidio scores 65% on the same test set.
guard.protect()swaps PII for placeholders like[GIVEN_NAME_1], andguard.reveal()fills them back into the reply. The LLM never sees the name; the user still does.- Default-deny: every detected label is redacted except city, state and ZIP, so the assistant keeps coarse location without the street line.
- Know the gaps: names in non-Latin scripts recall ~14% (Hindi 6%, Arabic 5%), and it scores 86.4% on a hostile-input suite. The repo calls it harm reduction, not perfect protection.
- Same size class, different job: Cactus Whistle is 16.9 MB speech-to-text in seven languages, 11 ms to first token on an M4 Pro CPU (Whisper base: 145 MB, 73 ms). It loads into the same engine as Needle 3, their tool-calling model, so one call takes audio in and returns
set_lights(room="kitchen", on=false). Voice commands for home automation with no cloud round trip. - The pattern: a tiny specialist at the edge does one narrow job (redact, transcribe, route), and the big model only sees what it needs. Both sets of benchmarks are vendor-reported.
- Oct 10, 2026
Sebastian Raschka’s history of text classifiers puts numbers on why Jev feels new. On IMDb, bag-of-words + logistic regression gets 89.9%, a fine-tuned ModernBERT about 95%, and Jev 96.5% zero-shot for $0.65 across 25k reviews. Under the hood it is likely still a pretrained transformer with a one-number head that scores each answer option. The hard part is broad training data and calibrated probabilities. What changes is the cost of starting: no labelling, training or hosting per task. Specialists still win on huge volume, the last point of accuracy, or data that can’t leave your network. Within a month OpenAI and Microsoft shipped the same yes/no, choice and score contract.
- Jun 26, 2026
baidu/Unlimited-OCR (paper) parses dozens of pages in one forward pass by fixing the real bottleneck in end-to-end OCR.
- The problem: an OCR decoder types out the page token-by-token, and its KV cache grows unbounded with output length — so memory climbs and speed decays the longer the doc, forcing page-by-page loops that wipe memory each step.
- The trick (Reference Sliding Window Attention): split context into two zones with different retention. Vision/prompt tokens stay fully visible and pinned forever (the “source book”); each token attends to only the last 128 of its own outputs (the “last few words you wrote”). KV cache becomes a fixed-size queue, so memory and TPS stay flat regardless of output length.
- The non-obvious part: discarding history improves accuracy (+6% on OmniDocBench, beating Qwen2.5-VL-72B at 3B/0.5B-active) — full attention can diverge on long dense output, and pinned vision tokens never blur.
- Cheap to build: freeze DeepSeek-OCR’s encoder, fine-tune only the decoder with the swapped attention.
- Generalizes past OCR: separate what you reference from what you remember.
- Ran it on an M1 Mac (32GB) with R-SWA intact, no NVIDIA. The official HF model (
trust_remote_code) already ships R-SWA as a pure-PyTorch eager ring buffer (SlidingWindowLlamaAttention, picked viaattn_implementation="eager") — not buried in a CUDA/FlashAttention kernel. So the “port” was just stripping.cuda()/torch.autocast("cuda")and running bf16 on MPS; zero MPS op-gaps hit. bf16 works on MPS in torch 2.12. - Proof R-SWA is live: instrument the KV cache during decode — on a 540-token page it plateaus at
prefill(277) + window(128) = 405and never grows (full MHA would hit 817). That constant-cache assertion + Distinct-35≈1.0 are the decisive signals, not edit distance (too noisy vs a single reference). - Gotcha: feeding all pages to one
generate()(infer_multi) loops at the document level — the 128-token decode window forgets the doc was already transcribed while the vision prefix still shows every page, so it restarts from page 1. Fix = onegenerate()per page (matches officialinfer.pyPAGE_SIZE=1). Accuracy then lands at/below gemini-vs-docai inter-annotator noise (~0.31 mean edit). ~35–55 s/page on M1.
- Jun 8, 2026
faberic is a crowd-sourced collection of prompts bundeled with a cli to use them via piped interfaces.
- Feb 6, 2026
Opus 4.6 launch.
- context compaction (beta) and 1M context window, enables longer agentic tasks without loosing context.
- they claim it has found 500 Zero-Day Flaws in open-source projects (yet to see the proofs though)
- agent teams, multiple agent coordinates with a leader agent. https://code.claude.com/docs/en/agent-teams