arnesh

Date Kolkata

← All writing

Next-Concept Modeling Explained

TL;DR: Next-Concept Modeling (NCM) is a new text generation method from Stanford and Together AI. It does not write one word at a time. It first makes a very rough sketch of the full text, then adds detail in a small number of parallel steps. On the LM1B benchmark, it scores better than the strongest diffusion baseline and runs 21× faster, with 12 steps in place of 128.

Current text generation methods

Most language models use next-token prediction. The model writes one token, reads it, and writes the next one. A 1,000-token answer needs 1,000 steps. A cache makes each step cheap, but the steps must happen one after the other.

Diffusion language models work differently. They start with masked or noisy tokens and repair all positions together. This work is parallel, so the number of steps can be much smaller than the number of tokens. The paper names three problems with this approach:

  • Many steps. Quality falls quickly when you remove steps.
  • Expensive steps. Each step reads the full sequence. The usual next-token cache does not apply directly, because attention goes in both directions.
  • Large training budgets. Strong baselines read over 500 billion tokens on OpenWebText.
Three grids compare next-token prediction, diffusion and NCM. Next token fills one cell per step, diffusion fills every cell in every step, and NCM uses few steps that begin with very wide cells. Next token 1 new token per step Diffusion all 8 tokens per step NCM more codes each step 8 steps one after the other 8 or more steps full length each time 4 steps short rows first
Each row is one step and each column is one position. Bright cells are the work that the model does in that step. In NCM, a wide cell is one code that describes a large part of the text.

Visual Overview of NCM

Think of a large image on a slow connection. First you see a blurry version of the full image. Then the detail comes in. NCM does the same for text. The first step gives a very short description of the full text. Each next step is longer and adds detail. Only the last step has one code for each token.

One sentence over four levels. With one code, most words are wrong. With eight codes, the sentence reads: Today the cat ran home in the rain. Codes in this level Text if you decode now Today the the the the and the the. Today the cat cat the in in the. Today the cat ran ran in in rain. Today the cat ran home in the rain.
A made-up sentence that shows the shape of the idea. It is not real model output. Bright words match the final text. Real sketches also contain repeated words that later levels remove.

The word concept in the name means the information in these first, short levels. A concept here is a learned code. It is not an idea that a person can read.

The method comes from image generation, where it is called next-scale prediction. Images make this easy, because you can shrink an image if you average its pixels.

A small picture of a sunset shown at five sizes, from one averaged color to sixteen by sixteen blocks. 1×1 2×2 4×4 8×8 16×16
An image has a natural low-resolution version. Text does not. The average of “cat” and “ran” is not a word.

So NCM must learn its own low-resolution version of text. This gives the method two stages. Stage 1 learns how to store text in layers. Stage 2 learns how to generate those layers.

Step 1: Store Text in Layers

The first stage trains a multiscale residual VQ-VAE. This name is long, but each part of it is simple.

Vector quantization

An encoder changes each token into a vector of numbers. Vector quantization then replaces this vector with the nearest entry in a fixed list, the codebook. You store only the position of that entry in the list. So a long vector becomes one integer. NCM uses 4,096 or 8,192 entries per level for text.

Residual

Rounding loses information. Residual quantization stores this loss in a second level, and the loss of the second level in a third. A small example with one number shows the idea:

Four levels store the number 83.6. The levels pick 75, plus 10, minus 1, minus 0.4, and the remainder falls from 8.6 to 0. Goal: store the number 83.6 Codebook for this level Total Left Level 1 steps of 25 0 25 50 75 100 75 8.6 Level 2 steps of 5 −10 −5 0 +5 +10 85 −1.4 Level 3 steps of 1 −2 −1 0 +1 +2 84 −0.4 Level 4 steps of 0.2 −0.4 −0.2 0 +0.2 +0.4 83.6 0
The vertical mark shows what is still missing at each level. The dot shows the nearest codebook entry. Each level corrects the error of the earlier levels. NCM does the same sum with vectors of 384 numbers on its text tasks.

Multiscale

The levels have different lengths. For LM1B, the released config uses 12 levels with these lengths:

1 8 16 24 32 40 52 64 76 92 108 128

So the first level is one code for 128 tokens. To use a short level, the tokenizer shrinks what is still missing to that length. It then snaps each vector to the codebook and stretches the result back to full length.

One tokenizer level in five steps. The missing part shrinks to two vectors, each vector snaps to a codebook entry, the two entries stretch back to full length, and the result joins the running total. What is still missing 8 vectors Shrink to this level 2 vectors Snap to the nearest entry 2 integer codes Look up and stretch 8 vectors again Add to the running total the text so far 417 2051 Then subtract the total from the goal, and repeat with a longer level.
One level, here with 2 codes for 8 positions. The two integers are examples. They are all that this level stores.

Nested dropout

One problem remains. The tokenizer can put almost all information in the last levels, and then the early levels are useless as a sketch. Nested dropout prevents this. During training, it keeps only the first k levels and tells the decoder to rebuild the text from them. The value of k changes at random, so each early level must carry useful information.

After training, the tokenizer is frozen. With all levels, it recovers 98.79% to 99.99% of tokens on the text tasks and 100% on Sudoku. This matters, because one wrong digit breaks a Sudoku solution.

Step 2: Predict the Next Layer

Each text is now a stack of integers. The generator is a transformer that predicts these integers, one level at a time. At each level, its input is the running total of the earlier levels, resized to the length of the current level.

The main assumption is simple. If you know the sketch so far, the codes inside one level are independent. So the model can sample all of them in one forward pass:

p(all codes) = p(level 1)
             × p(level 2 | sketch 1)
             × ...
             × p(level K | sketch K-1)

p(level k | sketch) = p(code 1 | sketch)
                    × p(code 2 | sketch)
                    × ...
The generation loop. For each level, the transformer reads the sketch so far and outputs all codes for that level. The codes join the sketch for the next level. After the last level, the decoder outputs text. Sketch so far New codes, all together Transformer Level 1 Level 2 Level 3 Level K Decoder One row is one forward pass. The row gets longer at each level. Today the cat ran home in the rain.
The loop, unrolled. The sketch is empty at level 1. The lines behind the transformer carry the new codes of each row into the next sketch. The number of forward passes equals the number of levels, however long the text is.

Generation is a short loop:

# start with nothing
sketch = zeros(L, d)

# K = 12 for LM1B
for k in range(K):
    # fit this level
    inputs = resize(sketch, length[k])
    # one forward pass, all codes at once
    codes = sample(transformer(inputs))
    # add the correction
    sketch += stretch(codebook[k][codes])

# sketch to text
tokens = decoder(sketch).argmax(-1)

Forward pass during training

During training, the frozen tokenizer gives the correct codes for each text. So the inputs for all levels are known before the model starts. The transformer predicts all K levels in one forward pass, with a cross-entropy loss.

Self reading

Without a prompt, attention stays inside the current level. This looks like a strong limit, but the input of each level already contains the earlier levels. In the paper’s test on TinyStories, this pattern gave the best mix of quality, sample diversity and speed. With a prompt, each level can also read the prompt.

Two attention maps drawn with the 12 real level sizes for LM1B. Block-causal fills a staircase of earlier levels. Block-diagonal fills only squares on the diagonal. Block-causal reads all earlier levels 1.40× the time Block-diagonal (NCM) reads its own level only fastest of the three tested
Attention maps drawn with the real LM1B level sizes. A bright cell means that a position can read another position. The timing is from the paper’s TinyStories test. A two-level sliding window took 1.21× the time.

How a bad code in training helps

Training gives the model perfect codes, but generation gives it its own codes, which contain errors. All codes in a level arrive together, so several errors can enter the next input at the same time. To prepare for this, NCM replaces some input codes with random entries during training. The targets stay correct. A moderate rate improves quality by a large amount, and too high a rate makes it worse.

Two (very) important parts

  • Number of levels. More levels give better text, but each increase helps less. On TinyStories, the Gen. PPL score (defined under Results, lower is better) falls by 52% from 4 to 8 levels, then by 32%, then by 20% at 32 levels.
  • Growth of level lengths. Slow growth at the start works best in this test. After 10k training steps, exponential and quadratic growth reach a Gen. PPL of about 58 and 60. Linear growth reaches 88, and square-root growth reaches 197.

Reason behind the speed

NCM saves time in two ways: it uses fewer steps, and its early steps are short. The picture below shows both at the same scale.

Two shapes at the same scale. Diffusion fills a square of 128 steps by 128 positions, 16,384 position passes. NCM fills a thin wedge of 12 steps, 641 position passes. Diffusion baseline 128 steps × 128 positions 16,384 position passes NCM 12 steps, 1 to 128 positions 641 position passes
Area is the number of times that a model processes one position. The outline on the right is the same 128 × 128 square as on the left.

This count is mine, and it is not a benchmark. Fewer steps give 128 / 12 = 10.7×. Shorter rows give 1,536 / 641 = 2.4×. Together they give about 26×. The paper measures 21× against DUO in wall-clock time, on one H100 GPU. The two numbers are close, but the count ignores model size, attention cost and the final decoder pass.

Training also costs less. On LM1B, NCM reads 13.36 billion token positions, and this includes the tokenizer. The baselines read 66 billion. On OpenWebText, NCM reads 127 billion, against over 500 billion for MDLM and DUO.

Level by level generation

The paper follows one German-to-English translation through all 11 levels. It decodes the sketch after each level and scores it against a human translation.

BLEU score of one translation after each of 11 levels. It rises from 6.0 to 77.8, with one dip at level 9. 0 20 40 60 80 1 2 3 4 5 6 7 8 9 10 11 Level decoded 6.0 38.9 77.8
BLEU after each level, from Table 12 of the paper. Higher is better. Hover over or tap a point to read its value.

After level 1, only the opening word is correct, and the rest is mostly repeats of “the”. Around level 6, the main topic words are present, but they repeat. Level 11 gives a nearly exact translation. The score also falls at level 9, so progress is not smooth. Later levels can repair the errors of earlier levels.

Results

The results use four measures:

  • Steps (NFE in the paper): the number of times that the model runs for one output.
  • Gen. PPL: how surprising the text is to a reference model, GPT-2-large. Lower is better. Repetitive text can also score low, so the paper reports text diversity with it.
  • BLEU and ROUGE-L: overlap with a human translation or summary. Higher is better.
  • Solved boards: the percentage of Sudoku boards that are fully correct.
Task Measure NCM Baseline Speed
LM1B Gen. PPL 93.05, 12 steps DUO 97.30, 128 steps 21×
OpenWebText Gen. PPL 83.12, 32 steps DUO 77.69, 1,024 steps 10×
XSum summaries ROUGE-L 28.0, 8 steps AURORA-LM 26.6, 128 steps 31×
WMT14 translation BLEU 22.6, 11 steps E2D2 24.8, 64 steps not given
Sudoku, hard Solved boards 86.1%, 12 steps FMLM+ 81.3%, 16 steps not given

The baseline is the one that the paper compares against for each task. The better score is in bold. Speed is the paper’s wall-clock measurement.

NCM does not win every row. It loses to E2D2 on translation. DUO scores better on OpenWebText, but it uses 32× more steps. Next-token models also stay ahead on raw quality: a next-token baseline reaches 35.45 on OpenWebText, against 83.12 for NCM. That baseline needs 1,024 steps.

Sudoku. A next-token baseline solves about 1% of hard boards, because it must commit to each digit from left to right. NCM refines the full board at each level, so later levels can correct earlier choices.

Saved time can give quality. NCM can generate many candidates and select the one that is most like the others. This is MBR decoding. On XSum, it reaches ROUGE-L 29.6 with 128 model runs. The best guided baseline reaches 28.6 with 184.

Effect of coarse levels on the high level content

Do the coarse levels really hold the high-level content? The authors test this on short children’s stories, in three ways:

  • Keep the first levels, resample the rest. The broad theme of the story stays. Names, objects and wording change.
  • Replace two early codes. Characters, objects and events can change, and parts of the plot stay.
  • Mix the early codes of two stories. The output contains details from both.

The paper calls these probes qualitative. They suggest that coarse levels capture global structure, but they do not prove it.

Limits

  • Fixed depth. Short text must also go through all levels, because the schedule does not change with the input.
  • A separate tokenizer. It trains before the generator, so it does not learn from the generator’s goal. The size comparisons also count only the generator. On LM1B, the 97M generator has a 111M tokenizer with it.
  • Small models. Most tests use about 100M parameters. Only LM1B goes further, to 725M, where quality improves. The paper does not test the sizes that production models use.
  • Artifacts. Text is generally fluent, but errors sometimes appear where coarse levels meet.

Final Thoughts

Earlier work on fast diffusion keeps the full-length representation and reduces the steps. NCM changes the representation, and this reduces both the number of steps and the cost of the early steps. For me, this is the main idea of the paper. The next test is whether the method keeps its advantage at much larger model sizes.

Credits

The method and results are the work of Hermann Kumbong, Ishan S. Khare, Iddah Mlauzi, Andrew Woen, Charles Ding, E. Kelly Buchanan, Simran Arora, Azalia Mirhoseini and Christopher Ré.

I drew the figures for this post. The numbers come from the paper, with two exceptions. The LM1B level lengths come from the released config. I calculated the position-pass count from those lengths.

Comments

Sign in with GitHub, Google or Discord to leave a comment.

Loading comments…