Skip to content
Back to blog
qwen codeArticle

Local Qwen Code: the medium profile from a home test

Wire-level reasoning effort, no fixed max_tokens, preserved thinking and task-scoped sessions removed observed failures in a home-PC experiment.

Author

Syntalith

Published Updated 3 min read

In the after-hours home-PC experiment, the most stable Qwen Code profile used medium effort in both the client and request, preserved thinking, 150k context and no fixed max_tokens. One RTX 3090 served one agent.

Every setting responds to an observed failure. This is not a generic checklist copied from documentation.

The profile core

The fragment below shows the structure. Replace the URL and environment-variable name; never paste the key into JSON:

{
  "$version": 4,
  "model": {
    "name": "qwen3.8-27b",
    "reasoningEffort": "medium",
    "skipLoopDetection": true
  },
  "tools": { "approvalMode": "auto-edit" },
  "modelProviders": {
    "openai": [{
      "id": "qwen3.8-27b",
      "envKey": "QWEN_VLLM_API_KEY",
      "baseUrl": "http://127.0.0.1:18020/v1",
      "generationConfig": {
        "timeout": 0,
        "maxRetries": 1,
        "contextWindowSize": 150000,
        "extra_body": {
          "top_k": 20,
          "min_p": 0,
          "reasoning_effort": "medium",
          "chat_template_kwargs": { "preserve_thinking": true }
        }
      }
    }]
  }
}

Check the current schema in Qwen Code provider documentation. Our measurements used Qwen Code 0.21.13. A client upgrade requires a fresh smoke test.

Medium must reach the model

Client-side reasoningEffort was insufficient with the generic OpenAI provider. Qwen's embedded template selects xhigh when the request omits the level. The profile therefore also sends extra_body.reasoning_effort.

On a small CSV export, low effort was 3.47 seconds faster than medium and missed the separator in the README. Older xhigh cells used more time without a repeatable quality gain. Medium became the default compromise. It is not an infallible mode.

Why we removed fixed max_tokens

A fixed 8,192-token limit disabled Qwen Code's adaptive 8k-to-64k retry. Long tool writes truncated, and the agent attempted them again. The current settings omit the override so the client can use its recovery path.

That does not make the system unbounded. The server has a context limit, the queue has task limits, and a watchdog can stop identical no-progress sequences. The change avoids cutting a valid write at an arbitrary point.

A false loop detector

During the first frontend run, Qwen Code made distinct successful edits that its action-stagnation heuristic treated as a loop. The session ended before browser QA. We disabled the client heuristic for uncapped cells.

External controls still stop genuine no-progress behaviour: repeated identical errors, the same command without state change or a growing queue. A client heuristic and process safety are different controls.

One card, one agent

The server had one inference slot. Subagent fan-out only serialized several conversations and multiplied context. A team profile should disable parallel agents or send them to separate workers.

Permissions also depend on environment. auto-edit was appropriate in disposable benchmark worktrees. A production repository needs branch protection, tests and recoverability. Deployment commands, secrets and cloud resources require separate gates.

Session hygiene

Resume when a follow-up depends on prior decisions. Start a fresh session for independent work after the previous task is complete. The repository already contains the edits; replaying millions of history tokens is unnecessary.

In our long frontend session, a two-rule CSS correction took 477.80 seconds. The result was correct, but large history and medium reasoning made it slow. That supports task-scoped sessions rather than globally lowering quality.

A copy-ready profile smoke

After a client or settings change, start Qwen Code in an empty worktree and use:

Create qwen-smoke.json with the exact content {"profile":"medium","ok":true}. Validate it with jq -e '.profile == "medium" and .ok == true' qwen-smoke.json. Change no other files.

The expected result is one new file, exit code 0 from jq, and a final response that claims no extra changes. Then ask in the same session to change profile to medium-resumed and validate again. This covers a tool write, command-result reading and follow-up. It does not assess coding quality, so we still run one repository task with a hidden check afterward.

Ship a profile with its test

A settings file without acceptance criteria turns into folklore. Include:

  • model hash and server image;
  • Qwen Code version;
  • a short JSON and tool smoke test;
  • one repository task with a hidden check;
  • expected time and VRAM range;
  • the previous working profile.

Syntalith includes this package in a local deployment and can teach the team to maintain it through the AI-Native course. For architecture and a quote, begin with the free process scan.

Free process scan

Start with a free process scan.

  • A 30-minute call with the engineer who would lead the work.
  • A review of the processes that cost you the most time and money.
  • A written summary of what to automate first and the likely cost range.

The scan chooses one process to assess, and within 2 business days you receive a recommendation, including when a simpler route is the better fit.

€0

30 minutes · written takeaway within 2 business days

Book a free process scan (30 min)

Times are shown in your own time zone. We work with clients across time zones.

Describe the process in the form