hn.today

Predicting LoRA size for any dataset

engram.com125 points13 comments
Screenshot of Predicting LoRA size for any dataset

The work develops a way to choose the rank of a LoRA adapter based on how much information a supervised fine-tuning dataset contains under the base model. It treats language-model loss as a code length: the better the adapted model predicts the training data, the more bits it has stored. To create test data with precisely known information content, it uses arithmetic coding in reverse, decoding random bit strings into text whose length under the base model is controlled. This makes it possible to compare dataset information and adapter capacity in the same units.

For a single adapted weight matrix, the authors derive a capacity curve from the singular values of a random matrix. Capacity rises roughly linearly at low rank, then yields diminishing returns as rank grows; at full rank, the theory predicts about half a bit per parameter. In an example involving a 512-by-1,024 attention projection, the model predicts roughly 378,000 bits at full rank and 1.3-1.4 bits per parameter at low rank. Training experiments closely match the theoretical curve: a rank-128 adapter stores 23.9 KB, as predicted, despite having 197,000 parameters. Extending the method to whole transformers requires experiments because jointly adapting multiple matrices produces more capacity than the sum of their individual capacities. The authors say their resulting predictions also work across real datasets, enabling rank estimates before training.

Read on engram.com13 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in AI

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.