Agent skill

Train Sft

by OpenPipe in OpenPipe/ART

SFT training reference for the ART framework. An agent skill from OpenPipe/ART.

Apache-2.0Auto-check passedAI & LLM Engineering

Install Train Sft

skills CLI
$ npx skills add OpenPipe/ART --skill train-sft -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install OpenPipe/ART train-sft --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/OpenPipe/ART.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/train-sft .claude/skills/train-sft && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
train-sft
GitHub stars
11k
Token cost
~2.9k tokens
SKILL.md length
876 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
Apache-2.0

At a glance

SFT training reference for the ART framework. An agent skill from OpenPipe/ART.

  • Works in 7 steps: Determine Training Scenario → Determine Backend → Select and Validate Dataset (JSONL… → …
  • The user asks to create
  • SKILL.md covers Step 1: Determine Training…, Step 2: Determine Backend, Step 3: Select and Validate… and Step 4: Gather Base Parameters, plus 4 more sections
  • Calls uv; reaches wandb.ai; needs WANDB_API_KEY

What it does

Train Sft is an agent skill from OpenPipe/ART. SFT training reference for the ART framework. Use when the user asks to create, write, or help with an SFT training script, fine-tune a model, train from a JSONL dataset, do distillation, or anything related to supervised fine-tuning.

Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Fine-tuning. It works with Qwen. The repository describes itself as: Agent Reinforcement Trainer: train multi-step agents for real-world tasks using GRPO. Give your agents on-the-job training. Reinforcement learning for Qwen3.6, GPT-OSS, Llama… The licence is Apache-2.0.

When your agent uses it

  • The user asks to create
  • Help with an SFT training script
  • Fine-tune a model
  • Train from a JSONL dataset

Example prompts

  • “/train-sft”

Requirements

  • Python 3
  • A credential in WANDB_API_KEY

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Determine Training Scenario
  2. Determine Backend
  3. Select and Validate Dataset (JSONL scenario)
  4. Gather Base Parameters
  5. Gather Hyperparameters
  6. Generate the Training Script
  7. Write and Offer to Run

What it can do on your machine

Read from SKILL.md and the folder at commit 12162f2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • uv

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • wandb.ai

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • WANDB_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Train Sft loads about 2.9k tokens when it runs. Until then it costs about 61 tokens; SKILL.md has 876 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~61
When it runs · the whole SKILL.md, loaded when a task matches
~2.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from OpenPipe/ART at commit 12162f2, republished under its Apache-2.0 licence (© OpenPipe). 876 words, ~2,897 tokens.

Download SKILL.mdSave it as .claude/skills/train-sft/SKILL.md (or your agent's skills folder).
name
train-sft
description
SFT training reference for the ART framework. Use when the user asks to create, write, or help with an SFT training script, fine-tune a model, train from a JSONL dataset, do distillation, or anything related to supervised fine-tuning.

SFT Training Wizard

You are guiding the user through setting up Supervised Fine-Tuning (SFT) for a language model using the ART framework. Act as an interactive wizard: ask questions, validate inputs, and generate a complete runnable script.

Important: Ask ONE question at a time. Wait for the user's response before asking the next question. Never bundle multiple questions into a single message.

Adaptability note: Some steps reference tools like AskUserQuestion, Glob, or Bash. If you don't have access to these tools, simply ask the user the same questions as plain text and skip any steps that require running code (e.g., file search, dataset validation, hyperparameter computation). Do NOT fabricate results — never pretend you ran a tool or searched for files when you didn't.

Step 1: Determine Training Scenario

Ask the user ONE question at a time. Wait for their response before moving to the next question.

Training scenario:

  1. Train from a JSONL file — They have a dataset file with chat-formatted examples
  2. Distillation — They want to train a smaller model using outputs from a larger teacher model

Step 2: Determine Backend

Backend:

  1. ServerlessBackend (Recommended) — Train on remote managed GPUs. No local GPU needed, production-ready inference endpoint.
  2. LocalBackend — Train on your local GPU. Full control, fast iteration.

Step 3: Select and Validate Dataset (JSONL scenario)

IMPORTANT: Do NOT assume a dataset. Do NOT make up or hallucinate file paths. Never pretend you searched for files if you didn't actually run a search tool.

If you have access to file system tools (Glob) and can actually execute them, search for .jsonl files using Glob (**/*.jsonl). Present real results as options. Always include "Provide my own file path" as the last option.

Otherwise, ask the user: "What is the path to your JSONL training file?" — nothing more.

Once the user has provided a file path, validate it if you can run code using the script below. If you cannot run code, skip validation and move on.

python
import json, sys
ROLES = {"system", "user", "assistant", "developer", "tool", "function"}
errors = []
for i, line in enumerate(open(sys.argv[1]), 1):
    try:
        r = json.loads(line)
        msgs = r.get("input", r).get("messages", [])
        assert isinstance(msgs, list) and msgs, "no messages"
        for j, m in enumerate(msgs):
            assert m.get("role") in ROLES, f"messages[{j}]: invalid role {m.get('role')!r}"
            assert m.get("content") or m.get("function_call") or m.get("tool_calls"), f"messages[{j}]: no content"
        if "input" not in r:
            assert msgs[-1]["role"] == "assistant", "last message must be from assistant"
        tools = r.get("tools")
        if tools is not None:
            assert isinstance(tools, list), "tools must be a list"
    except Exception as e:
        errors.append(f"  Line {i}: {e}")
print(f"{len(errors)} error(s):\n" + "\n".join(errors) if errors else f"Valid! {i} rows")
sys.exit(1 if errors else 0)

The JSONL format supports these fields per row:

  • messages (required): List of chat messages
  • tools (optional): List of tool/function definitions for tool-call training
  • response_format (optional): Structured output schema (not used during training, but useful as metadata)

Report the row count and validation result to the user. Do NOT read the whole dataset file. Do NOT name the dataset. If the format is wrong, help them fix it or convert their data.

Step 4: Gather Base Parameters

Do NOT ask the user to review or confirm their answers after collecting them — just proceed to the next step.

  • Base model: Recommend ONLY these models:
    • OpenPipe/Qwen3-14B-Instruct
    • Qwen/Qwen3-30B-A3B-Instruct-2507
    • meta-llama/Llama-3.1-8B-Instruct
  • Project name: A name for this training project (default: sft-project)
  • Run name: A static, descriptive name (e.g., agent-001, pii-redactor-001, math-tutor-001). Ask the user for a meaningful name. Do NOT generate random names.

For distillation also ask:

  • Teacher model: The larger model to distill from (e.g., an OpenRouter model)
  • Teacher API base URL and key: If using a third-party provider
  • Prompts: What prompts to send to the teacher model
Show full SKILL.md (377 more words)Show less

Step 5: Gather Hyperparameters

This step only applies if you can run code AND know the row count from validation. If you cannot run code, skip this step entirely — do NOT make up or guess hyperparameter values. The train_sft_from_file function has sensible built-in defaults.

Run this Python snippet via Bash to compute defaults (replace NUM_ROWS with the actual row count). Do NOT show any formulas or calculation steps to the user — only show the final values.

python
import math, sys
n = int(sys.argv[1])
epochs = max(1, min(10, round(10000 / n)))
batch_size = 2
total_steps = math.ceil(n * epochs / batch_size)
steps_per_epoch = math.ceil(n / batch_size)
warmup_steps = max(10, min(1000, round(steps_per_epoch * 0.05)))
warmup_ratio = round(warmup_steps / total_steps, 4)
print(f"epochs={epochs} batch_size={batch_size} lr=2e-4 schedule=linear warmup_ratio={warmup_ratio}")

Present the output values to the user, then ask:

  • Use defaults (Recommended) — show all values in the description
  • Customize — adjust individual hyperparameters

If they choose "Customize", ask which parameters to change.

For distillation:

Use the same defaults computation as JSONL (replace NUM_ROWS with the number of trajectories). create_sft_dataset_iterator handles the LR schedule automatically.

Step 6: Generate the Training Script

Write a complete, runnable Python script. Use the patterns below. Every script MUST:

  • Call await backend.close() at the end so the process doesn't hang
  • Print post-training info and usage examples (see shared block below)
Post-training block (append to ALL scripts before backend.close()):
python
    # --- Training complete ---
    step = await model.get_step()
    inference_name = model.get_inference_name()
    client = model.openai_client()

    print("\n" + "=" * 60)
    print("SFT TRAINING COMPLETE")
    print("=" * 60)
    print(f"  Model:          {inference_name}")
    print(f"  Base model:     <BASE_MODEL>")
    print(f"  Training step:  {step}")
    print(f"  Inference URL:  {client.base_url}")
    print(f"  W&B run:        https://wandb.ai/<YOUR_TEAM>/<PROJECT_NAME>/runs/<RUN_NAME>")
    print("=" * 60)

    print("\n--- Python usage (openai SDK) ---\n")
    print(f'''\
from openai import OpenAI

client = OpenAI(
    base_url="{client.base_url}",
    api_key="not-needed",
)

response = client.chat.completions.create(
    model="{inference_name}",
    messages=[
        {{"role": "user", "content": "Your prompt here"}},
    ],
)
print(response.choices[0].message.content)
''')

    print("--- curl usage ---\n")
    print(f'''\
curl {client.base_url}chat/completions \\
  -H "Content-Type: application/json" \\
  -d '{{
    "model": "{inference_name}",
    "messages": [
      {{"role": "user", "content": "Your prompt here"}}
    ]
  }}'
''')

    await backend.close()
Backend setup

Use the appropriate backend based on the user's choice:

LocalBackend:

python
from art.local import LocalBackend

backend = LocalBackend()
model = art.TrainableModel(
    name="<RUN_NAME>",
    project="<PROJECT_NAME>",
    base_model="<BASE_MODEL>",
    _internal_config=art.dev.InternalModelConfig(
        engine_args={"gpu_memory_utilization": 0.7},
    ),
)
await model.register(backend)

ServerlessBackend:

python
from art.serverless.backend import ServerlessBackend

backend = ServerlessBackend()  # uses WANDB_API_KEY env var
model = art.TrainableModel(
    name="<RUN_NAME>",
    project="<PROJECT_NAME>",
    base_model="<BASE_MODEL>",
)
await model.register(backend)

Note: _internal_config with gpu_memory_utilization is only used with LocalBackend. Do NOT include it for ServerlessBackend.

JSONL file training pattern:

If hyperparameters were computed in Step 5, pass them explicitly. If Step 5 was skipped, omit them — train_sft_from_file has sensible defaults.

python
"""SFT training script generated by /train-sft wizard."""
import asyncio
import art
<BACKEND_IMPORT>
from art.utils.sft import train_sft_from_file

async def main():
    <BACKEND_SETUP>

    await train_sft_from_file(
        model=model,
        file_path="<FILE_PATH>",
        # Only include these if hyperparameters were computed:
        # epochs=<EPOCHS>,
        # batch_size=<BATCH_SIZE>,
        # peak_lr=<PEAK_LR>,
        # schedule_type="<SCHEDULE_TYPE>",
        # warmup_ratio=<WARMUP_RATIO>,
        verbose=True,
    )

    # ... post-training block + backend.close() ...

if __name__ == "__main__":
    asyncio.run(main())
Distillation pattern:
python
"""Distillation SFT script generated by /train-sft wizard."""
import asyncio, os
from dotenv import load_dotenv
from openai import AsyncOpenAI
import art
<BACKEND_IMPORT>
from art.utils.sft import create_sft_dataset_iterator

load_dotenv()

async def main():
    teacher_client = AsyncOpenAI(
        api_key=os.environ["<API_KEY_ENV_VAR>"],
        base_url="<TEACHER_API_BASE>",
    )
    prompts = ["<PROMPT_1>", "<PROMPT_2>"]

    trajectories = []
    for prompt in prompts:
        completion = await teacher_client.chat.completions.create(
            model="<TEACHER_MODEL>",
            messages=[{"role": "user", "content": prompt}],
        )
        trajectories.append(
            art.Trajectory(
                messages_and_choices=[
                    {"role": "user", "content": prompt},
                    {"role": "assistant", "content": completion.choices[0].message.content},
                ],
                tools=<TOOLS_OR_NONE>,
                )
        )

    <BACKEND_SETUP>

    for chunk in create_sft_dataset_iterator(
        trajectories,
        epochs=<EPOCHS>,
        batch_size=<BATCH_SIZE>,
        peak_lr=<PEAK_LR>,
        schedule_type="<SCHEDULE_TYPE>",
        warmup_ratio=<WARMUP_RATIO>,
    ):
        await model.train_sft(chunk.trajectories, chunk.config, verbose=True)

    # ... post-training block + backend.close() ...

if __name__ == "__main__":
    asyncio.run(main())

Step 7: Write and Offer to Run

  1. Write the script to a file (suggest sft_train.py)
  2. Ask the user if they want to run it now with uv run python <script_path>
  3. If yes, run it directly using the Bash tool (do NOT delegate to a Task subagent) so training logs stream live to the user. Use a 2-minute timeout. If it times out, check progress and decide whether to continue.
  4. LocalBackend only — GPU memory errors: If training fails with OOM, lower gpu_memory_utilization in the existing _internal_config (e.g. from 0.7 to 0.5).
  5. LocalBackend only — Stale GPU memory: If available GPU memory looks too small, previous training runs may still be occupying memory. Before retrying, run nvidia-smi to check, and if needed kill leftover processes with kill <pid> to free memory.

Important Notes

  • LocalBackend requires a GPU.
  • ServerlessBackend requires a WANDB_API_KEY environment variable.

© OpenPipe, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/train-sft of OpenPipe/ART.

Open the folder on GitHubat commit 12162f2

Compare with similar skills

Train Sft next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Train Sft compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Train Sft this skillOpenPipe/ART11k—~2.9kAutomated safety check: PassApache-2.0
slime RL Post-TrainingOrchestra-Research/AI-Research-SKILLs13k5 repos~2.8kAutomated safety check: PassMIT
Finetuning Model Onboardingovermind-core/overmind544—~3.1kAutomated safety check: PassAGPL-3.0
Qwen21sorryhyun/anima_lora125—~1.9kAutomated safety check: NotesMIT
LlamafactoryPrism-Shadow/penguin-harness2.5k—~855Automated safety check: PassApache-2.0
Flux Txt2imgartokun/comfyui-mcp793—~3kAutomated safety check: PassMIT

Similar skills

  • slime RL Post-Training

    Orchestra-Research/AI-Research-SKILLs

    Guides reinforcement-learning post-training of LLMs with slime, which pairs Megatron-LM training with SGLang rollouts, including GRPO runs on GLM, Qwen3 and Llama 3 models.

    13k GitHub starsUsed in 5 repos~2.8k tokens
    AI & LLM EngineeringAuto-check passed
  • Finetuning Model Onboarding

    overmind-core/overmind

    Rules for adding a new model or model family to the finetuning pipeline, or changing finetuning behavior for an existing one — engine-agnostic customization via family hooks instead of if/else in…

    544 GitHub stars~3.1k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Qwen21

    sorryhyun/anima_lora

    Qwen-Image-2.1 LoRA line (NOT Anima) — running cache/train through the daemon, make gui-qwen, the CacheRequest/TrainRequest flag surface and how to add a field, model-dir resolution, cache layout…

    125 GitHub stars~1.9k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check: notes
  • Llamafactory

    Prism-Shadow/penguin-harness

    Fine-tune LLMs with LlamaFactory — register datasets, train via YAML configs, merge LoRA adapters and serve the result.

    2.5k GitHub stars~855 tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Flux Txt2img

    artokun/comfyui-mcp

    Build Flux txt2img workflows with Flux.1 Dev (SRPO), Flux 2 Klein 9B, Turbo LoRAs, FluxGuidance, and DualCLIPLoader patterns

    793 GitHub stars~3k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • Qwen Image Edit

    artokun/comfyui-mcp

    Build Qwen Image Edit workflows covering model loading, conditioning, LoRAs, prompt patterns, and XY plot testing

    793 GitHub stars~4.6k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed

More from OpenPipe/ART

  • Fix Art Issues

    OpenPipe/ART

    Fix a GitHub issue on OpenPipe/ART and open a PR. An agent skill from OpenPipe/ART.

    11k GitHub stars~840 tokensUpdated yesterday
    Auto-check: notes
  • Train Rl

    OpenPipe/ART

    RL training reference for the ART framework. An agent skill from OpenPipe/ART.

    11k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Train Sft

What does Train Sft do?

SFT training reference for the ART framework. An agent skill from OpenPipe/ART. Train Sft is an agent skill from OpenPipe/ART. SFT training reference for the ART framework.

When should I use Train Sft?

Train Sft fits situations like: the user asks to create; help with an SFT training script; fine-tune a model; train from a JSONL dataset.

How do I install Train Sft in Claude Code?

Run `npx skills add OpenPipe/ART --skill train-sft -a claude-code`. Or copy the skill folder (.agents/skills/train-sft in OpenPipe/ART) into .claude/skills/train-sft in your project. Claude Code loads it when a task matches its description.

How do I install Train Sft in Codex?

Run `npx skills add OpenPipe/ART --skill train-sft -a codex`. Or copy the skill folder (.agents/skills/train-sft in OpenPipe/ART) into .agents/skills/train-sft in your project. Codex loads it when a task matches its description.

Can I use Train Sft in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add OpenPipe/ART --skill train-sft -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/train-sft, .gemini/skills/train-sft, .github/skills/train-sft and .opencode/skills/train-sft in your project.

What does Train Sft need to run?

Going by SKILL.md and its folder, Train Sft needs the command-line tools its instructions call (uv) and credentials named WANDB_API_KEY. Our summary lists: Python 3; A credential in WANDB_API_KEY.

Does Train Sft access the network?

SKILL.md names 1 domain. In commands or code: wandb.ai; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Train Sft safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Train Sft use?

Train Sft is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Train Sft use?

About 2.9k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Train Sft?

Skills that share tags, products or a category with Train Sft: slime RL Post-Training (Orchestra-Research/AI-Research-SKILLs, 13k stars), Finetuning Model Onboarding (overmind-core/overmind, 544 stars), Qwen21 (sorryhyun/anima_lora, 125 stars) and Llamafactory (Prism-Shadow/penguin-harness, 2.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Train Sft?

OpenPipe (a GitHub organization) maintains it in OpenPipe/ART, which has 10,786 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on October 5, 2026.

Source: OpenPipe/ART on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.