Choosing a LoRA rank is still mostly guesswork, and Engram researchers say they have a way to replace it with a calculation. Their method measures both the training dataset and the adapter in bits, then reads off the smallest LoRA rank that can hold the data. On real datasets it landed within 5% of the measured answer.
Why LoRA size matters
LoRA is the most common way to customize models in industry, and the field has plenty of advice on hyperparameters. Rank is the open question. It’s agreed that LoRA falls behind full fine-tuning on larger datasets, but not at what size. Smaller adapters load faster, generate text faster and take less disk space, so oversizing has a cost. Some datasets, such as reinforcement learning data, can be represented in so few bits that a rank-one adapter, or smaller, can fit them.
The work comes from Engram, which trains models for individual users and updates them as information changes. Adapting models cheaply at scale is a main focus of its research, so sizing adapters correctly has direct cost consequences.
Counting a dataset in bits
The approach rests on a link between language models and compression. A model that assigns high probability to data can encode it in fewer bits, and the bits needed for a string equal its negative log-likelihood under the model. Training loss on a fixed dataset converts directly into bits learned.
To measure adapter capacity, the team needed data of an exactly known size. They ran arithmetic coding in reverse: start from N random bits and decode them into text using a pretrained model such as Qwen. The result is a sample whose code length under the model is N bits. Code lengths run slightly over N because tokens can’t be split.
What a single adapter can store
For one weight matrix, theory predicts capacity grows roughly linearly at low rank, then plateaus as the rank rises and singular values shrink. At full rank it recovers a classical result, mn divided by 2 ln 2 bits. For the 512 by 1024 value projections in an 800M-parameter Qwen3.5 model, that is about 378k bits, or 0.48 bits per parameter at full rank and 1.3-1.4 at low rank. Measured capacity matched the predicted curve at every rank.
Per parameter, LoRA learns less as rank grows, unlike full-parameter fine-tuning. That follows the diminishing returns the theory expects.
From one matrix to a full transformer
Adapting several matrices at once stores more than the sum of the parts. As the number of adapted layers rose, capacity climbed from 1.5 to 3.3 bits per parameter. Theory can’t yet explain that, so the team measured it directly with synthetic datasets of exact bit counts.
To avoid long training runs and learning-rate sweeps, they fit a log-logistic curve to runs of 1,000 steps and up and report the asymptote as capacity. Different learning rates converge to the same capacity under infinite training. Longer training stores more bits, and models forget about as much as they learn: a model absorbing 10 KB of new information might lose 12 KB of old.
Testing on real datasets
To size a real dataset, the team stretches the model’s context window to 2M tokens with YaRN and sums log-likelihood over 2M-token windows. That slightly overestimates information content, but the error is small. They read the predicted rank off the synthetic capacity curve, then train LoRAs from half to double that rank and take the smallest rank storing 95% of the dataset. Datasets came from the public internet and from partner workspaces. The measured ranks fell almost exactly on the predicted line, even though the theory assumes data drawn from the base model.
What it means for practitioners
In practice the workflow is short: measure the dataset’s size in bits under the base model, read the matching rank off the capacity curve, and train at that rank instead of sweeping several. Because capacity estimates don’t depend on learning rate once training runs long enough, the sweep over learning rates can shrink as well. The caveat is that the capacity curves were built on specific base models, so teams using another model would want to rebuild the curve.
What Engram is exploring next
The result lets a system create adapters of minimum size on the fly for a task. Engram says it doesn’t always use LoRA and is looking at trainable prefixes, sparse memory layers, steering vectors, GDN state and trainable experts. Work is also under way on estimating loss without training and on capacity when compute is limited.
Source: Engram