DocsAI Training Coach🩺 Diagnosis & Fixes

Fighting Overfitting

Concrete measures sorted by effectiveness

Overfitting is the most common problem in training. The good news: it's well researched and there are many proven techniques. Used alone or combined, they solve practically every overfitting case.

Overfitting: val loss rises again

EpochsLossoverfittingstarts hereTrain LossVal Loss

The 7 most effective measures against overfitting

1

More diverse training data

Very highEffort: High (effort)

More and more diverse data is always the most effective measure. More examples means the model can't memorize individual ones.

Grow the dataset (real data), data augmentation (chapter 7), generate synthetic data via LLM.

2

Enable early stopping

Very highEffort: Very low

Stop training before overfitting begins. Monitor validation loss and stop once it stops dropping.

patience=3–5, monitor="val_loss", always save the best checkpoint.

3

Use LoRA with a small rank

HighEffort: Low

LoRA drastically limits the number of trainable parameters. Fewer free parameters means less overfitting capacity.

rank=4 or rank=8 instead of rank=32. Only q_proj and v_proj as target_modules.

4

Increase dropout

HighEffort: Very low

A higher dropout value randomly deactivates more neurons. The network has to learn more robust, redundant representations.

Increase LoRA dropout from 0.05 to 0.1–0.2. Watch out: too high → underfitting.

5

Train for fewer epochs

MediumEffort: Zero

The simplest solution: just stop earlier. Useful when early stopping reacts too late.

Halve the epochs. The validation loss curve shows where the turning point was.

6

Increase weight decay (L2 regularization)

MediumEffort: Very low

Penalizes large weights. Keeps model parameters small and prevents the model from over-weighting individual features.

Increase weight_decay from 0.01 to 0.05–0.1 in the AdamW optimizer.

7

Enable label smoothing

Low–MediumEffort: Very low

Instead of hard 0/1 labels, soft labels are used (e.g. 0.9/0.05). Prevents overconfident predictions.

label_smoothing=0.1. Good if the model is too confident.

Combination strategies by situation

Fine-tuning with little data (< 500 examples)

Early stopping + LoRA rank=4–8 + weight_decay=0.1 + dropout=0.1

Data limitation is the main problem

Fine-tuning with a medium dataset (500–5,000)

Early stopping + LoRA rank=16 + weight_decay=0.01

Standard setup, should work well

Full fine-tuning with little data

Early stopping + small LR (1e-5) + weight_decay=0.1 + dropout=0.2

Be careful! Full FT with little data means high overfitting risk

Golden rule for FrameTrain fine-tuning

Early stopping + LoRA (rank=8–16) + weight_decay=0.01 is the most effective and simplest combination. It covers 90% of all overfitting cases.