1. Home
  2. Explore
  3. Computer Science
  4. Scaling Laws for Language Models

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Scaling Laws for Language Models

Scaling Language Models with Latent Reasoning

Scaling models, data, and compute

The performance of large language models has improved substantially through scaling: increasing model size and training-data size. A larger model has more parameters and can represent more complex patterns, but those parameters are useful only when the model is trained on enough data. Otherwise, the model may fail to use its capacity effectively or may overfit.

Scaling therefore involves balancing three quantities:

  • Model size: the number of parameters available to represent patterns.

  • Dataset size: the amount of training data, often measured in tokens.

  • Compute: the processing required to train the model, commonly measured in GPU time or operations.

In the conditions examined by early scaling-law research, an approximately eightfold increase in model size was associated with an approximately fivefold increase in dataset size for an efficient compute allocation. This is a reported relationship under particular experimental conditions, not a universal rule. The broader lesson is that a model’s size and the amount of data used to train it should grow together.

Increasing either model size or dataset size generally increases the compute required. Scaling relationships can therefore help researchers estimate the compute needed to reach a target test loss and plan training budgets.

Data as a limiting factor

Internet-derived human-created text is finite, and its growth is slower than the rate at which large language models have been consuming training data. This creates a potential constraint:

  1. Larger models need more data to make effective use of their parameters.

  2. More data requires additional compute to process.

  3. If the supply of useful data is limited, there is also a limit on how much useful compute can be applied through conventional training.

This motivates the search for ways to improve model capability without relying only on larger models or more training data.


Reasoning as a way to use compute differently

One approach to making use of additional compute is to let a model spend more computation on difficult problems. This is often called inference-time scaling or reasoning: the model uses extra steps to work through a problem rather than producing an answer in a single pass.

Reasoning can be elicited in several ways, ranging from simple prompts to longer chains of thought, multiple answer attempts, and self-checking. For example, a model might solve a simple arithmetic problem by identifying an intermediate result before producing its final answer.

Limitations of token-based reasoning

Conventional reasoning methods operate by generating additional tokens. This introduces several limitations:

  • Longer context: Intermediate reasoning takes up space in the model’s context. As the context grows, important information can become harder to retain or use reliably.

  • Multiple attempts: Difficult problems may require several attempts, or rollouts, before a correct answer is found.

  • Dependence on the base model: Extra attempts can help expose an answer the model already has some ability to produce, but they do not necessarily give the model new underlying capabilities.

  • Vocabulary constraints: A token-based reasoning process must express its thoughts in the model’s vocabulary. Different concepts may require different numbers of tokens, and some concepts may not have a concise equivalent in a given language.

A model can be trained to reward correct answers and discourage incorrect ones. However, penalizing every wrong attempt may create an undesirable imbalance. More generally, repeated sampling can help only within limits: the model’s base capabilities constrain the answers it can generate.

The base model as a performance ceiling

A useful way to evaluate a model’s latent problem-solving ability is to draw multiple answers from it and check whether at least one is correct. If the model is sampled KKK times, the test counts as successful when at least one of those samples gives the right answer. This is sometimes called pass-at-KKK accuracy.

As KKK increases, the model has more chances to produce a correct answer. Yet the base model still sets a ceiling: if it cannot produce a correct solution, taking more samples may not solve the problem. One interpretation of reinforcement learning is therefore that it can amplify existing knowledge and suppress unhelpful responses, rather than necessarily teaching entirely new knowledge.


Looped language models

A looped language model adds repeated internal computation to the language-modeling process. Rather than generating a chain of reasoning tokens between internal steps, the model repeatedly processes a latent representation before it produces the next output token.

Standard and looped processing

A standard transformer processes an input and generates an output token. A looped transformer follows a different process:

  1. The model processes its input and produces a latent vector.

  2. An exit gate evaluates whether the model should stop processing and produce the next token.

  3. If the gate chooses to exit, the model generates the token and moves on.

  4. If the gate chooses not to exit, the latent vector is passed back through the model for another processing step.

  5. This repeats until the gate exits or the maximum number of loops is reached.

Because the repeated computation happens in latent space, the model does not need to generate a visible chain of thought for each internal step. The method is therefore distinct from simply asking a model to produce more reasoning tokens.

Why latent looping may help

Latent looping aims to address several limitations of token-based reasoning:

  • It adds internal computation without requiring a long sequence of generated reasoning tokens.

  • It avoids constraining each intermediate reasoning step to a sequence of vocabulary items.

  • It incorporates repeated reasoning into pre-training, rather than treating reasoning only as a process added after a base model has been trained.

  • It offers a way to spend additional computation while keeping the model’s parameter count fixed.

The approach treats looping as an additional dimension of scaling, alongside model size and dataset size. It does not remove the need for compute: each loop still requires additional processing.


The early-exit mechanism

The model’s exit gate determines how many loops to perform before producing a token. For each loop, the gate produces a value between 000 and 111, using a dense layer followed by a sigmoid activation. This value can be interpreted as the conditional probability of exiting at that loop, given that the model has reached it.

Conditional and unconditional exit probabilities

A conditional exit probability is not the same as the probability of exiting at a particular loop overall. Reaching a later loop requires surviving all earlier loops.

Let qtq_tqt​ be the conditional probability of exiting at loop ttt. The probability of surviving loop ttt is 1−qt1-q_t1−qt​. The unconditional probability of exiting at loop ttt is therefore:

pt=qt∏j=1t−1(1−qj)p_t = q_t \prod_{j=1}^{t-1}(1-q_j)pt​=qt​∏j=1t−1​(1−qj​)

For example, suppose the gate assigns a 32%32\%32% chance of exiting at the first loop. The chance of continuing is then 68%68\%68%. If the conditional exit probability at the second loop is 51%51\%51%, the unconditional probability of exiting at that loop is:

p2=0.68×0.51p_2 = 0.68 \times 0.51p2​=0.68×0.51

The second-loop probability must be weighted by the probability that the model reached that loop in the first place.

These unconditional probabilities can be accumulated to form a cumulative distribution function (CDF). A threshold applied to the CDF determines whether the model exits at a given loop. If the maximum allowed number of loops is reached, the model is forced to exit, assigning all probability mass that remains to the final step. This guarantees that the model eventually proceeds to the next output token.


Training the exit gate

A first version of the exit mechanism developed a reward-hacking collapse: the model learned to put most of its exit probability on one loop, often the final loop, and largely ignored the others.

Why collapse occurs

During training, the model is evaluated at each possible stopping point. It calculates the loss that would result from exiting after loop one, loop two, loop three, and so on. The losses are combined using the model’s exit probabilities as weights.

A small initial advantage for one loop can create a self-reinforcing cycle:

  1. Random initialization gives one loop a slightly higher exit probability.

  2. That loop consequently contributes more to the weighted training loss.

  3. The model receives more training pressure to improve its prediction at that loop.

  4. Its performance and exit probability improve further.

  5. Other loops contribute less, so the model increasingly neglects them.

As training continues, the exit distribution can collapse around one step. The model then behaves as if it has only that exit point, rather than learning to use multiple loops.

Entropy regularization and a uniform prior

The solution is to encourage the model to spread exit probability across the available steps. This is done by adding a regularization term based on Kullback–Leibler divergence. The term compares the learned exit distribution with a prior distribution and penalizes a large mismatch.

A uniform prior gives each loop an equal target share of probability. In general, the regularization can be represented as:

Ltotal=Ltask+β DKL(Pexit ∥ Pprior)\mathcal{L}_{\text{total}} = \mathcal{L}_{\text{task}} + \beta\,D_{\mathrm{KL}}(P_{\text{exit}} \,\|\, P_{\text{prior}})Ltotal​=Ltask​+βDKL​(Pexit​∥Pprior​)

Here, PexitP_{\text{exit}}Pexit​ is the learned exit distribution, PpriorP_{\text{prior}}Pprior​ is the prior distribution, and β\betaβ controls the strength of the regularization. A loop does not always need to continue, so the model needs a way to balance the exit-distribution penalty against the task loss.

A geometric prior can encourage early exits, but in the reported tests it undertrained later loops. A uniform prior produced better results in those experiments, encouraging training to make effective use of the full set of loop steps.


KV caching in looped models

A key-value (KV) cache stores information from previous tokens so that the model does not have to recompute it repeatedly. Looped models complicate caching because each loop can have its own cache, and the appropriate cache use differs between training and inference.

Training and prefill

During training and the prefill stage of inference, the model has access to the full input sequence. To process tokens efficiently, the model can run a given loop across all tokens in parallel:

  1. Run loop one for all tokens.

  2. Let later tokens access the relevant earlier-token cache produced at that loop.

  3. Run loop two for all tokens, then continue in the same way.

This preserves parallel processing, but the available cache is limited to the loop steps that have been executed so far. A potentially more direct approach would allow a token’s chosen exit-loop cache to inform all loops for the next token. However, doing that would require processing tokens sequentially, one at a time. The resulting loss of parallelism would make training too slow for large-scale use.

Decoding during inference

During decoding, tokens are generated sequentially. The model must finish processing one token before it begins the next, which allows more flexibility in how it uses the KV cache. Several strategies can be considered:

  • Corresponding-loop cache: Use the cache from the matching loop. This is the default strategy in the reported results and preserves consistency with training.

  • Exit-loop cache: Use the cache from the loop that produced the final token representation.

  • Average cache: Average the caches from the loops before passing information to the next token.

  • First-loop cache: Use only the first loop’s cache.

The first-loop-cache strategy performed poorly in the reported tests. The other strategies performed similarly, including some that differed from the training setup. This suggests that the relationship between loop structure and KV-cache use may warrant further investigation.


Training pipeline and model scale

The training process used multiple phases and model sizes. A smaller model was first pre-trained on a large token corpus. A larger model was then derived by duplicating the smaller model’s non-embedding layers, resembling an additional loop pass, and relaxing the weights so that the larger model could continue training.

The training data also increased in quality over successive phases. This design provided a way to initialize and train larger models while making use of work already performed on smaller ones. The models discussed included versions around 1.41.41.4 billion and 2.62.62.6 billion parameters, with different thinking configurations. The work also described training at industrial scale, using trillions of tokens.


Benchmark results and loop-count experiments

The looped models were evaluated on a range of tasks, including difficult mathematics and competition-style benchmarks. On several tests, they performed better than similarly sized conventional models and, in some cases, were comparable to larger models. The comparisons also involved differences in model size and training-token count, so those results should not be interpreted as proving that looping alone accounts for every performance difference.

How many loops help?

To investigate the value of additional loops, the models were tested with different loop counts, including loop counts beyond those used in training.

  • On some benchmarks, performance continued to benefit from looping beyond the training loop count.

  • On other, more difficult benchmarks, performance was best around three to four loops.

  • Extending the number of loops too far could cause performance to deteriorate rapidly on some tasks.

The findings support a cautious conclusion: looping can improve performance, but the best number of loops depends on the task. More loops are not always better.


Distinguishing knowledge storage from knowledge manipulation

To understand what looping improves, it is helpful to distinguish between two capabilities:

  • Knowledge storage and extraction: storing facts and retrieving them when asked.

  • Knowledge manipulation: operating on stored facts to derive or transform information.

Controlled synthetic datasets can isolate these abilities more clearly than broad real-world benchmarks. One type of dataset might contain biographical facts such as a person’s name, birthday, and workplace.

Knowledge storage and extraction

In a storage-and-extraction task, the model is asked to recall facts from the dataset. Experiments across different model sizes, dataset sizes, and loop counts found little difference between one loop and four loops. Increasing the number of loops did not meaningfully improve the model’s ability to store or retrieve those facts.

This result is consistent with the nature of looping: looping does not add parameters. It supplies additional computation, but it does not by itself increase the model’s capacity to store information.

Knowledge manipulation

A knowledge-manipulation task requires the model to do more than recall facts. It must use or combine them to produce an answer. In the reported experiments, the model was required to answer immediately, without a chain of thought.

Performance increased as the number of loops increased:

  • One loop reached a relatively low performance level and quickly saturated.

  • Two loops provided a substantial improvement.

  • Four loops improved performance further.

These results suggest that the primary benefit of looping lies in knowledge manipulation. Repeated internal processing gives the model additional opportunities to compute over information already represented in its parameters, rather than simply adding more stored information.


Broader significance

Conventional inference-time reasoning often adds computation after a base model has already been trained. Looped language models instead integrate repeated latent computation into the pre-training process. The proposed benefit is not merely a better final answer through more visible reasoning tokens; it is that the base model learns to make use of internal computation as part of its modeling process.

This may be useful for both large and small language models. When a model is constrained by memory or must run on a mobile device, adding parameters may be impractical. Looping offers a way to increase the use made of existing parameters, potentially improving parameter efficiency.

The central distinction is that looping appears to help a model work more effectively with information it already has. It does not necessarily increase the amount of knowledge the model can store, but it can improve how effectively the model manipulates that knowledge.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent