A Practical Guide to Task-Based LLM Selection

    Choosing the right LLM for production is an engineering problem, not a matter of picking the most capable model. This guide breaks model selection into three core dimensions—context capacity and mid-context fidelity, reasoning depth with stable structured output, and throughput, latency, and cost multipliers—then lays out a practical evaluation pipeline, a scoring formula, and a task-to-model mapping table. It also covers engineering essentials such as a unified abstraction layer, chunking and retrieval before inference, citation verification, observability, and cost control, plus common pitfalls to avoid. Readers will learn how to turn task constraints into measurable metrics and route models by those metrics instead of intuition.

    1. Background: Why Model Selection Became an Engineering Problem

    When integrating large models into real business workflows, a common misconception is that the most capable model is always the best choice. Production environments vary enormously in task shape: some tasks require global retrieval and cross-comparison across hundreds of thousands of words, some must return results within a very short window, and others only need format conversion and field extraction. Putting a mismatched model on a mismatched task usually costs you three times over—quality, latency, and money.

    The kind of work described in the original scenario—reading a very long report end to end, producing itemized conclusions, annotating where each conclusion appears in the source, and flagging contradictory data—is essentially a composite task of long context + strong reasoning + traceable citations. Its typical failure mode is not that the model is not smart enough, but that the context window cannot hold the appendix, so the model loses earlier constraints partway through the input. Model selection should therefore start from task constraints, then look at model characteristics.

    2. Three Core Dimensions of Selection

    2.1 Context Capacity and Information Fidelity

    Context length is not the only metric; mid-context recall matters just as much. The industry widely observes a “lost in the middle” effect: fragments located in the middle of a long input are less likely to be used than those at the beginning or end. To evaluate this, build a “needle-in-a-haystack” test: insert key facts at random depths in a long document and check whether the model can cite them reliably.

    2.2 Reasoning Depth and Structured Output Stability

    Due diligence and close reading of research reports require verifiable conclusions. Key evaluation points include: whether conclusions are given item by item, whether source locations are annotated, whether data contradictions can be identified with suggested corrections, and whether the output can be parsed reliably by a program (JSON field completeness rate).

    2.3 Throughput, Latency, and Cost Multipliers

    The same model often offers different throughput tiers, expressed as multipliers. For urgent work, a higher-throughput tier can trade cost for latency; for offline batch processing, the standard tier keeps cost under control. Selection must weigh all three resources in a single table.

    3. A Practical Evaluation Workflow

    1. task profiling → candidate set → offline eval set → metric scoring → canary routing → continuous feedback

    The evaluation set should cover four sample categories: very long inputs (approaching the window limit), strong reasoning (conflicting materials), high-concurrency short requests, and format-sensitive tasks (fixed schema output). At least 50 samples per category are needed to suppress noise.

    Illustrative scoring logic:

    1. score = (
    2. 0.40 * context_fidelity # mid-context recall and citation accuracy in long text
    3. + 0.30 * reasoning_quality # conclusion accuracy, contradiction detection rate
    4. + 0.20 * schema_pass_rate # structured output parse rate
    5. + 0.10 * latency_score # P95 latency compliance
    6. )
    7. cost_penalty = price_multiplier * avg_tokens / 1000
    8. final = score - cost_penalty

    4. Task-to-Model Mapping

    Task Type Key Constraint Selection Direction
    Long-document surveys, due diligence, close reading of research reports Context capacity, traceable citations Long-context, strong-reasoning tier
    Urgent work, real-time Q&A P95 latency High-throughput multiplier tier
    Batch extraction, format conversion Cost, stability Standard tier + batch processing
    Cross-comparison of multiple sources Contradiction detection Long context + stepwise verification

    For long-document tasks, a two-stage approach is recommended: in the first stage, have the model output a list of conclusions with location annotations; in the second stage, use code to verify whether the cited locations actually exist and to count contradictions. This intercepts output that “looks reasonable but cannot be verified.”

    5. Engineering Implementation Notes

    1. Unified abstraction layer: Wrap model calls behind a single interface that hides tier differences, making canary rollout and rollback easier.
    1. def call_model(task, prompt, tier="standard"):
    2. cfg = ROUTER[task][tier] # stores only the tier identifier and multiplier
    3. return client.chat(cfg, prompt)
    1. Chunking and retrieval first: For very long materials, perform structured splitting and vector retrieval up front, and send only relevant fragments to the model. This significantly reduces dependence on an extra-long window.
    2. Citation verifier: Check the existence and consistency of the page or paragraph numbers the model provides; if verification fails, trigger a retry or fallback.
    3. Observability: Log input length, output schema pass rate, P95 latency, and multiplier consumption to close the selection loop.
    4. Cost control: Set token budgets and multiplier caps, and schedule offline jobs off-peak.

    6. Common Pitfalls

    • Looking only at window size while ignoring mid-context recall;
    • Substituting subjective impressions for an evaluation set;
    • Fixing a single tier across all scenarios, making urgent work slow and batch work expensive;
    • Skipping output verification and storing hallucinated citations directly into the database.

    7. Conclusion

    The essence of model selection is translating task constraints into measurable metrics, then using evaluation and routing to hard-code those metrics into the system. On Baidu AI Cloud, with a unified model service plus general cloud capabilities such as monitoring and alerting and logging, teams can upgrade from “picking models by experience” to “scheduling models by metrics,” making heavy tasks like long-document surveys, due diligence, and close reading of research reports both accurate and controllable.