AgentSkillsCN

toml-config

如何在 prime-rl 中编写并使用 TOML 配置文件。适用于创建配置文件、通过配置文件运行命令,或通过 CLI 覆盖配置值时使用。

SKILL.md
--- frontmatter
name: toml-config
description: How to write and use TOML configs in prime-rl. Use when creating config files, running commands with configs, or overriding config values via CLI.

TOML Config

All prime-rl commands use pydantic-settings with TOML configs and CLI overrides.

Running with configs

bash
# Load a config file with @ syntax
uv run inference @ configs/debug/infer.toml
uv run sft @ configs/debug/sft/train.toml
uv run rl @ configs/debug/rl/train.toml

# CLI overrides (take precedence over TOML)
uv run inference @ config.toml --model.name Qwen/Qwen3-0.6B --server.port 8001

# Boolean flags: no value needed
uv run inference --model.enforce_eager          # sets to true
uv run inference --no-model.enforce_eager       # sets to false

# CLI-only (no TOML file)
uv run inference --model.name Qwen/Qwen3-0.6B --model.max_model_len 2048

TOML structure

Top-level fields must come before any [section] header — this is a TOML rule.

toml
# Top-level fields first
gpu_memory_utilization = 0.5
seed = 42

# Then sections
[model]
name = "Qwen/Qwen3-0.6B"
max_model_len = 4096

[server]
port = 8000

Putting a top-level field after a section header nests it inside that section, which causes validation errors.

Config inheritance

Configs can inherit from other TOML files:

toml
toml_files = ["base.toml"]

[model]
name = "Qwen/Qwen3-0.6B"  # overrides base

Paths in toml_files are relative to the file containing the field.

Setting None

Use the string "None" in TOML to set a field to None:

toml
max_model_len = "None"

Available commands

All accept @ config.toml and CLI overrides:

CommandConfig classDescription
uv run rlfull RL pipelineOrchestrator + inference + trainer
uv run inferenceInferenceConfigvLLM inference server
uv run trainertrainer configRL trainer
uv run orchestratororchestrator configRollout orchestrator
uv run env-serverenv server configEnvironment server
uv run sftSFT configSupervised fine-tuning

Key files

  • src/prime_rl/utils/pydantic_config.pyparse_argv, BaseSettings, @ syntax parsing
  • configs/ — all config files, organized by task