LLM Selection and Orchestration: Building Efficient AI Workflows
Choosing the right large language model is no longer about availability but about matching models to specific tasks. This article explains the two main model categories—multimodal and text-only—and why neither is universally better. It breaks down the real cost of model usage beyond per-token pricing, introduces a reusable four-tier task routing strategy, and walks through a scheduled information collection pipeline. It also covers the engineering essentials for production stability, including observability, fallback, caching, and evaluation regression, helping teams balance output quality and cost.
1. Introduction: The Real Pain Point After an Explosion of Model Options
Over the past year, large language models have been iterating at a noticeably faster pace. Vendors around the world have been releasing new generations of models with different parameter sizes, context lengths, and inference speeds. Some focus on multimodal understanding, while others are optimized for text reasoning efficiency. With more options available, developers no longer face the question of “whether a usable model exists,” but rather “which one to choose for a specific task.”
Many teams fall into two common traps during selection. The first is capability-first thinking: assuming only the strongest model can produce the best results, which leads to sending even simple tasks to expensive models and quickly inflating the bill. The second is loyalty-first thinking: sticking to a single tool and ignoring the differences between tasks. Mature engineering practice treats models as replaceable, orchestrable compute resources and allocates them dynamically based on task characteristics.
2. Capability Divide: Two Technical Paths, Multimodal and Text-Only
Models on the market today fall into two broad categories.
The first is multimodal models, which can process text and images simultaneously, with some also able to understand video frame sequences. Their value lies in feeding “information that is hard to describe in words” directly into the model. For example, an error screenshot, a UI sketch, or a screen recording of an operation is often lengthy and lossy to describe in text, while supplying the image directly can significantly reduce communication overhead.
The second is text-only models, which accept text input only. Their core advantage is a short reasoning path, high throughput, and low unit cost. For tasks where both input and output are text—such as log cleaning, format conversion, and summary generation—text-only models typically offer better cost efficiency.
The two paths are not a matter of better or worse, but of different applicability boundaries. A more reliable engineering criterion is whether the task input contains non-text information, and how sensitive the task is to latency and cost.
3. Cost Structure: Look Beyond Unit Price to Cost per Task
The most easily overlooked aspect during selection is the cost measure. Real cost includes at least three layers:
- Unit price cost: the input and output price per million tokens;
- Latency cost: waiting and retries caused by slow responses;
- Opportunity cost: occupying high-value model quota and squeezing resources for critical tasks.
A practical estimation approach is as follows:
def estimate_cost(task, model_price, tokens_in, tokens_out, qps_limit):base = tokens_in * model_price["in"] + tokens_out * model_price["out"]# Using a high-tier model for simple tasks is equivalent to paying a premium for low-value workpremium = base * (model_price["tier"] - 1)return {"base": base, "premium": premium, "qps_limit": qps_limit}
The conclusion is straightforward: most day-to-day tasks can be handled by a mid-tier model, reserving top-tier models for architecture reviews, complex reasoning, and critical decisions.
4. Task-Based Allocation: A Reusable Routing Strategy
It is recommended to divide tasks into four tiers and assign corresponding models:
- Critical reasoning tier: architecture design, solution review, and difficult defect localization, using the most capable model to pursue accuracy.
- Multimodal tier: screenshot understanding, UI restoration, and chart reading, using models that support image input.
- High-frequency text tier: summarization, rewriting, classification, and structured extraction, using high-throughput text-only models.
- Batch background tier: scheduled collection, cleaning, and archiving, using low-cost models to optimize unit cost.
The routing layer can be implemented with simple rules, making it easy to replace later with more complex scheduling:
def route(task):if task.needs_vision:return "vision_model"if task.criticality == "high":return "flagship_model"if task.batch and task.complexity == "low":return "economy_model"return "standard_text_model"
The benefit of this layering is that models are pluggable. When a new model is released, you only need to adjust the routing table and evaluation set, without rewriting business code.
5. Typical Scenario: Scheduled Information Collection and Material Organization
Take the example of “collecting industry information from external sites daily and organizing it into materials.” This type of task has three characteristics: scheduled triggering, large data volume, and low per-item complexity. It does not require top-tier reasoning capability but is highly sensitive to stability and cost.
The engineering implementation is best split into four steps:
- Scheduling: trigger with scheduled jobs or a message queue to avoid a single long-lived connection;
- Crawling and cleaning: unify deduplication, denoising, and encoding normalization to turn unstructured content into standardized text;
- Structured extraction: have the model output JSON with a fixed schema for easy database ingestion;
- Archiving and alerting: write results to object storage, and notify via monitoring alerts when the failure rate exceeds a threshold.
Example prompt constraint:
Output JSON only, with fields title / summary / tags / source_time.Do not output explanatory text. summary must not exceed 120 characters.
Combined with a low-cost text-only model, this type of task can run stably around the clock, concentrating the budget on the parts that genuinely require high-intelligence effort.
6. Stability and Engineering Support
The model is only one link in the chain; production environments also require supporting capabilities:
- Observability: log the model identifier, latency, token usage, and failure reason for each call;
- Fallback strategy: automatically switch to a backup model when the primary model times out, ensuring uninterrupted business;
- Cache reuse: cache results for repeated requests to reduce wasted consumption;
- Evaluation regression: maintain a small evaluation set and run regression before a new model goes live, using data to decide whether to switch.
7. Conclusion
A steady stream of model releases is the norm. The key to selection is not chasing the strongest model, but building an engineering system of “task tiering + cost tiering + pluggable routing.” Using the model services and general cloud product capabilities (such as object storage, message queues, and monitoring alerts) provided by Baidu AI Cloud as the foundation, teams can focus their energy on evaluation and scheduling strategies, ensuring every type of task lands on the most suitable model and achieving a balance of both quality and cost.
