Prompt Architecture

Why this topic matters

Weak prompt architecture creates fragile systems. The prompt works in a demo, fails on new data, and no one can tell whether the breakage came from the model, the evidence, or the hidden assumptions in the prompt body.

Chroma search surfaced a repeated theme across LLM-application books and framework references: structured outputs and modular prompt construction are what make model behavior consumable by software systems. Current provider guidance also reflects this shift. Anthropic’s current prompt documentation groups clarity, examples, XML structuring, thinking, and prompt chaining as architecture choices, not isolated tricks.

Conceptual model / diagrams

Prompt architecture should separate stable instructions from request-specific material.


flowchart TD
    A[Policy and role] --> B[Task contract]
    B --> C[Evidence block]
    C --> D[Examples or counterexamples]
    D --> E[Output schema]
    E --> F[Validator and router]

Core patterns or workflows

This section explains the architectural choices that matter most in production prompts.

Layered prompt contracts

A strong prompt template usually contains five layers:

  1. Role and policy: what the model is allowed to do and what it must not do.
  2. Task objective: the concrete business goal for the current request.
  3. Evidence or context block: the data, document fragment, metadata, or tool result the model may rely on.
  4. Decision rules or examples: how to resolve ambiguity, classify edge cases, or imitate a house style.
  5. Output contract: the exact response structure and uncertainty behavior.

This layered approach makes it easier to pinpoint which part needs to change when outputs degrade.

Delimiters and labeled sections

Delimiters are not about style. They are about reducing context confusion. When the model sees explicit boundaries such as Instructions, Context, Rules, and Output Schema, it has a better chance of respecting the intended separation between the parts.

Useful delimiter patterns include:

  • labeled markdown sections for readability
  • XML-like tags for nested blocks or tool-ready prompt construction
  • field-by-field JSON schemas for machine-validated outputs
  • negative examples that show what the model must not emit

The right delimiter depends on the task. XML-style boundaries are often useful when several context blocks must stay distinct. JSON schemas are useful when the output must be parsed automatically.

Schema-bound outputs

Schema-bound outputs are the default choice when the model feeds a pipeline. Current provider capabilities and Chroma sources align on this point: the application should tell the model the field names, types, and allowed shapes rather than hoping the model improvises correctly.

Schema-bound outputs are especially strong for:

  • document extraction
  • classification and routing
  • tool invocation arguments
  • ranked candidate lists
  • human-review packets with fixed sections

They are less useful when the deliverable is an open narrative, but even then a section contract is better than freeform prose.

Decomposition and prompt chaining

If the task mixes interpretation, retrieval, policy, and action, the prompt is usually being asked to do too much at once. Split it when:

  • the stages can be validated independently
  • one stage depends on tool or retrieval output
  • the failure modes differ materially between stages
  • the approval boundary sits between stages

For example, in an index-maintenance assistant, “extract methodology rules,” “compare today’s constituents to the prior composition,” and “draft a reviewer note” should not be one opaque prompt. Each stage has different evidence and a different validation method.

Prompt versioning

Prompt architecture is incomplete until the system records which prompt revision produced which output. Versioning should capture:

  • prompt template identifier
  • model identifier
  • retrieval or tool configuration version
  • schema version
  • test-suite status before release

Without this, regression analysis is mostly anecdotal.

Production examples

Schema-bound ESG field extraction

For ESG extraction, the prompt should explicitly define:

  • the source pages or paragraph boundaries
  • the target fields such as scope, metric, unit, reporting period, and source reference
  • the allowed null behavior
  • whether inferred values are forbidden

That architecture keeps the prompt aligned with the traceability needs of [[03-sfdr-data-requirements]] and emerging ESG-ratings governance.

Methodology support for index analysts

For index methodology interpretation, a strong prompt architecture separates:

  • the methodology excerpt
  • the specific case facts
  • the rule-selection task
  • the allowed response shape
  • the escalation path when the rule is ambiguous

This prevents the model from blending methodology text, market color, and invented assumptions into one unsupported explanation.

Risks / anti-patterns

  • Storing policy, user input, and untrusted retrieved content in the same block.
  • Overloading a prompt template with several mutually independent jobs.
  • Using freeform outputs for tasks that need typed fields.
  • Modifying prompt wording in production without a recorded version bump or regression run.
  • Treating prompt chains as a substitute for proper application orchestration.

Recommendations / operating rules

  • Keep policy-level instructions stable and reusable.
  • Keep task-level instructions explicit and short enough that the real objective is obvious.
  • Keep evidence blocks narrow, labeled, and provenance-aware.
  • Use schemas for pipeline-facing outputs and section contracts for reviewer-facing outputs.
  • Log prompt version, model version, and schema version together.

Domain-specific applications

Prompt architecture matters wherever the model output will be reviewed against rules, not just style:

  • ESG taxonomy mapping where the output must distinguish disclosure text from mapped taxonomy code.
  • Corporate-actions extraction where dates, ratios, and event types need typed outputs.
  • Data-quality review flows where the model’s explanation is helpful, but the routing decision must still pass deterministic controls.

Evaluation / validation considerations

Architectural quality shows up in:

  • schema-validity rate
  • field completeness
  • unsupported inference rate
  • reviewer disagreement by task stage
  • rollback frequency after prompt changes

If a prompt architecture change improves prose quality but increases validation failures, it is not an improvement.

Troubleshooting / failure modes

  • If different inputs produce wildly different output structures, the schema contract is too weak.
  • If the model hallucinates from retrieved content, trusted and untrusted layers are not separated clearly enough.
  • If one template accumulates dozens of optional branches, the architecture should be split into specialized templates.
  • If prompt changes keep breaking outputs silently, the system is missing prompt versioning and regression gates.

Prompt Architecture References

  • ChromaDB enrichment: Designing Large Language Model Applications.epub
  • ChromaDB enrichment: Learning LangChain Building AI and LLM Applications with LangChain and LangGraph.epub
  • ChromaDB enrichment: Prompt Engineering for LLMs The Art and Science of Building Large Language Model-Based Applications.epub
  • Anthropic | Prompt engineering overview
  • Model Context Protocol | What is MCP?