Show HN: I RL-trained an agent that trains models with RL (for –$1.3k)
🤖 AI Training AI: A Meta-RL Experiment
Project Repository: Danau5tin/ai-trains-ai — RL-training an AI agent to RL-train AI agents.
This project explores a recursive approach to machine learning: using Reinforcement Learning (RL) to optimize an agent whose sole purpose is to design RL training pipelines for other models.
Open Source Status: Everything is available, including the trained agent's weights (via a LoRA adapter on Hugging Face), the agent harness, reward logic, task families, GPU orchestration scripts, and detailed write-ups of every pilot—
even the ones that failedincluding the failures.
🎯 TL;DR
I developed a pipeline where a "Trainer Agent" is given a goal (e.g., "Teach a model to do X"). The agent then generates a full prime-rl training configuration, encompassing the environment, the reward rubric, the dataset, and hyperparameters.
By utilizing Tinker, I RL-trained the Trainer Agent itself, providing rewards based on the performance of the models it produced. Over 54 training steps, the reward climbed from to a peak of .
The essence: An AI operating within an RL loop, where its primary action is to initiate another RL loop to train a different AI.
🔁 How it Works
The architecture consists of two distinct RL loops running on separate training stacks.
The Dual-Loop Architecture
| Feature | Outer Loop (The Trainer) | Inner Loop (The Trainee) |
|---|---|---|
| Target | Trainer Agent (Qwen3.6-35B-A3B, LoRA) | Small Base Model (Qwen3-0.6B / 1.7B) |
| Action | Writing training jobs (configs/rubrics) | Executing the job written by the agent |
| Stack | Tinker + tinker-cookbook (Importance-sampling GRPO) | prime-rl (GRPO) on Runpod GPUs |
| Reward | The trainee's hidden-eval score | Verifier environment + rubric |
Anatomy of an Episode
One episode represents a single attempt by the Trainer Agent to create a high-quality training job:
- Task Specification: The agent receives a description (e.g., "teach a small model to resolve multi-hop persona queries"), hard constraints, the eval tool API, and a few development examples.
- Agent Iteration: The agent interacts with a sandboxed environment using tools like
read_file,write_file,edit_file, andlist_files. It can also callget_baseline_scoresto evaluate the current untrained base models. - Dispatch: Once validated, the job is sent to a pool of warm Runpod GPU pods. These pods execute GRPO training via
prime-rland measure the checkpoint's performance before and after training. - Reward Calculation: The system calculates a reward based on how efficiently the job was validated and the resulting performance uplift.
Note: Each outer-loop batch triggers 40 inner training jobs across up to 16 GPU pods.
⚖️ Reward Design
The episode reward is a weighted sum of three components:
-
Validation (0.35):
- for a first-try valid submission.
- Decays with each additional attempt.
- if it never validates.
- Penalty: The outer loop applies a score if no parseable submission is made. (Note: in CSVs is a logging sentinel for "no post score," not a reward).
-
Job Quality (0.60): A hybrid metric focusing on the absolute score and the improvement over the best untrained baseline ():
- If the GPU job crashes, this scores .
-
Train Speed (0.05): A minor tie-breaker to encourage efficiency, provided the job succeeded.
Nuance Alert: The agent's internal prompt (
template/INSTRUCTIONS.md) uses a simplified version of this logic (a 75/25 uplift/absolute split and a nudge for fewer attempts) rather than the full breakdown. The published adapter was trained against this simplified prompt.
🧩 Task Families
The agent was tested on six task families requiring multi-step reasoning and tool use. These were specifically chosen because base models struggle with them.
| Family | Description | Untrained () |
|---|---|---|
calc_chain | Chained arithmetic (output of step is input for ) | |
multi_hop | Persona-world queries requiring dependent lookups | |
string_pipeline | Composed string transformations | |
ledger | Stateful account bookkeeping using tools | |
dispatch | Conditional routing decisions | |
triage | (Held Out) Incident triage across services/deploys |
The agent was trained on the first five families; triage was used exclusively for testing generalization.
📈 Results & Infrastructure
Key Findings:
- Reward Growth: The reward climbed in two distinct "rungs," eventually peaking at .
- Generalization: The skills learned transferred successfully to the held-out
triagefamily. - Model Selection: The agent learned to intelligently select the superior base model for the task.
Technical Setup:
- Infrastructure: Runpod GPUs.
- Training Frameworks:
Tinker(Outer) andprime-rl(Inner). - Cost: Approximately -\1.3\text{k}$.
Example Configuration Snippet:
[prime_rl]
model = "qwen3-0.6b"
learning_rate = 1e-6
batch_size = 64
# Agent-generated reward rubric follows...
🚀 Getting Started & Future
The project is fully open-sourced. Future improvements will focus on scaling the task diversity and refining the agent's ability to debug its own training jobs in real-time.