rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training
Use rlcli train sl, rl, harbor, and opsd to run supervised fine-tuning, RL on GSM8K, sandboxed Harbor agent RL, and on-policy self-distillation on local GPUs.
rlcli provides four training subcommands under train: sl for supervised fine-tuning, rl for reinforcement learning on math benchmarks, harbor for sandboxed agent RL, and opsd for on-policy self-distillation from a prompts file. Each subcommand sends requests to the Tinker API at --base-url and automatically sets TINKER_API_KEY=tml-dummy.
sl
rl
harbor
opsd
train sl
Supervised fine-tune a model on a messages JSONL dataset.
On-policy self-distillation on a prompts JSONL. Each step the student samples --group-size completions per prompt, a teacher scores the student’s own tokens, and the negative reverse KL (student || teacher) becomes the per-token advantage for an importance_sampling update. There is no reward: the teacher is the only signal. Drives the pinned cookbook’s distillation.train_on_policy recipe.
Path to a JSONL file, or - to read from stdin. Each line is {"prompt": "..."} or {"messages": [...]}; for messages, the last user turn is the prompt and earlier system/user/assistant text turns are context (trailing assistant turns are dropped).
string
required
HuggingFace model name of the student.
string
default:"http://localhost:8000"
Tinker API server URL.
string
Teacher: a base model name, or a tinker://... checkpoint of --model on the same server. Defaults to --model itself (self-distillation).
string
Privileged text the teacher sees prepended to every prompt (hint, blank line, prompt). The student never sees it, so with the default teacher this is “same weights + hint” self-distillation.
float
default:"1.0"
Weight of the negative reverse KL in the per-token advantages.
float
default:"0.0"
Discount for summing future per-token KL into each advantage. 0 keeps it per-token.
int
Stop after N steps. Defaults to one pass over the dataset.
string
Renderer to use. Defaults to the recommended renderer for the model.
int
default:"32"
Prompts per step.
int
default:"4"
Samples per prompt.
float
default:"1e-4"
Learning rate. --learning-rate is an alias.
int
default:"1024"
Maximum tokens to generate per response.
int
default:"32"
LoRA rank.
int
default:"20"
Save a checkpoint every N steps.
string
default:"~/.rlcli/runs/opsd-<timestamp>"
Directory for training logs.
flag
Load the prompts and print the resolved config without contacting the server.
Example
rlcli train opsd --model Qwen/Qwen3-4B-Instruct-2507 --dataset prompts.jsonl \ --teacher-hint "Think step by step and double-check your arithmetic." \ --batch-size 16 --group-size 4 --steps 50
The teacher scores the student’s tokens as rendered with the student’s chat template; a --teacher with a different template is scored under the student’s rendering (the cookbook’s assumption too). With --teacher-hint, rlcli builds the hinted prompt with the same renderer and wraps the teacher client so its logprob calls see hint + prompt while the student’s sequence is unchanged.
Common notes
TINKER_API_KEY is set to tml-dummy automatically if unset.
TINKER_BASE_URL is forwarded automatically.
The loss guard runs before training begins and fails fast with a clear message if the selected loss is unsupported by the backend.
gspo has a known upstream packing-order bug on multi-GPU and Megatron setups (NovaSky-AI/SkyRL#2043). Single-GPU FSDP is verified clean. rlcli prints a warning to stderr when --loss gspo is used.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"rlcli","colors":{"primary":"#2E7D5B","light":"#5FB98A","dark":"#1F5A42"},"favicon":{"light":"https://mintcdn.com/polygramme/BaEiNDsc-sBxT8rj/images/Blackback1.001.png?fit=max\u0026auto=format\u0026n=BaEiNDsc-sBxT8rj\u0026q=85\u0026s=890e6a7f364da70099257e4f91571233","dark":"https://mintcdn.com/polygramme/BaEiNDsc-sBxT8rj/images/Blackback1.001.png?fit=max\u0026auto=format\u0026n=BaEiNDsc-sBxT8rj\u0026q=85\u0026s=890e6a7f364da70099257e4f91571233"},"footer":{"socials":{"github":"https://github.com/polygramme/rlcli"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"polygramme","hasAudioNarration":false,"actualSubdomain":"polygramme","customDomains":["docs.polygramme.com"],"gitSource":{"type":"github","owner":"polygramme","repo":"rlcli","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ab893e7eb4fcebf68421eb8","clientVersion":"0.0.4344","searchFilterCounts":[{"language":"default","tag":"Documentation","count":13},{"language":"default","tag":"CLI Reference","count":6},{"language":"default","tag":"Guides","count":6},{"language":"default","tag":"Commands","count":5},{"language":"default","tag":"Concepts","count":4},{"language":"default","tag":"Get Started","count":3},{"language":"default","tag":"Overview","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[]}
{"page":{"pagePath":"cli/train","slug":"/cli/train","pageMetadata":{"title":"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training","sidebarTitle":"train","description":"Use rlcli train sl, rl, harbor, and opsd to run supervised fine-tuning, RL on GSM8K, sandboxed Harbor agent RL, and on-policy self-distillation on local GPUs.","href":"/cli/train"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Use rlcli train sl, rl, harbor, and opsd to run supervised fine-tuning, RL on GSM8K, sandboxed Harbor agent RL, and on-policy self-distillation on local GPUs.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note,ParamField,Tab,Tabs,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`rlcli provides four training subcommands under `,_jsx(_components.code,{children:`train`}),`: `,_jsx(_components.code,{children:`sl`}),` for supervised fine-tuning, `,_jsx(_components.code,{children:`rl`}),` for reinforcement learning on math benchmarks, `,_jsx(_components.code,{children:`harbor`}),` for sandboxed agent RL, and `,_jsx(_components.code,{children:`opsd`}),` for on-policy self-distillation from a prompts file. Each subcommand sends requests to the Tinker API at `,_jsx(_components.code,{children:`--base-url`}),` and automatically sets `,_jsx(_components.code,{children:`TINKER_API_KEY=tml-dummy`}),`.`]}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`sl`,id:`sl`,\"data-child-heading-ids\":`[\"train-sl\",\"flags\",\"example\"]`,children:[_jsx(Heading,{level:`2`,id:`train-sl`,children:`train sl`}),_jsx(_components.p,{children:`Supervised fine-tune a model on a messages JSONL dataset.`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`rlcli`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` train`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --dataset`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`PAT`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`H`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`MODE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`L`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [OPTIONS]`})]}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`flags`,children:`Flags`}),_jsx(ParamField,{path:`--dataset`,type:`string`,required:true,id:`param-dataset`,children:_jsxs(_components.p,{children:[`Path to a JSONL file, or `,_jsx(_components.code,{children:`-`}),` to read from stdin.`]})}),_jsx(ParamField,{path:`--model`,type:`string`,required:true,id:`param-model`,children:_jsx(_components.p,{children:`HuggingFace model name or path.`})}),_jsx(ParamField,{path:`--base-url`,default:`http://localhost:8000`,type:`string`,id:`param-base-url`,children:_jsx(_components.p,{children:`Tinker API server URL.`})}),_jsx(ParamField,{path:`--renderer`,type:`string`,id:`param-renderer`,children:_jsx(_components.p,{children:`Renderer to use. Defaults to the recommended renderer for the model.`})}),_jsx(ParamField,{path:`--batch-size`,default:`8`,type:`int`,id:`param-batch-size`,children:_jsx(_components.p,{children:`Training batch size.`})}),_jsx(ParamField,{path:`--lr`,default:`1e-4`,type:`float`,id:`param-lr`,children:_jsx(_components.p,{children:`Learning rate.`})}),_jsx(ParamField,{path:`--max-length`,default:`2048`,type:`int`,id:`param-max-length`,children:_jsx(_components.p,{children:`Maximum sequence length for training examples.`})}),_jsx(ParamField,{path:`--epochs`,default:`1`,type:`int`,id:`param-epochs`,children:_jsx(_components.p,{children:`Number of training epochs.`})}),_jsx(ParamField,{path:`--lora-rank`,default:`32`,type:`int`,id:`param-lora-rank`,children:_jsx(_components.p,{children:`LoRA rank.`})}),_jsx(ParamField,{path:`--save-every`,default:`20`,type:`int`,id:`param-save-every`,children:_jsx(_components.p,{children:`Save a checkpoint every N steps.`})}),_jsx(ParamField,{path:`--test-size`,default:`0`,type:`float`,id:`param-test-size`,children:_jsx(_components.p,{children:`Fraction of data to hold out for evaluation.`})}),_jsx(ParamField,{path:`--log-path`,default:`~/.rlcli/runs/sl-\u003ctimestamp>`,type:`string`,id:`param-log-path`,children:_jsx(_components.p,{children:`Directory for training logs.`})}),_jsx(ParamField,{path:`--dry-run`,type:`flag`,id:`param-dry-run`,children:_jsx(_components.p,{children:`Print the training plan without executing.`})}),_jsx(Heading,{level:`3`,id:`example`,children:`Example`}),_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`rlcli`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` train`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` sl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --dataset`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` clean.jsonl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Qwen/Qwen3-4B-Instruct-2507`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --batch-size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 16`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --lr`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 2e-4`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --epochs`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`})]}),`\n`]})})})]}),_jsxs(Tab,{title:`rl`,id:`rl`,\"data-child-heading-ids\":`[\"train-rl\",\"flags-2\",\"example-2\"]`,children:[_jsx(Heading,{level:`2`,id:`train-rl`,children:`train rl`}),_jsx(_components.p,{children:`Run reinforcement learning on GSM8K.`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`rlcli`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` train`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`MODE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`L`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [OPTIONS]`})]}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`flags-2`,children:`Flags`}),_jsx(ParamField,{path:`--model`,type:`string`,required:true,id:`param-model-1`,children:_jsx(_components.p,{children:`HuggingFace model name or path.`})}),_jsx(ParamField,{path:`--base-url`,default:`http://localhost:8000`,type:`string`,id:`param-base-url-1`,children:_jsx(_components.p,{children:`Tinker API server URL.`})}),_jsx(ParamField,{path:`--loss`,default:`importance_sampling`,type:`choice`,id:`param-loss`,children:_jsx(_components.p,{children:`RL loss to use. All losses are available; the server must support the chosen one.`})}),_jsx(ParamField,{path:`--loss-config`,type:`JSON string`,id:`param-loss-config`,children:_jsx(_components.p,{children:`Raw JSON overrides for the loss function configuration.`})}),_jsx(ParamField,{path:`--backend`,type:`choice`,id:`param-backend`,children:_jsxs(_components.p,{children:[`Backend hint for the loss guard. Choices: `,_jsx(_components.code,{children:`jax`}),`, `,_jsx(_components.code,{children:`fsdp`}),`, `,_jsx(_components.code,{children:`megatron`}),`. Auto-detected for managed servers.`]})}),_jsx(ParamField,{path:`--dataset`,default:`gsm8k`,type:`choice`,id:`param-dataset-1`,children:_jsxs(_components.p,{children:[`Dataset to train on. The only supported choice is `,_jsx(_components.code,{children:`gsm8k`}),`.`]})}),_jsx(ParamField,{path:`--renderer`,type:`string`,id:`param-renderer-1`,children:_jsx(_components.p,{children:`Renderer to use. Defaults to the recommended renderer for the model.`})}),_jsx(ParamField,{path:`--batch-size`,default:`64`,type:`int`,id:`param-batch-size-1`,children:_jsx(_components.p,{children:`Training batch size.`})}),_jsx(ParamField,{path:`--group-size`,default:`8`,type:`int`,id:`param-group-size`,children:_jsx(_components.p,{children:`Group size for grouped RL.`})}),_jsx(ParamField,{path:`--lr`,default:`4e-5`,type:`float`,id:`param-lr-1`,children:_jsx(_components.p,{children:`Learning rate.`})}),_jsx(ParamField,{path:`--max-tokens`,default:`256`,type:`int`,id:`param-max-tokens`,children:_jsx(_components.p,{children:`Maximum tokens to generate per response.`})}),_jsx(ParamField,{path:`--lora-rank`,default:`32`,type:`int`,id:`param-lora-rank-1`,children:_jsx(_components.p,{children:`LoRA rank.`})}),_jsx(ParamField,{path:`--save-every`,default:`20`,type:`int`,id:`param-save-every-1`,children:_jsx(_components.p,{children:`Save a checkpoint every N steps.`})}),_jsx(ParamField,{path:`--eval-every`,default:`0`,type:`int`,id:`param-eval-every`,children:_jsxs(_components.p,{children:[`Run evaluation every N steps. `,_jsx(_components.code,{children:`0`}),` disables evaluation.`]})}),_jsx(ParamField,{path:`--max-steps`,type:`int`,id:`param-max-steps`,children:_jsx(_components.p,{children:`Maximum number of training steps.`})}),_jsx(ParamField,{path:`--log-path`,type:`string`,id:`param-log-path-1`,children:_jsx(_components.p,{children:`Directory for training logs.`})}),_jsx(ParamField,{path:`--dry-run`,type:`flag`,id:`param-dry-run-1`,children:_jsx(_components.p,{children:`Print the training plan without executing.`})}),_jsx(Heading,{level:`3`,id:`example-2`,children:`Example`}),_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`rlcli`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` train`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` rl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Qwen/Qwen3-4B-Instruct-2507`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --loss`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` ppo`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --batch-size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 32`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --group-size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --max-steps`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 100`})]}),`\n`]})})})]}),_jsxs(Tab,{title:`harbor`,id:`harbor`,\"data-child-heading-ids\":`[\"train-harbor\",\"flags-3\",\"example-3\"]`,children:[_jsx(Heading,{level:`2`,id:`train-harbor`,children:`train harbor`}),_jsx(_components.p,{children:`Run sandboxed Harbor agent RL on terminal-bench or your own task dataset.`}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`rlcli`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` train`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` harbor`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`MODE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`L`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [OPTIONS]`})]}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`flags-3`,children:`Flags`}),_jsx(ParamField,{path:`--model`,type:`string`,required:true,id:`param-model-2`,children:_jsx(_components.p,{children:`HuggingFace model name or path.`})}),_jsx(ParamField,{path:`--base-url`,default:`http://localhost:8000`,type:`string`,id:`param-base-url-2`,children:_jsx(_components.p,{children:`Tinker API server URL.`})}),_jsx(ParamField,{path:`--loss`,default:`importance_sampling`,type:`choice`,id:`param-loss-1`,children:_jsx(_components.p,{children:`RL loss to use.`})}),_jsx(ParamField,{path:`--loss-config`,type:`JSON string`,id:`param-loss-config-1`,children:_jsx(_components.p,{children:`Raw JSON overrides for the loss function configuration.`})}),_jsx(ParamField,{path:`--backend`,type:`choice`,id:`param-backend-1`,children:_jsxs(_components.p,{children:[`Backend hint for the loss guard. Choices: `,_jsx(_components.code,{children:`jax`}),`, `,_jsx(_components.code,{children:`fsdp`}),`, `,_jsx(_components.code,{children:`megatron`}),`. Auto-detected for managed servers.`]})}),_jsx(ParamField,{path:`--dataset`,default:`[email protected]`,type:`string`,id:`param-dataset-2`,children:_jsxs(_components.p,{children:[`Task dataset. Defaults to `,_jsx(_components.code,{children:`[email protected]`}),` and auto-downloads via `,_jsx(_components.code,{children:`uvx harbor datasets download`}),` if missing.`]})}),_jsx(ParamField,{path:`--sandbox`,default:`docker`,type:`choice`,id:`param-sandbox`,children:_jsxs(_components.p,{children:[`Sandbox backend. Choices: `,_jsx(_components.code,{children:`docker`}),`, `,_jsx(_components.code,{children:`modal`}),`.`]})}),_jsx(ParamField,{path:`--task-filter`,type:`string`,id:`param-task-filter`,children:_jsx(_components.p,{children:`Filter tasks by name or pattern.`})}),_jsx(ParamField,{path:`--limit`,type:`int`,id:`param-limit`,children:_jsx(_components.p,{children:`Maximum number of tasks to use.`})}),_jsx(ParamField,{path:`--renderer`,type:`string`,id:`param-renderer-2`,children:_jsx(_components.p,{children:`Renderer to use. Defaults to the recommended renderer for the model.`})}),_jsx(ParamField,{path:`--group-size`,default:`4`,type:`int`,id:`param-group-size-1`,children:_jsx(_components.p,{children:`Group size for grouped RL.`})}),_jsx(ParamField,{path:`--groups-per-batch`,default:`4`,type:`int`,id:`param-groups-per-batch`,children:_jsx(_components.p,{children:`Number of groups per batch.`})}),_jsx(ParamField,{path:`--lr`,default:`1e-5`,type:`float`,id:`param-lr-2`,children:_jsx(_components.p,{children:`Learning rate.`})}),_jsx(ParamField,{path:`--max-tokens`,default:`4096`,type:`int`,id:`param-max-tokens-1`,children:_jsx(_components.p,{children:`Maximum tokens to generate per response.`})}),_jsx(ParamField,{path:`--max-turns`,default:`10`,type:`int`,id:`param-max-turns`,children:_jsx(_components.p,{children:`Maximum turns per agent episode.`})}),_jsx(ParamField,{path:`--lora-rank`,default:`32`,type:`int`,id:`param-lora-rank-2`,children:_jsx(_components.p,{children:`LoRA rank.`})}),_jsx(ParamField,{path:`--save-every`,default:`5`,type:`int`,id:`param-save-every-2`,children:_jsx(_components.p,{children:`Save a checkpoint every N steps.`})}),_jsx(ParamField,{path:`--eval-every`,default:`0`,type:`int`,id:`param-eval-every-1`,children:_jsxs(_components.p,{children:[`Run evaluation every N steps. `,_jsx(_components.code,{children:`0`}),` disables evaluation.`]})}),_jsx(ParamField,{path:`--max-steps`,type:`int`,id:`param-max-steps-1`,children:_jsx(_components.p,{children:`Maximum number of training steps.`})}),_jsx(ParamField,{path:`--sandbox-timeout`,default:`3600`,type:`int`,id:`param-sandbox-timeout`,children:_jsx(_components.p,{children:`Timeout for the sandbox environment in seconds.`})}),_jsx(ParamField,{path:`--command-timeout`,default:`120`,type:`int`,id:`param-command-timeout`,children:_jsx(_components.p,{children:`Timeout for individual commands inside the sandbox in seconds.`})}),_jsx(ParamField,{path:`--log-path`,type:`string`,id:`param-log-path-2`,children:_jsx(_components.p,{children:`Directory for training logs.`})}),_jsx(ParamField,{path:`--dry-run`,type:`flag`,id:`param-dry-run-2`,children:_jsx(_components.p,{children:`Print the training plan without executing.`})}),_jsx(Heading,{level:`3`,id:`example-3`,children:`Example`}),_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`rlcli`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` train`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` harbor`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Qwen/Qwen3-4B-Instruct-2507`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --dataset`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` [email protected]`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --sandbox`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` docker`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --max-steps`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 50`})]}),`\n`]})})})]}),_jsxs(Tab,{title:`opsd`,id:`opsd`,\"data-child-heading-ids\":`[\"train-opsd\",\"flags-4\",\"example-4\"]`,children:[_jsx(Heading,{level:`2`,id:`train-opsd`,children:`train opsd`}),_jsxs(_components.p,{children:[`On-policy self-distillation on a prompts JSONL. Each step the student samples `,_jsx(_components.code,{children:`--group-size`}),` completions per prompt, a teacher scores the student’s own tokens, and the negative reverse KL (student || teacher) becomes the per-token advantage for an `,_jsx(_components.code,{children:`importance_sampling`}),` update. There is no reward: the teacher is the only signal. Drives the pinned cookbook’s `,_jsx(_components.code,{children:`distillation.train_on_policy`}),` recipe.`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`rlcli`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` train`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` opsd`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --dataset`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`PAT`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`H`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`MODE`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`L`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [OPTIONS]`})]}),`\n`]})})}),_jsx(Heading,{level:`3`,id:`flags-4`,children:`Flags`}),_jsx(ParamField,{path:`--dataset`,type:`string`,required:true,id:`param-dataset-3`,children:_jsxs(_components.p,{children:[`Path to a JSONL file, or `,_jsx(_components.code,{children:`-`}),` to read from stdin. Each line is `,_jsx(_components.code,{children:`{\"prompt\": \"...\"}`}),` or `,_jsx(_components.code,{children:`{\"messages\": [...]}`}),`; for messages, the last user turn is the prompt and earlier system/user/assistant text turns are context (trailing assistant turns are dropped).`]})}),_jsx(ParamField,{path:`--model`,type:`string`,required:true,id:`param-model-3`,children:_jsx(_components.p,{children:`HuggingFace model name of the student.`})}),_jsx(ParamField,{path:`--base-url`,default:`http://localhost:8000`,type:`string`,id:`param-base-url-3`,children:_jsx(_components.p,{children:`Tinker API server URL.`})}),_jsx(ParamField,{path:`--teacher`,type:`string`,id:`param-teacher`,children:_jsxs(_components.p,{children:[`Teacher: a base model name, or a `,_jsx(_components.code,{children:`tinker://...`}),` checkpoint of `,_jsx(_components.code,{children:`--model`}),` on the same server. Defaults to `,_jsx(_components.code,{children:`--model`}),` itself (self-distillation).`]})}),_jsx(ParamField,{path:`--teacher-hint`,type:`string`,id:`param-teacher-hint`,children:_jsx(_components.p,{children:`Privileged text the teacher sees prepended to every prompt (hint, blank line, prompt). The student never sees it, so with the default teacher this is “same weights + hint” self-distillation.`})}),_jsx(ParamField,{path:`--kl-coef`,default:`1.0`,type:`float`,id:`param-kl-coef`,children:_jsx(_components.p,{children:`Weight of the negative reverse KL in the per-token advantages.`})}),_jsx(ParamField,{path:`--kl-discount`,default:`0.0`,type:`float`,id:`param-kl-discount`,children:_jsxs(_components.p,{children:[`Discount for summing future per-token KL into each advantage. `,_jsx(_components.code,{children:`0`}),` keeps it per-token.`]})}),_jsx(ParamField,{path:`--steps`,type:`int`,id:`param-steps`,children:_jsx(_components.p,{children:`Stop after N steps. Defaults to one pass over the dataset.`})}),_jsx(ParamField,{path:`--renderer`,type:`string`,id:`param-renderer-3`,children:_jsx(_components.p,{children:`Renderer to use. Defaults to the recommended renderer for the model.`})}),_jsx(ParamField,{path:`--batch-size`,default:`32`,type:`int`,id:`param-batch-size-2`,children:_jsx(_components.p,{children:`Prompts per step.`})}),_jsx(ParamField,{path:`--group-size`,default:`4`,type:`int`,id:`param-group-size-2`,children:_jsx(_components.p,{children:`Samples per prompt.`})}),_jsx(ParamField,{path:`--lr`,default:`1e-4`,type:`float`,id:`param-lr-3`,children:_jsxs(_components.p,{children:[`Learning rate. `,_jsx(_components.code,{children:`--learning-rate`}),` is an alias.`]})}),_jsx(ParamField,{path:`--max-tokens`,default:`1024`,type:`int`,id:`param-max-tokens-2`,children:_jsx(_components.p,{children:`Maximum tokens to generate per response.`})}),_jsx(ParamField,{path:`--lora-rank`,default:`32`,type:`int`,id:`param-lora-rank-3`,children:_jsx(_components.p,{children:`LoRA rank.`})}),_jsx(ParamField,{path:`--save-every`,default:`20`,type:`int`,id:`param-save-every-3`,children:_jsx(_components.p,{children:`Save a checkpoint every N steps.`})}),_jsx(ParamField,{path:`--log-path`,default:`~/.rlcli/runs/opsd-\u003ctimestamp>`,type:`string`,id:`param-log-path-3`,children:_jsx(_components.p,{children:`Directory for training logs.`})}),_jsx(ParamField,{path:`--dry-run`,type:`flag`,id:`param-dry-run-3`,children:_jsx(_components.p,{children:`Load the prompts and print the resolved config without contacting the server.`})}),_jsx(Heading,{level:`3`,id:`example-4`,children:`Example`}),_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`rlcli`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` train`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` opsd`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --model`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` Qwen/Qwen3-4B-Instruct-2507`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --dataset`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` prompts.jsonl`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --teacher-hint`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Think step by step and double-check your arithmetic.\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --batch-size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 16`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --group-size`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 4`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --steps`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 50`})]}),`\n`]})})}),_jsx(Note,{children:_jsxs(_components.p,{children:[`The teacher scores the student’s tokens as rendered with the student’s chat template; a `,_jsx(_components.code,{children:`--teacher`}),` with a different template is scored under the student’s rendering (the cookbook’s assumption too). With `,_jsx(_components.code,{children:`--teacher-hint`}),`, rlcli builds the hinted prompt with the same renderer and wraps the teacher client so its logprob calls see hint + prompt while the student’s sequence is unchanged.`]})})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`common-notes`,children:`Common notes`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`TINKER_API_KEY`}),` is set to `,_jsx(_components.code,{children:`tml-dummy`}),` automatically if unset.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`TINKER_BASE_URL`}),` is forwarded automatically.`]}),`\n`,_jsx(_components.li,{children:`The loss guard runs before training begins and fails fast with a clear message if the selected loss is unsupported by the backend.`}),`\n`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`gspo`}),` has a known upstream packing-order bug on multi-GPU and Megatron setups (NovaSky-AI/SkyRL#2043). Single-GPU FSDP is verified clean. rlcli prints a warning to stderr when `,_jsx(_components.code,{children:`--loss gspo`}),` is used.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training","sidebarTitle":"train","description":"Use rlcli train sl, rl, harbor, and opsd to run supervised fine-tuning, RL on GSM8K, sandboxed Harbor agent RL, and on-policy self-distillation on local GPUs.","href":"/cli/train"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"train sl","slug":"train-sl","depth":2,"children":[{"title":"Flags","slug":"flags","depth":3,"children":[],"tabId":"sl"},{"title":"Example","slug":"example","depth":3,"children":[],"tabId":"sl"}],"tabId":"sl"},{"title":"train rl","slug":"train-rl","depth":2,"children":[{"title":"Flags","slug":"flags-2","depth":3,"children":[],"tabId":"rl"},{"title":"Example","slug":"example-2","depth":3,"children":[],"tabId":"rl"}],"tabId":"rl"},{"title":"train harbor","slug":"train-harbor","depth":2,"children":[{"title":"Flags","slug":"flags-3","depth":3,"children":[],"tabId":"harbor"},{"title":"Example","slug":"example-3","depth":3,"children":[],"tabId":"harbor"}],"tabId":"harbor"},{"title":"train opsd","slug":"train-opsd","depth":2,"children":[{"title":"Flags","slug":"flags-4","depth":3,"children":[],"tabId":"opsd"},{"title":"Example","slug":"example-4","depth":3,"children":[],"tabId":"opsd"}],"tabId":"opsd"},{"title":"Common notes","slug":"common-notes","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"polygramme","siteName":"rlcli","title":"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training - rlcli","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-03T00:02:16.671Z","originalFileLocation":"cli/train.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Use rlcli train sl, rl, harbor, and opsd to run supervised fine-tuning, RL on GSM8K, sandboxed Harbor agent RL, and on-policy self-distillation on local GPUs.\">\u003cmeta data-mint-head name=\"application-name\" content=\"rlcli\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/polygramme/NFKxZG2kfEcSFxDP/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/polygramme/NFKxZG2kfEcSFxDP/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/polygramme/NFKxZG2kfEcSFxDP/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/polygramme/NFKxZG2kfEcSFxDP/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/polygramme/NFKxZG2kfEcSFxDP/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/polygramme/NFKxZG2kfEcSFxDP/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/polygramme/NFKxZG2kfEcSFxDP/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/polygramme/NFKxZG2kfEcSFxDP/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/polygramme/NFKxZG2kfEcSFxDP/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training - rlcli\">\u003cmeta data-mint-head property=\"og:description\" content=\"Use rlcli train sl, rl, harbor, and opsd to run supervised fine-tuning, RL on GSM8K, sandboxed Harbor agent RL, and on-policy self-distillation on local GPUs.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"rlcli\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.polygramme.com/cli/train\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://polygramme.mintlify.site/_mintlify/api/og/v2?division=Commands\u0026amp;title=rlcli+train%3A+one-shot+SL%2C+RL%2C+Harbor+agent%2C+and+self-distillation+training\u0026amp;description=Use+rlcli+train+sl%2C+rl%2C+harbor%2C+and+opsd+to+run+supervised+fine-tuning%2C+RL+on+GSM8K%2C+sandboxed+Harbor+agent+RL%2C+and+on-policy+self-distillation+on+local+GPUs.\u0026amp;theme=d0407e035e3046081c859cc8\u0026amp;signature=7877da8ecd15ac1e67f8d009318b03e0d21f424ecc0150c6761be08cf1a8feaa\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training - rlcli\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Use rlcli train sl, rl, harbor, and opsd to run supervised fine-tuning, RL on GSM8K, sandboxed Harbor agent RL, and on-policy self-distillation on local GPUs.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://polygramme.mintlify.site/_mintlify/api/og/v2?division=Commands\u0026amp;title=rlcli+train%3A+one-shot+SL%2C+RL%2C+Harbor+agent%2C+and+self-distillation+training\u0026amp;description=Use+rlcli+train+sl%2C+rl%2C+harbor%2C+and+opsd+to+run+supervised+fine-tuning%2C+RL+on+GSM8K%2C+sandboxed+Harbor+agent+RL%2C+and+on-policy+self-distillation+on+local+GPUs.\u0026amp;theme=d0407e035e3046081c859cc8\u0026amp;signature=7877da8ecd15ac1e67f8d009318b03e0d21f424ecc0150c6761be08cf1a8feaa\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/polygramme/NFKxZG2kfEcSFxDP/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"rlcli\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2E7D5B\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.polygramme.com/cli/train\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/cli/train.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.polygramme.com/#organization\",\"name\":\"rlcli\",\"url\":\"https://docs.polygramme.com\"},{\"@type\":\"WebSite\",\"@id\":\"https://docs.polygramme.com#website\",\"name\":\"rlcli\",\"url\":\"https://docs.polygramme.com\",\"publisher\":{\"@id\":\"https://docs.polygramme.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.polygramme.com/cli/train#webpage\",\"url\":\"https://docs.polygramme.com/cli/train\",\"name\":\"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training\",\"description\":\"Use rlcli train sl, rl, harbor, and opsd to run supervised fine-tuning, RL on GSM8K, sandboxed Harbor agent RL, and on-policy self-distillation on local GPUs.\",\"dateModified\":\"2026-09-03T00:02:16.671Z\",\"isPartOf\":{\"@id\":\"https://docs.polygramme.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.polygramme.com/cli/train#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.polygramme.com/cli/train#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Commands\",\"item\":\"https://docs.polygramme.com/cli/serve\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training\",\"item\":\"https://docs.polygramme.com/cli/train\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.polygramme.com/cli/train#article\",\"headline\":\"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training\",\"name\":\"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training\",\"description\":\"Use rlcli train sl, rl, harbor, and opsd to run supervised fine-tuning, RL on GSM8K, sandboxed Harbor agent RL, and on-policy self-distillation on local GPUs.\",\"url\":\"https://docs.polygramme.com/cli/train\",\"mainEntityOfPage\":{\"@id\":\"https://docs.polygramme.com/cli/train#webpage\"},\"dateModified\":\"2026-09-03T00:02:16.671Z\",\"publisher\":{\"@id\":\"https://docs.polygramme.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.polygramme.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"rlcli\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"rlcli\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/cli/train.md","siteName":"rlcli","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":""}]},{"tab":"CLI Reference","groups":[{"group":"Overview","pages":[{"title":"rlcli CLI reference and command summary","sidebarTitle":"Overview","href":"/cli/overview"}]},{"group":"Commands","pages":[{"title":"rlcli serve: manage local SkyRL Tinker server","sidebarTitle":"serve","description":"Start, stop, check, and tail logs for the local SkyRL Tinker server that powers rlcli training and sampling.","href":"/cli/serve"},{"title":"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training","sidebarTitle":"train","href":"/cli/train"},{"title":"rlcli import: normalize chat dumps to messages JSONL","sidebarTitle":"import","description":"Convert OpenAI, Anthropic, and messages JSONL chat dumps into a standardized messages JSONL format for rlcli training.","href":"/cli/import"},{"title":"rlcli sample: quick generation against a server","sidebarTitle":"sample","href":"/cli/sample"},{"title":"rlcli checkpoint, run, session: Tinker CLI passthrough","sidebarTitle":"Tinker Passthrough","href":"/cli/passthrough"}]}]}]},"basePath":"","title":"rlcli train: one-shot SL, RL, Harbor agent, and self-distillation training - rlcli","deploymentId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","buildId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","dynamics":[],"chunks":[]}