Skip to content

Troubleshooting

The failures of a first LoRA run are mostly not exotic. In rough order of how often they bite:

The loss does not fall at all

The model is not learning, and the usual causes are mechanical. The adapter's target modules name layers your base model does not have (hand-rolled setups can fail silently here; the PEFT library raises an error for unknown targets, which is one reason to use it). The learning rate is orders of magnitude out — 5×10⁻⁸ trains nothing, 5×10⁻¹ trains chaos. Or the labels are all -100 by mistake, so nothing is ever graded; check what your data pipeline actually feeds the trainer. Print one batch, decoded back to text, before blaming the model.

The loss falls, and falls — to nearly zero

On a small dataset that is not triumph; it is chapter 6's warning sign. The model has memorised the pages. Confirm with held-out questions (chapter 8): if it recites training answers and collapses on new ones, cut the epochs, lower the learning rate, or gather more examples — in that order of effort.

It learned the style but not the facts (or the reverse)

Style is learned from the shape of every example; a fact is learned from the few examples that state it. If the voice is perfect and one fact is wrong, check the dataset first: facts in training data are sometimes stated inconsistently in ways a human proofreader skims past — 1.7 litres in one answer, 1.5 in another. The model learned both, and averages them the only way it can. Consistency (chapter 3) is the fix, not more epochs.

Out of memory

Training memory is dominated by the base model, the optimiser's state for every trainable parameter, and the batch moving through the network. LoRA shrinks the second of these to nearly nothing, which is its point — but a big base model at full precision with a big batch still does not fit on a small card. The levers, in order: smaller batch, shorter examples, a quantised base (chapter 12's QLoRA), a smaller model. The lab's run — an 82M model, batch 4 — uses well under a gigabyte and is not the place to learn this failure; it arrives with your first real model.

The adapter loads but changes nothing

Check you loaded the adapter onto the base it was trained on, and that the generation settings are not sampling so wildly that a small behavioural nudge is invisible: compare greedily first (chapter 8), where any real difference must show. And check the question format matches the training format exactly — headings, spacing, all of it. A model taught one pattern and asked in another is not broken; it is unaddressed.

It answers everything in your house style — including things it should refuse to guess

The standing hazard of behaviour training, and not fully solvable by settings: you taught a voice, and the voice sounds certain about everything. Chapter 8's invented travel kettle is the tame version. For real deployments the mitigations are data (examples that decline gracefully what they do not know) and chapter 1's discipline: facts in retrievable documents, where "not found" is an answer the system can give.

Training crashes partway on CPU

On a small machine the usual culprit is the system running out of RAM while tokenising or during the first steps, or another program taking the memory first. Close the memory-hungry browsers, keep sequences as short as your examples allow, and if the machine swaps, expect times measured in patience. The lab's machine had 7.7 GB and the run never came close to troubling it.