Profiles & placement evidence — Context Window Architecture
Context Window Architecture
Profiles & placement evidence

Why placement is a profile, not a rule.

CWA fixes what each slot means, not where it goes in the request. Where an item sits changes whether a model uses it, and the effect differs by model and task. So placement is a profile: versioned, chosen per route, and evaluated before use. The rules are in Spec §5.

The position

Where an item sits in the window changes whether the model uses it. That effect is real, measured, and different for every model family, task shape and context length. A specification that hard-coded an order would be right for one deployment and wrong for the next, and nobody would be able to tell which.

So CWA takes no position on where items go. It requires only that placement be a profile: versioned, per route, evaluated against that route's tasks before it's promoted for deployment, and recorded in every trace. Every profile on this site is an unevaluated example. No reproducible profile evaluation is published here; evaluate the target route before promotion.

What the research measures

Serial-position effects are measured, not folklore. Liu et al. tested models on multi-document question answering and key-value retrieval and found a U-shaped curve: accuracy is highest when the relevant information sits at the beginning of the context (primacy) or at the end (recency), and drops when it sits in the middle. [1]

Later long-context work finds the effect persists and varies. RULER evaluated 17 models and found almost all lose accuracy as context length grows, despite near-perfect scores on simple needle retrieval. [2] NoLiMa finds models do well at the edges of the window when the task is a literal match, but when the answer needs an associative hop, longer contexts pull performance down even at the edges. [3]

Position, length, model family and task interact. No single number describes it, and no single order is safe to bake into a spec.

Varies with
Model family and version
Varies with
Total context length
Varies with
Task: literal match vs associative hop
Varies with
Number and similarity of distractors

Provider guidance, by generation

Provider guidance differs and is written per model generation. Both recommendations below are right for their workloads; neither is right for the other's.

Anthropic · long-context tips [4]
Documents near the top, the question after them.

Long inputs go early and clearly delimited; instructions and the query follow. The document-analysis profile is this shape.

OpenAI · GPT-4.1 prompting guide [5]
Instructions at both ends of long context.

Repeat instructions before and after the long material, or above it if stated once. The guide notes that the family needed prompt migration. The long-context-reinforced profile is this shape.

Placement and prompt caches

Placement decides a second thing: how much of one call's payload the next call repeats byte for byte. Provider prompt caches reuse a request's leading part only up to the first byte that changed. [6] [7] A slot whose content changes every turn, placed early, makes everything after it full price on every call.

CWA's part is to make the repeat exact and its boundaries visible. An identical snapshot renders identical bytes (R-23). History renders in the order turns were said, so a new turn lands after the earlier ones (R-7). The optional cwa-message-blocks/v1 renderer hands each placed item over as its own content entry, so a breakpoint can follow any item. The application's part is the request: which entry carries a breakpoint, which cache lifetime to pay for, and any cache key. None of it is text, so the count and hash the trace records still describe what the model reads (§1).

Attention and caching mostly agree: stable governance goes early and the live query goes last. They disagree in the middle. Long-context guidance puts documents near the top [4], while a cache wants per-turn retrieval below the history. cache-first-chat/v1 is the cache-ordered example; policy-first-chat/v1 is the attention-ordered one, and both are published in examples/profiles.json. Which order wins for a route is an evaluation question, like every other placement choice.

Some things break reuse even in a stable order: budget pressure that sheds the oldest turn on every call (R-16), a different variant chosen for an early item (R-18), a governance item at a new source_version, and a surfaced conflict's mark (R-11). A history producer that compacts old turns in blocks, rather than dropping one per call, keeps the history's leading part unchanged between compactions.

Owner · assembler
Identical bytes for an identical snapshot (R-23), and history in the order turns were said (R-7).
Owner · profile
Slot order: what changes least comes first.
Owner · renderer
Where content entries begin: one per placed item under cwa-message-blocks/v1.
Owner · application
Breakpoints, cache lifetime and cache key, added to the request outside its text (§1).
Anthropic · prompt caching [6]
Hits only at content-block boundaries.

Up to four breakpoints on blocks of tools, system and messages, or one automatic breakpoint on the last block. The prefix runs tools, then system, then messages, so the provider, not the profile, decides where system and tool entries sit. A hit is found only at a block boundary within 20 positions of a breakpoint, which is why cwa-message-blocks/v1 gives each item an entry of its own.

OpenAI · prompt caching [7]
Automatic, on the whole leading part.

On by default from 1,024 input tokens on GPT-5.6 and later, and the entire rendered prefix must match. The guide puts stable instructions and shared material first and dynamic content last, the order cache-first-chat/v1 follows. No entry boundary is needed.

Profile format

A profile is a JSON or YAML document. The example below is the first published profile, in JSON syntax, which is valid YAML. It carries the spec it was written for, an id and version, the route it serves, the model family it was evaluated on, an ordered placement with a wrapper rule per slot, the versioned route policy, and an explicit evaluation status (R-19). A slot may appear twice; the second occurrence is a reinforcement, rendered again. Omitted slots are not rendered, but required slots and admitted protected items may not be omitted (R-20).

profile.yamlpolicy-first-chat/v1
{  "spec": "cwa/draft",  "id": "policy-first-chat",  "version": 1,  "route": "support-chat",  "model_family": null,  "route_policy_version": "illustrative/v1",  "placement": [    {      "slot": "governance.instructions",      "wrap": "system"    },    {      "slot": "state.user",      "wrap": "xml:user_profile"    },    {      "slot": "evidence.knowledge",      "wrap": "xml:evidence"    },    {      "slot": "state.task",      "wrap": "xml:task"    },    {      "slot": "interaction.memory",      "wrap": "xml:memory"    },    {      "slot": "interaction.history",      "wrap": "xml:history"    },    {      "slot": "governance.capabilities",      "wrap": "tools"    },    {      "slot": "evidence.tool_results",      "wrap": "xml:observation"    },    {      "slot": "governance.examples",      "wrap": "xml:examples"    },    {      "slot": "governance.output_contract",      "wrap": "xml:format"    },    {      "slot": "interaction.query",      "wrap": "xml:query"    }  ],  "evaluation": {    "status": "unevaluated",    "suite": null,    "date": null,    "result": null,    "artifact": null  }}

Version note. These profiles are drafts for the revised contract. All are explicitly unevaluated; promotion requires a model version, suite, date, results, and reproducible artifact. Earlier evaluation summaries are withdrawn because supporting runs are unavailable.

Each placement row says where a slot's items go. system makes a system message, tools fills the request's tool list, and each xml: wrapper becomes a tag around the item inside one user message, in the profile's order. The model receives ordinary messages with tagged text, so no training is needed. This is the specification's example request, rendered with the profile above:

request · cwa-messages/v1policy-first-chat/v1
── system ──
You are Ada, a support agent for Northwind.
Never quote prices you cannot verify with a tool.

── tool ──
{"name": "issue_refund", "parameters": {"order_id": "string", "amount": "number"}}

── tool ──
{"name": "lookup_order", "parameters": {"order_id": "string"}}

── user ──
<user_profile id="user:profile">
plan=pro; region=EU; tone=concise
</user_profile>
<evidence id="billing-faq:v3#p1">
Refunds return to the original payment method.
</evidence>
<evidence id="refunds-eu:v17#p4">
Pro plans refund in full within 30 days of purchase.
</evidence>
<task id="task:refund_request">
refund_request: verify_eligibility=done, issue=pending
</task>
<memory id="mem:plan-purchase">
User bought Pro in March, EU billing.
</memory>
<history id="turn:16" speaker="user">
Is my order refundable?
</history>
<history id="turn:17" speaker="assistant">
Let me check order 8821.
</history>
<observation id="obs:order-8821">
{"order_id": "8821", "total": 240, "days_since_purchase": 12}
</observation>
<format id="format:chat">
Max 3 sentences. No bullet lists.
</format>
<query id="turn:18">
Can you just process it now?
</query>

The same step in a running app, on the home page →

Evaluating a profile

A profile is promoted by evidence from its own route, not by argument. The protocol is short and the trace makes it cheap: freeze the assembly snapshot, model configuration, and scoring protocol. Inspect changes in inclusion, repetition, wrappers and token counts as well as order. Deterministic requests do not make model responses deterministic or isolate placement as the sole cause of an outcome difference.

{{ p.n }} {{ p.name }} {{ p.text }}
An unevaluated profile is a hypothesis. Keep evaluation.status as unevaluated until a reproducible route evaluation justifies promotion; a schema-valid profile is not evidence of model quality.
References
  1. Liu, Lin, Hewitt, Paranjape, Bevilacqua, Petroni, Liang. “Lost in the Middle: How Language Models Use Long Contexts.” arXiv 2307.03172 (2023); TACL 2024. arxiv.org/abs/2307.03172
  2. Hsieh et al. “RULER: What’s the Real Context Size of Your Long-Context Language Models?” arXiv 2404.06654 (2024). arxiv.org/abs/2404.06654
  3. Modarressi et al. “NoLiMa: Long-Context Evaluation Beyond Literal Matching.” arXiv 2502.05167 (2025). arxiv.org/abs/2502.05167
  4. Anthropic. “Long context prompting tips.” docs.anthropic.com
  5. OpenAI. “GPT-4.1 Prompting Guide.” developers.openai.com
  6. Anthropic. “Prompt caching.” Accessed 2026-10-03. platform.claude.com
  7. OpenAI. “Prompt caching.” Accessed 2026-10-03. developers.openai.com