Fine-tuning a 350M Model for Better Structured Outputs in 100 GRPO Steps
GRPO fine-tuning of LFM2.5-350M with TRL on about 500 Nemotron structured-output samples for 100 steps raises its IFStruct pass rate from 22.6% to 29.7%. The run fits on a free-tier Colab or Kaggle GPU. The recipe uses a LoRA adapter (~1.66% of parameters) on the hybrid attention/convolution modules and prompt augmentation for fenced code blocks and bare lists. Three weighted reward functions score format parseability, field count and JSON Schema validation. Gains concentrate where training aimed: JSON rises from 18.0% to 31.9% and bare lists from 16.6% to 29.7%, while YAML is flat, bringing the 350M model close to Qwen3.5-2B's 33.15%. Evaluation runs locally via llama.cpp serving BF16 GGUFs.
Related posts
- We Got Claude to Fine-Tune an Open Source LLM
Hugging Face mediumAdeptHugging Face Skills, specifically the hf-llm-trainer skill, lets coding agents like Claude Code, Codex and Gemini CLI run a full LLM fine-tuning lifecycle. The agent validates the dataset, picks GPU hardware by model size, generates a TRL training script with Trackio monitoring, submits it to Hugging Face Jobs, reports progress and pushes the result to the Hub. The walkthrough covers setup, SFT, DPO and GRPO, LoRA for models over 3B, GGUF conversion for llama.cpp, and cost guidance. A 0.6B Qwen3 SFT run on a t4-small costs about $0.30, 3-7B models need A10G/A100 with LoRA at $15-40, and a cheap 100-example test run before a production job catches dataset format errors early.
- Together AI expands fine-tuning service with more models, live metrics, and finer controls
Together AI mediumAdeptTogether Fine-Tuning adds support for new open-weight models (GLM-5.3, Kimi K2.7, Qwen 3.5/3.6/3.8, Gemma 4, DeepSeek-V4-Flash), live per-step metrics via API, CLI and dashboard, and new training controls. These include LoRA on MoE expert layers, early stopping with refunds, and gradient accumulation for arbitrary batch sizes. In an invented-facts test, expert-layer LoRA recalled up to 89% of new knowledge versus 15% for attention-only adapters, and it kept routed experts from falling out of use. Data tooling adds tokenized dataset previews, per-example sample weights, pre-flight JSONL validation and packing controls, alongside price cuts of 30–70%.
- 🐯 Liger GRPO meets TRL
Hugging Face hardMasterLiger's chunked loss, extended to GRPO and integrated into TRL's GRPOTrainer, cuts peak training memory by up to 40% with no change in reward curves. It chunks the lm_head input along the batch and computes each chunk's gradients during the forward pass, so full logits never need to be held for backward. Benchmarks on Qwen3-0.6B with gsm8k show savings growing with batch size. FSDP and PEFT support allow 1.5–1.8x larger batch sizes across Qwen3 sizes, and LoRA removes the need for a separate reference model. Setup is a `use_liger_loss=True` flag, with optional vLLM-server generation for faster rollouts.
- CodeAgents + Structure: A Better Way to Execute Actions
Hugging Face mediumAdeptForcing code-writing agents to emit their reasoning and Python code as a structured JSON blob (thoughts + code) beats both markdown-parsed CodeAgents and JSON tool-calling agents by 2-7 percentage points on GAIA, MATH, SimpleQA and Frames for capable models. An analysis of 15,724 traces shows first-step parsing errors cut success from 51.3% to 42.3% and raise average steps from 3.18 to 4.63, which structured generation eliminates. Smaller models such as Mistral-7B pay a "structure tax", producing broken Python when juggling JSON escaping and code at once, so the approach is recommended for 32B+ or frontier models. In smolagents it is enabled with use_structured_outputs_internally=True.
- GLM-5.2: Built for Long-Horizon Tasks
Hugging Face hardMasterGLM-5.2 is Z.ai's MIT-licensed flagship model for long-horizon coding-agent work, with a 1M-token context and selectable thinking effort levels. It scores 81.0 on Terminal-Bench 2.1 and lands near Claude Opus 4.8 on FrontierSWE. Architecturally, IndexShare reuses one sparse-attention indexer across every four DSA layers, cutting per-token FLOPs 2.9× at 1M context. An improved MTP draft layer, using shared indices and KV, rejection sampling and an end-to-end TV loss, raises speculative-decoding acceptance length by 20%. Post-training switches from group-wise optimization to critic-based PPO, which handles compacted sub-traces, and uses slime for agentic RL plus a two-stage rule-and-LLM-judge guard that blocks reward-hacking tool calls online without aborting rollouts.