Training Gym
"# Training Gym\n\nModal Training Gym is an open-source Python SDK for RL post-training on [Modal](https://modal.com).\n\nThe library takes care of infrastructure concerns such as cluster topology, Ray/NCCL bring-up, volume mounts, checkpointing, and serving for eval and rollouts, so you (or your agent!) can focus on training models.\n\nTo get started, you can go through the [Quickstart](#quickstart) section below, or paste the prompt below into your favorite agent:\n\n```txt\nInstall the `training-gym` library. Then, install the skill bundle into the local project with `training-gym skills install`. Finally, tell the user that they can ask you to do something like: \"Given a budget of 1 B300, train Qwen3.8 27B to correctly solve problems taken from agentica-org/DeepCoder-Preview-Dataset with xhigh reasoning and a length penalty to limit the number of reasoning tokens.\"\n```\n\n## Quickstart\n\nRequirements:\n\n- Python 3.12\n\nInstall the package directly:\n\n```bash\nuv pip install -q git+https://github.com/modal-projects/training-gym.git@main\n```\n\nOr pin it in `pyproject.toml`:\n\n```toml\ntraining-gym = { git = \"https://github.com/modal-projects/training-gym.git\", branch = \"main\" }\n```\n\nAuthenticate with Modal:\n\n```bash\nmodal setup\n```\n\nSet up the [dashboard](https://gym.modal.dev/guides/dashboard):\n\n```bash\ntraining-gym setup\n```\n\n<div class=\"tg-dashboard-previews\">\n <span>\n <img src=\"/homepage.gif\" alt=\"Training runs list in the Training Gym dashboard\" width=\"100%\" />\n </span>\n <span>\n <img src=\"/longrun.gif\" alt=\"Long-running training run details in the Training Gym dashboard\" width=\"100%\" />\n </span>\n</div>\n\nAnd empower your agents with the Gym's skill bundle:\n\n```bash\ntraining-gym skills install\n```\n\nThen, it's as easy as:\n\n```python\nfrom modal_training_gym import (\n HuggingFaceDataset,\n Qwen3_4B,\n Qwen3_4B_Recipe,\n TrainConfig,\n)\n\nconfig = TrainConfig(\n model=Qwen3_4B(),\n dataset=HuggingFaceDataset(\n hf_repo=\"zhuzilin/dapo-math-17k\",\n hf_split=\"train[:120]\",\n input_column=\"prompt\",\n output_column=\"label\",\n input_format=\"messages\",\n ),\n recipe=Qwen3_4B_Recipe(\n gpu_type=\"H100\",\n actor_num_nodes=1,\n actor_num_gpus_per_node=8,\n tensor_model_parallel_size=1,\n sequence_parallel=False,\n rollout_num_gpus=8,\n rollout_num_gpus_per_engine=1,\n colocate=True,\n num_rollout=1,\n n_samples_per_prompt=4,\n rollout_batch_size=8,\n rollout_max_response_len=2048,\n max_tokens_per_gpu=4096,\n sglang_mem_fraction_static=0.6,\n rm_type=\"deepscaler\",\n ),\n)\nrun = config.launch()\nprint(run.training_run_id)\n```\n\n## Supported models\n\n<!-- BEGIN MODELS LIST -->\n<!-- Auto-generated by scripts/generate_models_table.py from the recipe registries in modal_training_gym/train_recipes/*/__init__.py. -->\n\n| Family | Models |\n|---|---|\n| GLM | <ul><li>[GLM-4.7](https://huggingface.co/zai-org/GLM-4.7)</li></ul> |\n| Gemma | <ul><li>[gemma-4-26B-A4B-it](https://huggingface.co/google/gemma-4-26B-A4B-it)</li></ul> |\n| Inkling | <ul><li>[Inkling-Small](https://huggingface.co/thinkingmachines/Inkling-Small)</li></ul> |\n| Moonlight | <ul><li>[Moonlight-16B-A3B-Instruct](https://huggingface.co/moonshotai/Moonlight-16B-A3B-Instruct)</li></ul> |\n| Qwen3 | <ul><li>[Qwen3-0.6B](https://huggingface.co/Qwen/Qwen3-0.6B)</li><li>[Qwen3-1.7B](https://huggingface.co/Qwen/Qwen3-1.7B)</li><li>[Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B)</li><li>[Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B)</li><li>[Qwen3-ASR-1.7B](https://huggingface.co/Qwen/Qwen3-ASR-1.7B)</li><li>[Qwen3-VL-8B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct)</li></ul> |\n| Qwen3.5 | <ul><li>[Qwen3.5-0.8B](https://huggingface.co/Qwen/Qwen3.5-0.8B)</li><li>[Qwen3.5-2B](https://huggingface.co/Qwen/Qwen3.5-2B)</li><li>[Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B)</li><li>[Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B)</li></ul> |\n| Qwen3.6 | <ul><li>[Qwen3.6-27B](https://huggingface.co/Qwen/Qwen3.6-27B)</li><li>[Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B)</li></ul> |\n| Qwen3.8 | <ul><li>[Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B)</li></ul> |\n<!-- END MODELS LIST -->\n\n## Multi-node access\n\n:::caution[Important]\nSingle-node training is open to everyone. Multi-node clusters are still in Beta and are required for larger models. [Contact us on Slack](https://modal.com/slack) for access.\n:::\n"
Modal Training Gym is an open-source Python SDK for RL post-training on Modal.
The library takes care of infrastructure concerns such as cluster topology, Ray/NCCL bring-up, volume mounts, checkpointing, and serving for eval and rollouts, so you (or your agent!) can focus on training models.
To get started, you can go through the Quickstart section below, or paste the prompt below into your favorite agent:
Install the `training-gym` library. Then, install the skill bundle into the local project with `training-gym skills install`. Finally, tell the user that they can ask you to do something like: "Given a budget of 1 B300, train Qwen3.8 27B to correctly solve problems taken from agentica-org/DeepCoder-Preview-Dataset with xhigh reasoning and a length penalty to limit the number of reasoning tokens."Quickstart
Section titled “Quickstart”Requirements:
- Python 3.12
Install the package directly:
uv pip install -q git+https://github.com/modal-projects/training-gym.git@mainOr pin it in pyproject.toml:
training-gym = { git = "https://github.com/modal-projects/training-gym.git", branch = "main" }Authenticate with Modal:
modal setupSet up the dashboard:
training-gym setup
And empower your agents with the Gym’s skill bundle:
training-gym skills installThen, it’s as easy as:
from modal_training_gym import ( HuggingFaceDataset, Qwen3_4B, Qwen3_4B_Recipe, TrainConfig,)
config = TrainConfig( model=Qwen3_4B(), dataset=HuggingFaceDataset( hf_repo="zhuzilin/dapo-math-17k", hf_split="train[:120]", input_column="prompt", output_column="label", input_format="messages", ), recipe=Qwen3_4B_Recipe( gpu_type="H100", actor_num_nodes=1, actor_num_gpus_per_node=8, tensor_model_parallel_size=1, sequence_parallel=False, rollout_num_gpus=8, rollout_num_gpus_per_engine=1, colocate=True, num_rollout=1, n_samples_per_prompt=4, rollout_batch_size=8, rollout_max_response_len=2048, max_tokens_per_gpu=4096, sglang_mem_fraction_static=0.6, rm_type="deepscaler", ),)run = config.launch()print(run.training_run_id)Supported models
Section titled “Supported models”| Family | Models |
|---|---|
| GLM | |
| Gemma | |
| Inkling | |
| Moonlight | |
| Qwen3 | |
| Qwen3.5 | |
| Qwen3.6 | |
| Qwen3.8 |