Topic · Tasks

Language models

Everything on this site about language models, in the order to read it: a page is listed after the pages it builds on. The figures below are the ones those pages use to explain it; each is live: move a slider and it recomputes.

In reading order

  1. Read
  2. Read · read first: Text2SQL — Part 2: Datasets
  3. Read
  4. Read

The figures these pages use

Pulled from the pages above. Move a slider and the figure recomputes, exactly as on its page.

From Jev — Thinking Fast, in One Pass › 1. Two Systems in Your Head

10035
Two equal lines. Which line is longer? Stretch the bottom one until the two look equal, then switch on the ruler. The picture is the Müller-Lyer illusion from chapter 1 of Kahneman's book: measuring it does not make it go away.

From Jev — Thinking Fast, in One Pass › 1. Two Systems in Your Head

1 / 3 · bat and ball0
Three quick questions, and their checks. Answer each puzzle in your head first, then set the slider to your answer and read what it implies. The check is one addition, one rate or one step back. The three puzzles are Frederick's Cognitive Reflection Test (2005).

From Jev — Thinking Fast, in One Pass › 1. Two Systems in Your Head

1060
Linda, counted. A hundred women who fit Linda's description. Shaded: the bank tellers. Dark: the tellers who are also active feminists. Move either slider: the dark group can never outgrow the shaded one.

From Jev — Thinking Fast, in One Pass › 1. Two Systems in Your Head

1580
The cab problem, counted. A hundred cabs. Dark squares are Blue cabs, light ones Green. Outlined: the cabs the witness would call Blue. Of all the outlined cabs, how many are really Blue? The story is from chapter 16 of Kahneman's book; the counting is Bayes' rule.

From Jev — Thinking Fast, in One Pass › 2. From Brains to Models

850010
Steps per answer: one pass against token by token. Sequential steps (forward passes that must wait for the previous one) to answer k questions about one input. Token counts per answer and per stretch of thinking are my estimates, set with the sliders; the 2 + 3 preset uses Chen et al.'s example of 901 tokens for one sum.

From Jev — Thinking Fast, in One Pass › 2. From Brains to Models

Is a 0.9 right nine times in ten?. Simulated answers, not any model's: 2,000 reports spread evenly, each right with the chance its temperature hides. Ten bins by reported top probability; the dashed diagonal is a perfectly calibrated model. Shifted data keeps the reports and makes every answer a fifth less likely to be right.

From Jev — Thinking Fast, in One Pass › 3. Jev, From the Outside

1.50.5-10.90.5
One question, its probabilities and a threshold. Numbers you set, run through TypeSafe's published confidence formulas; the presets marked "saved call" put back the probabilities of the real call in this section. The two threshold sliders are rules in your code; Jev has none.

From Jev — Thinking Fast, in One Pass › 4. Jev, From the Inside

510011.1
Thirteen questions, one call. Count: forward passes for N questions about one state, my estimates of the token counts, not a timing. Cost: the list price applied to one call with N questions and to N calls with one each. Time: only points someone measured; TypeSafe's own are marked as such.

From Jev — Thinking Fast, in One Pass › 4. Jev, From the Inside

00
Learning from a score. A toy, not Jev: three options that pay 1 point with hidden chances of 0.2, 0.5 and 0.8. Nobody tells the model which option is right. It picks by its current chances, gets a score, compares the score with its average so far, and nudges the picked option up if the score beat the average and down if it fell short. Press play to watch the chances move. Then add 4 to every score and compare with zero: every pick now looks like good news, and over 200 runs the chance of the best option after 500 pulls is 0.53 instead of 0.95.

From Jev — Thinking Fast, in One Pass › 4. Jev, From the Inside

0.70.9
Rewards that pay for an honest probability. A yes/no question whose true chance of “yes” is p. Each panel shows what one reward pays on average for reporting the probability q. The dashed line is q = p, the honest report; the filled dot is the report that pays most. Only squared error and log put their peak on the dashed line, at every p. The hollow dot is the report you choose with the slider.

From Jev — Thinking Fast, in One Pass › 4. Jev, From the Inside

40
Training on a reward: where the reported chances end up. A toy training run, not Jev and not a language model: ten kinds of yes/no question whose true chance of “yes” runs from 0.05 to 0.95, and one number per kind that sets the probability the model reports. Each step it reports, sees the outcome, gets the reward, and is nudged by the score against its average, as in the three-option figure. Dots on the dashed diagonal are honest. Press play: squared error and log pull the dots onto the diagonal; rewarding confidence when right pushes them toward 0 and 1; scoring only the decision gets each dot to the correct side of 0.5 and then lets it wander.

From Jev — Thinking Fast, in One Pass › 4. Jev, From the Inside

0.4
Names against definitions. A toy that shows one way this can happen: a model that reads the definitions but also leans on what the option names mean. Hollow bars are the toy; solid bars are measurements on Jev, which the toy is not fitted to.

From Jev — Thinking Fast, in One Pass › 5. Visual Jev and Other Models That Read Pictures

Answering without looking. Accuracy by chance, with the picture replaced by flat grey, and with the picture, for the same questions and options (Yu & Yao, Table 1, original 4B backbone). Whatever the grey bar has above chance came from the wording of the question and its options alone.

From Jev — Thinking Fast, in One Pass › 5. Visual Jev and Other Models That Read Pictures

6 / 6 · 32
One look, many questions. Milliseconds per question as more questions are asked about the same image, on one RTX 5090 (Yu & Yao, Table 13). Sharing the image and batching the questions is slower for one question and about nine times faster for 32. Times are averages over the group and leave out image decoding and the network.

From Mamba — Selective State Spaces, Step by Step › 3. S4: Fixed Weights, So a Convolution

-1.01 / 4 · −1
One step of the memory. One channel, B = C = 1. Left: Ā (old state kept) and B̄ (new input written) against the step Δ. Right: the weight an input still has k steps later, the kernel of a fixed model. "As a gate" sets Δ = softplus(z) with A = −1, so Ā = 1 − σ(z) and B̄ = σ(z) (Theorem 1), with the paper's rule.

From Mamba — Selective State Spaces, Step by Step › 4. Selection: Let the Token Choose

0.52.00.011 / 2 · the 6-step check
A fixed filter against a choosing one. A toy with one channel (A = −1, B = C = 1). Filled squares are data tokens, empty ones noise. The fixed model uses one Δ everywhere, so every row is the row above shifted by one: a convolution. The choosing model takes a large Δ on data and a small one on noise, so its state holds between data tokens.

From Mamba — Selective State Spaces, Step by Step › 5. No Convolution, So How Is It Fast?

1 / 4 · the pairs
for what is kept
2 / 2 · 2560 (2.8B)11
How a recurrence runs in parallel. Eight steps of h_t = a_t · h_(t−1) + b_t with toy values, each a pair (a_t, b_t). Each round combines every slot with the one 1, 2, then 4 places to its left; after three rounds every slot holds h_t, the same as the loop on top. "What is kept": the values one layer holds while generating. Mamba's state does not grow with the length; a Transformer layer's K and V cache does.

From Mamba-3 — A Better Step, a Turning State, More Work per Byte › 1. A Better Step

0.51 / 5 · Δ = 0.4
Hold one end or average both. A toy, h′ = −h + sin 3t. Left: one step's area; λ = 1 keeps the right end (Mamba-2), λ = ½ averages both ends. Right: the error at t = 4 as the step shrinks. Measured gain: Tab. 8, 15.81 → 15.72 perplexity.

From Mamba-3 — A Better Step, a Turning State, More Work per Byte › 2. A State That Can Turn

1 / 4 · sequence A0.910
Turning instead of shrinking. A toy, not a trained model. The arrow is a two-number state. Shrinking never changes its direction; turning by an input-set angle counts the ones, a fixed angle counts the steps. Measured (Tab. 5b): parity 100.00 with input angles, 1.56 fixed, 2.27 none.

From Mamba-3 — A Better Step, a Turning State, More Work per Byte › 3. More Work per Byte

Same memory traffic, more work. Left, from the formulas of Tab. 2: FLOPs per byte of one decode step as R grows, against an H100 matrix multiply (about 295, p. 9). Even R = 16 sits far below it. Right, measured: one decode step of the 1.5B models (Tab. 6, BF16, state size 128).

Tags that go with it

Natural language 7Transformers 4State space models 2Developer tools 1Efficient networks 1Evaluation and metrics 1Systems programming 1Vision and language 1