Skip to content

Latest commit

 

History

History
69 lines (60 loc) · 11.1 KB

File metadata and controls

69 lines (60 loc) · 11.1 KB

Technical Review Matrix: AI Agent Architectures & Prompt Optimisation

  • Source Document: AI Agent Architectures and Prompt Optimization Guide
  • Analysis Date: July 2026
  • Objective: Comparative architectural synthesis of prompt frameworks and model constraints.

1. High-Level Architectural Comparison

Model Name Core Prompting Framework (e.g., CoD, Zero-Shot CoT) Primary Architectural Role / Specialisation Input Context Window & Constraints
OpenAI GPT-5 Series (GPT-5, 5.1, 5.2, 5.5) Router-based auto-CoT, custom reasoning_effort parameter (minimal to xhigh), Zero-Shot first emphasis, Responses API for persistent reasoning state. General agentic loops and coding; GPT-5.2 specializes in high-fidelity vision, tool calling, and end-to-end coding tasks. Dynamically managed via Responses API to persist context across turns; requires outcome-oriented prompts and positive directives.
DeepSeek (R1/V3/V4) R1: Pure internal CoT (avoid system prompts, user-only instructions). V3: Few-shot/structured. V4: Adaptive CoT via thinking parameter/high effort. Advanced multi-step logical reasoning, math problem solving, and complex logic execution. 1M token context window (V4); automatically caches static prefixes using on-disk Context Caching.
Google Gemini (3.0/3.5) Structured few-shot prompting; XML-style tags; automatic internal thinking (Gemini 2.5+); configurable thinking_level. Scale-oriented agentic tasks, iterative coding cycles, rapid prototyping, and exploration. 1M token context window (3.5 Flash). Defaults to thought preservation across turns. Place queries at the end of the context.
Anthropic Claude 4.6 (Opus & Sonnet) XML structuring; literal interpretation; front-loaded instructions; adaptive thinking (thinking: {type: "adaptive"}). Long-horizon reasoning, strict state tracking, computer use, and premium frontend design. Auto-compacted near limit; documents placed at top of prompt; explicit token budgeting across turns.

2. Deep-Dive Model Profiles

OpenAI GPT-5 Series (GPT-5, 5.1, 5.2, 5.5)

  • Core Technical Prompts:
    • System-Level Directives: Write shorter, outcome-oriented prompts focusing on "what good looks like". Avoid process-heavy legacy prompts. Replace negative constraints (what not to do) with positive, prescriptive instructions. Separate systemic guidelines from raw input datasets using triple quotes (""") or triple hashes (###).
    • Few-Shot Examples / In-Context Learning Tokens: Try Zero-Shot prompting first, as GPT-5 models infer intent from minimal context exceptionally well.
  • Architectural Constraints:
    • Latent Bottlenecks / Token Economy: Utilize the Responses API to allow the model to persist its chain of thought (reasoning items) across turns and tool calls, reducing caching overhead and latency. Keep prompts short, delegate simpler sub-tasks to smaller models, and reduce redundant steps in agentic loops.
    • Context Degradation Over Long Sequences: Mitigate degradation by utilizing the Responses API, which grants every request access to the complete internal context, maximizing cache hit rates as context scales.
  • Desired Outcomes & Execution Performance:
    • Targeted Domain Outputs: Designed for the full spectrum of coding and agentic tasks. GPT-5.2 is specifically optimized for vision, tool calling, and end-to-end code generation (including building frontend experiences, financial analysis, and technical diagram interpretation).
    • Observed Reasoning Efficiency: Explicit Chain-of-Thought prompting (e.g., "think step by step") is unnecessary because the router automatically invokes reasoning when needed. Instead, control reasoning intensity via the reasoning_effort parameter (minimal, low, medium, high, xhigh) and verbosity parameters. GPT-5.1 and 5.2 feature adaptive reasoning to dynamically right-size reasoning effort to task complexity.

DeepSeek (R1/V3/V4)

  • Core Technical Prompts:
    • System-Level Directives: For R1, omit system prompts entirely and place all instructions within the user prompt. For V4, isolate general instructions from the question body using Markdown or XML tags.
    • Few-Shot Examples / In-Context Learning Tokens: For R1, avoid few-shot examples completely as they consistently degrade performance. For V3, heavily leverage few-shot examples and structured schemas.
  • Architectural Constraints:
    • Latent Bottlenecks / Token Economy: The DeepSeek API utilizes default on-disk Context Caching. To maximize cache hits, structure prompts with static system messages and large reference files placed at the very beginning of the context. R1's internal thinking mode is slower and can over-analyze trivial tasks.
    • Context Degradation Over Long Sequences: DeepSeek V4 features an ultra-large 1 million token context window, preventing context degradation and retaining state over large-scale codebases and document sets.
  • Desired Outcomes & Execution Performance:
    • Targeted Domain Outputs: R1 is highly optimized for advanced reasoning, logic, and math using reinforcement learning (RL) and supervised fine-tuning (SFT). Math evaluations require instructing the model: "Please reason step by step, and put your final answer within \boxed{}" for proper parsing.
    • Observed Reasoning Efficiency: Avoid explicit CoT prompts for R1 because reasoning is generated internally. V4 supports an adaptive CoT mechanism triggered by the thinking parameter or high effort settings. You can enforce rigorous reasoning by prompting the model to start its response with the <think>\n tag.

Google Gemini (3.0/3.5)

  • Core Technical Prompts:
    • System-Level Directives: Direct, concise prompting utilizing a structured hierarchy (best with XML-style tags for Gemini 3 Pro). Place specific queries/questions at the very end of the prompt, after the context, as the attention mechanism weights later content more heavily.
    • Few-Shot Examples / In-Context Learning Tokens: Always include few-shot examples; zero-shot is explicitly not preferred. Use one-shot or few-shot examples to specify formatting, style, and scope constraint boundaries.
  • Architectural Constraints:
    • Latent Bottlenecks / Token Economy: In Gemini 3.5 Flash, preserved thoughts increase the input token count across multiple turns. Clear reasoning thoughts for simple queries to reduce token cost. If an agent enters excessive tool loops, reduce the thinking level (medium, low, or minimal).
    • Context Degradation Over Long Sequences: Supports a 1M token context window. Thought preservation is enabled by default, carrying reasoning context forward across turns to improve multi-step tasks like iterative debugging.
  • Desired Outcomes & Execution Performance:
    • Targeted Domain Outputs: Optimized for agentic and coding tasks at scale, particularly rapid prototyping, exploration, and iterative coding cycles.
    • Observed Reasoning Efficiency: Adding "think step by step" is redundant and wastes tokens as Gemini 2.5+ automatically generates internal thinking. Gemini 3.5 Flash defaults to a medium thinking level for lower latency. Modifying temperature, top_p, and top_k is not recommended since reasoning is pre-tuned for default settings.

Anthropic Claude 4.6 (Opus & Sonnet)

  • Core Technical Prompts:
    • System-Level Directives: Provide explicit and literal instructions, as Claude does not infer implicit generalizations. Structure prompts using XML tags (e.g., <instructions>, <context>). Front-load instructions, placing the most important direction at the very top. Use explicit behavioral constraints like <do_not_act_before_instructions>.
    • Few-Shot Examples / In-Context Learning Tokens: Wrap examples in <example> tags. For reasoning tasks, embed <thinking> tags within the examples to demonstrate the expected reasoning pattern.
  • Architectural Constraints:
    • Latent Bottlenecks / Token Economy: Control intelligence and token costs via the effort parameter (low, medium, high, xhigh, max). Claude tends to use more tokens during interactive coding because it reasons intensely after each user turn. Instruct the model to clean up its temporary files to avoid wasting tokens.
    • Context Degradation Over Long Sequences: Place long reference documents near the top of the prompt (above the query) to boost quality by up to 30%. Claude tracks its token budget; instruct it: "Your context window will be automatically compacted as it approaches its limit" to manage behavior near the threshold.
  • Desired Outcomes & Execution Performance:
    • Targeted Domain Outputs: High-performance long-horizon reasoning with precise state tracking, computer use, and frontend design. Bypasses typical "AI slop" aesthetics (cream backgrounds, serif fonts) using the <frontend_aesthetics> tag to demand modern design systems and CSS variables.
    • Observed Reasoning Efficiency: Employs adaptive thinking (thinking: {type: "adaptive"}), dynamically deciding reasoning length based on query complexity and the effort parameter. Deprecates manual budget_tokens control. To prevent reasoning degradation in multi-turn sessions, avoid feeding reasoning output back as input on subsequent turns.

3. Structural Analysis: CoD vs. Zero-Shot CoT

Key Architectural Differentiation: This section contrasts the text density, compute overhead, and token efficiency observed when executing Chain of Draft (CoD) versus traditional Zero-Shot Chain-of-Thought prompting across the models reviewed above.

  • Chain of Draft (CoD) Efficiency Matrix:
    • Token Conservation Factor: Drastically reduces token overhead, consuming as little as 7.6% of the tokens used in standard Chain-of-Thought prompting (yielding a massive ~92.4% reduction in generation cost).
    • Impact on Latency: Significantly speeds up inference and lowers latency by reducing the verbose output stream. Crucially, CoD matches or exceeds standard CoT in accuracy for math and logic tasks. However, it requires few-shot exemplars to demonstrate the brief format and struggles in zero-shot settings due to the lack of drafting patterns in pre-training data.
  • Zero-Shot CoT Overhead Analysis:
    • Reasoning Trace Length Verbosity: Traditional Zero-Shot CoT (triggered by "Let's think step by step") results in extremely verbose outputs, which increases inference latency, generation costs, and token consumption. However, in advanced models like the Qwen2.5 series, Zero-Shot CoT matches or outperforms Few-Shot CoT in mathematical reasoning.
    • Error Propagation Risk: For weaker or older models (e.g., LLaMA-1B, Qwen-7B), they cannot autonomously generate complex reasoning paths and require few-shot exemplars to guide their output formatting. In modern highly capable models, few-shot examples do not enhance reasoning capacity but simply serve to align formatting (e.g., ensuring final answers are boxed in \boxed{}). Verbose reasoning traces in standard CoT can introduce a risk of cascading errors and logical drift, which is mitigated by the structured brevity of CoD (max 5 words per reasoning step, focused on raw math/logic operations).