Engram proposes a way to predict LoRA rank from a dataset's bits

Engram proposes a way to predict LoRA rank from a dataset's bits

Engram, which says it trains many models, including ones for individual users, has published a post on a question it considers open: how to set the rank of a LoRA adapter. LoRA is, in the authors' words, the predominant approach for customizing models in industry. It is widely agreed to underperform full fine-tuning on larger datasets, but the point at which that happens is unclear. Smaller adapters are also lighter to load, faster to generate text from and easier to store.

The core idea is to measure adapters and datasets in the same unit, bits. A language model works as a text compressor, so the number of bits needed to encode a string under it is the string's negative log-likelihood. The required LoRA size then depends on how many bits it takes to encode the dataset under the base model.

The first part is theory. For a single adapted weight matrix, the authors use a second-order statistical model, built on the Fisher information matrix, to derive an approximate capacity for a rank-r adapter. Capacity grows roughly linearly at low rank and plateaus as rank rises. At full rank it recovers a classical result from Wilks' theorem in statistics. For the attention value projection (v_proj) layers of an 800M-parameter Qwen3.5 model, the theory predicts about 378k bits: 0.48 bits per parameter at full rank and 1.3 to 1.4 at low rank. The authors say actual training matches this prediction well at every rank.

Theory cannot predict the nonlinear behavior of deep transformers, so for full models the team measures capacity empirically. It builds synthetic datasets with a known bit count by running arithmetic coding in reverse: random bits are decoded into text with a pretrained open model such as Qwen or Inkling. A log-logistic curve, fit on runs of 1k training steps and up, estimates what an adapter would store with unlimited training.

Adapting several matrices together yields more capacity than the sum of the parts, an effect the theory cannot yet explain. As more layers are adapted, capacity rises from 1.5 to 3.3 bits per parameter. For a model of fixed depth, a higher rank also raises total capacity, and so does longer training. Across all models trained for the post, the authors saw them forget roughly as much as they learned, with forgetting measured as likelihood on samples from the base model.

For real data, the team extends the model's context window to 2M tokens with YaRN and sums log-likelihoods, splitting larger datasets into windows of that size. It reads a predicted rank off the synthetic capacity curve, then trains LoRAs at a range of ranks and records the smallest one that stores 95% of the dataset. The test sets came from the public internet and from the workspaces of Engram and its partners. The authors call the predictions extremely accurate and say the bit estimates, although slightly high, are good enough to predict rank within 5% error.

Key facts

  • Engram's premise: the LoRA size needed depends on how many bits it takes to encode a dataset under the base model.
  • For the v_proj layers of an 800M-parameter Qwen3.5 model, theory predicts about 378k bits: 0.48 bits per parameter at full rank, 1.3 to 1.4 at low rank.
  • Full-transformer capacity is measured on synthetic text made by decoding random bits with an open model, using arithmetic coding in reverse.
  • Adapting more layers raises capacity from 1.5 to 3.3 bits per parameter, a super-additive effect the theory cannot yet explain.
  • On real datasets, where the target is the smallest rank storing 95% of the data, the authors report rank prediction within 5% error.

Why it matters

The authors say there is plenty of knowledge about training LoRA well, yet how to set its rank is still unclear, as is the dataset size at which a bigger adapter becomes necessary. Their answer turns this into a measurement: count the bits in the data, then pick a rank with enough capacity. The theory also predicts diminishing returns. Unlike full-parameter fine-tuning, LoRA learns less per parameter as it grows, because some dimensions influence model outputs more than others.

Who it affects

The work is aimed at people who fine-tune models on supervised fine-tuning (SFT) data with LoRA and have to choose a rank. It is especially relevant to those who care about adapter size for loading, generation speed or storage. Engram describes its own case as training models for individual users and updating them when information changes. The post also notes, citing prior work, that rank-1 can hold a lot on larger models, and that some data, such as reinforcement learning data, often fits in a rank-one adapter or smaller.

How to use it

The procedure runs in three steps. First, measure the dataset's size in bits as its log-likelihood under the base model; Engram extends context to 2M tokens with YaRN and sums over windows if the data is longer. Second, build a capacity curve across ranks by training on synthetic datasets of known bit counts, extrapolating to unlimited training with the log-logistic fit. Third, read off the rank whose capacity covers the dataset. The fit lets users train for a fixed number of steps and avoid constant learning-rate sweeps, since different rates converge to the same capacity under unlimited training.

How solid is it

This is a company blog post that pairs theory with the authors' own experiments. The closed-form analysis covers a single weight matrix and is approximate. For full transformers the evidence is empirical. The authors report that on real datasets, the smallest adapters that fit each one fall almost on the predicted capacity line, and they put rank prediction within 5% error. These are Engram's own results.

Risks and caveats

The capacity estimates assume training data is drawn from the base model, which real data is not, although the authors say predictions still held. Measuring datasets in 2M-token windows slightly overestimates their information content. Most results assume unlimited training, and capacity is lower with fewer steps. Learning also has a cost: models forgot about as much as they gained, and the post illustrates this by saying a model that learns 10 KB might forget 12 KB. Engram adds that it does not always use LoRA and is exploring alternatives such as trainable prefixes, sparse memory layers and steering vectors.

“The idea is simple: the size of the LoRA required depends on how many bits it takes to encode the dataset under the base model.”

— Engram, blog post on LoRA sizing