A Practical Coding Plan: LLM Selection and Engineering
A coding plan turns model choice into a measurable engineering process: capability dimensions, evaluation tiers, latency and cost budgets, and layered routing with observability. This article covers why teams need one, how to score models, and how to ship routing, fallbacks, and monitoring.
Why Teams Need a Coding Plan
Model releases have compressed from quarterly to weekly. Every few weeks a new flagship, high-speed variant, lightweight Flash-style model, or anonymous preview appears, each with a different emphasis: repo-scale engineering, frontend and real-time coding, native multimodal and 3D understanding, or search-style tool APIs.
Ad-hoc selection in that cadence typically creates three problems:
- Decisions that cannot be reproduced: this round was based on a demo; the next owner cannot reconstruct the rationale.
- Cost and experience out of balance: every request hits the strongest model, bills grow fast, and most traffic only needs a lighter model.
- Silent capability regressions: after an upstream silent update, pass rates drop and the team notices only a week or two later.
A coding plan organizes model capability, task type, latency budget, cost cap, and compliance into an executable, measurable, iterable engineering scheme. It is not a leaderboard ranking; it is a decision and routing mechanism.
How to Split Capability Dimensions
Public comparisons usually score models on a handful of benchmarks. Production needs dimensions aligned with the business. Cover at least these five:
- General reasoning and Q&A: quality of architecture design, trade-offs, and hard-problem explanations.
- Code generation and completion: inline completion and function-level generation; extremely sensitive to time-to-first-token.
- Repo-scale engineering: cross-file edits, bugfix, refactor, test fill-in; long context and global consistency.
- Frontend and real-time coding: page scaffolding, style fidelity, interaction; visual consistency and iteration speed.
- Agents and tool use: multi-step planning, tool choice, error recovery, search augmentation; instruction following and stability.
Multimodal and 3D skills are becoming a separate dimension, especially for graphical config, screenshot understanding, and 3D content generation.
There is no universal number one—only “best on a given dimension under a given budget.” Named dimensions move selection from gut feel to verifiable judgment.
Three Tiers of Evaluation Trust
Use external data by trust tier; do not treat a single total score as ground truth:
| Tier | Data type | How to use |
|---|---|---|
| A | Internal eval set (real, de-identified production samples) | Sole decision basis |
| B | Public live benchmarks, community arena-style blind tests | Screening and trend |
| C | Vendor claims, one-off demos, leaderboard totals | Leads only, not conclusions |
Watch three biases:
- Data contamination: public items may already be in training data; scores inflate.
- Task-distribution shift: public sets lean contest algorithms; production is often config changes, log triage, dependency upgrades.
- Version drift: snapshots under the same model name differ; lock a version for regression.
Building an A-tier set outranks chasing any leaderboard. A few hundred internal cases covering real defects and real requests usually beats the latest public ranking.
Three Budgets: Latency, Throughput, and Cost
Speed often drives perceived quality more than scores. Split budgets:
- Interactive: inline completion needs time-to-first-token in the hundreds of milliseconds; beyond that, developers turn the feature off.
- Task: an agent run may include tens of model calls; end-to-end time is the sum of steps—cap steps and timeouts.
- Cost: normalize as cost per thousand requests, not list price; context billing and cache policies differ widely.
Vendors often ship flagship vs. high-speed, full vs. lite—quality traded for latency and cost. Do not pick one model; route by task.
Layered Routing: Turn the Plan into Code
A practical router is classify → pick model → degrade → fall back. The sketch below shows the idea (profiles should come from internal eval, not hard-coded constants):
from dataclasses import dataclassfrom enum import Enumclass TaskKind(Enum):COMPLETION = "completion" # inline completion: most latency-sensitiveCHAT = "chat" # explanation and Q&AAGENT = "agent" # multi-step tool useREVIEW = "review" # repo-level review and refactor@dataclassclass ModelProfile:name: strp50_latency_ms: int # internal measured median TTFTpass_rate: float # internal eval pass ratecost_unit: float # normalized unit costdef route(task: TaskKind, profiles: list[ModelProfile]) -> ModelProfile:if task is TaskKind.COMPLETION:pool = [p for p in profiles if p.p50_latency_ms <= 300]elif task is TaskKind.AGENT:pool = [p for p in profiles if p.pass_rate >= 0.75]else:pool = profilesif not pool: # degrade: fall back if budget not metpool = profilesreturn max(pool, key=lambda p: p.pass_rate / p.cost_unit)
Engineering constraints matter as much:
- Timeouts and retries: hard timeouts per call; retries with backoff to avoid stampedes.
- Structured output checks: schema-validate JSON; on failure retry or degrade—do not write dirty data into the repo.
- Canary and kill switch: new models by traffic share; one-click rollback to a stable version.
- Observability: traces, token use, pass rate, and user accept rate in storage, with logs and alerts—close the loop.
Common Mistakes
- Leaderboard-only decisions: using C-tier data is the most common and expensive error.
- One model for everything: skipping layered routing loses on both cost and latency.
- No version lock: without snapshot IDs, regression is not reproducible.
- Stale eval sets: after the product moves on, old items lose discrimination; add samples quarterly.
- Missing compliance: when code leaves the boundary, define data limits and de-identification before chasing capability.
Closing
Short-term model leads will keep resetting. Eval systems, routing policy, and a monitoring loop are assets that last. In two weeks, aim for three things: an internal eval set of 200+ cases, a minimal layered router, and a basic dashboard. After each new release, run regression, update profiles, and adjust canary weights—selection becomes a measurable process instead of guesswork. Eval jobs and routing services can sit on generic containers, object storage, queues, and log/metrics platforms so the architecture stays vendor-neutral and replaceable.
