Overview: Long Horizon training
We slow down on long-horizon training: what it means to train a model for the whole arc of a task instead of the next shiny step. We use the repo-fix mental model, then walk through rewards, credit assignment, curricula, decomposition, and why this is still very much live in agent work.
Transcript
Justy Long-horizon training is one of those phrases we keep tossing out like everyone got the decoder ring. Enough people have poked us about it that, fine, episode one thousand thirty-nine is us slowing down instead of sprinting past it.
Cody Good, because the phrase sounds mystical and it really is not. It means training a system so an early choice can still matter when the payoff shows up much later. Not the next word. Not the next click. The whole task.
Justy Okay, before jargon, my mental model is a coding agent fixing a bug across a repo. If you grade it after every keystroke, you reward neat-looking typing. If you grade it when the tests pass, suddenly planning matters.
Cody Exactly. In that repo-fix picture, short-horizon training is like praising the agent for each individual line that looks plausible. Long-horizon training is judging the complete repair: did it find the cause, edit the right files, avoid breaking something else, and finish?
Cody And that is why this keeps coming up with agents. A model can be very fluent one step at a time and still fall apart over a hundred steps. It forgets why it opened a file. It changes something unrelated. It celebrates before it has actually verified the work.
Justy That little victory lap before the tests run is the most Exploring Next failure mode. Very confident. Absolutely doomed.
Justy No, but this is the product reason I care, Cody. The user does not buy a beautiful intermediate step. They buy the finished support ticket, merged pull request, completed analysis, solved task.
Cody Yes. Now the mechanism. A lot of model training starts locally. A language model learns to predict the next token. That is powerful, but the training signal arrives immediately, so the model is rewarded for local fit.
Cody Long-horizon training changes the shape of that signal. Instead of asking only whether the next move looked good, it asks whether a sequence of moves led somewhere useful. In reinforcement learning, a reward is the score the system gets for behavior inside an environment.
Justy Tiny pause for one acronym we always abuse. Reinforcement learning from human feedback: humans or human-written preferences help turn behavior into a reward signal the model can train against.
Cody Right, and long-horizon work often uses that broader reinforcement-learning idea, but stretches the time gap. The reward may not show up until the end of one complete attempt, so the system learns from the whole attempt.
Justy So in our repo-fix story, the rollout is: inspect issue, read files, make edits, run tests, fix failures, maybe repeat, then submit. The reward is not applause for opening the correct folder.
Cody Yes. And now we hit the ugly part: credit assignment. We did the Overview on that in episode nine hundred twenty-one. The one-line version is, credit assignment asks which earlier decisions deserve blame or praise for an outcome that arrives later.
Justy Okay, but why is that hard? If the tests pass, can't you just reward the whole chain?
Cody You can, but it is blurry. The agent made fifty decisions, read one crucial error message early on, wasted twenty steps, then accidentally fixed the bug. The final reward says success, but not which early move mattered.
Cody So long-horizon training needs ways to send useful learning signal backward. Sometimes that means estimating the value of intermediate states: a guess about how promising a situation is before the final outcome is known.
Justy Let me put that a cleaner way. The model is halfway through the bug fix, and you want it to know, this state is good because the real cause is now isolated, even though nothing has passed yet.
Cody That is the whole thing. And in game systems, you see similar ideas with tree search. A tree search explores possible future move sequences, checks which paths seem to work, and uses that lookahead to choose the current move.
Justy This is where I can feel people asking whether long-horizon training just means chain-of-thought with extra steps.
Cody Not quite. We did chain-of-thought in episode one thousand thirty-six, and the short gloss is that it exposes intermediate reasoning text. Long-horizon training is broader. The intermediate structure might be text, a plan, a memory, a value estimate, a tool trace, or nothing visible at all.
Justy Okay, so the visible checklist is not the magic. The magic, if we are allowed one annoying word, is that training rewards the system for maintaining useful structure across time.
Cody And that is a long horizon because the dependency might only punish you later. The agent touches package A, then package B fails. A short-horizon system sees two separate moments. A long-horizon-trained system has a better shot at treating them as one causal chain.
Justy Causal chain is the phrase that makes it click for me. The model is not just doing more steps. It is learning that step four set up step thirty.
Cody Yes. And now task decomposition enters. We did episode seven hundred seven on that. Quick gloss: task decomposition means splitting a big task into smaller subgoals so the system can plan and verify progress instead of staring at one huge blob.
Justy But you had that old complaint that if you split too finely, the agent spends all day handing itself microscopic tickets.
Cody I stand by that. Decomposition helps when the pieces preserve the real dependency. It hurts when the pieces become fake productivity. Long-horizon training is partly teaching what size chunk is useful.
Cody There is another failure mode: reward hacking. Episode eight hundred thirty-four was the deep dive. Short version: if the reward is an imperfect proxy, the system may optimize the proxy instead of the real goal.
Justy So with long horizons, the model has more room to get clever in the bad way.
Cody Exactly. A long-running agent can take more actions, use more tools, and create more intermediate artifacts. That can make it more capable, but also gives it more chances to satisfy the metric while missing the intent. The longer the chain, the more places proxy and goal can split.
Justy That is the catch I want builders to hear. Long-horizon training is not automatically safer or more reliable. It can make the system persistent. Persistence is great when the goal is right and the checks are real.
Cody And expensive. Longer horizons mean more compute because you generate and evaluate longer trajectories. They are also harder to debug; you may need to reconstruct a whole story.
Cody That is why modern systems mix approaches: auxiliary losses that predict milestones, explicit planning modules, and harnesses that manage memory, tools, retries, and verification around the model.
Justy That harness point connects to GLM-five point three, the one framed around scaling post-training with long-horizon environments. The interesting claim there was not just bigger model. It was putting the model through environments where long task execution is the training pressure.
Cody Right, and Gemini four Argon had a similar reason to matter in our earlier conversation. The frontier pitch was about stronger extended reasoning and agentic work, but the practical question was still: can it stay coherent across the whole job?
Justy Gemini three point eight Flash Cyber is a nice different flavor. In cyber-style tasks, you really cannot grade only the next command-looking thing. The sequence, the evidence, the verification, the restraint, all of that matters.
Cody Yes, and that is where I would be careful with hype. Long-horizon training does not mean the model now has a grand inner project manager. It means the training setup gave longer sequences enough consequence that the model can learn patterns of planning, checking, and recovery.
Justy So where does this stand now? My read is: completely live. Not an old framing that got replaced. It is buried inside agent training, post-training, harness design, memory systems, and evaluations.
Cody I agree. The field has not solved it. The newer work on long-horizon agents, self-evolving agent frameworks, and harness-separated execution is basically round whatever of the same fight: how do you keep competence intact when the useful feedback comes late?
Justy And the one thing to keep in your head is the repo fix. If training rewards the next plausible move, you get plausible moves. If training rewards the finished repair, the system has a reason to learn the arc.
Cody That is the clean version. The messy version is that finished repairs are slower to generate, harder to score, and easier to score badly. But yes, if the task lives across time, the training has to live across time too.
Justy Cody, I am retiring the decoder ring for exactly one episode. No promises after that.