LLM Selection and Cost Evaluation: A Practical Guide for Domestic Chinese Models

    This guide explains how to select and evaluate large language models based on task fit and cost rather than raw capability. It covers task tiering, reproducible quality evaluation, latency and throughput metrics, a token-based cost model, prefix caching, and stability practices such as rate limiting and fallback, helping teams balance quality and budget across model tiers.

    1. The Real Problem: Choose the Best Fit, Not the Strongest Model

    When teams adopt a large language model, the first instinct is often to pick the top model on a leaderboard. In real-world vibe coding and business integration scenarios, however, the question is rarely “which model is the smartest.” Instead, three constraints must hold at the same time: task quality meets the bar, response latency is acceptable, and the cost per token stays within budget.

    A typical pattern in the source material is that a user ran the same prompt across a batch of models on a cloud platform. Smaller models and domestic Chinese models were clearly friendlier in terms of elapsed time, throughput, and credit consumption, while ultra-large models delivered stronger results but were “too expensive to use freely.”

    This means selection must return to an engineering perspective: treat a model as an external dependency with a cost structure and a performance curve, not as a static capability label.

    2. Task Tiering: Match Different Tiers of Models to Different Tasks

    Start by splitting the workload into three tiers:

    • L1 light tasks: text rewriting, field extraction, format conversion, comment generation, unit test skeletons. Optimize for high throughput, low latency, and low cost.
    • L2 medium tasks: cross-file refactoring, defect localization, API design and integration, script writing. Require stronger reasoning and context retention.
    • L3 heavy tasks: architecture design, complex algorithm implementation, long-chain debugging, root cause analysis of difficult issues. Prioritize quality, with cost as a secondary concern.

    The value of tiering is to concentrate 80% of call volume on L1/L2 and reserve L3 for a small number of critical requests. A common root cause of cost overruns is that every request goes to the most expensive model.

    A routing sketch can be very simple:

    1. def route(task):
    2. if task.risk == "high" or task.est_lines > 300:
    3. return "reasoning_tier" # high-quality reasoning tier
    4. if task.kind in ("extract", "format", "comment"):
    5. return "fast_tier" # high-throughput small model tier
    6. return "balanced_tier" # balanced tier

    Make the routing layer configurable and pair it with a gradual rollout switch, so you can roll back quickly when quality regresses.

    3. Quality Evaluation: Use a Fixed Prompt Set for Reproducible Comparison

    The approach in the source material is worth borrowing: run all candidate models with the same prompt (for example, an opening paragraph of a roughly 200-character short story), and record elapsed time, input/output tokens, total tokens, credits consumed, credits per total token, and token/s. The core of this method is not the task itself, but “same input, same sampling parameters, same evaluation criteria.”

    In practice, expand this into a three-layer evaluation set:

    1. Correctness set: cases that can be judged automatically, such as whether unit tests pass, whether JSON is parseable, and whether SQL is executable.
    2. Preference set: human or model-based review scores for generation quality, covering readability, constraint adherence, and code maintainability.
    3. Stress set: long context, multi-turn tool calls, and very long outputs, used to observe truncation, timeouts, and degradation.

    Evaluation script skeleton:

    1. cases = load_cases("eval/*.jsonl")
    2. for m in models:
    3. for c in cases:
    4. r = call(m, prompt=c.prompt, temperature=0.2, max_tokens=c.max_tokens)
    5. record(m, c, latency_ms=r.latency, tokens=r.usage, score=judge(c, r.text))
    6. report(pivot_by="model", metrics=["pass_rate", "p95_latency", "cost_per_case"])

    Do not look only at average scores for key metrics; look at P95 latency and failure rate, because interactive coding is extremely sensitive to tail latency.

    4. Performance and Throughput: Break “Fast” into Three Measurable Metrics

    “Fast enough” is a vague statement. In engineering terms, it should be split into:

    • Time to first token (TTFT): determines the interactive feel; set clear thresholds for L1/L2.
    • Output throughput (token/s): determines the total time for long code generation.
    • Tail latency P95/P99: determines whether the system is usable during peak hours.

    The cross-model data in the source material shows a general pattern: smaller and domestic models are usually more balanced in throughput and credit efficiency, while ultra-large tiers have significantly higher unit costs. A “dual-tier strategy” is therefore recommended: default to the balanced tier, escalate when a complex task is detected, and handle timeouts and retry backoff on the client.

    1. try:
    2. return call(balanced, timeout_s=8)
    3. except TimeoutError:
    4. return call(reasoning, timeout_s=30)

    5. Cost Model: Budget with a Credit Formula, Not Gut Feeling

    The billing formula in the source material is broadly applicable: credits = input tokens × input multiplier + cache creation tokens × cache creation multiplier + cache hit tokens × cache read multiplier + output tokens × output multiplier. Abstract it into a general formula:

    1. Cost = in*ri + cacheWrite*rw + cacheHit*rc + out*ro
    2. Unit cost = Cost / (in + out)

    This yields three clear optimization paths:

    1. Improve cache hit rate: place system prompts, project conventions, and long documents in a stable prefix to reduce repeated billing.
    2. Compress input: deduplicate retrieved snippets, trim irrelevant files, and replace full text with summaries.
    3. Control output: cap max_tokens, ask for “the diff first, then the explanation,” and avoid long-winded responses.

    Budget estimation example (illustrative values, algorithm demonstration only):

    1. def estimate(in_tok, out_tok, ri, ro, cache_hit_ratio=0.0, rc=0.0):
    2. hit = in_tok * cache_hit_ratio
    3. miss = in_tok - hit
    4. return miss * ri + hit * rc + out_tok * ro

    6. Context and Caching Engineering: The Most Overlooked Way to Save Money

    The existence of cache-related billing items means that “prefix stability” translates directly into money. Practical recommendations:

    • Put invariant content first: role settings, coding conventions, and directory structure notes go at the very front of the prompt and are not dynamically concatenated.
    • Put dynamic content last: user questions and retrieval results go at the end.
    • Keep timestamps and random IDs out of the prefix, or the entire cache is invalidated.
    • Build a summary layer for long documents and inject only relevant passages during retrieval.

    7. Stability and Governance: Rate Limiting, Fallback, and Observability

    The source material notes that the platform enforces RPM rate limits (for example, 50 RPM), which is enough for daily use but can be saturated at peak. In engineering terms, prepare:

    • Client-side token bucket rate limiting plus queue-based peak shaving;
    • A multi-model fallback chain: balanced tier → small model tier → rule-based fallback;
    • Full-chain instrumentation: record model, elapsed time, tokens, credits, and hit rate;
    • A quality regression gate: any model or parameter change must run the fixed evaluation set.

    8. Conclusion: A Reusable Selection Checklist

    1. Tier first, then select; 2. Quantify quality with a fixed evaluation set; 3. Describe performance with TTFT/throughput/P95; 4. Budget and compare unit cost with the credit formula; 5. Reduce cost with caching and prefix governance; 6. Ensure stability with rate limiting, fallback, and instrumentation. Following this process, you can choose among multiple tiers of domestic Chinese models in a way that satisfies both quality and cost, without relying on the marketing claims of any single product.