LLM Migration Checklist: Six Code Changes and Three Validation Steps
A reliable LLM migration requires more than successful API requests. This checklist covers six areas of code and configuration changes, followed by three validation stages for API compatibility, task behavior, and production reliability. It also explains how to manage conversation state, tool execution, caching, staged rollout, and rollback so that model upgrades remain verifiable and reversible.
1. Migration Success Means Controlled Behavior, Not Just Successful Requests
LLM migrations often start with a configuration change, but rarely end there. A successful API response only confirms that a request was accepted. It does not prove that tools executed correctly, long conversations retained their context, output quality remained stable, or costs and latency stayed within business limits.
In applications with tool calling, multi-turn conversations, and reusable state, the model sits within a larger execution pipeline:
User input → Context assembly → Model request → Tool execution → Result submission → Final output.
A contract change anywhere in this pipeline can affect subsequent steps. For example, a model may issue a valid tool call, but an application still parsing the old response format may interpret it as “no output.” Similarly, reorganizing historical messages while retaining the original session state can create inconsistent context.
Migration therefore needs to address three layers:
- Protocol compatibility: Do requests, responses, and tool interactions follow the target API specification?
- Behavioral consistency: Can the model still complete existing tasks while respecting business constraints?
- Operational reliability: Are latency, usage, error rates, and conversation state under control?
Requirements for parameters, caching, and state management vary across model services. Do not treat one service’s behavior as a universal rule for all LLM APIs. Verify every specific configuration against the target service’s official documentation and actual test results.
2. Before Changing Code: Establish a Migration Baseline
Before modifying code, inventory every model invocation path, including interactive Q&A, background processing, tool execution loops, scheduled jobs, failure retries, and fallback paths.
Checking only the main application path can leave low-frequency branches behind. Normal requests may use the new API while timeout retries still use the old configuration. The main service may stop sending unsupported parameters while background jobs continue sending them. These issues often surface only after deployment.
The baseline should include at least:
- Request configuration: Model identifiers, timeouts, retries, output length limits, and other optional parameters.
- Context structure: How system-level constraints, conversation history, tool results, and retrieved content are organized.
- Response handling: Text extraction, structured result validation, and streaming event parsing.
- Operational metrics: Request success rate, task completion rate, latency, and usage.
- Release controls: Configuration versions, traffic allocation, and rollback mechanisms.
Freeze the test set in advance. Using the same de-identified inputs before and after migration helps separate model changes from changes in test samples. For tasks with external dependencies, keep tool responses fixed wherever possible so that external data updates do not distort the comparison.
3. Six Code Changes: From Configuration to State Management
1. Model Identifiers and Request Configuration: Centralize Them
Store model identifiers in a shared configuration layer rather than scattering them across business functions. During migration, update not only the primary path but also fallback paths, retries, and offline jobs.
Bind each request to an explicit configuration version and keep that version consistent throughout the tool execution loop. If one turn uses the old model to generate a tool call and the next uses the new model to process its result, diagnosing problems becomes harder.
External users should not directly control the model identifier. The application should select models through an approved configuration mapping to prevent users from bypassing cost limits or security policies.
2. APIs and Tool Calling: Validate the Full Loop
Whether an API change is necessary depends on the target service’s tool-calling support. Do not assume that every model upgrade requires switching to a particular API.
When the API changes, update both request construction and response parsing. Check:
- Whether tool definition structures and parameter constraints are supported.
- How tool calls are represented in responses.
- How tool requests are linked to their results.
- Whether a response can contain multiple tool calls.
- Whether streaming tool arguments must be assembled from fragments.
- How model execution continues after tool results are submitted.
Validation must cover the complete loop:
Generate a tool call → Validate arguments → Execute the tool → Submit the result → Generate the final answer.
Before executing a tool, perform permission checks and argument validation. A model’s request to invoke a tool is not unconditional authorization to execute it. Operations with side effects, such as charging a payment, sending a notification, or modifying data, require additional confirmation or business authorization.
3. Reasoning Configuration: Verify Capabilities Before Reusing Values
Some models expose controls for reasoning effort or thinking budgets; others do not. Even when controls have similar meanings, their supported values and defaults may differ.
Build a capability inventory during migration: which settings the target model supports, which it does not, what the defaults are, and which tasks may be affected by configuration changes.
Simple information extraction and complex planning may need different settings. A more reliable approach is to run small evaluations by task category and select an appropriate balance of quality, latency, and usage.
If the service returns a configuration compatibility error, record and fix it explicitly rather than silently removing the parameter and continuing. Silent fallback may restore request success while concealing a change in behavior.
4. Sampling and Output Parameters: Review Each One
Support for randomness controls, candidate probability outputs, and output length limits can vary across services and models.
Classify existing parameters into three groups:
- Explicitly supported by the target service and safe to retain.
- Supported through an equivalent capability but requiring remapping.
- Unsupported and requiring removal or changes to the application.
After removing a parameter, verify the business function it previously served. If the application relied on low randomness for stable classification, add classification-label validation and repeated testing rather than merely checking that requests no longer fail.
For structured output, use explicit format constraints and parsing validation. Output format compliance is a separate engineering concern; sampling settings alone should not be expected to guarantee it.
5. Caching: Distinguish the Layers
Application-level result caching, model input caching, and server-side conversation state are different mechanisms.
An application result cache may reuse an existing answer directly. Input caching typically reduces the processing overhead of repeated inputs. Conversation state may retain context associations needed by subsequent requests. Each has different key design requirements, invalidation conditions, and security boundaries.
If the target service supports input caching, verify:
- Whether the service manages the cache automatically.
- Whether its lifetime is configurable.
- What conditions are required for a cache hit.
- Whether cache-hit or usage information is observable.
Do not assume that a fixed parameter or cache lifetime applies to every service. Likewise, a lower cache-hit rate does not by itself indicate lost conversation context.
For fixed prompts and stable knowledge material, keep content and ordering consistent where possible without changing meaning or instruction priority. Do not place untrusted input in high-priority instruction fields simply to improve cache hits.
6. Prompts and Conversation History: Preserve Boundaries and Versions
Prompts should distinguish persistent constraints, the current task, historical content, and external data. After migration, verify how the target API supports each message category and what its priority means.
Moving an instruction from one field to another is not automatically equivalent. Its position may affect instruction priority, session reuse, or caching conditions, so the change requires validation.
Assign versions to prompt templates and record the version used for each request. Store conversation history in an explicit structure that preserves roles, content, tool associations, and necessary business metadata.
Summarization, de-identification, and truncation also change context. They should not be treated as harmless text cleanup.
4. Why Append-Only Conversation History Is Usually Easier to Manage
For multi-turn applications, appending new messages is generally easier to keep consistent than modifying old messages in place. This is not because every API prohibits editing. It is because earlier messages may already have contributed to tool execution, state creation, or cache matching.
If the application changes historical content while continuing to reference the original state, the application and service may have different views:
- The application treats the history as updated.
- The server continues from the previously established state.
This mismatch can appear as repeated tool execution, ignored constraints, or references to outdated information. However, without verification, it is not valid to claim that editing history always discards hidden state or increases usage by a fixed multiple.
A practical strategy is to:
- Use append-only records for normal conversations rather than overwriting messages.
- Create a new conversation branch or state version when a user edits history.
- Rebuild context or start a new session according to the API specification.
- Check whether tool results following the edited content remain valid.
- Tell the business layer which downstream results require recalculation.
If an order identifier in the history changes, the original tool query result generally cannot be reused. If the edit only corrects inconsequential punctuation, business rules can determine whether rebuilding is necessary. The goal is explainable invalidation rules, not blindly rerunning everything after every edit.
The following pseudocode illustrates the design only; it does not represent any specific service API:
If the request modifies existing history:Create a new conversation versionReassemble valid context according to business rulesInvalidate state references that are no longer validRevalidate affected tool resultsAppend the current input to the conversationSend the request according to the target API specificationValidate and process the responseAppend the new results to the conversation
5. Three Validation Steps: API, Behavior, and Operations
Step 1: API Validation — Verify Every Invocation Path
API validation should cover plain text, structured output, tool calling, streaming, and error-handling paths.
The minimum test set should confirm that:
- A basic request returns successfully.
- Every tool type completes at least one full execution loop.
- Invalid parameters are clearly identified.
- Invalid tool arguments safely block execution.
- Retries behave as expected after timeouts, interruptions, and rate limits.
- The current parser correctly handles response structures.
Pay particular attention to tool idempotency. Retrying a model request must not automatically repeat a tool operation with side effects. The application can track execution status using a business operation identifier, then reuse an existing result or reject duplicate execution when repeated requests occur.
Step 2: Behavioral Validation — Verify Task Quality and Boundaries
Compare results before and after migration using a fixed test set. Evaluate whether business objectives are met, not merely whether the wording looks similar.
Common evaluation criteria include:
- Accuracy of information extraction.
- Compliance of structured results with constraints.
- Correct tool selection.
- Completion of critical steps in multi-step tasks.
- Retention of necessary facts in long conversations.
- Isolation of malicious instructions embedded in external text.
- Clear acknowledgment of uncertainty when information is insufficient.
Run stochastic tasks multiple times to assess stability rather than making release decisions from a single sample.
Create dedicated test cases for history edits, context summarization, and recovery after tool failures. These scenarios often reveal state-management problems more readily than single-turn Q&A.
Step 3: Operational Validation — Verify Production Sustainability
Test under concurrency levels and conversation lengths close to actual workloads. Check:
- Request success rate and error categories.
- Time to first response and total task duration.
- Total duration of multi-turn tool workflows.
- Input, output, and other measurable usage.
- Cache metrics.
- Retry counts and queue backlog.
- State anomalies in long conversations.
Break metrics down by task type. Healthy performance for short Q&A does not establish healthy performance for complex tool workflows. Stable average latency can also hide severe slowdowns in a small number of long-running tasks.
Set release thresholds before reviewing results rather than adjusting them afterward. Tasks involving money, permissions, or sensitive data also require separate security validation.
6. Rollout and Rollback: Keep the Migration Reversible
Even after testing passes, use a staged rollout: internal validation first, then a small share of real traffic, followed by gradual expansion to all requests.
During rollout, keep each conversation on the same configuration version wherever possible to reduce cross-version state compatibility issues. A rollback plan must restore more than the model identifier. It should also cover request adapters, response parsing, prompt versions, and state-handling rules.
If the new version changes the conversation storage structure, verify in advance whether the old version can read it. Where compatibility is not possible, define a migration boundary, retain a compatibility layer, or allow old and new conversations to complete their lifecycles separately. Simply switching configuration back can otherwise introduce new failures.
Logs should record necessary configuration versions, error categories, and tool execution status while following data minimization principles. Troubleshooting a migration does not justify indiscriminately retaining complete user inputs or sensitive tool results.
7. Conclusion: Treat Model Upgrades as Verifiable Engineering Changes
A reliable LLM migration is not simply a model identifier replacement that produces no errors. It must demonstrate that API contracts are correct, task behavior meets requirements, production operation is stable, and recovery is possible when something goes wrong.
The six code changes address application and configuration compatibility. The three validation steps address technical compatibility and business risk. Bringing state management, tool idempotency, observability, and rollback into the same checklist helps prevent a deployment that appears successful while accumulating operational problems.
