MLOps
Operating Foundation and Generative AI Systems
Apply MLOps principles to prompts, retrieval, tools, evaluators, model providers, safety controls, and generative serving economics.
By the end you can
- Represent a generative application as a compound release with multiple mutable components
- Version prompts, retrieval, tool schemas, policies, providers, and evaluation suites
- Operate hosted and self-served foundation models under changing behavior and cost
- Monitor groundedness, tool execution, safety, latency, and user outcomes without relying on one grader
Example
A tool-call schema change creates duplicate refunds
A refund is supposed to happen once, however many times the request is sent. The contract that makes that true says who generates the key. An IETF draft, revised on 15 October 2025, puts it in one sentence: “An idempotency key is a unique value generated by the client which the resource uses to recognize subsequent retries of the same request.” Generated by the client. On a repeat of an already completed request, the draft says the resource “SHOULD respond with the result of the previously completed operation, success or an error.”
The draft itself expired on 18 April 2026. It is marked "Expired & archived" on the IETF Datatracker and was never published as an RFC. The contract survived anyway, in production. Stripe's API implements exactly it. The client generates the key. Stripe saves the status code and body of the first request carrying that key and replays them on later requests, 500 errors included. Keys may be removed once they are at least 24 hours old. And the idempotency layer compares the incoming parameters against the original request, erroring if they differ.
Now the failure. A provider begins filling an optional idempotency field differently, and the model — not the tool layer — becomes the thing minting the key. Every retry carries a fresh value. So the resource never recognises a retry: it sees a first request, and the stored first result is never replayed. Nothing in the JSON schema was violated. The schema describes shape. The contract describes provenance.
- Valid structure: The generated call conforms to the JSON schema, and every declared field parses cleanly.
- Changed semantics: The application derives a new idempotency key on every retry, so the resource cannot "recognize subsequent retries of the same request" — each attempt looks like the first.
- Repeated execution: Timeout recovery submits the refund twice, and no previously completed result is replayed because no key repeats.
- Weak gate: Structured-output validity was treated as transactional safety; the schema never encoded who generates the key or what a repeat must return.
- Repair: Generate the key in the tool layer rather than in the model, replay the stored status code and body on a repeat, compare incoming parameters against the original request and error on a mismatch as Stripe does, and authorize independently of the generated call.
The provider changed and no repository commit moved
A support assistant begins producing shorter answers after a hosted model update. The application code, prompt name, and retrieval index are unchanged. Yet user satisfaction and citation behavior shift.
Foundation-model operations must account for external model versions, provider routing, prompt and policy changes, retrieval state, tools, evaluators, and conversation context. The release is a compound system.
The most literal version of this is published on a calendar the team does not control. OpenAI's deprecations page lists gpt-4-32k, gpt-4-32k-0613 and gpt-4-32k-0314 as shut down on 6 June 2025. It lists gpt-4-0613, gpt-4-turbo, gpt-3.5-turbo-0125 and o1-2024-12-17 as shutting down on 23 October 2026. Those are strings sitting in configuration files today, and on dates already fixed they will resolve to nothing. Nothing in the repository will move on those dates either.
Visual
The compound generative release
The language model is one layer inside a broader application, and a failure can be hard to attribute across those layers. That difficulty is not folklore. It is an enumerated risk in federal guidance.
NIST AI 600-1 is the generative-AI profile of the AI Risk Management Framework, published in July 2024. Executive Order 14110, of 30 October 2023, had given NIST 270 days to produce it. It enumerates twelve GAI risks. The twelfth is "Value Chain and Component Integration": non-transparent or untraceable integration of upstream third-party components. §2.12 states the consequence plainly: “As GAI systems often involve many distinct third-party components and data sources, it may be difficult to attribute issues in a system's behavior to any one of these sources.”
That is what the layers below are for. Each one is a place a behavior change can originate. A decision trace that cannot say which layer moved is the twelfth risk realised.
- 01
User and conversation state
Input, memory, identity, permissions, locale, and prior turns.
- 02
Prompt and policy
Instructions, templates, refusal rules, formatting, and routing.
- 03
Knowledge and tools
Indexes, chunking, reranking, APIs, schemas, credentials, and authorization.
- 04
Model and serving
Provider, model version, decoding, context limits, caching, and fallback.
- 05
Evaluation and evidence
Test cases, graders, human review, traces, citations, safety events, and outcomes.
Comparison
Hosted and self-served models shift different responsibilities
Neither option removes operational work. What the hosted route has acquired, at least in the EU, is a documentation obligation that runs downstream toward the integrator rather than sitting with the provider alone.
The EU Artificial Intelligence Act writes it out twice. Article 53(1) obliges providers of general-purpose AI models to draw up and keep up to date technical documentation covering the training and testing process and the results of the evaluation. That set is Annex XI, held for the AI Office and national competent authorities. Article 53(1)(b) then obliges the same providers to “draw up, keep up-to-date and make available information and documentation to providers of AI systems who intend to integrate the general-purpose AI model into their AI systems”. That second set has a floor: at minimum the elements of Annex XII. The European Commission states that these general-purpose AI rules became applicable on 2 August 2025.
So "need contractual and evaluation controls" is no longer only a procurement preference on the hosted side. It is a named annex an integrator can ask for, on a date. Self-serving weights moves that evidence in-house, and moves the runtime, scaling, patching and supply-chain burden with it. Routing across providers multiplies both the evidence to collect and the behavior to compare.
Hosted API
Provider operates model infrastructure and may evolve behavior or limits.
- Fast access to capable models
- External dependency and policy change
- Provider-specific telemetry
- Need contractual and evaluation controls
Self-served foundation model
Team operates weights, runtime, scaling, and patching.
- Greater control and observability
- Large infrastructure burden
- Security and supply-chain ownership
- Need model and runtime optimization
Routed portfolio
Application selects among models or providers by task, cost, risk, or availability.
- Improves resilience and economics
- Adds behavior variability
- Requires comparable evals and policies
- Needs exact route attribution
Generative assets change on different clocks
A prompt can change hourly, an index daily, tool schemas weekly, and a hosted model without a local deployment event. Evaluation cases and grader models also evolve.
The last of those clocks is mechanical, and one provider has written down its gearing. Microsoft's Foundry Models lifecycle policy sets a GA model's retirement date programmatically, at 18 months from launch. It gives at least 60 days' notice. After retirement, all inference returns HTTP 410 Gone. Standard deployments are auto-upgraded: gpt-4o version 2024-05-13 retires on 2026-10-01 and is replaced by gpt-5.1. Provisioned deployments are never auto-upgraded. One deployment type has its behavior changed for it, the other stops answering, and both events are scheduled outside the repository. The policy's FAQ closes the negotiation in three words: “Retirement dates aren't extendable.”
Treat each behavior-changing component as a versioned asset with effective time. A decision record should preserve the exact provider or model identifier when available, the prompt, the retrieval corpus, the tool policy and the fallback. A retirement date belongs in that record too. It is not a calendar invite.
Key idea
A model grader can share the candidate’s blind spots
Automated graders improve scale, but their preferences, knowledge, prompt sensitivity, and failure modes can correlate with the system under test. Validate graders against human judgments, contrast cases, and known failures.
Do not let one changing grader control release without versioning and calibration. The evaluation system is itself a production dependency.
There is a measured figure behind the caution. Strong judges such as GPT-4 can match controlled and crowdsourced human preferences well, and Zheng and co-authors put a number on how well at NeurIPS 2023: “over 80% agreement, the same level of agreement between humans”. Read that twice. The ceiling being matched is human agreement, not correctness. A grader at that level still inherits whatever the humans were inconsistent about.
The correlation with the candidate has since been given a mechanism rather than a worry. GPT-4 and Llama 2 can tell their own generations from those of other models and of humans with non-trivial accuracy. A NeurIPS 2024 paper then showed the ability is not inert: “By fine-tuning LLMs, we discover a linear correlation between self-recognition capability and the strength of self-preference bias; using controlled experiments, we show that the causal explanation resists straightforward confounders.” Move the self-recognition, and the self-preference moves with it, in a straight line. A grader drawn from the same model family as the candidate is therefore a measured conflict, not a stylistic one, and "we used a different provider for the judge" is a versioned fact worth recording next to the score.
A grader supplies evidence; it does not become the ground truth by being automatic.
Steps
Release a compound generative application
Freeze the complete behavior envelope before comparing candidates. And decide what a single eval score is worth before promoting on one.
τ-bench, published at ICLR 2025, built the gate that step 2 needs. It introduced pass^k: the probability that an agent solves the same task on all of k independent reruns. Its authors ran it over retail and airline customer-service domains. The abstract reports the result. “Our experiments show that even state-of-the-art function calling agents (like gpt-4o) succeed on <50% of the tasks, and are quite inconsistent (pass^8 <25% in retail).” Under 50% average success on one run. Roughly 25% once the same task must come out right on all of eight. Sierra, which built the benchmark, calls that “a staggering 60% drop”.
The operational reading is narrow and useful. A single-run score on a tool-calling suite can overstate the agent by more than half, and the gap is invisible until the suite is rerun. Representative evals therefore means reruns as well as coverage: groundedness, tool traces, safety, edge cases, cost and user tasks, each measured with the consistency the production path actually requires, before shadow or canary traffic begins.
1. Inventory mutable components
Model, provider, prompt, retrieval, tools, policies, graders, and state.
2. Build representative evals
Include groundedness, tool traces, safety, edge cases, cost, and user tasks.
3. Validate authority boundaries
Enforce schema, semantics, permissions, idempotency, and human approval outside the model.
4. Expose progressively
Use shadow or canary traffic with exact route and asset attribution.
5. Monitor and compare
Track outcomes, citations, abstention, tool errors, latency, spend, and provider change.
Provider abstraction should not erase evidence
A unified model interface can simplify code while hiding tokenization, context, safety, tool, and version differences. Preserve provider-specific evidence behind the abstraction. Where Article 53(1)(b) applies, the Annex XII documentation the upstream provider owes you is part of what there is to preserve.
The application should degrade safely when the model, retrieval, or tool layer is unavailable. It should never expand authority merely to preserve a fluent response.
A national security agency has written down why the boundary belongs outside the model. “Current large language models (LLMs) simply do not enforce a security boundary between instructions and data inside a prompt”, the UK’s NCSC wrote in December 2025, because “under the hood of an LLM, there’s no distinction made between ‘data’ or ‘instructions’; there is only ever ‘next token’”. Its conclusion is that “it’s very possible that prompt injection attacks may never be totally mitigated in the way that SQL injection attacks can be”. Design as though the filter will be bypassed.
It has already been bypassed in a shipping enterprise product, with a number on it. CVE-2025-32711 records an AI command-injection flaw in Microsoft 365 Copilot, classified under CWE-74. Microsoft, the assigning CNA, published it on 11 June 2025 under the title "M365 Copilot Information Disclosure Vulnerability". The CNA description is one line: “Ai command injection in M365 Copilot allows an unauthorized attacker to disclose information over a network.” Read the vector Microsoft assigned — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:N — and note UI:N: no user interaction. Microsoft scored the record CVSS 3.1 base 9.3 (Critical). NVD's own primary analysis of the same record scored it 7.5 (High). Two bodies read one flaw and did not agree on how bad it was. That is a further reason to place authority, idempotency and approval in the tool layer, rather than sizing controls to somebody's severity estimate.
Key takeaways
- A generative release includes model, prompts, retrieval, tools, policies, graders, and state. The twelfth risk in NIST AI 600-1 is that failures in such a chain are hard to attribute to any one source.
- Hosted providers change and remove models on published calendars with no local commit: OpenAI shut down gpt-4-32k on 6 June 2025, and Microsoft Foundry sets GA retirement at 18 months from launch, then returns HTTP 410 Gone.
- Structured output validates form, not semantic correctness or authorization — an idempotency key is defined as generated by the client, and a schema-valid call can defeat that contract without breaking the schema.
- Automated graders need versioning and validation against independent evidence: a NeurIPS 2024 paper found self-recognition and self-preference bias moving together in a linear correlation.
- Model routing requires comparable evals and exact provider attribution, and evals worth promoting on must be rerun — τ-bench's gpt-4o agent scored under 50% at pass^1 and under 25% at pass^8 in retail.
- Safe degradation should reduce capability or abstain rather than expand authority, because the instruction/data boundary is not enforced inside the model — CVE-2025-32711 is what that costs in production.