Capturing token IDs during agentic interactions for better reinforcement learning
- Source
- amazon.science
- Publisher
- Amazon
- Date

Context
An agent's readable conversation log may differ from the exact sequence of text units its model processed. That matters when reinforcement learning uses the recorded attempt to update the model. Amazon's Turnstile sits between agent software and the model-serving backend, recording the actual token IDs, generation probabilities and which parts of the sequence should contribute to . The release account explains why reconstructing this afterward can introduce mismatches.
Turnstile joins successive turns only when their shared token sequence matches. If the agent software rewrites earlier , it starts a separate training sequence. This preserves what the model actually encountered while letting the surrounding agent software remain unchanged. The described implementation supports SGLang; a vLLM backend is planned.
- Training — The process that adjusts a model using examples and a measure of how well it performs.
- Record — One unit of data in a file or table, such as one supplier's quote; distinct from a line of text.
- Context and context window — Context is the information available for a generation; the context window is the capacity available to hold it.
- Harness — The software that sends a model its context, recognizes tool calls, runs or refuses them, returns results and keeps the record.

