TLDR: This research introduces Autoregressive State-Tracking Prompting (ASTP), a method that enables Large Language Models (LLMs) to follow strict procedural rules in dynamic in-game trading while maintaining conversational flexibility. By explicitly tracking and reporting dialogue states, and using a placeholder-based post-processing for accurate price calculations, ASTP achieves over 99% procedural compliance and 99.3% calculation precision. It also allows smaller LLMs to match the performance of larger ones with significantly faster response times, making it practical for commercial games and other rule-governed AI interactions.
Large Language Models (LLMs) are rapidly changing how we interact with non-player characters (NPCs) in games, offering more natural and dynamic experiences than ever before. However, a significant hurdle remains: these powerful AI models often struggle to follow strict procedural rules, especially in critical systems like in-game trading. This can lead to issues like accidental purchases or skipped confirmation steps, eroding player trust and undermining game integrity.
A new research paper introduces a solution called Autoregressive State-Tracking Prompting (ASTP) to tackle this challenge. This innovative method aims to bridge the gap between the creative flexibility of LLMs and the rigid demands of transactional processes, such as the typical browse-offer-review-confirm flow in game trading.
The Core Problem: Balancing Creativity and Rules
The fundamental tension lies in the nature of LLMs themselves. They are designed to be creative and intent-driven, which is great for open-ended conversations. But in a system where specific steps must be followed to protect player assets, this flexibility can be a drawback. For instance, an LLM might interpret a simple price inquiry as an immediate purchase intent, bypassing the necessary review and confirmation steps. This isn’t just a gaming problem; it applies to any human-AI interaction requiring both natural conversation and strict adherence to protocols, like customer service or medical consultations.
Introducing Autoregressive State-Tracking Prompting (ASTP)
ASTP is a prompting methodology that makes the LLM’s internal state-tracking process explicit and verifiable. Instead of relying on the model’s implicit understanding, ASTP instructs the LLM to identify and report the previous dialogue state before deciding on the next action. This process is embedded within a structured “Prime–Guide–Enforce” workflow, ensuring procedural compliance without sacrificing conversational fluidity.
Here’s how ASTP works in simple terms:
- The LLM first infers what the previous conversation state was (e.g., “showing items,” “offering a price”).
- Based on this inferred previous state and the player’s latest input, it then determines the current state.
- Finally, it generates an appropriate NPC response for that determined state.
This explicit identification of the previous state acts as a crucial anchor, making the LLM’s decision-making process more transparent and less prone to errors.
Ensuring Transactional Integrity with Placeholder Post-Processing (PPP)
Another common challenge with LLMs is their occasional struggle with precise mathematical calculations. Even if they correctly list items and individual prices, they might make errors in the final total, which is unacceptable in a trading system. To address this, ASTP incorporates a state-specific Placeholder Post-Processing (PPP) method.
During the critical “OFFER SELL” state, where the NPC proposes the official price, the LLM is instructed to use a placeholder like “__PRICE__” for the total amount. After the LLM generates its response, the system then accurately calculates the correct total price based on the item details and replaces the placeholder. This ensures 100% accuracy for price calculations at the most crucial point in the transaction, and this accurate price is then fed back into the dialogue history for consistent future references.
Impressive Results and Practical Benefits
The evaluation of ASTP across 300 trading dialogues yielded remarkable results:
- **High Compliance:** ASTP achieved over 99% state compliance, meaning the LLM consistently followed the required trading procedures. This is a significant improvement from a baseline of 78.1%.
- **Calculation Precision:** The PPP method boosted price calculation accuracy to 99.3% from 84.3%.
- **Efficiency:** Notably, ASTP with PPP allowed smaller models, like Gemini-2.5-Flash, to match the performance of much larger models, like Gemini-2.5-Pro. This came with a substantial reduction in response time, from 21.2 seconds down to just 2.4 seconds, making it highly practical for real-time commercial games with resource constraints.
The research highlights that the core principles of ASTP are portable and can enhance other prompting methods, demonstrating its broad applicability. The explicit state-tracking and the targeted post-processing mechanism prove to be robust even in complex, exploratory conversations.
Also Read:
- The Art of AI Conversation: Balancing Structure and Spontaneity for Game Characters
- Boosting E-commerce Catalog Quality: A New LLM Prompting System
Beyond Gaming
While focused on in-game trading, the principles behind ASTP have wider implications. This methodology offers a foundational step towards enhancing reliability in any domain where AI agents need to be both expressive in language and strictly compliant with rules. Future work will explore scaling ASTP to a larger number of states and more intricate transition rules.
For more technical details, you can read the full research paper here.


