Files
mu/scripts
2858c115f7 Local Qwen 3.8 27B: scripts, a how-to, and a three-way comparison (#63)
* Local Qwen 3.8 27B: design and plan

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* qwen-local.sh: start, stop and status for the local llama-server

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* qwen-opencode.sh: OpenCode on the local Qwen server

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* qwen-claude.sh: Claude Code on the local Qwen server, in its own config dir

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Local Qwen: setup procedure and verified server flags

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* qwen-local.sh: native reasoning flags and MTP on by default

llama-server has --reasoning-effort and --reasoning off, so the plan's
--chat-template-kwargs is replaced (plan corrected in Task 2). The MTP
default, checked against this build's --help, drafts with mtp.gguf on the GPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Claude Code on local Qwen: fix the chat template, pass the context size

Claude Code sends hook context as a system message mid-conversation, and
Qwen's template refuses any system message after the first, so every
request failed with HTTP 500. qwen-local.sh template saves a copy that
renders it as a system turn, and start uses it. qwen-claude.sh tells
Claude Code the server's context (CLAUDE_CODE_MAX_CONTEXT_TOKENS).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* qwen-opencode.sh: always --standalone

OpenCode 2 runs sessions in a background service that keeps the config
and environment it started with, so a later OPENCODE_CONFIG_CONTENT (and
the safety variables) were ignored. --standalone gives each session a
private server with exactly this config.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Local Qwen: measured speed, context and reasoning effort

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* qwen-local.sh: cap the prompt cache in system RAM at 2 GB

llama-server keeps a prompt cache in system RAM, 8 GB by default. In an
agent session it grew past WSL's 12 GB memory cap, and the kernel's
out-of-memory killer stopped the server. With --cache-ram 2048 the
server stays at about 3.4 GB after five long prompts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* qwen-local.sh: keep 4 context checkpoints, not 32

Qwen 3.8 is a hybrid model: each context checkpoint holds its recurrent
state in system RAM. With llama-server's default of 32, a long session
grew the server from 2 GB to 5.7 GB, and with an agent and Go tests
beside it, WSL's 12 GB cap was hit and the server was killed. With 4 it
stays at about 2.3 GB through 50K tokens of conversation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Local Qwen: three-way comparison and lessons

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* qwen-claude.sh: guard the account dirs in both modes; strip cloud switches

The config-dir guard covered only init and missed $HOME, so a run with
QWEN_CLAUDE_DIR=~/.claude would have used the work config, and init with
$HOME would have written ~/.claude.json. Both modes now refuse a dir that
is inside an account dir or holds one. The Bedrock, Vertex and Foundry
switches are removed, since they take Claude Code past the base URL.
Found by the final review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Local Qwen notes: the remaining config differences and the skills link

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* qwen-measure.py and qwen-capture.py: the measurement and capture tools

The speed, long-prompt and memory-growth measurements in the notes, and
the request capture that found the template and OpenCode service bugs,
were throwaway scripts. They are now repo tools with tests, so the
experiment can be repeated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* qwen-compare.sh: run one task three ways and keep the evidence

The three-way comparison (OpenCode on local Qwen, Claude Code on local
Qwen, Claude Code on a hosted model) was a throwaway runner. It is now a
repo script with tests: throwaway worktrees at one commit, the same
prompt, and per run the output, diff, server-log slice and wall time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Local Qwen: a reproduce how-to, the comparison's evidence, docs accepted

The how-to holds every step: setup, daily use, the measurements, the
comparison and request capture, with troubleshooting for what broke. The
notes keep the findings. The three B-071 diffs, the prompt and the run
summary are kept, since the worktrees are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Bruno Guilhermo de Barros Valério <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-10-20 02:12:29 +02:00
..