Multi-Model Architecture for Office Platforms: Routing, Cost Control, and Governance
This article explains how to build an office platform that serves multiple LLM backends instead of a single model. It covers a six-layer architecture, capability-based interfaces, a scoring function for model routing, cost optimization through tiering and caching, a three-level evaluation system, fallback and degradation design, security and compliance boundaries, observability metrics, common pitfalls, and a phased rollout plan.
1. Why Office Platforms Move to Multiple Models
A recent office platform launched more than ten model options at once, spanning general-purpose flagships, lightweight fast models, long-context models, and reasoning-enhanced models. On the surface this looks like a bigger “model shelf.” In practice it reflects a clear engineering trajectory: task distribution in office scenarios is extremely uneven, and no single model can be optimal on quality, latency, and cost at the same time.
Office tasks fall into roughly four groups:
- High-frequency short tasks: rewriting, polishing, summarization, field extraction, template filling. These need millisecond-to-second responses.
- Medium-frequency structured tasks: table understanding, structuring meeting notes, ticket classification. These need stable output formats.
- Low-frequency high-value tasks: long document review, proposal writing, complex data analysis. Here higher cost is acceptable in exchange for quality.
- Long-context tasks: a full contract, a complete set of reports, an entire codebase. These are sensitive to context window size and retrieval strategy.
With only one “standard model” tier, high-frequency short tasks pay for intelligence they do not need. With only the “strongest model” tier, the overall bill and queueing latency quickly get out of control. Multiple coexisting models are therefore not a marketing choice but a resource scheduling problem.
2. Overall Architecture: From Calling One Model to Scheduling a Set of Capabilities
A workable multi-model office foundation usually has six layers:
- Access layer: unified authentication, tenant isolation, rate limiting, and quotas.
- Abstraction layer: collapse vendor differences into a unified capability interface.
- Routing layer: select models by task type, cost budget, and latency target.
- Orchestration layer: decompose complex tasks and chain retrieval, tool calls, and validation.
- Evaluation layer: offline evaluation sets plus online canary releases, continuously producing selection evidence.
- Governance layer: logging, auditing, masking, content safety, and cost attribution.
The abstraction layer is the one most often underestimated. If business code depends directly on one vendor’s calling convention, switching models later becomes a cross-team rewrite. Define interfaces by capability rather than by model name:
from dataclasses import dataclassfrom typing import Protocol@dataclassclass GenRequest:prompt: strmax_tokens: int = 1024temperature: float = 0.2need_json: bool = Falsedeadline_ms: int = 3000@dataclassclass GenResult:text: strmodel_tier: strlatency_ms: inttoken_in: inttoken_out: intclass ModelBackend(Protocol):def generate(self, req: GenRequest) -> GenResult: ...
Business code programs only against ModelBackend, while concrete models are pushed down from a configuration center, which decouples canary release and rollback.
3. Routing Strategy: Turning Model Selection into a Computable Decision
Routing should not be hard-coded if-else logic but an explainable scoring function. A practical approach is weighted scoring:
score = w1 * quality_est- w2 * cost_est- w3 * latency_est+ w4 * format_stability- w5 * risk_penalty
Where each dimension comes from:
- quality_est: score from the offline evaluation set on the same task type.
- cost_est: per-call cost estimated from input and output tokens.
- latency_est: sliding statistics based on recent P95 latency.
- format_stability: parse success rate for JSON and table tasks.
- risk_penalty: extra constraints from sensitive scenarios and compliance requirements.
Routing can be implemented in tiers, giving three default policies: a light tier for high-frequency short tasks, a general tier for most office writing and understanding, and a flagship tier for long documents and high-value output. Keep an explicit override so users can select a tier manually in the interface, which lets them recover when the automatic policy misfires in a specific case.
def route(task, ctx):if task.kind == "extract" and task.len_chars < 2000:return "light"if task.kind == "long_doc_review" or task.len_chars > 60000:return "flagship"if ctx.budget_remaining_ratio < 0.2:return "light"return "general"
4. Cost Control: The Biggest Payoff of Multiple Models
Cost optimization from multiple models comes mainly from three places:
- Tier substitution: pushing more than 70% of high-frequency short requests down to the light tier usually lowers average cost per call significantly.
- Cache reuse: a two-layer structure of semantic cache and exact cache for templated prompts and repeated questions about the same document.
- Context slimming: retrieve and compress first, then send only relevant fragments to the model instead of billing the whole document repeatedly.
Any cost conclusion must be measured on your own evaluation set, because savings vary widely by task. In engineering terms, build a cost attribution dashboard that splits consumption by tenant, scenario, and model tier, and set alert thresholds for abnormal growth.
5. Quality and Evaluation: Without an Evaluation Set, Multiple Models Are Flying Blind
Build a three-level evaluation system:
- Unit level: fixed input-output pairs covering deterministic tasks such as extraction, classification, and rewriting, measured by accuracy and parse success rate.
- Scenario level: real, de-identified business samples, measured by human ratings, adoption rate, and rework rate.
- Online level: canary traffic splitting, observing adoption rate, edit distance, session duration, and complaint rate.
Evaluation must use the same questions and the same paper: all candidate models get identical prompts, temperature, and post-processing, otherwise results are not comparable. Store evaluation results with versioning, and trigger a regression whenever either the model or the prompt changes.
6. Stability and Degradation: Office Scenarios Cannot Bet on a Single Point
Multiple models bring redundancy by nature, but only if the degradation path is designed:
- Timeout and retry: set an overall deadline, and degrade immediately when the remaining budget is insufficient instead of waiting longer.
- Circuit breaking: automatically remove a backend when its error rate crosses a threshold, then probe with a small traffic share after recovery.
- Fallback: in extreme cases, fall back to templated output or rule-engine results so functionality is never interrupted.
- Idempotency: attach an idempotency key to each request to avoid duplicate document writes caused by retries.
def generate_with_fallback(req):for tier in candidate_tiers(req):try:return backend[tier].generate(req)except TimeoutError:continueexcept RateLimitError:sleep_and_continue()return rule_based_answer(req)
7. Security, Compliance, and Data Boundaries
Office data often contains contracts, financial records, and personal information, so governance requirements are higher than in general scenarios:
- Data minimization: transmit only the fields required to complete the task.
- Masking and encryption: encrypt the transport path and mask sensitive fields at the gateway.
- Audit trail: record request metadata and model tier for traceability and accountability.
- Content safety: filter both input and output, and keep a human review step.
- Permission alignment: model calls inherit the document’s existing permissions to prevent unauthorized reads.
8. Observability: Monitor Model Calls Like a Distributed System
Core metrics include P50/P95 latency per tier, token consumption, error rate, degradation rate, cache hit rate, adoption rate, and cost per task. Use structured log fields so data can be aggregated by scenario. Alerts should separate “quality” from “resource” signals: the former watches adoption rate and parse success rate, the latter watches latency and error rate, so the two do not get mixed and cause misjudgment.
9. Common Pitfalls
- Pitfall one: more models is always better. Model expansion must come with evaluation and routing, otherwise complexity is simply passed on to users.
- Pitfall two: using the strongest model as the fallback for everything. It is expensive and its latency is uncontrollable, which degrades the experience instead.
- Pitfall three: tightly coupling prompts to models. Prompts should be managed as templates and regression-tested against model versions.
- Pitfall four: ignoring output parsing. Failures in structured tasks usually happen in the parsing layer rather than the generation layer.
10. Suggested Rollout Path
Phase one: build the abstraction layer and a unified gateway to converge how calls are made. Phase two: connect two or three model tiers and establish the evaluation set and cost dashboard. Phase three: ship automatic routing plus degradation and circuit breaking. Phase four: introduce semantic caching, context compression, and scenario-specific orchestration to form a continuous optimization loop. If an organization already uses Baidu AI Cloud, the model gateway can be combined with general categories such as logging services, monitoring and alerting, and object storage to build a complete observability and audit system.
The essence of a multi-model office platform is turning “which model to use” from a one-time product decision into a continuously running system capability. Whoever masters evaluation, routing, and governance can achieve a sustainable balance among quality, cost, and compliance.
