How to Choose a Chinese LLM and Apply Vibe Coding: A Practical Guide
This guide reframes LLM selection from comparing model specs to building a repeatable engineering capability. It covers task tiering, building reproducible evaluation sets, latency and throughput metrics, a token-based cost model, context engineering, automated validation loops, and quota governance, with practical code snippets and a decision checklist.
1. Reframing the Problem: From “Which Model” to “How to Build Selection Capability”
A common frustration with AI coding tools is that subscription quotas burn faster than expected, which pushes developers to compare models side by side. These comparisons usually stay at the level of parameters and reputation, lack a reproducible evaluation standard, and produce conclusions that do not transfer to your own codebase.
A more practical approach is to break the problem into three engineering questions: how to tier tasks, how to measure quality, and how to attribute cost. The model is the output of solving these three questions, not the starting point.
2. Task Tiering: Different Coding Stages Need Different Capability Levels
AI-assisted coding is not a single task. It can be split into at least four categories:
- Completion: single-line or small-block code completion, requiring very low latency and high throughput.
- Editing: cross-file refactoring and bug fixes, requiring long context and instruction following.
- Planning: requirement breakdown and solution design, requiring strong reasoning and structured output.
- Verification: test generation, static review, and log attribution, requiring stability and low hallucination.
Key takeaway: using the strongest model for completion tasks is the biggest source of waste; using a weak model for planning tasks causes rework, and rework costs far more than the price difference between models.
3. Building an Evaluation Set: Making Selection Conclusions Reproducible
Extract 30–50 tasks from real repositories to form a small regression set that covers the four categories above, and define automatic pass conditions for each task.
# Minimal example: a model regression evaluation harnesstasks = load_tasks("repo_tasks.jsonl") # each entry has prompt, context, judge scriptdef run(model, task, max_tokens=2048):out = model.generate(task.prompt, task.context, max_tokens)return outdef evaluate(case):passed, lint_ok, tests_ok = case.judge(case.output)return {"pass": passed, "lint": lint_ok, "tests": tests_ok}report = {}for name, model in models.items():rows = [evaluate(replace(run(model, t), t)) for t in tasks]report[name] = {"pass_rate": mean(r["pass"] for r in rows),"lint_rate": mean(r["lint"] for r in rows),"test_rate": mean(r["tests"] for r in rows),}
Prefer objective signals for judging: whether compilation passes, whether unit tests pass, whether static checks report zero warnings, and whether the patch applies cleanly. Subjective scoring is only a supplement and requires fixed reviewers and a fixed rubric.
4. Performance and Throughput: Read Latency Inside the Pipeline
Single-request timing cannot be interpreted in isolation. The source material shows that latency for the same prompt can differ by several times across models, and output rate (token/s) varies just as significantly. Three composite metrics matter in engineering:
- Time to first byte: determines the feel of interactive completion.
- End-to-end duration: determines queue time for batch refactoring tasks.
- Effective throughput: the real output rate after subtracting repeated generation and retries caused by format errors.
An often-overlooked fact: a high-throughput model with unstable output formatting will have its speed advantage eaten by retries. Throughput must therefore be evaluated together with first-pass rate.
5. Cost Model: Write the Billing Formula Down
Most platforms use a credit or token scheme with this general structure:
credit usage = input tokens × input multiplier+ cache creation tokens × cache creation multiplier+ cache hit tokens × cache read multiplier+ output tokens × output multiplier
This yields three optimization paths:
- Raise the cache hit rate: in the multiplier structure, cache reads are usually far cheaper than input, so stable prefixes (system prompts, spec documents, type declarations) should be placed first and kept byte-for-byte identical.
- Compress output: the output multiplier is generally one to several times the input multiplier, so constraining the model to “output only the patch, no explanation” cuts cost directly.
- Control context growth: feeding the entire repository is the most typical credit sink.
Illustrative comparison (showing order of magnitude only, not specific product data):
Scenario A: no cache, 20k input, 2k outputScenario B: 18k cache hit, 2k input, 2k outputWhen the cache read multiplier is about 1/5 of the input multiplier, Scenario B's input-side cost drops by roughly 70%
6. Context Engineering: The Highest-Leverage Optimization Layer
- Retrieval instead of dumping: fetch relevant snippets with keyword or vector search first, then hand them to the model.
- Layered context: global specs (small, stable) plus local code (relevant, variable).
- Structured interfaces: type signatures, interface definitions, and data models as contract inputs save tokens and drift less than natural-language descriptions.
- Accumulate failure samples: write rejected generations into the spec as negative examples to reduce repeat mistakes.
7. Validation Loop: Make AI Output Automatically Judgeable
AI coding cannot scale without a validation loop. The recommended minimal loop is: generate patch → auto-format → static check → unit tests → on failure, retry with error logs (with a retry limit). Retry prompts should pass back only the key error lines to avoid a second round of context growth.
# Minimal example: validation pipeline (commands are generic placeholders)apply_patch && fmt_check && lint && unit_test --changed-only
8. Quota and Rate-Limit Governance
Exhausting a plan quota is usually not a unit-price problem but a concurrency and retry-strategy problem. Recommendations: set a per-minute request cap to fit platform rate limits; route completion tasks to a small-model queue while reserving large-model quota for planning tasks; build a dashboard tracking credit usage share per task category and review it weekly.
9. Selection Decision Checklist
- Do you have a reproducible evaluation set with automatic judging?
- Are capability levels assigned by task tier?
- Have you quantified cache hit rate and output compression rate?
- Do you record the credit-to-output ratio for each task category?
- Are retry counts and context size capped?
10. Conclusion
Leaderboards only provide priors; real selection capability comes from the three-piece set of evaluation sets, cost formulas, and validation loops. In general engineering practice on platforms such as Baidu AI Cloud, model services are typically used alongside foundational capabilities like object storage, logging, and monitoring and alerting. Turning evaluation and cost data into observable metrics is what makes “which model” a repeatable, auditable engineering decision rather than a one-off consumption choice.
