· via Hacker News – Front Page (native)
Engram's formula predicts the LoRA rank needed to fit a dataset, measured in bits
Engram derives a closed-form link between LoRA rank and the bits an adapter can store, plus a method for building datasets of exact bit sizes, so teams can pick the minimum rank for a fine-tuning job.

The claim
Engram, a company that trains and continuously updates models for individual users, has published research that offers a predictive theory of how much a LoRA adapter can learn as a function of its rank. The post, which surfaced on the front page of Hacker News, makes a concrete promise: given a supervised fine-tuning dataset, you can work out in advance how large an adapter you need to fit it.
LoRA has become the default way industry customizes models. Rather than updating a weight matrix directly, it trains two small matrices whose scaled product forms a low-rank update, with the rank determining how many parameters are trained. Engram's complaint is that while guidance on training LoRA well is plentiful, choosing the rank has no principled answer. It is broadly accepted that LoRA trails full fine-tuning on larger datasets, but nobody can say how large a dataset has to be before a bigger adapter is required.
A common currency: bits
The central idea is to express both the dataset and the adapter in a shared unit — bits. By Shannon's source coding theorem, a model's cross-entropy corresponds directly to its effectiveness as a compressor, so the bits needed to represent a string under a model are simply its negative log-likelihood, summed token by token. Training loss then translates directly into how much information about the training set has been stored. In one worked example in the post, a rank-6 LoRA applied to a model's MLP layers had stored 6.67 KB of a 6.75 KB dataset — 98.8% — by step 3,981.
What rank actually buys
Prior work, according to Engram, suggests full-parameter training capacity grows roughly linearly with parameter count. LoRA does not: some directions in weight space influence model outputs far more than others, so each added rank contributes less than the last, and returns diminish — which matches what practitioners see.
For a single m×n matrix, the post derives a closed-form approximation. It treats the log-likelihood, to second order, as a curved surface around the base weights; when the training data is sampled from the model itself, the statistics of the gradient and Hessian are governed by the Fisher information matrix, which keeps the algebra tractable. The result: a rank-r adapter can store approximately the expected sum of the squared top-r singular values of an m×n matrix of independent standard normal entries, divided by 2 ln 2, expressed in bits. At low rank this is nearly linear, adding roughly (√m + √n)² / (2 ln 2) bits per unit of rank; it then flattens as the singular values decay, and at full rank it reaches mn / (2 ln 2) bits, a figure Engram points out matches a classical result from Wilks' theorem in statistics. The company fixed the scaling factor α at 256 throughout so that rank is not conflated with learning rate.
Calibrating theory on real transformers
Closed-form math cannot anticipate the nonlinear behavior of deep transformers, so Engram pairs the theory with measurement. That requires datasets of exactly known size, which the team produces by running arithmetic coding in reverse: start from N random bits and decode them into text using a pretrained open-source model such as Qwen or SmolLM2. The output is a sample from the model's own distribution whose code length under that model is exactly N bits — essentially neural linguistic steganography using a code chosen at random. Code lengths come out slightly long because tokens are indivisible. Training adapters on synthetic data built this way yields a measured capacity for each rank, and Engram reports that the resulting predictions hold up on real datasets across a variety of settings, accurately determining the rank an adapter needs.
Why it matters
If adapter capacity is predictable, rank stops being a hyperparameter and becomes a measurement, with consequences for both cost and latency.
- Budget planning: teams can compute how many bits a dataset occupies under the base model and provision exactly the rank that covers it, avoiding both underfitting and paying for parameters that will never be used.
- Serving economics: smaller adapters are quicker at inference time, lighter to load and less bulky on disk. Engram notes that some data — RL data, for instance — compresses to so few bits that a rank-1 adapter, or something even smaller, is enough.
- A principled frame: tying adapter capacity to Shannon and Wilks gives the field a shared vocabulary for a question that has until now been settled empirically.
The derivation covers a single adapted matrix, and the whole-transformer numbers come from calibration on synthetic data rather than analysis. Even with that limitation, for anyone allocating fine-tuning budgets at scale — Engram's own situation, with per-user adapters that change as information changes — a rank you can compute beats a rank you guess.
- #lora
- #fine-tuning
- #llms
- #information-theory
- #machine-learning