Atropos is a Language Model Reinforcement Learning Environments framework for collecting and evaluating LLM trajectories through diverse environments
Atropos is a Language Model Reinforcement Learning Environments framework for collecting and evaluating LLM trajectories through diverse environments
⚠️ This repository has been archived and is no longer maintained.
No further updates, bug fixes, or security patches will be made.
Atropos is an environment microservice framework for async RL with LLMs.
Atropos encompasses both environments, which are set up as services, and a trajectory API for the environments to send data to and for the trainer to pull batches from.
Atropos is a robust, scalable framework for Reinforcement Learning Environments with LLMs.
The goal: provide a flexible, scalable, and standardized platform to accelerate LLM-based RL research across diverse, interactive settings.
The framework supports collecting, distributing and evaluating LLM trajectories through diverse environments including:
We have been able to achieve significant improvements on specific domains or tasks with Atropos - Below are some of the results.
Tool Calling Environment Results:
Model Artifact: https://huggingface.co/NousResearch/DeepHermes-ToolCalling-Specialist-Atropos
Environment Used: https://github.com/NousResearch/atropos/blob/main/environments/tool_calling_server.py
Financial Fundamentals Prediction Environment Results:
Model Artifact: https://huggingface.co/NousResearch/DeepHermes-Financial-Fundamentals-Prediction-Specialist-Atropos
Environment Used: https://github.com/NousResearch/atropos/blob/main/environments/fundamental_prediction_environment.py
Using the RLAIF Environment to change the personality of the model, we have produced several artifacts of interesting and weird personalities.
DeepHermes Egregore v1 and v2 8B:
https://huggingface.co/NousResearch/DeepHermes-Egregore-v1-RLAIF-8b-Atropos https://huggingface.co/NousResearch/DeepHermes-Egregore-v2-RLAIF-8b-Atropos
DeepHermes Ascension Maze 8B:
https://huggingface.co/NousResearch/DeepHermes-AscensionMaze-RLAIF-8b-Atropos
Environment Used: https://github.com/NousResearch/atropos/blob/main/environments/rlaif_server.py
| Category | Description |
|---|---|
atroposlib/ |
Core library containing base classes and utilities |
environments/ |
Collection of ready-to-use RL environments. Community contributions are typically placed in the environments/community/ subdirectory. |
example_trainer/ |
Example training scripts and configurations |
Key Documents:
Before installing Atropos, ensure you have the following:
python --versionOPENAI_API_KEY environment variable)use_wandb=False in your environment config to skipNote: You do not need a GPU to develop or test environments locally. A GPU is only required for running inference servers locally or for training.
Get your Python 3.10 (or later) environment ready, then simply pip install:
pip install atroposlibIf you're looking to get into developing the repo or using the environments:
pip install -e . # for using
pip install -e .[dev] # for development
pip install -e .[examples] # for running examples
pip install -e .[verifiers] # for verifiers integration
pip install -e .[all] # for everythingImportant: If you're committing to the repository, please install the pre-commit hooks:
pre-commit installCreate Your First Environment
environments/ directory for examplesRun an Example Environment
You should edit the config_init section of the environment file you want (For example, in GSM8K Environment) to point to a running VLLM or SGLang inference server as well as any other configuration changes you'd like to make, such as the group size, then:
Note: By default, Atropos uses the OpenAI-compatible API endpoint which works with any provider. For enhanced features, use
VLLMServer(atroposlib/envs/server_handling/vllm_server.py) orSGLangServer(atroposlib/envs/server_handling/sglang_server.py) for direct access to native APIs with full token and logprob tracking.
# Start the API server
run-apiIn a separate terminal, start the GSM8K environment microservice
python environments/gsm8k_server.py serve --openai.model_name Qwen/Qwen2.5-1.5B-Instruct --slurm false
# alternatively
# python environments/gsm8k_server.py serve --config environments/configs/example.yaml
# python environments/gsm8k_server.py serve --config environments/configs/example.yaml --env.group_size 8 # cli args override corresponding config settingsIf you want to just start getting rollouts, and not use a trainer, see the debug section for help getting started with the available tools, we recommend starting with process or view-run
You can use multiple environments at once, just point them all to the same server.
Environments come with detailed logging and reporting support, runs track completion lengths, eval accuracies, full rollouts and scores, and more:
Axolotl is a powerful tool for fine-tuning a wide range of AI models, supporting techniques like LoRA and QLoRA through simple YAML configurations.
The Atropos plugin for Axolotl seamlessly integrates Atropos' RL environments into Axolotl's training pipelines. This allows you to leverage Atropos for reinforcement learning while utilizing Axolotl's extensive features for model fine-tuning.
To use, follow the README on the plugin repository.
The Tinker API is a simple and flexible LoRA trainer framework for researchers and developers to quickly build out their ideas without worrying about the complexities of distributed training. Users write a simple loop that runs on their CPU, and Tinker manages the backend computation on their GPUs, while still providing full control over the training and algorithmic details.
The Tinker-Atropos integration layer enables all Atropos environments to leverage the power of Tinker for their RL experiments. This allows users with little or no compute to develop and build Atropos environments with minimal worry about the underlying compute behavior, as well as providing an easy environment integration point for Tinker users.
To get started, check out the README at the project repository.
Atropos repo contains an example trainer that should primarily be used as a reference example to show how a trainer and inference provider can be integrated with Atropos to complete the RL Training Loop.
To use the example trainer, see this page: training example guide
Atropos now supports OPD at the transport layer by carrying distillation arrays
through ScoredDataGroup and the API queue/batch endpoints.
BaseEnv.Each scored group may include:
distill_token_ids: shape [sequence][position][top_k]distill_logprobs: shape [sequence][position][top_k]These fields are optional, and when present are forwarded from:
/scored_data or /scored_data_list/batch -> trainerscores["distill_token_ids"] = distill_token_ids
scores["distill_logprobs"] = distill_logprobscurl -s http://localhost:8002/latest_example | jq '{has_ids:(.distill_token_ids!=null), has_lps:(.distill_logprobs!=null)}'The follow-up teacher environment uses a dedicated teacher server config and attaches teacher prompt logprobs before the group is sent to the API.
Teacher config shape:
TeacherDistillationConfig(
teacher_enabled=True,
teacher_top_k=8,
)Teacher server configs are passed separately at init, just like the primary
server_configs:
env = MyTeacherEnv(
config=env_config,
server_configs=student_server_configs,
teacher_server_configs=[
APIServerConfig(
base_url="http://localhost:9003/v1",
model_name="Qwen/Qwen3-30B-A3B-Instruct-2507",
api_key="",
server_type="vllm",
tokenizer_name="Qwen/Qwen3-30B-A3B-Instruct-2507",
)
],
)You can either:
TeacherDistillationEnv into an existing
BaseEnv-derived env such as GSM8kEnv, orTeacherDistillationEnv directly and implement the usual environment
methods yourself.In both cases, TeacherDistillationEnv still assumes the normal BaseEnv
runtime contract: tokenized rollouts, ScoredDataGroup pay
No open issues yet, or sync has not completed.