unsloth/studio/backend/core/training
Daniel Han 762657afd2
studio/mlx: lower per-element grad clip default from 5.0 to 1.0 (#5440)
Studio's MLX training worker explicitly pinned ``max_grad_value=5.0``
into the ``MLXTrainingConfig`` so it would override the zoo default
regardless. The 5.0 threshold was effectively no protection -- per-
element transformer gradients in steady state are 1e-3..1e-1, so
|g_i| > 5 basically never fires even on spike batches, mixed-precision
overflow, or RL gradient bursts.

Switch to 1.0:
  - matches the universal LLM clip_grad_norm=1.0 baseline (HF Trainer
    / TRL / PEFT / AutoTrain) while staying on MLX's fast per-element
    ``tree_map(mx.clip)`` path (no global reduction)
  - actually catches outliers without distorting Adam's normalised
    updates (typical post-warmup |g_i| << 1.0)
  - lines up with the new MLXTrainingConfig default in
    unslothai/unsloth-zoo so Studio doesn't silently disagree with
    what zoo ships

No UI change; the TODO to expose grad clipping in Studio settings
remains. Existing trained runs are unaffected: only newly-spawned
training workers pick up the tighter clip.
2026-05-15 03:51:55 -07:00
..
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
resume.py Studio: Add checkpoint resume for stopped training runs (#5255) 2026-05-04 00:34:46 +04:00
trainer.py Studio: Passing batch size for eval (#5168) 2026-05-14 17:48:28 +04:00
training.py studio: drop unused max_grad_value schema + route plumbing (#5424) 2026-05-14 05:43:58 -07:00
worker.py studio/mlx: lower per-element grad clip default from 5.0 to 1.0 (#5440) 2026-05-15 03:51:55 -07:00