The Problem Nobody Talks About
Almost all of us have seen a Google Assistant demo — it schedules appointments, makes calls, books things. But when you say "book a flight, also a hotel, and buy some products" — it falls apart. There are several reasons. One of the biggest: the APIs agents depend on change, silently, mid-operation. No warning. No changelog. The agent has no idea.
This is what AdaptiveWorldEnv is about.
The Solution: A Picture of the World
The solution I came up with is from a real-world reference — the way all of us work. When we do something wrong we figure out how we could have done it better. When playing a game, we don't know what the next level will bring. We go in, take actions, win or lose, and then figure out what it actually needed. We build a picture of the world in our head as we go.
So that is exactly what I gave the agent — a picture of the world. And to measure how accurate that picture is, I introduced a metric other than just REWARD:
task_reward tells us if the agent completed the task. belief_accuracy tells us if the agent actually understood what was happening. Those two things are not always the same — an agent can get lucky and complete a task with a completely wrong understanding of the world, and you'd never know from reward alone.
How It Actually Works
The environment gives the agent a task — place an order, book a flight, file a claim. The agent starts calling APIs, getting responses. Simple enough. But at some point mid-episode, without telling the agent, the world mutates.
The agent has to figure it out — not because somebody told it something changed, but because it starts seeing things that don't match what it knew before. So it calls query_history, compares responses, calls probe_schema to check what the API actually expects today, updates its picture of the world, and retries.
Two Types of Agents
Suppose the agent is doing an e-commerce order. Step 1 and 2 go fine. Step 3 — the world drifts. qty becomes quantity, a new required field customer_id appears. Agent gets a 422.
Agent A just retries slightly differently and somehow gets through. Task reward goes up. But belief accuracy is low — it never figured out what changed.
Agent B calls query_history, compares step 2 response to step 4 response, calls probe_schema, finds the new field names, updates its belief, retries correctly. Task reward goes up. Belief accuracy also goes up. That's the agent we're training.
Adaptive Difficulty
The environment doesn't stay at one difficulty. When the agent gets good at handling a single drift — say a field rename — the environment automatically starts combining drift types in the same episode. Field rename plus a policy change at the same time. Then it starts hiding error signals more. Then it forces silent semantic drift where there's no 4xx anywhere. Difficulty escalates based on how well the agent is actually understanding the world, not just completing tasks.
The Training Pipeline: SFT → GRPO → DPO
The training pipeline has three stages and understanding all of them is important because most people just throw a model into RL and wonder why it's not learning.
Stage 1: SFT (30 steps, lr=5e-5)
I downloaded a dataset of correct behavior examples — broken API call, agent calling probe_schema, comparing history, corrected call with right field name, declared belief state. Basically showing the model what good looks like before asking it to figure out good on its own. Think of it like watching someone else play the game before you pick up the controller.
Stage 2: GRPO (200 steps, lr=2e-6)
Once the model had that baseline I switched to GRPO — group relative policy optimization. The model starts generating its own actions, those actions get sent to the environment, and the reward function scores on both task_reward and belief_accuracy.
Combating Reward Hacking
The model could just always output probe_schema because that always returns a small positive reward (0.05) without doing anything meaningful. Or it could guess the endpoint correctly and get high task reward with a completely wrong belief state.
So: the combined reward weights belief accuracy at 0.3 — you can't fully hack one without the other. Plus the reward function has a local scorer checking actual content — did the field_name in the belief state match the ground truth, did the model actually declare drift_detected: true. And max_grad_norm=0.2 is tight — prevents collapse into one repetitive strategy.
Stage 3: DPO (~50 steps)
During GRPO, every generation saves the prompt, completion, and reward. Those rollouts become preference pairs for DPO — high-reward completions as chosen, low-reward as rejected. About 50 steps of DPO on top of GRPO, then pushed the final model to HuggingFace.
The Results: Honest Numbers
The most important chart is the correlation. Early training still looks messy if we only watch raw step-by-step samples — four GRPO completions per step means some draws look lucky even when belief is wrong. On smoothed rolling windows, an early segment already sits around r≈0.957, and late training pushes to about r≈0.977 in this run. The agent is succeeding because it understood what changed, not despite misunderstanding it. That shift is the whole point of this environment.
Most environments just show task reward going up and call it done. Here we can see that task reward going up means nothing if belief accuracy is not following. The model needs to earn both. r≈0.977 is not the ceiling — it is the headline measured correlation from this submission run.
Post Hackathon — Honest Assessment
I tried to go beyond traditional RL and ran into several failures during the hackathon window. I retrained many times, burned through most compute credits, and went through a lot of iteration before landing on a training script that held together.
My honest estimate: we are probably looking at needing 1000+ GRPO steps, and only after that would DPO on top start producing really significant improvement. The environment is hard, the reward signal is sparse in early steps, and the model needs a lot more exploration before it can start exploiting what it has learned.