Skip to main content

How do I switch between AI models as better models become available?

Summary

  • Make a model change a configuration change, not a code change: applications call a stable, named endpoint, and the model behind that name changes as better options arrive.
  • On Databricks, a Unity Gateway model service is that stable name. You can change the underlying model without changing the name the application calls, and the unified APIs translate requests to each model's native format.
  • Roll out a new model gradually with traffic splitting, keep the incumbent as a fallback, and confirm the split in the system.ai_gateway.usage table before moving all traffic.
  • Evaluate the candidate on your own tasks first. A model marketed as better may not be better on your workload, so switch on evidence, not release notes.
  • For coding agents, the Unity Gateway CLI lets developers pick a model at launch or mid-session, and a centrally published coding agent configuration (Beta) changes the default for a whole team.

How do I switch between AI models as better models become available?

Put a stable name between your applications and the models they call, then make every switch a change to what sits behind that name. With that indirection in place, adopting a better model becomes a governed rollout: evaluate the candidate on your own tasks, send it a slice of live traffic, keep the incumbent as a fallback, and move the rest once the results hold. Without it, every release means touching application code, rotating keys, and re-testing integrations, which is how teams get stuck on whatever model they wired in first.

Why switching is harder than it looks

Three things lock teams in. Hard-coded model names and provider SDKs spread through code. Provider credentials live in apps and on laptops. And for coding agents, the harness can become a de facto lock-in to a model family, because proprietary models are increasingly co-designed with specific harnesses (managing AI coding costs at scale). The pace of releases raises the stakes: as the cost-performance frontier moves, the best choice for a job a few months ago often has a better or cheaper alternative today (Unity Gateway CLI announcement).

What a switch-ready setup needs

Capability Why it matters
Stable endpoint name Apps keep calling the same name when the model changes
Provider-neutral API One request format across providers, so no client rewrite
Weighted traffic splitting Canary a new model on a share of real traffic
Ordered fallbacks Failed requests retry on a known-good model
Central credentials Adding a provider doesn't mean new keys in every app
Per-destination logging Proof that traffic went where you intended
Repeatable evaluation Evidence the new model is better on your work

How Databricks approaches model switching

Call a model service, not a model. A Unity Gateway model service is an endpoint that routes inference requests to one or more models, with traffic splitting and fallbacks. The docs' own example is a model-agnostic endpoint for an application: "Change the underlying model without changing the name the application calls." A service can route to Databricks-hosted models or to external models through a model provider service, and one service can mix both. Owners and users with MANAGE edit it in place.
Keep one request format. Unified APIs translate each request to the downstream model's native format, so you can switch models across providers without changing client code (query model services). External providers are registered once as model provider services that hold encrypted credentials.
Roll out gradually. Traffic splitting distributes requests across destinations by percentage, for gradual rollouts and A/B tests. Session affinity pins a session to one destination, which takes advantage of prefix caching. Fallbacks retry a failed request, such as one that returns a 429 or 5xx error, against backup destinations in the order you define. Routing decisions land in the usage table, so you can check the live split:

SELECT destination_name AS destination, COUNT(*) AS request_count
FROM system.ai_gateway.usage
WHERE endpoint_name = 'your-endpoint-name'
  AND event_time >= CURRENT_TIMESTAMP - INTERVAL 7 DAY
GROUP BY destination_name;

Mind the owner's privileges. A model service runs with its owner's privileges, so the owner must keep EXECUTE on every destination, primary and fallback, or requests fail (govern model services).
Evaluate before and after. Score the incumbent and the candidate on the same MLflow evaluation dataset, then compare the runs to catch regressions.
Switch coding agents centrally. With the Unity Gateway CLI, developers choose a model at launch with --model or switch mid-session with /model in most agents. Admins can publish a coding agent configuration, currently in Beta, that sets each agent's default models, and ug applies it when developers next launch an agent.
Databricks runs this pattern on itself. New models reach employees on an experimental basis under a per-user budget, then get promoted, made the default, or dropped once benchmarks, user feedback, and cost data are in (how Databricks rolls out frontier models).

FAQs

Do I need to change application code to switch models?

Not if the app calls a model service. You change the service's destinations, and the app keeps calling the same name.

How do I test a new model on real traffic safely?

Add it as a second destination with a small traffic share, keep the incumbent as a fallback, and watch quality and cost before raising its share.

Can I mix Databricks-hosted and external models?

Yes. One model service can route to Databricks-hosted models and to external models through a model provider service.

What happens to a conversation during a traffic split?

Session affinity routes requests that carry a session-identifying header to the same destination, so a session doesn't hop between models.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.