Multi-Model Routing for Office Automation Platforms: Architecture and Selection Practices
This article explains how to build an office automation platform that routes tasks across multiple LLMs. It covers a three-dimensional model pool based on quality, latency, and cost; three-tier routing with rule-based, quality-fallback, and feedback mechanisms; long-document context and budget control; a layered evaluation system; a reference implementation path on Baidu AI Cloud; and common pitfalls to avoid.
1. Background: Office Automation Enters the Multi-Model Era
Over the past year, intelligent office workflows have shifted from single-turn Q&A to end-to-end task execution. Users no longer want a single block of generated text; they expect systems to retrieve documents, organize rules, self-check plans, generate demo scripts, and extract structured information as a connected sequence. No single model can balance quality, latency, and cost across all of these steps, so “multi-model access with task-based routing” has become a common engineering pattern.
The product described in the source material is essentially a multi-model scheduling problem: the platform maintains a model pool spanning flagship reasoning models to lightweight, high-speed models, and either the frontend user or a backend agent selects the execution model based on task characteristics. This article strips away product-specific details and focuses on the general architecture and practical considerations for this class of systems.
2. Capability Tiers: Designing the Model Pool as a Cost-Latency-Quality Matrix
Rather than splitting models into “good” and “bad,” engineering teams should build a three-dimensional evaluation matrix:
- Quality: complex reasoning, long-context understanding, native vision understanding, and tool-calling reliability;
- Latency: time to first token (TTFT) and overall throughput (TPS);
- Cost: average token consumption per task combined with unit price, not unit price alone.
A practical tiering example:
| Tier | Suitable Tasks | Key Metrics |
|---|---|---|
| Flagship reasoning | Complex reasoning, cross-document comparison, solution design | Accuracy, long-context recall |
| Balanced analysis | Rule organization, plan review, simulated demos, structured output | JSON validity rate, instruction following |
| Lightweight high-frequency | Copywriting, information extraction, content organization | P95 latency, cost per task |
Note that flagship models from different vendors vary widely in parameter count and context window. Selection should rely on results from your own evaluation set, not public leaderboards.
3. Routing Strategy: From Static Configuration to Observable Dynamic Scheduling
Routing is the brain of the system and should be implemented in three tiers.
The first tier is rule-based routing, which uses keywords, task type, and input length for hard matching with zero model overhead:
def route(task):if task.kind in ("summarize", "extract", "rewrite"):return "light_tier" # high-frequency, low-costif task.kind in ("rule_check", "plan_review", "structured_out"):return "balanced_tier" # analysis and judgmentif task.tokens > 200_000 or task.kind == "deep_reasoning":return "flagship_tier" # long context / complex reasoningreturn "balanced_tier"
The second tier is quality fallback routing: when a lightweight-tier output fails validation (JSON Schema checks, factual consistency checks, regex constraints), the system automatically escalates to a higher tier and retries, forming a loop of “downgrade to save cost, escalate on failure.”
result = call(model=route(task))if not validate(result, task.schema):result = call(model="flagship_tier", retry=1)
The third tier is feedback routing: online human adoption rates and rework rates are fed back as dynamic weights for each model, and tier boundaries are recalculated periodically (for example, weekly) to prevent the evaluation set from drifting away from real traffic over time.
4. Context and Long-Document Handling: The Key Cost Variable
In office scenarios, long documents are the primary cost driver. Key practices include:
- Retrieval first: use hybrid vector and keyword recall to send only relevant passages to the model instead of the entire document;
- Layered summarization: first summarize sections with a small model, then synthesize the summaries with a flagship model, which typically reduces token consumption by an order of magnitude;
- Context budget table: set a hard limit of
system + retrieved passages + history + outputfor each task, and trim by priority when exceeded; - Structured output first: any result meant for machine consumption should use JSON mode to reduce post-processing and follow-up calls.
An illustrative budget control:
BUDGET = {"system": 800, "context": 12000, "history": 2000, "output": 1500}def fit(messages, budget=BUDGET):while count_tokens(messages) > sum(budget.values()):drop_oldest(messages) # keep system prompt and latest intentreturn messages
5. Evaluation System: Without Your Own Evaluation Set, You Have No Selection Capability
A three-layer evaluation approach is recommended:
- Offline benchmark set: sample 200–500 real historical tickets covering extraction, rewriting, comparison, and reasoning, with human-labeled reference answers;
- Online canary: route 5% of traffic to a new model and compare adoption rate, average turns, and timeout rate;
- Cost attribution: track average cost per task by task type to identify “expensive but ineffective” call paths.
Evaluation metrics should go beyond accuracy and include “effective output per unit cost,” i.e., effective tasks / total cost, which is the true optimization target for the routing strategy.
6. Engineering Implementation: A General Path on Baidu AI Cloud
If an enterprise wants to build this capability on Baidu AI Cloud, it can reuse general cloud product categories to close the loop: use a container platform to host routing and validation services, object storage to store evaluation sets and prompt versions, a message queue to smooth out batch document tasks, logging and monitoring with alerting to track TTFT, escalation rate, and cost curves, and a key management service to centrally manage model credentials. The model access layer should use an adapter abstraction to hide protocol differences across vendors:
class Adapter:def chat(self, messages, **kw): raise NotImplementedErrorclass OpenAICompat(Adapter): ... # OpenAI-style protocol compatibleclass CustomHTTP(Adapter): ... # private protocol adapter
This way, when adding or replacing a model, you only need to register a new adapter and tier label, with zero changes to routing and evaluation code.
7. Common Pitfalls and How to Avoid Them
- Selecting only by unit price: ignoring retries and rework can make the actual cost per task higher;
- Not versioning prompts: makes it impossible to pinpoint the cause of quality regressions;
- Missing timeouts and circuit breakers: flagship model queuing can drag down the overall office experience;
- Ignoring data compliance: office documents often contain sensitive information, so masking and audit trails are required.
8. Conclusion
The core competitiveness of a multi-model office platform lies not in “how many models are connected” but in “whether it has the scheduling and measurement capability to assign the right task to the right model.” With a tiered model pool as the foundation, three-tier routing (rules, quality, feedback) as the skeleton, and your own evaluation set and cost attribution as the yardstick, enterprises can achieve a sustainable balance among quality, latency, and cost.
