Benchmarking Open-Source Chinese Code Models and Building a Low-Barrier AI Coding Workflow

    Open-source code models from China can now handle part of everyday development work, but they should not be assumed to replace top-tier closed-source services. This article provides a reproducible testing method covering model verification, real-task benchmarking, workflow setup, cost and compliance checks, and selection criteria, so teams can reach their own conclusions based on measured data.

    1. Conclusions and Scope of Applicability

    Open-source code models developed in China can already handle a portion of day-to-day development work, including business boilerplate code, unit test completion, API integration, and locating common bugs. For harder tasks such as complex algorithm design or cross-module refactoring with very long context, teams still need to make judgments based on their own test results. Teams should not assume that open-source models can fully replace top-tier closed-source services. This article provides a reproducible testing method so teams can draw their own conclusions.

    2. Verify Model Parameters and Benchmark Sources First

    Many articles online cite parameter counts, leaderboard rankings, or claims such as “close to closed-source models.” Each of these claims needs to be verified individually:

    1. Confirm the exact model name, version number, and release date. Capabilities can differ significantly between versions of the same series.
    2. Check the official model card or technical report to confirm how parameter counts are stated. Mixture-of-Experts (MoE) models usually report both total parameters and activated parameters; the two must not be used interchangeably.
    3. Check the benchmark name, benchmark version, and evaluation conditions. A leaderboard score only reflects performance on that specific benchmark, not on real business scenarios.
    4. Do not include numbers whose sources cannot be verified in team documentation or external materials.

    The core characteristic of MoE architecture is sparse activation: each computation only invokes a subset of the expert networks. Therefore, the compute cost of a single inference is mainly determined by the activated parameters, not the total parameter count. Actual latency and cost are also affected by batch size, context length, and the expert routing strategy. The provider’s deployment approach can change these metrics as well.

    3. Test with Real Tasks

    During testing, give the same batch of tasks to both the candidate open-source models and the model the team currently uses. The tests should follow these rules:

    • Use identical prompts, identical code context, and identical temperature settings.
    • Run each task at least 3 times and record the stability of the results.
    • Have results reviewed blindly by colleagues who do not know which model produced them, to reduce subjective bias.
    • Complete all tasks in a test repository or on desensitized data; never use production data.

    The table below shows the test case design, covering common development scenarios. The “Items to record” column is left blank and should be filled in by the team based on actual runs.

    Task type Input scale Pass criteria Items to record
    Single-function generation (e.g., date handling, string parsing) Single file, within ~50 lines Passes all unit tests Pass rate, time taken
    Business API integration (calling a third-party REST API) Single module, with API documentation Request parameters match the documentation; runs correctly Pass rate, number of manual fixes
    Slow SQL query diagnosis One SQL statement plus table schema Identifies the root cause and provides an executable optimization plan Whether the diagnosis is correct, number of fixes
    Error log triage A stack trace plus related code Locates the correct line of code Localization accuracy, time taken
    Unit test completion An existing module New tests run and cover the main branches Coverage change, number of fixes
    Cross-file refactoring 3 or more interdependent files All tests pass after refactoring; interface behavior unchanged Pass rate, number of steps requiring manual intervention

    When summarizing results, look at three metrics together: accuracy, manual correction cost, and per-task time. Looking at accuracy alone makes it easy to overlook cases that “run but require extensive rework.”

    4. Build a Low-Barrier Workflow

    1. Confirm the integration method. Review the provider’s documentation to confirm the endpoint address, model name, and authentication method. Some providers are compatible with common API formats; others require a dedicated SDK.
    2. Manage keys properly. API keys should only be stored in environment variables, a key management service, or a local file with 600 permissions. Never write them into code, configuration templates, or commit history.
    3. Configure the terminal tool. Reference the environment variables below in the configuration of the tool you use. Field names should follow the tool’s documentation.
    1. # The endpoint, model name, and key are all provided in the provider's documentation; these are placeholder examples
    2. export AI_CODE_API_BASE="<endpoint provided by the provider, e.g., https://provider-domain/v1>"
    3. export AI_CODE_MODEL="<model name from the provider's documentation>"
    4. # Read the key from a local file with 600 permissions to avoid plaintext keys in scripts or repositories
    5. export AI_CODE_API_KEY="$(cat "$HOME/.config/ai-code/api_key")"
    6. # Connectivity check: if the provider offers an endpoint to list models, verify with the following command
    7. curl -sS -o /dev/null -w "HTTP %{http_code}\n" \
    8. --max-time 10 \
    9. -H "Authorization: Bearer ${AI_CODE_API_KEY}" \
    10. "${AI_CODE_API_BASE}/models"
    1. Implement error handling. Take different actions based on HTTP status codes. 401 or 403 usually means an incorrect key or insufficient permissions; check the key and permissions. 429 means rate limiting; retry with exponential backoff, up to 3 retries. 5xx indicates a server-side error; retry as well. If failures persist, switch to a backup service or try again later.
    2. Set timeouts. Set a timeout for each request to prevent the terminal from blocking for long periods.
    3. Desensitize logs. When saving call logs, remove keys, sensitive fields in source code, and user data; keep only request time, model name, duration, and status code.

    5. Cost, Privacy, and Compliance Checklist

    • Confirm where the provider stores data and whether code content is used for model training.
    • Confirm whether private deployment is needed, and estimate hardware and operational costs.
    • Estimate monthly costs based on call volume and set up budget alerts.
    • Review the data processing terms and allocation of responsibilities in the contract.
    • Define a key rotation schedule, and rotate keys promptly when team members change.
    • For code involving personal information, classified material, or regulated content, obtain approval from legal and security teams first.

    6. Selection Recommendations

    The table below lists the dimensions to compare when selecting a model. Each item should be based on the team’s own test data or the provider’s written commitments.

    Evaluation dimension Questions to confirm Comparison method
    Code accuracy Does the pass rate on the team’s tasks meet requirements Use the test cases from Section 3
    Overall cost Per-task call cost plus manual correction time Record costs and correction time
    Response latency Time to first token and total time during peak hours Measure multiple times across different periods
    Context length Can it hold the team’s largest code files and context Test with the longest real files
    Data security Data storage location, terms on training data usage Review contracts and privacy policies
    Private deployment capability Can it be deployed inside a private network, and what hardware does it require Evaluate against the team’s infrastructure constraints