ai-llm
Skill94 starsChanged 35 days agoMITView on GitHub
Adapts LLMs: SFT dataset loss masking, LoRA and QLoRA, full FT vs PEFT, distillation, pruning, tokenizer fragmentation. Use when fine-tuning or compressing a model.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- zyphr-labs/bounty-harnesstheir own version, first seen Aug 26, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- zyphr-labs/bounty-harness★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository146 other files it gives its agents.
- agents/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- hooks/AGENTS.mdAGENTS.md
- agents-hooksSkill
- agents-mcpSkill
- agents-memorySkill
- agents-skills-feedback-loopSkill
- agents-skillsSkill
- agents-subagentsSkill
- agents-swarm-orchestrationSkill
- ai-agentsSkill
- ai-architecture-advisorSkill
- ai-bot-builderSkill
- ai-coding-agents-observability-evalsSkill
- ai-coding-agents-pluginsSkill
- ai-coding-agents-provider-runtimeSkill
- ai-coding-agents-runtime-coreSkill
- ai-coding-agents-safety-envelopeSkill
- ai-coding-agents-settings-policySkill
- ai-coding-agentsSkill
- ai-coding-agents-stateSkill
- ai-coding-agents-surfacesSkill
- ai-context-layerSkill
- ai-data-curation-pretrainingSkill
- ai-deep-researchSkill
- ai-distributed-trainingSkill
- ai-evalsSkill
- ai-llm-inferenceSkill
- ai-local-model-opsSkill
- ai-ml-data-scienceSkill
- ai-mlopsSkill
- ai-ml-timeseriesSkill
- ai-post-trainingSkill
- ai-pretrainingSkill
- ai-product-operating-modelSkill
- ai-prompt-engineeringSkill
- ai-ragSkill
- ai-scaling-lawsSkill
- ai-vector-brainSkill
- ai-voice-botsSkill
- data-analytics-engineeringSkill
- data-lake-platformSkill
- data-metabaseSkill
- data-sql-optimizationSkill
- data-streamingSkill
- dev-ai-coding-metricsSkill
- dev-api-designSkill
- dev-context-code-graphSkill
- dev-context-engineeringSkill
- dev-context-multi-repoSkill
- dev-contribution-quality-analysisSkill
- dev-dependency-managementSkill
- dev-git-commit-messageSkill
- dev-git-workflowSkill
- dev-workflow-planningSkill
- docs-ai-prdSkill
- docs-codebaseSkill
- docs-notes-retrievalSkill
- document-docxSkill
- document-pdfSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 48
Escalate only on evidence: If LoRA plateaus on a hard, far-from-pretraining domain, follow the escalation order in fine-tuning-recipes.md …
- Distinctive: line 49
Distillation step: Before any teacher call, confirm the teacher's terms permit training a competing model, and record the licence.
- Distinctive: line 75
Check the trainer's own docs for supported methods and losses before promising one (for example, whether a preference loss is built in).
- Very specific: line 76
Check the model card and config.json for architecture facts (layers, hidden size, KV heads, MoE experts) instead of recalling them.
- Distinctive: line 77
Check a framework's repository status before starting new work on it.
- Very specific: line 106
When prior decisions or pitfalls are relevant, consult learnings.consolidated.md if present.
- Very specific: line 108
After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append …
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LLM Adaptation
Change a model's weights so it does a task better: supervised fine-tuning (SFT), parameter-efficient fine-tuning (PEFT: LoRA, QLoRA, DoRA), full fine-tuning, distillation and compression recovery, plus the dataset and tokenizer work that decides whether any of it succeeds.
Deciding whether to adapt at all (prompt vs thinking vs RAG vs fine-tune vs post-train) is not this skill. Use the single build ladder in ai-architecture-advisor first, and come here once it says "fine-tune" or "distill".
When to Use This Skill
- Configuring LoRA or QLoRA: rank, alpha, alpha convention, target modules, learning rate
- Choosing full fine-tuning vs PEFT, or escalating when LoRA plateaus
- Building an SFT dataset: chat templates, prompt-token loss masking, packing, contamination control
- Distilling a large teacher into a smaller student, or recovering quality after pruning
- Diagnosing tokenizer fragmentation, fertility, or glitch tokens on a subset of inputs
- Deciding whether a fine-tune pays back (break-even on volume and stability)
Scope Boundaries
| Need | Go to |
| Which approach at all; model and provider choice; MoE vs dense | ai-architecture-advisor |
| Preference and RL post-training: RLHF/PPO, DPO, GRPO, RLVR, reward models | ai-post-training |
| Eval design, judge calibration, thresholds, benchmark harnesses | ai-evals |
| Prompts, structured outputs, schema enforcement | ai-prompt-engineering |
| Context assembly and memory | ai-context-layer |
| RAG and agents | ai-rag, ai-agents |
| Serving, quantization formats, pruning runtime support | ai-llm-inference |
| Local runs and GGUF packaging | ai-local-model-ops |
| Deployment, rollout, monitoring, model/provider migration | ai-mlops |
| API cost model, caching, self-host breakeven | ops-cost-optimization |
| Pretraining, tokenizer building, scaling laws | ai-pretraining, ai-scaling-laws |
| Multi-GPU parallelism | ai-distributed-training |
| Hugging Face TRL trainer specifics | the huggingface-skills: plugin (external) |
Default Workflow
- Confirm the gap is behavior, not knowledge or reasoning. Missing facts belong in retrieval and multi-step logic in the thinking budget (see the advisor ladder). Fine-tune for a stable behavior, format, or style gap that survives prompt and RAG fixes.
- Build the eval before the dataset. Hold out a task set by slice, capture a same-seed baseline of the untuned model, and add an out-of-domain forgetting set.
- Build the dataset. Group duplicate and near-duplicate source examples, then assign whole groups to train or eval before augmentation or synthetic generation; check for residual overlap. Apply the model's own chat template, and use the same template at train and at serve (generation prompt and end-of-turn token included): render one example through the training pipeline and through the serving engine and diff the token IDs, because a mismatch raises no error and looks like a fine-tune that did nothing (§5E). Compute loss on assistant tokens only (
ignore_index=-100on prompt tokens). Packing must not let attention or loss cross example boundaries. See dataset-formatting-guide.md. - Start with PEFT. LoRA or QLoRA on all linear layers; record rank, alpha, alpha convention, target modules, and effective batch (micro × accumulation × world size). Trainable share = Σ r·(d_in + d_out) over adapted matrices ÷ total parameters; compute it for your model instead of quoting a percentage.
- Escalate only on evidence. If LoRA plateaus on a hard, far-from-pretraining domain, follow the escalation order in fine-tuning-recipes.md and keep the forgetting eval.
- Distillation step. Before any teacher call, confirm the teacher's terms permit training a competing model, and record the licence. Then pick the supervision signal your access gives you (logits, generated text, or rationales) per advanced-llm-patterns.md.
- Gate the release. Run the gate on the exact serving artifact and configuration: test the adapter loaded separately if that is how it will serve, or test the merged and quantized artifact if that is the deployment path. A delta that appears only after quantization is not the fine-tune's (merge and quantize). Pick the release checkpoint on the task and forgetting slices; validation loss only ranks checkpoints for early stopping. Compare against the baseline by slice, schema-valid and tool-call rates, and the forgetting set. Hand deployment to ai-mlops.
Quick Reference
| Decision | Default | Change when | Avoid |
| Method | LoRA/QLoRA, all-linear targets | Plateau on a hard domain after rank and DoRA tries → GaLore, then full FT | Jumping to rank 256 |
| Memory | QLoRA when the base does not fit in BF16 | Base fits → plain LoRA | Sizing MoE by active params (all experts load) |
| Multi-GPU | Data parallel when the frozen base fits one GPU | Base does not fit → FSDP / ZeRO-3 (memory model) | Sharding by reflex |
| Loss | Assistant tokens only | Pretraining-style continued training on raw text | Training on system and user tokens |
| Distillation | Sequence KD from teacher outputs | Logit access → soft-label KD; reasoning traces → trace KD | Any teacher whose terms forbid training a competitor |
| Payback | Use the ROI calculator | Volume is high and the domain is stable | Fine-tuning for knowledge that changes |
Known Traps
- fine-tuning for information that should live in retrieval, or for a reasoning gap that a larger thinking budget closes
- quoting a LoRA parameter percentage instead of computing Σ r·(d_in + d_out) for the actual model
- computing loss on prompt tokens, or packing examples so attention crosses boundaries
- splitting near-duplicate source examples across train/eval, or augmenting before assigning source groups to a split
- distilling from a hosted model whose terms forbid training a competing model
- gating a compressed or tuned model on perplexity; reasoning, schema-valid, and tool-call slices break first
- treating a too-good eval score as success instead of a leakage alarm
- sizing an MoE fine-tune by active parameters, or ignoring router drift toward a few experts
Trainer features, supported losses, and framework maintenance status change often.
- Check the trainer's own docs for supported methods and losses before promising one (for example, whether a preference loss is built in).
- Check the model card and
config.jsonfor architecture facts (layers, hidden size, KV heads, MoE experts) instead of recalling them. - Check a framework's repository status before starting new work on it; some fine-tuning libraries have wound down.
Scripts
This skill ships no scripts. The per-call cost estimator is in ops-cost-optimization (scripts/cost_estimator.py), and the offline prompt regression runner is in ai-evals (scripts/prompt_eval_runner.py).
Navigation: References
- Fine-Tuning Recipes: SFT, instruction tuning, LoRA/QLoRA configuration, PEFT method family, full-FT escalation, multi-GPU and MoE notes, safety data, mid-training, data feedback loops, contamination control
- Dataset Formatting Guide: instruction, chat, and transformation formats; dataset hygiene; loss masking (
ignore_index=-100, first EOS unmasked); packing inside example boundaries.ai-pretrainingdelegates SFT formatting here. - Adaptation Patterns: task-specific tuning, synthetic data, knowledge distillation (logit, sequence, on-policy, rationale, prune-then-distill, reasoning-trace) with the teacher licence gate, compression checklist, multi-task learning.
ai-architecture-advisorowns whether to distill;ai-pretrainingdelegates distillation here. - Tokenizer Diagnostics: fertility and parity, glitch and undertrained tokens, domain fragmentation, number tokenization, typo brittleness. Building a BPE tokenizer is ai-pretraining.
- Multimodal Patterns: vision, audio, and document workflows. Outside the adaptation scope; kept here until it has an owner.
Moved out of this skill: post-training → ai-post-training; eval patterns → ai-evals; cost economics → ai-api-cost-guide; deployment, migration, and monitoring → ai-mlops; the build ladder and model selection → ai-architecture-advisor.
Templates
- Fine-Tuning Config: reproducible SFT/LoRA config record
- SFT Chat Dataset and Instruction Dataset: minimal record shapes
- Data Quality: dedupe, PII, and quality checks for training data
- Fine-Tuning ROI Calculator: break-even analysis for an adaptation investment
External Sources
See data/sources.json for the papers and docs behind the recipes (LoRA, QLoRA, DoRA, rsLoRA, IA³, LoRA-vs-full-FT, distillation) and provider lookup pages for current-fact checks.
Learnings Loop
When prior decisions or pitfalls are relevant, consult learnings.consolidated.md if present; use learnings.md only for needed history or as the available fallback. Otherwise skip both.
After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

