@miller-tech/uap 1.216.0 → 1.218.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -124,7 +124,7 @@ LLAMA_LOG_FILE=/home/cogtek/llama.cpp/llama-server.log
124
124
  LLAMA_N_PREDICT=16384
125
125
 
126
126
  # Gemma 4 speaks its own <|turn>/<|tool_call> DSL, NOT ChatML. Use the
127
- # model's embedded template — the qwen3.5-enhanced.jinja used by the Qwen
127
+ # model's embedded template — the qwen-sharp.jinja used by the Qwen
128
128
  # profile emits a format Gemma was never trained on and silently destroys
129
129
  # tool calling.
130
130
  LLAMA_CHAT_TEMPLATE_FILE=embedded
@@ -57,9 +57,58 @@ LLAMA_SLOT_SAVE_PATH=/home/cogtek/.cache/inference/kv-slots
57
57
  LLAMA_LOG_FILE=/home/cogtek/llama.cpp/llama-server.log
58
58
  LLAMA_N_PREDICT=16384
59
59
 
60
- # Qwen3.6 is ChatML with the qwen3_coder tool-call format; the proxy's parsers
61
- # are built around exactly this template. Do NOT switch it to "embedded".
62
- LLAMA_CHAT_TEMPLATE_FILE=/home/cogtek/dev/miller-tech/universal-agent-protocol/tools/agents/config/qwen3.5-enhanced.jinja
60
+ # CHAT TEMPLATE (2026-08-20): switched from qwen3.5-enhanced.jinja to
61
+ # qwen-sharp.jinja -- peculiar-ragdoll/Qwen-Sharp-Chat-Templates
62
+ # (template_version qwen3.8-froggeric-v22.1), vendored verbatim at
63
+ # tools/agents/config/qwen-sharp.jinja. It targets Qwen 3.5/3.6/3.8 and is the
64
+ # template for ALL qwen models here. Pinned artifact -- both are asserted in
65
+ # test/chat-template-system-message.test.ts so a silent re-vendor fails CI:
66
+ # upstream revision 3dc34df52c63dd22ada21f96435e069deaa8d7da (2026-08-18)
67
+ # file sha256 d1f22a89eac3609dcfaa7b471b1f7d23bee2f084d275d26f4f8231d1d7908f4e
68
+ #
69
+ # WHAT IT FIXES: qwen3.5-enhanced.jinja hard-raised
70
+ # 'No user query found in messages.' -- a server-side failure for the whole
71
+ # request -- whenever no user turn survived its backwards scan, i.e. when every
72
+ # user turn was a <tool_response> or when the transcript was system+assistant
73
+ # only. Both shapes occur in normal agent loops. qwen-sharp renders them.
74
+ #
75
+ # WHAT STAYS COMPATIBLE (rendered and compared, not assumed):
76
+ # * the tool-call contract the model is told to EMIT is unchanged:
77
+ # <tool_call><function=NAME><parameter=K>V</parameter></function></tool_call>.
78
+ # anthropic_proxy.py's _HERMES_FUNCTION_RE / _TOOL_CALL_XML_RE parse it
79
+ # unchanged. The default is selected at render time by `_tool_format`, so
80
+ # the test asserts on RENDERED output -- the file contains a JSON emitter
81
+ # too, and a grep cannot tell which one is live.
82
+ # * the generation prompt matches the old template in BOTH enable_thinking
83
+ # states, so --reasoning auto --reasoning-format deepseek is unaffected.
84
+ # * a mid-conversation system message renders inline in both templates.
85
+ #
86
+ # WHAT ACTUALLY DIFFERS -- known and accepted:
87
+ # * HISTORY rendering of prior tool calls differs in whitespace only: with
88
+ # string-form `arguments` (the proxy's path -- it json.dumps them) the old
89
+ # template emitted "}\n</function>", the new one "}</function>"; and the
90
+ # separator between two tool calls in one assistant turn went "\n" ->
91
+ # "\n\n". Neither changes what the parsers accept.
92
+ # * the injected tool-calling instruction block was rewritten upstream: it now
93
+ # requires a <think> block before each tool call and forbids prose before
94
+ # the call. Behavioural, deliberate, not a wire change.
95
+ # * a system message containing an IMAGE now raises. Unreachable via the
96
+ # proxy, which flattens system to a text string before dispatch
97
+ # (anthropic_proxy.py ~4709). Direct-to-:8080 OpenAI clients can hit it.
98
+ # * unknown message roles no longer raise; they render as "[role]: content".
99
+ # * prior <think> blocks are retained across turns. Upstream sells this as a
100
+ # prompt-cache win; on the PROXY path it is a no-op, because the proxy
101
+ # already strips <think> from prior assistant turns on purpose
102
+ # (anthropic_proxy.py ~4725: "Stripping breaks the copy cycle"). On the
103
+ # direct path it re-introduces exactly that cycle -- pass
104
+ # chat_template_kwargs.preserve_thinking=false there if it shows up.
105
+ #
106
+ # chat_template_kwargs.reasoning_effort accepts
107
+ # none|minimal|low|medium|high|xhigh|max. NOTE: 'none' forces thinking OFF,
108
+ # overriding enable_thinking=true.
109
+ # Do NOT switch this to "embedded" -- the model's own baked-in template still
110
+ # carries the 'System message must be at the beginning.' raise.
111
+ LLAMA_CHAT_TEMPLATE_FILE=/home/cogtek/dev/miller-tech/universal-agent-protocol/tools/agents/config/qwen-sharp.jinja
63
112
 
64
113
  # --cache-ram sizing — measured, not guessed
65
114
  # The host-RAM prompt cache holds KV prefixes so a follow-up turn re-uses its
@@ -0,0 +1,211 @@
1
+ # =====================================================================
2
+ # Qwen 3.8 27B (dense, UD-IQ4_XS) @ 131072 ctx/slot / 2 slots, DFlash2
3
+ # speculative decoding -- 2026-08-20. THIS IS THE DEFAULT PROFILE.
4
+ # Service: uap-llama-server.service -> scripts/run-llama-server-continuity.sh
5
+ # Install: cp to ~/.config/uap/llama-server.env
6
+ #
7
+ # Supersedes qwen38-27b-mtp.env (kept alongside as the fallback). Same model,
8
+ # same context, same slot count -- ONLY the speculative-decoding config differs.
9
+ #
10
+ # MEASURED, not assumed (RTX 3090 24 GiB, sm_86, temp 0, 4 prompts,
11
+ # 1032 tokens/arm, same binary across arms so spec config is the only variable):
12
+ #
13
+ # arm aggregate tok/s accept tok/verify step
14
+ # draft-mtp --parallel 1 59.3 93.6% 2.68
15
+ # DFlash2 n4 --parallel 1 68.7 67.4% 3.68 1.16x
16
+ # draft-mtp --parallel 2 66.0 92.5% 2.67
17
+ # DFlash2 n4 --parallel 2 89.8 66.5% 3.66 1.36x
18
+ #
19
+ # The --parallel 2 row is two GENUINELY CONCURRENT requests, i.e. the
20
+ # production shape. Note this CONTRADICTS the upstream PR thread, whose
21
+ # reviewers report DFlash2 degrading at -np>=2; on this card the advantage
22
+ # GROWS under concurrency. Re-measure before trusting it on other hardware.
23
+ #
24
+ # WHY n-max 4 AND NOT 7: n-max 7 was measured too and was SLOWER (69.8 vs
25
+ # 76.7 tok/s in the first pass) despite accepting a longer block (4.86 vs
26
+ # 3.87 tokens/step). Acceptance falls from 72% to 55% as the block lengthens,
27
+ # so the extra drafting work outruns what it buys. The drafter card's
28
+ # published acceptance length of 5.39 is real but is not the throughput
29
+ # optimum here.
30
+ #
31
+ # VRAM -- THE REAL COST. Peak in this exact shape (262144 total ctx,
32
+ # --parallel 2, both slots driven concurrently) is 23449 / 24576 MiB, i.e.
33
+ # ~1.1 GiB free. The drafter's weights are the obvious cost, but the MARGINAL
34
+ # cost vs draft-mtp is NOT measured: no paired probe of the mtp profile was ever
35
+ # taken with the same harness, and docs/guides/QWEN36_LLAMACPP.md reports ~0.95
36
+ # GiB free for draft-mtp at this same tier -- which cannot both be true and
37
+ # leave DFlash2 roomier. Do not quote a delta until both are re-measured with
38
+ # one harness. The 23449 figure is also a 1 s nvidia-smi sample over a ~10 s run
39
+ # whose longest prefill was 540 tokens; it never saw a long-context prefill on
40
+ # two slots, which is the actual peak event at 131072/slot.
41
+ #
42
+ # KNOWN DEFECT OF THIS BUILD -- SHUTDOWN HANGS. The PR-27342 binary can deadlock
43
+ # in __futex_wait after printing "cleaning up before exit...", so SIGTERM does
44
+ # not always complete. Under systemd this is contained: TimeoutStopSec=20 then
45
+ # SIGKILL, and the cgroup releases the VRAM. Started OUTSIDE systemd it is not:
46
+ # observed 2026-08-20 leaving an orphaned llama-server holding 21362 MiB with no
47
+ # listening socket, which starves the real service on load. Always drive this
48
+ # profile through `systemctl --user {start,stop,restart} uap-llama-server`, and
49
+ # if a load fails with an allocation error check
50
+ # `nvidia-smi --query-compute-apps=pid,used_memory --format=csv` for an orphan
51
+ # first. This card has a history of GLOBAL kernel
52
+ # OOM events selecting this service for its RSS (see the --cache-ram note
53
+ # below), and the GPU side is now thinner too. If the server starts dying or
54
+ # failing to load, switch back to qwen38-27b-mtp.env FIRST -- that is the
55
+ # whole reason it is kept.
56
+ #
57
+ # ENGINE IS AN UNMERGED UPSTREAM PR. LLAMA_BIN below is built from
58
+ # ggml-org/llama.cpp#27342 ("support DFlash2", commit 5ecbe1ac1) cherry-picked
59
+ # onto f466cfa38 with zero conflicts. The patch is vendored at
60
+ # config/llama-patches/dflash2-pr27342.patch so the build is reproducible if
61
+ # that worktree is lost -- create a detached llama.cpp worktree at f466cfa38,
62
+ # apply that patch to it, then configure with CUDA on, arch 86, native on,
63
+ # shared libs on, Release, and build the llama-server target.
64
+ # The merged draft-dflash v1 engine CANNOT substitute: a v2 checkpoint declares
65
+ # the same general.architecture="dflash", so auto-detect picks draft-dflash and
66
+ # then fails on the 23 conv/selector tensors and dflash.conv_*/selector_* keys
67
+ # v1 has no loader for. Return to plain master once #27342 lands upstream.
68
+ # =====================================================================
69
+ LLAMA_BIN=/home/cogtek/llama.cpp/.worktrees/dflash2-trial/build-cuda/bin/llama-server
70
+ LLAMA_MODEL=/home/cogtek/Downloads/Qwen3.8-27B-UD-IQ4_XS.gguf
71
+ # CONFIRMED INCOMPATIBLE 2026-08-20: mmproj-BF16.gguf crashed the server on
72
+ # load -- "mismatch between text model (n_embd = 5120) and mmproj
73
+ # (n_embd = 2048)". It was built for a different, smaller model's vision
74
+ # tower, not Qwen3.8-27B (n_embd 5120). Same applies to mmproj-F16.gguf
75
+ # (same family of file, unverified for this model). Do not re-enable either
76
+ # without a projector confirmed to report n_embd=5120 for its text side.
77
+ # "none" is a real opt-out (added to the continuity script 2026-08-20); an
78
+ # empty value is NOT equivalent -- it still falls through to auto-detect,
79
+ # which is how this got picked up in the first place.
80
+ LLAMA_MMPROJ=none
81
+
82
+ LLAMA_HOST=0.0.0.0
83
+ LLAMA_PORT=8080
84
+ LLAMA_CTX_SIZE=262144
85
+ LLAMA_PARALLEL=2
86
+ # UAP RAILS -- KEEP IN SYNC WITH THESE TWO LINES (~/.config/uap/anthropic-proxy.env).
87
+ # --ctx-size is the TOTAL across slots; /props reports the PER-SLOT figure.
88
+ # 262144 / 2 slots = 131072 per slot, so the proxy rails must read:
89
+ # PROXY_CONTEXT_WINDOW=131072 (== per-slot ctx, NOT the total)
90
+ # PROXY_CONCURRENCY_LIMIT=2 (== LLAMA_PARALLEL, the slot count)
91
+ # Over-stating either one makes the proxy admit work the server cannot hold and
92
+ # turns a queue into context-overflow errors. Re-derive from /props after any
93
+ # change here. LLAMA_PORT below must match the proxy's LLAMA_CPP_BASE port; the
94
+ # proxy auto-discovers a live server if its pin is stale, but the pin should
95
+ # still be correct so a cold boot does not depend on discovery.
96
+ LLAMA_THREADS=16
97
+ LLAMA_GPU_LAYERS=99
98
+
99
+ LLAMA_CACHE_TYPE_K=q4_0
100
+ LLAMA_CACHE_TYPE_V=q4_0
101
+
102
+ LLAMA_BATCH_SIZE=512
103
+ LLAMA_UBATCH_SIZE=512
104
+
105
+ # DFlash2 speculative decoding. Unlike draft-mtp this needs a SEPARATE drafter
106
+ # file -- z-lab/Qwen3.8-27B-DFlash2-GGUF Q4_K_M, trained for this exact target.
107
+ # Q8_0 (2.0 GB) does NOT fit at this context tier; Q4_K_M (1.1 GB) does.
108
+ #
109
+ # The drafter carries its OWN 2048-token sliding window, so its KV cache is
110
+ # ~80 MiB at f16 regardless of the target's 131072/slot -- which is why this
111
+ # fits without cutting context or slots. Do not "fix" that by setting
112
+ # LLAMA_DRAFT_CTX_SIZE; leaving it unset is what keeps the KV small.
113
+ #
114
+ # n-min and p-min are pinned to 0 DELIBERATELY. The measurement above was taken
115
+ # with llama.cpp's defaults for a dflash drafter (n_min=0, p_min=0.00, per the
116
+ # server's own startup line). The continuity script always passes both flags, so
117
+ # leaving the draft-mtp values (1 / 0.75) here would gate the block-diffusion
118
+ # drafter on a per-token probability it was never measured with, and the numbers
119
+ # above would no longer describe what runs.
120
+ LLAMA_ENABLE_SPEC_DECODING=true
121
+ LLAMA_SPEC_TYPE=draft-dflash
122
+ LLAMA_DRAFT_MODEL=/home/cogtek/Downloads/Qwen3.8-27B-DFlash2-Q4_K_M.gguf
123
+ LLAMA_DRAFT_GPU_LAYERS=99
124
+ LLAMA_DRAFT_MAX=4
125
+ LLAMA_DRAFT_MIN=0
126
+ LLAMA_DRAFT_P_MIN=0
127
+
128
+ # Sampling requested for this profile (llama-server defaults are top-p 0.95,
129
+ # top-k 40, temp 0.8 when unset -- see scripts/run-llama-server-continuity.sh).
130
+ LLAMA_TEMP=0.7
131
+ LLAMA_TOP_P=0.8
132
+ LLAMA_TOP_K=20
133
+
134
+ LLAMA_REPEAT_PENALTY=1.0
135
+ # LLAMA_CACHE_REUSE stays unset here (carried over from the previous Qwen3.6
136
+ # profile, where it never took effect). --cache-reuse (in-slot prompt PREFIX
137
+ # reuse) is disabled at load time in server-context.cpp whenever
138
+ # llama_kv_cache::get_can_shift() is false, which holds on three architectural
139
+ # conditions, none of them a flag: arch==STEP35; n_pos_per_embd()>1 (M-RoPE);
140
+ # or any layer with k_idx ("shifting would leave k_idx stale" -- the GDN
141
+ # linear-attention layers). qwen35-arch models (3.6, 3.8) trip the latter.
142
+ # The host-side prompt cache (--cache-ram) and --ctx-checkpoints are the
143
+ # mechanisms that DO run here.
144
+ LLAMA_SLOT_SAVE_PATH=/home/cogtek/.cache/inference/kv-slots
145
+ LLAMA_LOG_FILE=/home/cogtek/llama.cpp/llama-server.log
146
+ LLAMA_N_PREDICT=32768
147
+
148
+ # CHAT TEMPLATE (2026-08-20): switched from qwen3.5-enhanced.jinja to
149
+ # qwen-sharp.jinja -- peculiar-ragdoll/Qwen-Sharp-Chat-Templates
150
+ # (template_version qwen3.8-froggeric-v22.1), vendored verbatim at
151
+ # tools/agents/config/qwen-sharp.jinja. It targets Qwen 3.5/3.6/3.8 and is the
152
+ # template for ALL qwen models here. Pinned artifact -- both are asserted in
153
+ # test/chat-template-system-message.test.ts so a silent re-vendor fails CI:
154
+ # upstream revision 3dc34df52c63dd22ada21f96435e069deaa8d7da (2026-08-18)
155
+ # file sha256 d1f22a89eac3609dcfaa7b471b1f7d23bee2f084d275d26f4f8231d1d7908f4e
156
+ #
157
+ # WHAT IT FIXES: qwen3.5-enhanced.jinja hard-raised
158
+ # 'No user query found in messages.' -- a server-side failure for the whole
159
+ # request -- whenever no user turn survived its backwards scan, i.e. when every
160
+ # user turn was a <tool_response> or when the transcript was system+assistant
161
+ # only. Both shapes occur in normal agent loops. qwen-sharp renders them.
162
+ #
163
+ # WHAT STAYS COMPATIBLE (rendered and compared, not assumed):
164
+ # * the tool-call contract the model is told to EMIT is unchanged:
165
+ # <tool_call><function=NAME><parameter=K>V</parameter></function></tool_call>.
166
+ # anthropic_proxy.py's _HERMES_FUNCTION_RE / _TOOL_CALL_XML_RE parse it
167
+ # unchanged. The default is selected at render time by `_tool_format`, so
168
+ # the test asserts on RENDERED output -- the file contains a JSON emitter
169
+ # too, and a grep cannot tell which one is live.
170
+ # * the generation prompt matches the old template in BOTH enable_thinking
171
+ # states, so --reasoning auto --reasoning-format deepseek is unaffected.
172
+ # * a mid-conversation system message renders inline in both templates.
173
+ #
174
+ # WHAT ACTUALLY DIFFERS -- known and accepted:
175
+ # * HISTORY rendering of prior tool calls differs in whitespace only: with
176
+ # string-form `arguments` (the proxy's path -- it json.dumps them) the old
177
+ # template emitted "}\n</function>", the new one "}</function>"; and the
178
+ # separator between two tool calls in one assistant turn went "\n" ->
179
+ # "\n\n". Neither changes what the parsers accept.
180
+ # * the injected tool-calling instruction block was rewritten upstream: it now
181
+ # requires a <think> block before each tool call and forbids prose before
182
+ # the call. Behavioural, deliberate, not a wire change.
183
+ # * a system message containing an IMAGE now raises. Unreachable via the
184
+ # proxy, which flattens system to a text string before dispatch
185
+ # (anthropic_proxy.py ~4709). Direct-to-:8080 OpenAI clients can hit it.
186
+ # * unknown message roles no longer raise; they render as "[role]: content".
187
+ # * prior <think> blocks are retained across turns. Upstream sells this as a
188
+ # prompt-cache win; on the PROXY path it is a no-op, because the proxy
189
+ # already strips <think> from prior assistant turns on purpose
190
+ # (anthropic_proxy.py ~4725: "Stripping breaks the copy cycle"). On the
191
+ # direct path it re-introduces exactly that cycle -- pass
192
+ # chat_template_kwargs.preserve_thinking=false there if it shows up.
193
+ #
194
+ # chat_template_kwargs.reasoning_effort accepts
195
+ # none|minimal|low|medium|high|xhigh|max. NOTE: 'none' forces thinking OFF,
196
+ # overriding enable_thinking=true.
197
+ # Do NOT switch this to "embedded" -- the model's own baked-in template still
198
+ # carries the 'System message must be at the beginning.' raise.
199
+ LLAMA_CHAT_TEMPLATE_FILE=/home/cogtek/dev/miller-tech/universal-agent-protocol/tools/agents/config/qwen-sharp.jinja
200
+
201
+ # --cache-ram sizing inherited unchanged from the previous profile (measured
202
+ # working set was for a different model, but the host-RAM cache mechanism
203
+ # and its OOM history apply regardless of which model is loaded on the GPU
204
+ # side). Re-measure with the eviction grep in qwen36-35b-a3b.env's history
205
+ # if this model's prefill/eviction pattern differs materially.
206
+ #
207
+ # FLAG DRIFT: upstream renamed --checkpoint-every-n-tokens (old b8780
208
+ # spelling) to --checkpoint-min-step. An unknown flag makes llama-server
209
+ # exit 1, and systemd then burns its restart budget looping on it. Re-check
210
+ # every flag here against `llama-server --help` whenever LLAMA_BIN moves.
211
+ LLAMA_EXTRA_ARGS=--metrics --jinja --prio 2 --reasoning auto --reasoning-format deepseek --reasoning-budget 8000 --ctx-checkpoints 64 --checkpoint-min-step 2048 --cache-ram 16384
@@ -0,0 +1,155 @@
1
+ # =====================================================================
2
+ # Qwen 3.8 27B (dense, UD-IQ4_XS) @ 131072 ctx/slot / 2 slots, native MTP spec
3
+ # decoding on llama.cpp master (f466cfa38, 2026-08-20) — 2026-08-20
4
+ # Service: uap-llama-server.service -> scripts/run-llama-server-continuity.sh
5
+ # Install: cp to ~/.config/uap/llama-server.env
6
+ #
7
+ # WHY THIS BUILD: previous profile (qwen36-35b-a3b.env, kept alongside this
8
+ # file) ran a stale mtp-port worktree binary ~5 months behind upstream, with
9
+ # spec decoding off. Investigated wiring in the operator's local "dflash"
10
+ # tree-kernel / DDTree branches for tree-mode speculative verification on
11
+ # hybrid SSM+attention models; found upstream (commit 4e732e0a6, "llama:
12
+ # allow partial seq_rm for GDN models for speculative decoding") already
13
+ # merged the same core mechanism natively, and the remaining DDTree/tree-
14
+ # topology piece has no upstream equivalent and would need fresh kernel R&D,
15
+ # not a port -- deferred rather than shipped half-verified. This profile is
16
+ # instead plain upstream master + native `draft-mtp`, which measured 60-91%
17
+ # draft acceptance and no corruption/crashes across single, 5x-consecutive,
18
+ # multi-turn, and -np 2 concurrent validation queries.
19
+ #
20
+ # WHY MTP WORKS HERE (unlike the old profile's note below): Qwen3.8-27B-
21
+ # UD-IQ4_XS.gguf is a DENSE qwen35-arch model with a native MTP head baked
22
+ # into the checkpoint (blk.64.nextn.* tensors) -- confirmed via `gguf`
23
+ # tensor dump. The old profile's "MTP is a no-op" finding was specifically
24
+ # about a MoE (A3B) model; it does not apply here. No -md draft model file
25
+ # is used or needed -- draft-mtp reads the head from LLAMA_MODEL itself.
26
+ #
27
+ # CONTEXT BUDGET: --ctx-size is the TOTAL across slots, /props reports the
28
+ # PER-SLOT figure. 262144 / 2 slots = 131072 tokens/slot (2026-08-20: raised
29
+ # from 65536/slot per operator request). See
30
+ # docs/guides/QWEN36_LLAMACPP.md#measured-qwen38-27b-dense--native-draft-mtp-rtx-3090-24-gb
31
+ # for measured VRAM headroom at both tiers on this card (24 GiB) -- at
32
+ # 131072/slot only ~0.95 GiB is free, verified stable but thin; drop back to
33
+ # 65536/slot first if instability appears under real concurrent load. Keep
34
+ # PROXY_CONCURRENCY_LIMIT == slot count and PROXY_CONTEXT_WINDOW == per-slot
35
+ # context (anthropic-proxy.env; re-derive from /props if this changes).
36
+ # =====================================================================
37
+ LLAMA_BIN=/home/cogtek/llama.cpp/.worktrees/dflash-mtp-upgrade/build-cuda/bin/llama-server
38
+ LLAMA_MODEL=/home/cogtek/Downloads/Qwen3.8-27B-UD-IQ4_XS.gguf
39
+ # CONFIRMED INCOMPATIBLE 2026-08-20: mmproj-BF16.gguf crashed the server on
40
+ # load -- "mismatch between text model (n_embd = 5120) and mmproj
41
+ # (n_embd = 2048)". It was built for a different, smaller model's vision
42
+ # tower, not Qwen3.8-27B (n_embd 5120). Same applies to mmproj-F16.gguf
43
+ # (same family of file, unverified for this model). Do not re-enable either
44
+ # without a projector confirmed to report n_embd=5120 for its text side.
45
+ # "none" is a real opt-out (added to the continuity script 2026-08-20); an
46
+ # empty value is NOT equivalent -- it still falls through to auto-detect,
47
+ # which is how this got picked up in the first place.
48
+ LLAMA_MMPROJ=none
49
+
50
+ LLAMA_HOST=0.0.0.0
51
+ LLAMA_PORT=8080
52
+ LLAMA_CTX_SIZE=262144
53
+ LLAMA_PARALLEL=2
54
+ LLAMA_THREADS=16
55
+ LLAMA_GPU_LAYERS=99
56
+
57
+ LLAMA_CACHE_TYPE_K=q4_0
58
+ LLAMA_CACHE_TYPE_V=q4_0
59
+
60
+ LLAMA_BATCH_SIZE=512
61
+ LLAMA_UBATCH_SIZE=512
62
+
63
+ # Native MTP speculative decoding (self-contained, no draft model file).
64
+ # Measured 2026-08-20: 60-91% draft acceptance, stable under -np 2
65
+ # concurrency and 5x-consecutive/multi-turn stress, no crashes/corruption.
66
+ LLAMA_ENABLE_SPEC_DECODING=true
67
+ LLAMA_SPEC_TYPE=draft-mtp
68
+ LLAMA_DRAFT_MAX=2
69
+ LLAMA_DRAFT_MIN=1
70
+ LLAMA_DRAFT_P_MIN=0.75
71
+
72
+ # Sampling requested for this profile (llama-server defaults are top-p 0.95,
73
+ # top-k 40, temp 0.8 when unset -- see scripts/run-llama-server-continuity.sh).
74
+ LLAMA_TEMP=0.7
75
+ LLAMA_TOP_P=0.8
76
+ LLAMA_TOP_K=20
77
+
78
+ LLAMA_REPEAT_PENALTY=1.0
79
+ # LLAMA_CACHE_REUSE stays unset here (carried over from the previous Qwen3.6
80
+ # profile, where it never took effect). --cache-reuse (in-slot prompt PREFIX
81
+ # reuse) is disabled at load time in server-context.cpp whenever
82
+ # llama_kv_cache::get_can_shift() is false, which holds on three architectural
83
+ # conditions, none of them a flag: arch==STEP35; n_pos_per_embd()>1 (M-RoPE);
84
+ # or any layer with k_idx ("shifting would leave k_idx stale" -- the GDN
85
+ # linear-attention layers). qwen35-arch models (3.6, 3.8) trip the latter.
86
+ # The host-side prompt cache (--cache-ram) and --ctx-checkpoints are the
87
+ # mechanisms that DO run here.
88
+ LLAMA_SLOT_SAVE_PATH=/home/cogtek/.cache/inference/kv-slots
89
+ LLAMA_LOG_FILE=/home/cogtek/llama.cpp/llama-server.log
90
+ LLAMA_N_PREDICT=32768
91
+
92
+ # CHAT TEMPLATE (2026-08-20): switched from qwen3.5-enhanced.jinja to
93
+ # qwen-sharp.jinja -- peculiar-ragdoll/Qwen-Sharp-Chat-Templates
94
+ # (template_version qwen3.8-froggeric-v22.1), vendored verbatim at
95
+ # tools/agents/config/qwen-sharp.jinja. It targets Qwen 3.5/3.6/3.8 and is the
96
+ # template for ALL qwen models here. Pinned artifact -- both are asserted in
97
+ # test/chat-template-system-message.test.ts so a silent re-vendor fails CI:
98
+ # upstream revision 3dc34df52c63dd22ada21f96435e069deaa8d7da (2026-08-18)
99
+ # file sha256 d1f22a89eac3609dcfaa7b471b1f7d23bee2f084d275d26f4f8231d1d7908f4e
100
+ #
101
+ # WHAT IT FIXES: qwen3.5-enhanced.jinja hard-raised
102
+ # 'No user query found in messages.' -- a server-side failure for the whole
103
+ # request -- whenever no user turn survived its backwards scan, i.e. when every
104
+ # user turn was a <tool_response> or when the transcript was system+assistant
105
+ # only. Both shapes occur in normal agent loops. qwen-sharp renders them.
106
+ #
107
+ # WHAT STAYS COMPATIBLE (rendered and compared, not assumed):
108
+ # * the tool-call contract the model is told to EMIT is unchanged:
109
+ # <tool_call><function=NAME><parameter=K>V</parameter></function></tool_call>.
110
+ # anthropic_proxy.py's _HERMES_FUNCTION_RE / _TOOL_CALL_XML_RE parse it
111
+ # unchanged. The default is selected at render time by `_tool_format`, so
112
+ # the test asserts on RENDERED output -- the file contains a JSON emitter
113
+ # too, and a grep cannot tell which one is live.
114
+ # * the generation prompt matches the old template in BOTH enable_thinking
115
+ # states, so --reasoning auto --reasoning-format deepseek is unaffected.
116
+ # * a mid-conversation system message renders inline in both templates.
117
+ #
118
+ # WHAT ACTUALLY DIFFERS -- known and accepted:
119
+ # * HISTORY rendering of prior tool calls differs in whitespace only: with
120
+ # string-form `arguments` (the proxy's path -- it json.dumps them) the old
121
+ # template emitted "}\n</function>", the new one "}</function>"; and the
122
+ # separator between two tool calls in one assistant turn went "\n" ->
123
+ # "\n\n". Neither changes what the parsers accept.
124
+ # * the injected tool-calling instruction block was rewritten upstream: it now
125
+ # requires a <think> block before each tool call and forbids prose before
126
+ # the call. Behavioural, deliberate, not a wire change.
127
+ # * a system message containing an IMAGE now raises. Unreachable via the
128
+ # proxy, which flattens system to a text string before dispatch
129
+ # (anthropic_proxy.py ~4709). Direct-to-:8080 OpenAI clients can hit it.
130
+ # * unknown message roles no longer raise; they render as "[role]: content".
131
+ # * prior <think> blocks are retained across turns. Upstream sells this as a
132
+ # prompt-cache win; on the PROXY path it is a no-op, because the proxy
133
+ # already strips <think> from prior assistant turns on purpose
134
+ # (anthropic_proxy.py ~4725: "Stripping breaks the copy cycle"). On the
135
+ # direct path it re-introduces exactly that cycle -- pass
136
+ # chat_template_kwargs.preserve_thinking=false there if it shows up.
137
+ #
138
+ # chat_template_kwargs.reasoning_effort accepts
139
+ # none|minimal|low|medium|high|xhigh|max. NOTE: 'none' forces thinking OFF,
140
+ # overriding enable_thinking=true.
141
+ # Do NOT switch this to "embedded" -- the model's own baked-in template still
142
+ # carries the 'System message must be at the beginning.' raise.
143
+ LLAMA_CHAT_TEMPLATE_FILE=/home/cogtek/dev/miller-tech/universal-agent-protocol/tools/agents/config/qwen-sharp.jinja
144
+
145
+ # --cache-ram sizing inherited unchanged from the previous profile (measured
146
+ # working set was for a different model, but the host-RAM cache mechanism
147
+ # and its OOM history apply regardless of which model is loaded on the GPU
148
+ # side). Re-measure with the eviction grep in qwen36-35b-a3b.env's history
149
+ # if this model's prefill/eviction pattern differs materially.
150
+ #
151
+ # FLAG DRIFT: upstream renamed --checkpoint-every-n-tokens (old b8780
152
+ # spelling) to --checkpoint-min-step. An unknown flag makes llama-server
153
+ # exit 1, and systemd then burns its restart budget looping on it. Re-check
154
+ # every flag here against `llama-server --help` whenever LLAMA_BIN moves.
155
+ LLAMA_EXTRA_ARGS=--metrics --jinja --prio 2 --reasoning auto --reasoning-format deepseek --reasoning-budget 8000 --ctx-checkpoints 64 --checkpoint-min-step 2048 --cache-ram 16384
@@ -82,10 +82,10 @@
82
82
 
83
83
  "llm_server": {
84
84
  "description": "Instance 1: Main LLM (Qwen3.5 35B A3B) — port 8080",
85
- "command": "llama-server --model /path/to/Qwen3.5-35B-A3B-UD-IQ4_XS.gguf --chat-template-file chat_template.jinja --port 8080 --host 0.0.0.0 --ctx-size 131072 --gpu-layers 99 --cache-type-k q8_0 --cache-type-v q4_0 -fa on --threads 8 --batch-size 512 --ubatch-size 256 --mlock --metrics --n-predict 16384 --temp 0.3 --top-p 0.9 --top-k 20 --min-p 0.05",
85
+ "command": "llama-server --model /path/to/Qwen3.5-35B-A3B-UD-IQ4_XS.gguf --chat-template-file tools/agents/config/qwen-sharp.jinja --port 8080 --host 0.0.0.0 --ctx-size 131072 --gpu-layers 99 --cache-type-k q8_0 --cache-type-v q4_0 -fa on --threads 8 --batch-size 512 --ubatch-size 256 --mlock --metrics --n-predict 16384 --temp 0.3 --top-p 0.9 --top-k 20 --min-p 0.05",
86
86
  "flags": [
87
87
  "--model /path/to/Qwen3.5-35B-A3B-UD-IQ4_XS.gguf",
88
- "--chat-template-file chat_template.jinja",
88
+ "--chat-template-file tools/agents/config/qwen-sharp.jinja",
89
89
  "--n-predict 16384",
90
90
  "--temp 0.3",
91
91
  "--top-p 0.9",
@@ -79,7 +79,7 @@
79
79
  "description": "Instance 1: Main LLM (Qwen3.6 35B A3B) — port 8080, fronted by the proxy on :4000",
80
80
  "flags": [
81
81
  "--model /path/to/Qwen3.6-35B-A3B-UD-IQ4_XS.gguf",
82
- "--chat-template-file chat_template.jinja",
82
+ "--chat-template-file tools/agents/config/qwen-sharp.jinja",
83
83
  "--n-predict 16384",
84
84
  "--temp 0.3",
85
85
  "--top-p 0.9",