MCPInstall

ai-llm

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.

Installs
184
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/vasilyu1983/ai-agents-public --skill ai-llm
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads ai-llm automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

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

NeedGo to
Which approach at all; model and provider choice; MoE vs denseai-architecture-advisor
Preference and RL post-training: RLHF/PPO, DPO, GRPO, RLVR, reward modelsai-post-training
Eval design, judge calibration, thresholds, benchmark harnessesai-evals
Prompts, structured outputs, schema enforcementai-prompt-engineering
Context assembly and memoryai-context-layer
RAG and agentsai-rag, ai-agents
Serving, quantization formats, pruning runtime supportai-llm-inference
Local runs and GGUF packagingai-local-model-ops
Deployment, rollout, monitoring, model/provider migrationai-mlops
API cost model, caching, self-host breakevenops-cost-optimization
Pretraining, tokenizer building, scaling lawsai-pretraining, ai-scaling-laws
Multi-GPU parallelismai-distributed-training
Hugging Face TRL trainer specificsthe huggingface-skills: plugin (external)

Default Workflow

  1. 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.
  2. 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.
  3. 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=-100 on prompt tokens). Packing must not let attention or loss cross example boundaries. See dataset-formatting-guide.md.
  4. 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.
  5. 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.
  6. 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.
  7. 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

DecisionDefaultChange whenAvoid
MethodLoRA/QLoRA, all-linear targetsPlateau on a hard domain after rank and DoRA tries → GaLore, then full FTJumping to rank 256
MemoryQLoRA when the base does not fit in BF16Base fits → plain LoRASizing MoE by active params (all experts load)
Multi-GPUData parallel when the frozen base fits one GPUBase does not fit → FSDP / ZeRO-3 (memory model)Sharding by reflex
LossAssistant tokens onlyPretraining-style continued training on raw textTraining on system and user tokens
DistillationSequence KD from teacher outputsLogit access → soft-label KD; reasoning traces → trace KDAny teacher whose terms forbid training a competitor
PaybackUse the ROI calculatorVolume is high and the domain is stableFine-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.

  1. Check the trainer's own docs for supported methods and losses before promising one (for example, whether a preference loss is built in).
  2. Check the model card and config.json for architecture facts (layers, hidden size, KV heads, MoE experts) instead of recalling them.
  3. 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-pretraining delegates 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-advisor owns whether to distill; ai-pretraining delegates 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.

FAQ

What does the ai-llm skill do?

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.

How do I install ai-llm?

Run npx skills add https://github.com/vasilyu1983/ai-agents-public --skill ai-llm in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/ai-llm/ (personal) or .claude/skills/ai-llm/ (project).

Which AI agents can use ai-llm?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is ai-llm safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains ai-llm?

It is published by vasilyu1983 in vasilyu1983/ai-agents-public. It has 184 recorded installs.

More from vasilyu1983/ai-agents-public

View all →

software-architecture-design

vasilyu1983/ai-agents-public

Designs runtime topology in a chosen solution. Use when choosing monolith vs services, cells, consistency, ADRs. Not for cross-system design (software-solution-architecture).

product-management

vasilyu1983/ai-agents-public

Guides founder-PM discovery, roadmaps, prioritization, and PMF measurement. Use when planning product strategy, metrics, or roadmaps.

AI & Agents914 installs

document-xlsx

vasilyu1983/ai-agents-public

Builds Excel charts, pivots, validation, exports, Office Scripts/Graph automation, and workbook audits. Use when automating workbooks; for plain edits prefer official xlsx skill.

Data & Databases875 installs

software-ui-ux-design

vasilyu1983/ai-agents-public

Designs and audits UI/UX systems with usability and accessibility requirements. Use when shaping flows, design systems, interaction patterns, or WCAG-aware product behavior.

Frontend & Design731 installs

document-pdf

vasilyu1983/ai-agents-public

Handles PDF/UA accessibility, real redaction, metadata scrubbing, signing, and extraction. Use when redacting or signing PDFs; for plain create/merge prefer the official pdf skill.

Docs & Writing689 installs

qa-testing-playwright

vasilyu1983/ai-agents-public

Builds and debugs Playwright E2E suites. Use when authoring browser tests, fixing flakes, or hardening Playwright CI and locator strategy.

Testing & QA665 installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs