Notes on what I'm learning, in my own words.
188 posts found
/AI/5 min read
Deciding to stop is only half of barge-in; the audio already on its way keeps playing. A server that pushed 3 s of speech ahead talks over the user for 3.2 s after it decides to stop. Pace the stream and flush the client and it is 280 ms; mute on the device itself and it is about 210.
/AI/5 min read
An MDP is the mathematical frame for decisions whose effects ripple forward. In a tiny machine that earns 2 for running fast but overheats if pushed when warm, always-slow is worth 10, always-fast −4.55 — and value iteration finds the policy "fast when cool, slow when warm" worth 15.5.
/AI/5 min read
A decision tree asks one yes/no question at a time, choosing each by how much purer it makes the groups: splitting 10/10 into 8/2 and 2/8 cuts Gini impurity from 0.5 to 0.32. A forest averages hundreds of deliberately different trees — 100 trees with correlation 0.3 keep only 30.7% of one tree's variance.
/AI/4 min read
"Mm-hmm" means keep going. Over four minutes of agent speech a caller might say it 24 times; a barge-in rule that stops for any 300 ms of sound halts the agent about 15.6 times in that call. Recognising backchannels as words brings it to about 1.2 — and a good agent says them too.
/AI/4 min read
A jailbreak is an input crafted to get a model to do what its training told it not to. Attackers get unlimited retries: a trick that works 2% of the time succeeds within 100 attempts 86.7% of the time. That is why defence is layered — three independent filters that each miss 10% let through 0.1%.
/AI/4 min read
Logprobs are the model's own probability for each token it wrote, on a log scale. Four tokens at 0.9, 0.6, 0.95 and 0.05 sum to −3.663 — a sequence probability of 2.6% — and the single −2.996 is where to look for a guess. They turn a fluent answer back into a measure of how sure the model was.
/AI/4 min read
The context window is everything a model can see at once — about 100,825 words, or 306 pages, at 128k tokens. Filling it costs 256 times the attention arithmetic of an 8k context and 42.9 GB of cache on a 70B model, and a 20-turn chat re-sends 105,000 tokens to hold a 10,000-token conversation.
/AI/4 min read
KL divergence measures the extra bits you pay for using the wrong distribution. For P = [0.5, 0.3, 0.2] and Q = [0.4, 0.4, 0.2] it is 0.0365 bits one way and 0.0372 the other — not a distance — and if Q gives an outcome that P considers likely just one in a million, it jumps to 3.30.
/AI/4 min read
While a voice agent speaks, the user's microphone picks up interruptions, coughs, "mm-hmm"s and the TV. Stop after 150 ms of sound and the agent halts for 98.3% of backchannels and 84.7% of coughs; wait 700 ms and those fall to 4.2% and 2.0% — but every real interruption takes 700 ms to obey.
/AI/4 min read
Fit 15 noisy points with a straight line and it is wrong in the same way every time (bias). Fit them with a degree-12 polynomial and it is wrong in a different way every time (variance). Across 400 simulated datasets the line scores 0.304 on new data, degree 12 scores 0.587 despite the lowest training error, and degree 3 wins at 0.116.
/AI/4 min read
Start every weight at the same value and every hidden neuron computes the same thing, gets the same update, and stays identical forever. A 4-neuron XOR network started at 0.5 ends 5,000 steps later with all four neurons still exactly equal and the problem unsolved; started randomly, it solves it.
/AI/4 min read
On a bowl 50 times steeper one way than the other, plain SGD must keep its step under 0.04 or diverge, and then crawls: 137 steps at best. Momentum gets there in 83, Adam in 80. Every popular optimizer is a fix for the same problem — one learning rate for directions that need different ones.
/AI/4 min read
A half-duplex agent takes turns: it listens, then speaks. A full-duplex one listens and speaks at once, deciding every 80 ms whether to talk. That makes overlap, backchannels and instant yielding natural — and means running the model 7,500 times in a 10-minute call instead of about 936.
/AI/4 min read
Teach a model what should not matter by showing it the same example changed in ways that keep the label. Random 4-pixel shifts and a horizontal flip turn each 32×32 image into 162 variants — 8.1 million from 50,000 — but flip the wrong thing and a 6 becomes a 9.
/AI/4 min read
A 5% chance of interrupting on any single turn sounds tolerable. Over a 12-turn call it means 46.0% of callers are cut off at least once; at 10% it is 71.8%. Cut-offs have half a dozen distinct causes, and each needs its own fix.
/AI/4 min read
Serving turns a trained model into an API that answers within a deadline at an affordable price. The same $2-an-hour GPU costs $11.11 per million tokens serving one request at a time and $0.28 when batching — and pushing it from 50% to 95% busy multiplies queueing delay nineteen-fold.
/AI/4 min read
50,000 examples in batches of 32 is 1,563 iterations per epoch; ten epochs is 15,630 weight updates. Batches of 512 need only 980 updates for the same ten epochs and give gradients a quarter as noisy. A large language model, by contrast, sees most of its data less than once — 3.75 million steps, under one epoch.
/AI/4 min read
People read phone numbers in groups — 415, pause, 555, pause, 0134. If those pauses run a median 450 ms, a 500 ms endpointer cuts 66.0% of phone numbers in half and 80.1% of card numbers. Knowing how many digits are expected fixes it; a longer timer barely does.
/AI/4 min read
Cosine similarity compares the direction of two vectors and ignores their length: (3, 4) and (6, 8) score exactly 1. In high dimensions, unrelated vectors score near 0 — random 768-dimensional vectors land within about ±0.037 — which is what makes a score of 0.4 meaningful.
/AI/4 min read
A VLM cuts an image into 14-pixel patches, encodes them, and feeds them to a language model as if they were words. A 336-pixel image becomes 576 tokens — about as much context as 443 words — and a minute of video at one frame a second is 34,560.
/AI/4 min read
Backpropagation multiplies a gradient by one factor per layer. At 0.9 per layer, 50 layers leave 0.5% of it; at 1.1, it grows 117-fold. In a simulated 50-layer ReLU network, weights drawn slightly too small shrink the signal to 2.7 × 10⁻¹³, slightly too large grow it to 5.65 million, and He initialisation keeps it near 0.5.
/AI/4 min read
One-hot encoding turns a category into a vector of zeros with a single 1. It makes no false claims about order or similarity — and that is also its limit: every pair of categories is equally unrelated, and a 50,000-word one-hot is 195 KB to say what a 4-byte index says.
/AI/4 min read
Logits are a model's raw scores before they become probabilities. A logit of 0 is a coin flip, 2.2 is 90% and 4.6 is 99% — every 2.3 is another factor of ten in the odds. A language model produces 128,000 of them per token, and editing them directly is how constrained decoding works.
/AI/4 min read
Ask "what's your policy number?" and the caller goes looking for it. If their thinking pauses run a median 2.5 s, a 2-second ceiling interrupts 61.0% of them and even 4 seconds interrupts 27.8%. The fix is not a longer timer but recognising that the user is still holding the turn.
/AI/5 min read
An LLM does one thing — predict the next token — and repeats it. Learning to do that well on 15 trillion tokens takes about 6.3 × 10²⁴ operations for a 70B model, roughly 18 days on 10,000 GPUs; answering one question with what it learned takes 70 trillion.
/AI/4 min read
Softmax turns any list of scores into probabilities that sum to 1: [3, 1, 0.2] becomes [0.836, 0.113, 0.051]. Adding 100 to every score changes nothing — which is the trick that stops it overflowing, since a float16 exponential breaks above 11.09 and float32 above 88.7.
/AI/4 min read
A fixed 500 ms silence rule is a different rule for every speaker: it cuts off 13.7% of a quick talker's turns and 39.0% of a slow one's. Scaling the wait to each person's own pauses — 350 ms for one, 800 ms for the other — gives both the same 21.7%, and the quick talker faster replies.
/AI/4 min read
Three slices of data, three jobs: learn, choose, and report. Skip the middle one and tune on the test set, and the best of 20 equally good models scores 91.71% on a 1,000-example test that all of them would really score 90% on — an improvement that does not exist.
/AI/4 min read
Without a bend between layers, a deep network is one linear layer in disguise. Which bend matters too: a sigmoid's slope is at most 0.25, so ten sigmoid layers can shrink a gradient by a factor of a million — 9.54 × 10⁻⁷. ReLU's slope is 1, which is most of why deep networks became trainable.
/AI/4 min read
A fixed 500 ms silence rule answers every turn after 500 ms and cuts off 21.7% of turns. A model that reads the words can answer clear endings after 150 ms and wait a full second on doubtful ones — 405 ms on average, with turns cut off 12.9% of the time. Faster and politer at once.
/AI/4 min read
Endpointing is a classifier that fires on every pause and must say "finished" or "still talking". Over 1,000 real endings and 3,000 mid-sentence pauses, a 300 ms silence rule is right only 67.5% of the times it fires; 1,200 ms reaches 94.2% — and makes every reply 1.2 s late.
/AI/4 min read
Three lookups at a median 600 ms each take a median 1,984 ms one after another and 948 ms in parallel; the 95th percentile drops from 3,456 ms to 1,954. Parallelism, prefetching, fillers and honest timeouts are how a voice agent stays conversational while the backend is slow.
/AI/4 min read
Stack layers of neurons with a bend between them and you can approximate any reasonable function. Each ReLU adds one kink: 4 of them fit a sine wave to within 0.21, 32 to within 0.0048. Inside every transformer, an MLP holds two-thirds of each layer's parameters.
/AI/4 min read
Start writing the reply when the user merely seems to have finished, and throw it away if they keep talking. Starting at 150 ms of silence instead of 500 saves 350 ms on every turn it guesses right — at the cost of about half again as many generated tokens.
/AI/4 min read
"Let me check that for you" is not politeness; it is latency engineering. If a lookup takes a median 800 ms with a 2.5 s tail, a 0.6 s filler covers it 33.9% of the time, a 1.2 s filler 72.2%, and a 2 s one 90.8% — and the remaining silences are the ones users notice.
/AI/4 min read
A batch TTS engine synthesises a whole sentence before you hear any of it: 7.2 s of speech at 10× real time is a 0.72 s wait. A streaming engine starts speaking after a few words — but it has to commit to intonation before it knows how the sentence ends.
/AI/4 min read
Between the LLM's token stream and the voice sits a small piece of code deciding when there is enough text to speak. Waiting for a full 18-word sentence costs 0.47 s; speaking at the first comma costs 0.18 s; four words, 0.10 s — each cut trading a little naturalness for speed.
/AI/4 min read
Voice-to-voice latency is the gap a person actually hears. A server that logs 620 ms is delivering about 800 ms over WebRTC and 1,020 ms over a phone line — and estimating the 95th percentile from 50 calls can land anywhere from 1,154 to 1,578 ms.
/AI/4 min read
A 60-word spoken reply lasts 24 seconds. Generating it takes 1.56 s and synthesising it 2.4 s — so a non-streaming agent stays silent for 4.21 s, while a streaming one can start talking in under one. Users judge the silence, not the total.
/AI/4 min read
Almost all the arithmetic in a neural network is one operation: multiply a matrix of inputs by a matrix of weights. A 70B model does about 140 GFLOPs of it per token — and serving one user at a time uses 0.34% of a GPU's compute, because a matrix times a single vector reuses nothing.
/AI/4 min read
Seven stages with medians adding up to 820 ms do not give an 820 ms agent. Simulated with realistic spread, the median turn takes 891 ms, the 95th percentile 1,407 ms, and a third of all replies take over a second. Adding up per-stage p95s would have predicted 1,890.
/AI/4 min read
A cascade chains speech-to-text, a text LLM and text-to-speech; a speech-to-speech model hears audio and speaks audio. The second keeps tone and cuts hand-offs, but a 10-minute call at 25 audio tokens a second is about 30,000 tokens of context against roughly 1,950 as text.
/AI/4 min read
Layers of weighted sums, each followed by a bend. A network with 17 parameters learns XOR — something no single neuron can — going from outputs stuck near 0.41 to 0.01 / 0.99 / 0.99 / 0.013 in 5,000 steps. Every large model is the same idea with more of everything.
/AI/4 min read
Barge-in is the user talking over the agent and the agent yielding. Detection takes ~200 ms; whatever audio is already buffered keeps playing — 500 ms of buffer means 700 ms of both talking at once. And the agent must forget the 85 words it planned but never said.
/AI/5 min read
Humans swap turns in about 200 ms without talking over each other. A voice agent that waits for silence has to pick a threshold — and in a simple model of real pauses, 300 ms cuts off 40.9% of turns while 1,200 ms still cuts 6.0% and adds over a second of dead air.
/AI/4 min read
A model does not look facts up; it picks the next token from a distribution. When it is unsure, that distribution is spread over plausible wrong answers, and one gets written with the same fluency as the truth. A 25-token citation right at 97% per token is fully right 46.7% of the time.
/AI/4 min read
The model itself remembers nothing between conversations. What feels like memory is text placed into the prompt: a list of saved facts, and snippets retrieved from past chats. A 1,000-token memory block rides along with every message — 30,000 tokens a day for a moderate user.
/AI/4 min read
A browser agent looks at a page, decides on one click or keystroke, and looks again. At 98% reliability per action a 20-step task finishes 66.8% of the time and a 50-step one 36.4% — which is why the design is mostly about taking fewer, surer steps.
/AI/4 min read
Users write bad search queries, and a retriever can only find what the query resembles. Rewriting the question three ways lifts recall from 60% to 93.6% if the rewrites fail independently — 76.8% if they fail together half the time — and reciprocal rank fusion decides which results win.
/AI/4 min read
Chain-of-thought commits to one line of reasoning; Tree of Thoughts explores several and keeps the best. A three-step problem solved 21.6% of the time in one chain becomes 97.0% with five candidates per step and a perfect judge — and 49.6% with a judge that is right 80% of the time.
/AI/4 min read
A chunk that says "revenue grew 3%" does not say whose revenue or when. Contextual retrieval has a model write that missing context onto each chunk before indexing. Anthropic measured a 49% cut in retrieval failures — and prompt caching makes the preprocessing 6.2× cheaper.
/AI/5 min read
Ollama packages a quantized model, an inference engine and an HTTP server behind one command. On a laptop, the speed you get is set by one division: memory bandwidth over model size — 20.6 tokens a second for an 8B model at 100 GB/s, 2.4 for a 70B.
/AI/4 min read
A model keeps generating until something tells it to stop. When that fails, a 200-token answer runs to the 4,096-token cap — 20.5× the cost and 82 seconds instead of 4. With a 1% miss rate, that is ten runaways in every thousand replies.
/AI/4 min read
A model never sees text, only token IDs, and the split decides what it costs and what it can do. At 1.3 tokens per word a 128k window holds 100,824 words; at 4 tokens per word — common for languages the tokenizer under-trained on — it holds 32,768, at 3.08× the price.
/AI/5 min read
A kernel is a function run by thousands of GPU threads at once. Whether it is fast depends on one ratio — arithmetic per byte moved. An element-wise add reaches 0.056% of an H100's peak; a 4,096-square matrix multiply can use nearly all of it. Fusing three element-wise ops is a free 3×.
/AI/4 min read
If writing code is 30% of the job, making it ten times faster makes the job 1.37× faster — and infinitely faster only 1.43×. The work that is left is deciding what to build and proving it works, and that is where the profession is heading.
/AI/4 min read
The 2017 transformer block is still recognisable in every frontier model, but nearly every part of it has been replaced. Most of the replacements are about one thing: a GPT-3-style cache needs 4.72 MB per token, which at 128k tokens is 618 GB for a single conversation.
/AI/4 min read
Both cut off the long tail of unlikely tokens before sampling, and each fails where the other works. On a confident step, top-p at 0.9 keeps 4 tokens where top-k keeps 40; on a flat one it keeps 15,996 where top-k keeps 40 — and leaves 62.5% of the probability out.
/AI/4 min read
Using a 70B language model to route a support ticket spends 241 times the arithmetic a small decision model needs — and returns a string that might not be one of the five queues. A System One model returns a typed answer with a calibrated probability instead.
/AI/5 min read
A voice agent is five components in a pipeline with a deadline. Assembled naively, the gap after the user stops speaking is 1,100 ms; people expect about 200. The design is mostly the work of taking those 900 milliseconds back.
/AI/4 min read
A system that improves the thing that improves it. Ten cycles at a steady 10% compound to 2.59×; with returns halving each cycle the ceiling is 1.21×. And on a 500-question benchmark, a change that makes the model 1% worse passes as an improvement 36.5% of the time.
/AI/4 min read
Temperature divides the logits before the softmax. On the same four candidates, T = 0.2 gives the wrong answer a 0.0% chance and T = 1.5 gives it 5.2% — which across 100 users means nobody sees it, or 99.5% of the time somebody does.
/AI/4 min read
Speculative decoding without a draft model: guess the next tokens by finding the last few tokens earlier in the context and copying what followed. On a code edit that is 4.59 tokens per step; in open chat it is 1.10 — and it never makes anything slower.
/AI/4 min read
One 32k-token prompt arriving on a shared server freezes every running conversation for 1.16 seconds — 178 decode steps. Splitting prefill and decode onto separate machines removes the freeze, at the price of shipping a 10.74 GB cache across the network.
/AI/5 min read
A 70B-class model stores 320 KB of keys and values per token — 10.74 GB for one 32k-token conversation, so 40 GB of free memory serves three. Quantizing and evicting the cache together takes that to 66, and the three methods that get there fail in different ways.
/AI/4 min read
Instead of embedding chunks, give the model a table of contents and let it navigate. A 300-page report is answered by reading 2,320 tokens instead of 150,000 — but every level of the tree is a chance to take the wrong branch, and 95% per step is 85.7% after three.
/AI/5 min read
Chunk size is a trade between two failure rates that both scale as L/C: a 60-token fact is cut in half 23% of the time at 256-token chunks, and makes up only 23% of the chunk when it survives. Overlap is how you stop paying both.
/AI/4 min read
Attention weights must sum to exactly one, so "nothing here is relevant" cannot be expressed. The first token becomes where the surplus goes — and dropping it makes every remaining weight 2.63× sharper than the model intended.
/AI/4 min read
Limiting each token to a 4,096-position window cuts the attention cost 32× at 131k tokens — and cuts the memory a sequence holds from 17.18 GB to a fixed 537 MB, which is 3 concurrent requests becoming 122.
/AI/4 min read
A decode step launches 384 tiny kernels and spends 1.92 ms of CPU time just asking for them. Replaying the whole step as one recorded graph makes that 5 microseconds, which is 1.27× more tokens per second for no change in arithmetic.
/AI/4 min read
Putting the weights in on-chip SRAM makes a single stream 27× faster and costs 732× the throughput per chip. That one exchange rate explains every design decision in the architecture.
/AI/4 min read
Guessing the model's next hidden state instead of its next token removes the sampling noise from the guess. Going from 2.5 to 3.5 accepted tokens per pass is only an 11-point accept-rate gain, and a 40% speedup.
/AI/4 min read
Extra prediction heads on the same model replace a separate draft model — 134 MB instead of 2 GB. The acceptance chain multiplies, so the fourth head adds 0.044 tokens and the sixth adds 0.001.
/AI/4 min read
Attention costs n²d and recurrence costs nd², so they cross exactly at n = d — 768 tokens for a typical model. Transformers won on training parallelism, and pay for it past that crossover.
/AI/4 min read
A loop stops when its checker passes, so the checker sets a ceiling on quality that no number of attempts can lift. Tightening the checker buys more than improving the model does.
/AI/4 min read
Prefix tuning trains 48× more parameters than prompt tuning, and that factor is exactly twice the layer count. What the extra numbers buy is influence at every depth rather than only at the input.
/AI/5 min read
A graph with one three-way decision and a cycle capped at three has fifteen possible paths. The same work as a free loop with six tools and twelve steps has 2.61 billion. Only one of those numbers can be tested.
/AI/5 min read
An agent's cost grows with the square of its step budget, so doubling the budget nearly quadruples the bill. In one accounting the last six of twelve turns served 12% of runs and carried 71% of the tokens.
/AI/4 min read
Accuracy follows a U-shape across a long input, which means the order you pass chunks in is worth real points. Ten chunks arranged well beat twenty in rank order, using half the tokens.
/AI/5 min read
Detecting a watermark is a coin-flip test. At full strength 64 tokens is enough; every halving of the signal quadruples the text you need, which is exactly why paraphrasing defeats it.
/AI/5 min read
Nine hundred comparisons — one hour of someone's attention — taught a simulated robot to backflip. That is 11,111× fewer human decisions than scoring every step, and the trick is what the comparison is asked about.
/AI/5 min read
Thirteen thousand written examples is 0.002% of the pretraining text, and the whole alignment run was 1.6% of the compute. It made a 1.3-billion-parameter model preferred over a 175-billion one.
/AI/4 min read
Keeping one vector per token instead of one per passage lets every query term find its own best match. On a worked example that widened the gap between the right document and a plausible wrong one from 64% to 113%.
/AI/4 min read
A guardrail catching 90% of harmful requests with a 1% false-positive rate blocks 1,267 requests a day, of which 997 are legitimate. The visible effect of most guardrails is refusing real users.
/AI/5 min read
In the cloud the data travels to the model; on a device the model travels to the data. Three numbers decide which: the latency budget, the crossover request count, and the fraction of users who never take your update.
/AI/4 min read
One mask setting separates the two, and it decides two things that look unrelated: how much training signal a corpus yields, and whether generation can be made incremental. Both favour the decoder by a wide margin.
/AI/4 min read
A classifier picks one of a handful of labels. A generator picks one of 10^470 possible answers, which is why it cannot work by choosing from a list — and why its characteristic failure is being fluent and wrong.
/AI/5 min read
A filter that blocks 95% of attempts sounds strong and falls to a coin flip in fourteen tries. Which is why the defences that work are the ones enforced in code, where the number is 100% by construction.
/AI/4 min read
The trade-off everyone describes is real and it is not the main problem. When positives are rare, a 98%-accurate classifier produces alerts that are wrong 91% of the time — and the fix is not a better model.
/AI/4 min read
Two numbers can hold two distinguishable concepts. Sixteen can hold twenty-one. That measured curve is the reason real embeddings have hundreds of dimensions, and it is rarely the explanation given.
/AI/4 min read
Loading fifty procedures eagerly costs 210,000 tokens and does not fit. Loading their descriptions costs 4,750, which makes the whole thing work — and turns the real problem into a fifty-way choice made from twenty words.
/AI/4 min read
A protocol turns an N×M integration problem into N+M, which is 8.6× less work at a dozen apps and thirty systems. The part that needs more attention is that a server's own text reaches the model's context.
/AI/4 min read
Fine-tuning is good at changing how a model behaves and bad at teaching it facts. It also has a break-even point — about 6,750 requests in one worked case, and ten times that if the prompt it replaces was being cached.
/AI/4 min read
An agent can work out a column's type by looking. It cannot work out that status 'H' means excluded from revenue, because that fact is in someone's head — and four rules out of five are like that.
/AI/4 min read
Matching by meaning solves the vocabulary problem and creates a new one: one vector per chunk averages everything together, so a single distinguishing term contributes about 1/√n of the direction. At 200 tokens that is 7%.
/AI/5 min read
Three different models do three different jobs, and the reason is a latency budget. A completion has about 210 ms of model time before it feels late, and a large model needs six times that.
/AI/4 min read
Replacing old turns with a summary buys room, and each summary is lossy. Summarise a summary eight times and 43% of the original detail is left — which is why the facts that matter must never be summarised twice.
/AI/4 min read
A coding agent is a model plus tools plus a loop. The two things that make it work are searching instead of reading — a 700× reduction in what enters the context — and being able to check its own answer, which turns 55% into 96%.
/AI/4 min read
Running a model on a laptop CPU is a memory-bandwidth problem, not an arithmetic one — which sets a hard ceiling of about 12 tokens a second. It also explains why offloading half the layers to a GPU barely helps.
/AI/4 min read
Fewer bits per number is the easy part. What decides whether it works is how many numbers share a scale — and in one measured case the average error looked fine at 5% while the ordinary features were off by 42%.
/AI/4 min read
A model has no scratchpad except the tokens it has already written, and each token gets one fixed pass through the network. Asking for the steps is asking for more computation — sixty tokens of working is sixty times as much.
/AI/4 min read
Splitting a task across several prompts makes each step more reliable and makes more steps that all have to work. Those pull against each other, and the result is an optimal chain length that is shorter than most people assume.
/AI/4 min read
PyTorch builds the computation graph by running your code, which is why ordinary Python control flow works inside a model. The same decision explains its two most common bugs.
/AI/4 min read
An exact cache is never wrong. A semantic cache answers a question nobody asked, which makes the similarity threshold a decision about how often you are willing to be confidently incorrect.
/AI/4 min read
Keyword and vector search fail on opposite queries, so run both. The hard part is combining two ranked lists whose scores are not on the same scale — and the constant in the standard fix quietly decides your ordering.
/AI/4 min read
A question and its answer barely resemble each other, which is a problem when retrieval works by resemblance. HyDE has the model write a fake answer first and searches with that instead.
/AI/4 min read
Serving a model is two workloads wearing one name, and their metrics pull against each other. Time to first token is 1.5% of a long answer's duration and almost all of how responsive it feels.
/AI/5 min read
A GPU is thousands of simple cores, which suits the arithmetic of a neural network perfectly. What actually decides what you can build on one is not the cores — it is that training a model needs eight times the memory of running it.
/AI/4 min read
The point is not that graphs are more flexible than lines. It is that the graph's position is stored alongside its data, so a run can be paused, resumed after a crash, or held for a human — none of which a straight-line pipeline can do.
/AI/4 min read
The framework's actual content is one interface that every piece implements. That is what makes the pipe operator work, what makes batching and streaming propagate through a chain you assembled — and what makes a broken prompt hard to find.
/AI/4 min read
SGLang keeps every in-flight request's attention cache in one prefix tree, so any overlap between any two requests is reused automatically — including overlaps nobody declared. Its second trick is not calling the model for output that was never in doubt.
/AI/4 min read
Giving up the guarantee of finding the true nearest vector buys enormous speed for almost no accuracy. In a measured run, scanning 3.4% of the data found the exact answer 99.8% of the time.
/AI/4 min read
A TPU is built around a grid of multipliers that pass values to each other instead of fetching them. That one decision is where its speed and its power efficiency come from — and also where its awkwardness comes from.
/AI/3 min read
Comparing images by their pixels fails badly — the same object moved twelve pixels can look less like itself than a different object does. An embedding is a representation trained so that stops happening.
/AI/4 min read
An agent that drives a screen with a mouse and keyboard needs no integration at all, which is its whole appeal. It also has to be right at every single step, and that requirement is much harsher than it sounds.
/AI/4 min read
Fugu does not answer questions. It decides which frontier model should, and in its larger form how several of them should divide the work — which makes the interesting question how much capability is actually available to be routed to.
/AI/3 min read
Instead of writing left to right, a diffusion language model starts from an all-masked sequence and fills it in over a few rounds. The speedup is real, and so is the reason it cannot be pushed as far as it looks.
/AI/4 min read
The same text embeds to the same vector every time, so recomputing it is pure waste. What makes the cache worth building is that query traffic is wildly lopsided — a few megabytes of memory removes most of the calls.
/AI/4 min read
A world model is a learned simulator an agent can practise inside. The whole design question is how many steps it can imagine before its own small errors compound into fiction.
/AI/4 min read
vLLM's central idea is to stop giving each request a contiguous slab of GPU memory and instead hand it small blocks through a lookup table — which removes the waste, and as a side effect makes sharing memory between requests almost free.
/AI/5 min read
Generating a token barely uses the GPU's arithmetic — it spends almost all its time moving weights from memory. Once you see that, every serving optimization sorts itself into one of three piles.
/AI/4 min read
The model never runs anything. It writes a structured request and stops, and your code decides whether to honour it — which is both why function calling is safe and where every mistake with it comes from.
/AI/4 min read
GGUF is one file holding the weights, the tokenizer and everything needed to run a model — laid out so the runtime can map it into memory instead of parsing it, and quantized in small blocks so 4 bits per weight is actually usable.
/AI/4 min read
A trained model knows more than the answer it gives — it knows how close the wrong answers were. Distillation trains a small model on that whole distribution instead of the single correct label, which is a far richer target.
/AI/4 min read
A model produces its answer one token at a time, so the answer exists in pieces long before it is finished. Streaming is the decision to send those pieces instead of holding them, and it works because reading is far slower than generating.
/AI/4 min read
Most of a long prompt is the same on every request. Prompt caching stores the work already done on that unchanging opening so the model never has to redo it — but only if the opening really is unchanged, character for character.
/AI/4 min read
Predict what a hidden part of an image means rather than what it looks like. The objective that makes that work has a perfect and useless solution, and the architecture exists to keep it out of reach.
/AI/4 min read
Retrieval is fast because it never reads the question and the document together. A reranker does read them together, which is why it is better and why it can only be used on a shortlist.
/AI/5 min read
Storing meaning as coordinates is the easy half. The hard half is finding the nearest ones among a hundred million without reading all of them — which is why the answer is allowed to be slightly wrong.
/AI/4 min read
Switch off a random half of the neurons at every training step. It stops the network relying on any particular one, and the scaling factor that makes it work is more interesting than it looks.
/AI/4 min read
Two networks trained against each other, one making fakes and one catching them. Because each is graded by the other, the loss numbers stop meaning what loss numbers usually mean.
/AI/5 min read
Teaching a trained model something new tends to erase what it already knew. Every fix for that is a different way of deciding which weights are allowed to move.
/AI/5 min read
An ordinary autoencoder compresses well and generates nothing, because its latent space is full of holes. A VAE fills the holes by encoding to regions instead of points — and pays for it with a second loss term.
/AI/4 min read
Destroy an image with noise in a thousand small steps, then train a network to undo one step at a time. Each individual step is easy, which is the entire reason the method works.
/AI/4 min read
Running several attention operations side by side costs nothing extra — the parameters and the cache are identical to one big head. What you actually spend is the width each head gets to work in.
/AI/4 min read
One sequence asks the questions and a different sequence answers them. Two useful things follow from that split: the attention matrix stops being square, and the answering side is computed once.
/AI/4 min read
The word self means the queries, keys and values all come from the same sequence. The consequence is that a word's representation is built from its neighbours, so the same word comes out different in different sentences.
/AI/5 min read
An agent's answer is the smallest part of what it did. Recording the rest produces far more data than ordinary logging — around seventy times more — which makes what you keep a real decision.
/AI/4 min read
Once several agents work on one task, they have to pass things to each other. The shape of who-talks-to-whom is the decision that matters, and the arithmetic makes it for you.
/AI/4 min read
A subagent is an agent called like a function: it runs its own loop, returns a value, and throws its working away. That discarded working is the entire point.
/AI/4 min read
The loop is about twenty lines of ordinary code. Its cost is not ordinary — because the whole history is re-sent every turn, tokens grow with the square of the turn count.
/AI/4 min read
Wiring several model calls and tools into one workflow. The shape you choose is not a style preference — it decides latency, cost, and how much you can debug.
/AI/4 min read
Judging an agent by whether it finished is not enough, because per-step reliability compounds. A 95%-per-step agent completes a twenty-step task about a third of the time.
/AI/4 min read
There is no formula for whether an answer was any good, so evaluation becomes a choice about what to trade away. The costs differ by two orders of magnitude, which is what decides the shape of a real setup.
/AI/4 min read
Using one model to grade another scales in a way human review cannot. It also brings biases that are measurable — and at least one of them cancels exactly if you run the comparison twice.
/AI/4 min read
Teach a model what things mean by showing it what is the same and what is different. Almost all the learning signal comes from the few negatives it nearly got wrong.
/AI/4 min read
Rather than reading a huge input, the model writes code that reads it — calling other models on the pieces and seeing only what comes back. What that buys is not fewer tokens.
/AI/5 min read
Generate several answers to the same question, and score each one against how the others did. The group's own average replaces a whole second network — and it fails in a way that is easy to measure.
/AI/4 min read
DPO removes the reward model by noticing that a language model already contains one. What it optimises is a difference, and that turns out to matter more than it sounds.
/AI/4 min read
PPO improves a policy while refusing to move it far in one step. The clipping that enforces this is not symmetric, and the asymmetry is the part worth understanding.
/AI/4 min read
Same formula, different axis. One averages a feature across the examples in a batch, the other averages all the features within one example — and that choice decides which architectures each one suits.
/AI/5 min read
A reasoning model spends thousands of tokens working before it answers. Those tokens are billed, they set the latency, and they are the reason it gets harder problems right.
/AI/5 min read
People cannot score an answer out of ten consistently, but they can say which of two is better. RLHF is the machinery for turning a pile of those comparisons into a model that behaves.
/AI/4 min read
Generate one token, append it to what you have, and use that to generate the next. The whole design follows from one identity in probability, and so does its main weakness.
/AI/4 min read
Waiting for every request in a batch to finish leaves most of the GPU's slots idle most of the time. Refilling each slot the moment it empties is a scheduling change, and it roughly doubles what the same hardware serves.
/AI/5 min read
Under about ten billion parameters, a model stops needing a datacentre. What actually decides where it can run is not the parameter count but how many gigabytes it occupies.
/AI/4 min read
A picture and the sentence describing it are completely different kinds of data. Multimodal models work by turning both into vectors that land in the same place.
/AI/5 min read
Sending every request to the largest model means paying premium prices for questions a small model answers perfectly. Routing picks a model per request — and it tolerates being wrong far more than you would expect.
/AI/4 min read
Everything a model knows about your task is in one window, and the pieces compete for space. Deciding what goes in, in what order, and what gets dropped is most of the work.
/AI/4 min read
The agent writes something, criticises its own draft, and rewrites. It works because judging is an easier job than writing — and it fails in a specific way when the critic asks for facts it cannot check.
/AI/5 min read
A small model guesses the next few tokens and a large one checks them all in a single pass. Done properly the output is not an approximation of the large model — it is exactly what the large model would have produced.
/AI/4 min read
Chunk search finds passages that look like the question. When the answer is a chain running through documents that mention none of the question's words, that is not enough.
/AI/4 min read
Instead of deciding one step at a time, the agent writes the whole plan first and then works through it. Cheaper and steadier when the path is knowable, and useless when it is not.
/AI/4 min read
Ordinary retrieval searches once and hopes the result was good. Agentic RAG puts an agent in charge of searching, so it can judge what came back, rewrite the query, and go again.
/AI/4 min read
ReAct makes an agent write down its reasoning before every action. The thought is not decoration — it is what the model reads back on the next step, and it is the only place you can see why anything happened.
/AI/5 min read
Splitting a job across several specialised agents buys parallelism and focus, and costs latency, tokens and the ability to debug easily. It is worth it less often than it looks.
/AI/5 min read
A million tokens of context is unaffordable with ordinary attention. DeepSeek-V4 gets there by summarising the distant past into far fewer entries and attending to those instead.
/AI/4 min read
A language model remembers nothing between calls. Everything that looks like memory is machinery around it deciding what to write down and what to put back in front of the model.
/AI/4 min read
An agent is a language model wrapped in a loop that lets it call tools and see what happened. The loop is the whole difference between answering a question and doing a job.
/AI/4 min read
Layer normalisation does two things: it recentres values and it rescales them. RMSNorm drops the recentring, keeps the rescaling, and modern language models have almost all switched to it.
/AI/4 min read
Fine-tuning normally means updating every weight in the model. LoRA freezes them all and learns a pair of thin matrices alongside, which turns out to be enough.
/AI/5 min read
RoPE gives a transformer position information by rotating query and key vectors instead of adding anything to them. The rotation cancels in the dot product, leaving only the gap between two tokens.
/AI/4 min read
Every attention head keeping its own keys and values makes the cache enormous. Grouped query attention has heads share them in small groups, cutting the memory by the size of the group.
/AI/5 min read
Cross-entropy turns a set of predicted probabilities into one number saying how wrong they were. It is built so that being confidently wrong costs far more than being unsure.
/AI/5 min read
Training a model means finding the weights that make the error smallest. Gradient descent does it by repeatedly stepping downhill, and the size of those steps decides whether it works at all.
/AI/4 min read
A vision transformer runs an image through the same machinery a language model runs text through. Almost all of the work is in turning a picture into something shaped like a sentence.
/AI/4 min read
Attention gets the attention, but two thirds of a transformer layer's parameters sit in the feed-forward network. It is where the model keeps what it knows.
/AI/5 min read
Flash attention produces exactly the same numbers as ordinary attention. It is faster because it never writes the score matrix to memory at all.
/AI/4 min read
A mixture-of-experts layer holds many small networks and sends each token through only two of them. The model gets to be large without every token paying for all of it.
/AI/5 min read
A transformer takes tokens in and gives tokens out. Between those two ends sits a short list of components, each with one job — and the same list underpins BERT, GPT and everything since.
/AI/5 min read
Training a network means working out how much each weight contributed to the error. Backpropagation does it with one rule from calculus, applied backwards through the network.
/AI/3 min read
The scaling factor in scaled dot-product attention is not a tuning knob. It is the one number that keeps the attention scores at a usable size no matter how wide the vectors are.
/AI/4 min read
Attention is one formula built from three matrices. Working it end to end on a three-word sentence shows exactly what Q, K and V are doing.
/AI/4 min read
A model on its own can only turn text into more text. The harness is everything you build around it — tools, memory, guardrails, retries — and it is usually where most of the work lives.
/AI/5 min read
A model cannot read text, only numbers, so text has to be cut into pieces first. Byte pair encoding decides where to cut by repeatedly merging the most common pair of neighbours.
/AI/5 min read
Serving an LLM means reserving memory for a reply before you know how long it will be. Paged attention stops that reservation from wasting most of the GPU.
/AI/3 min read
An LLM generates one token at a time, and each new token needs the keys and values of every token before it. The KV cache stores them instead of recomputing them.
/AI/4 min read
Causal masking is what stops a token from attending to the tokens that come after it. Without it, a language model can see the answer it is being asked to predict.
Writing next
Android
AI