NEFTune and early stopping
Small datasets overfit. These two flags push back from different sides: NEFTune makes the training signal noisier, and early stopping ends the run when it stops helping. Both are off by default.
NEFTune
NEFTune (Jain et al. 2023) adds uniform noise to the token embeddings during the SFT forward pass, scaled by alpha / sqrt(seq_len × embed_dim). The adapter can no longer memorize the exact surface form of a few hundred examples, which tends to improve instruction-following. Nothing changes at inference.
$ optiq lora train mlx-community/Qwen3.5-4B-OptiQ-4bit \
--data ./my_data -o ./my_adapter \
--neftune-noise-alpha 5
The paper suggests alpha between 5 and 15. It applies to SFT only, as in TRL, and the noise is switched off during validation, so the loss you watch is measured on clean embeddings.
Early stopping
--early-stopping-patience N stops the run once validation loss has not improved for N evaluations in a row. --early-stopping-min-delta sets how much it has to drop to count, so small wobbles do not keep a run alive. It needs a valid.jsonl; without one the flag does nothing and says so.
When it fires, the best-validation adapter becomes the returned adapter. OptiQ keeps a copy of the best checkpoint in a best/ folder inside the adapter in every run, whether or not early stopping is on.
$ optiq lora train mlx-community/Qwen3.5-4B-OptiQ-4bit \
--data ./my_data -o ./my_adapter \
--steps-per-eval 50 \
--early-stopping-patience 3 --early-stopping-min-delta 0.01 \
--neftune-noise-alpha 5
Watching the run
--report-to wandb streams train and validation metrics to Weights & Biases (install wandb and log in first), with --wandb-project to name the project. swanlab works too, and you can pass both separated by a comma. They run beside the terminal log and the Lab's live chart.