The 3-Phase AI Approach: Stop Paying AI to Count to Ten
Summary
The "3-Phase AI Approach" proposes a method to significantly reduce token costs and improve the reliability of AI-powered systems by clearly separating deterministic tasks from those requiring genuine intelligence. This approach divides AI workflows into three distinct phases: Pre-Work, Work, and Post-Work. Pre-Work involves gathering context, validating inputs, and constructing the environment using traditional code (e.g., Go) to fetch data from sources like Kubernetes CRDs, GitHub, and databases, reducing input tokens by up to 73%. The Work phase is exclusively for AI to perform complex reasoning, such as planning, coding, or review. Post-Work uses code to parse, validate, sanitize, store, and act on the AI's output, preventing production incidents from malformed responses. This structured separation ensures AI focuses only on tasks where it provides unique value, leading to cost discipline and more robust outputs.
Key takeaway
For AI Engineers building AI-powered systems, you should adopt a 3-phase approach to optimize costs and reliability. By using traditional code for deterministic pre-work (context gathering, input validation) and post-work (output parsing, storage), you can dramatically reduce token usage and prevent errors from unpredictable AI outputs. Focus your AI's efforts solely on complex reasoning tasks to improve performance and maintain system stability.
Key insights
Separate AI workflows into deterministic pre/post-work and intelligent core work to optimize cost and reliability.
Principles
- Code handles deterministic tasks.
- AI handles complex reasoning.
- Validate AI output deterministically.
Method
Implement a 3-phase workflow: Pre-Work (code for context/validation), Work (AI for intelligence), Post-Work (code for parsing/acting on output), ensuring AI only performs non-deterministic tasks.
In practice
- Use code for context retrieval.
- Strictly validate AI-generated JSON.
- Avoid AI for arithmetic or lookups.
Topics
- AI Workflow Optimization
- Token Cost Reduction
- Large Language Models
- Kubernetes Orchestration
- Deterministic Systems
Best for: MLOps Engineer, AI Engineer, Software Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by LLM on Medium.