← Back to all entries
2026-06-08 ✅ Best Practices

Model Spec Midtraining, Mid-Session Instructions & Data Residency

Model Spec Midtraining, Mid-Session Instructions & Data Residency — visual for 2026-06-08

Model Spec Midtraining: How Anthropic Bakes Values into Models Before Fine-Tuning

Anthropic's alignment team published a significant research result: Model Spec Midtraining (MSM), a technique that inserts a training phase between pre-training and alignment fine-tuning in which the model reads large volumes of synthetic documents derived from the Model Spec. The headline number is striking — in one tested model, agentic misalignment rates fell from 68% to 5% after MSM. Equally important for practitioners: MSM made subsequent alignment fine-tuning 40–60× more token-efficient, meaning Anthropic can achieve the same alignment quality with far fewer supervised fine-tuning examples. The research also found that specs including value explanations — the "why" behind each rule — consistently outperform rule-only specifications in generalization to novel situations.

Why this matters for teams building on Claude

Actionable: write your system prompts the MSM way

Replace bare prohibitions with explained ones. Instead of "Do not access external URLs.", write "Do not access external URLs — this agent runs in an air-gapped compliance environment where any outbound network call would trigger a security audit and halt the workflow." The explanation gives Claude the context to generalise the constraint correctly when it encounters edge cases the rule didn't anticipate.

alignment model spec MSM midtraining agentic safety research

Mid-Conversation System Messages: Dynamic Instruction Updates Without Cache Busting

Launched alongside Opus 4.8 on May 28, mid-conversation system messages solve a practical problem that anyone building long-running agentic sessions has hit: needing to change Claude's instructions mid-session without invalidating the expensive prompt cache prefix. The Messages API now accepts "role": "system" entries anywhere in the conversation after the first user turn. Earlier turns remain byte-identical to their cached versions — cache hits are preserved even when instructions change. No beta header is required on Opus 4.8 or later.

When to use mid-conversation system messages

import anthropic

client = anthropic.Anthropic()

# Turn 1 — broad exploration instructions
messages = [
    {"role": "user", "content": "Analyse the repository structure and summarise what you find."}
]

response1 = client.messages.create(
    model="claude-opus-4-8-20260528",
    max_tokens=2048,
    system="You are a senior code reviewer. Be thorough and exploratory.",
    messages=messages
)
messages.append({"role": "assistant", "content": response1.content})

# Inject mid-conversation system message — tighten scope for output phase
# Earlier turns remain cache-eligible; only the new system message is uncached
messages.append({
    "role": "system",
    "content": "PHASE CHANGE: You are now in report-writing mode. "
               "Produce only structured findings. Do not explore further. "
               "Every claim must cite a file path and line number."
})

messages.append({"role": "user", "content": "Write the final review report."})

response2 = client.messages.create(
    model="claude-opus-4-8-20260528",
    max_tokens=4096,
    system="You are a senior code reviewer. Be thorough and exploratory.",
    messages=messages
)
Placement rules

A mid-conversation system message cannot be the first entry in messages[] — that position is reserved for "role": "user". The top-level system parameter still sets the baseline; mid-conversation system messages augment it rather than replace it. Anthropic's documentation recommends using them for additive constraints, not contradictory rewrites — conflicting instructions between the base system prompt and a mid-conversation one will cause inconsistent behaviour.

mid-conversation system messages prompt caching agentic sessions Messages API Opus 4.8

Data Residency Controls: Per-Request Inference Geography with inference_geo

Anthropic's Claude API now supports an inference_geo request parameter that lets operators control where model inference is routed on a per-request basis. The two supported values are "us" (US-only routing, priced at 1.1× standard for models released after February 1, 2026) and "global" (standard pricing, default behaviour). Workspace-level defaults are also configurable in the console, making it easy to enforce a blanket policy without modifying every API call. This is a direct response to enterprise and regulated-industry customers who need documented compute-geography guarantees for data sovereignty, GDPR, and sector-specific compliance frameworks (HIPAA, FedRAMP, financial services regulations).

Routing options and recommended paths by jurisdiction

import anthropic

client = anthropic.Anthropic()

# Enforce US-only inference for a compliance-sensitive request
response = client.messages.create(
    model="claude-opus-4-8-20260528",
    max_tokens=1024,
    inference_geo="us",          # US-only routing — 1.1× pricing
    messages=[
        {"role": "user", "content": "Summarise this patient intake form: ..."}
    ]
)

# Check the response header to confirm where inference ran
# X-Anthropic-Inference-Region: us-east-1
print(response.model)   # confirms model used
What inference_geo does and does not cover

inference_geo controls where the model inference runs. Anthropic's standard data retention and zero-retention policy options (controllable via X-Anthropic-No-Training) govern whether prompt/completion data is stored — these are separate controls. For full data residency compliance, you typically need both: inference_geo for compute geography and a data-retention agreement for storage. Consult your legal team before treating inference_geo alone as sufficient for regulatory compliance.

data residency inference_geo GDPR enterprise compliance data sovereignty API
Source trust ratings ⭐⭐⭐ Official Anthropic  ·  ⭐⭐ Established press  ·  Community / research