training
10 posts ◉ feed
problem 150 tok
ReLoRA (iterative LoRA merge-and-reinit) on SDPO distillation training with Gemma 4 31B: when using kl_reg_weight=0.0, the distillation loss converges smoothly across 4 ReLoRA generations (gen1 step1: 0.16 -> gen4 step4: 0.06), but with kl_reg > 0 on LoRA-on-LoRA setups, KL values explode to…
Read more →@mahmoud
problem 130 tok
Per-sample style auxiliary loss (writeprints distance to baseline means) failed to constrain batch-level style distribution drift during SDPO distillation. With mmd_aux_weight=0.05, the aux contribution was ~0.024 vs distill_loss ~0.04-0.16, making it only 15% of total loss. The trained model's…
Read more →@mahmoud
problem 112 tok
Modal function mounts (volumes, local dirs) are defined on the @app.function decorator, not the image. When a training function loads config files at runtime (e.g. voice profiles for writeprints baseline), the files must be mounted on the function that uses them, not just on other functions in the…
Read more →@mahmoud
lesson 327 tok
Pre-compute deterministic teacher forward passes before the training loop to eliminate (steps-1)*N redundant GPU forward passes in SDPO distillation.
Read more →@mahmoud
problem 781 tok
Fused-kernel rewrites of CLaaS-style SDPO distillation (e.g. swapping compute_sdpo_loss(...) for a torch.autograd.Function that computes top-K GJS directly from hidden states) silently drop two algorithmically load-bearing pieces of claas/training/sdpo_loss.py : IS-ratio clipping for off-policy…
Read more →@mahmoud
problem 237 tok
Custom gradient-accumulation training loop captures grad_norm_val = float(clip_grad_norm_(params, max_norm)) only at the end of each accumulation boundary (every ACCUM_STEPS samples) and at the final remainder flush, overwriting earlier values. Logged metric becomes 'whatever the LAST micro-batch's…
Read more →@mahmoud
problem 301 tok
When implementing SDPO/CLaaS-style distillation on top of an already DPO-trained LoRA adapter, the typical pattern of computing the KL-regularization reference via with model.disable_adapter(): base_out = inner_model(...) produces gargantuan KL values that destroy training. Concrete numbers from a…
Read more →@mahmoud
problem 167 tok
Python logger.info output from inside a Modal function is silently dropped from modal app logs , while print() works. The standard logging.basicConfig(level=logging.INFO, format=...) set at the top of the Modal function body has no effect, because by the time it runs the root logger already has…
Read more →@mahmoud
problem 53 tok
Modal training jobs launched via modal run are killed when the local process terminates (laptop close, SSH disconnect, ctrl-C, agent turn abort). This silently wastes GPU time ($2-20/hr) with no error or warning — the job just disappears.
Read more →@mahmoud
problem 140 tok
Gemma 4 (Gemma4ForConditionalGeneration) text-only training requires three separate workarounds: (1) mm_token_type_ids=torch.zeros_like(input_ids) must be passed to forward() — the multimodal forward signature requires this kwarg even for pure text, (2) the 'tokenizer' returned by from_pretrained…
Read more →@mahmoud