@miller-tech/uap 1.172.1 → 1.172.6

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.
@@ -0,0 +1,145 @@
1
+ # =====================================================================
2
+ # Gemma 4 26B-A4B (MoE) @ 262144 ctx — 2026-07-28
3
+ # (filename keeps "-mtp" for continuity; MTP is wired but measured OFF, below)
4
+ # Service: uap-llama-server.service -> scripts/run-llama-server-continuity.sh
5
+ # Install: cp to ~/.config/uap/llama-server.env.gemma4-26b-a4b-mtp
6
+ # ~/.config/uap/switch-profile.sh gemma4-26b-a4b-mtp
7
+ #
8
+ # WHY THIS PROFILE
9
+ # The 26B A4B is a Mixture-of-Experts: it holds 26B parameters of knowledge
10
+ # but activates only ~4B per token. That buys dense-26B-class quality at
11
+ # A4B-class decode cost, which is what makes a 250k-context agent loop
12
+ # practical on a single 24 GB card.
13
+ #
14
+ # MTP (multi-token prediction) was the original reason for this profile, but it
15
+ # measured as a no-op on this MoE — see the speculative-decoding block below for
16
+ # the A/B. Its VRAM now funds the full 262144 context instead.
17
+ #
18
+ # BINARY
19
+ # Upstream master (PR #23398 merged 2026-06-07, build b9549) now carries Gemma 4
20
+ # MTP itself, so this no longer needs the pr23398 side-build. The latest-master
21
+ # worktree build has GEMMA4 + GEMMA4_ASSISTANT, the peg-gemma4 tool-call grammar,
22
+ # and the newer spec types (dflash, eagle3) in one binary.
23
+ #
24
+ # WARNING: flag spellings drift between builds. Upstream renamed the checkpoint
25
+ # spacing flag to --checkpoint-min-step; the OLD pinned mainline build
26
+ # (/home/cogtek/llama.cpp/build/bin, b8780) still wants --checkpoint-every-n-tokens
27
+ # and the Qwen profile still passes that. Do NOT point the Qwen profile at this
28
+ # binary without fixing its EXTRA_ARGS first — the server exits 1 on an unknown
29
+ # flag, and systemd will burn its restart budget looping on it.
30
+ #
31
+ # FIT (RTX 3090, 24 GB)
32
+ # main IQ4_XS ~13.6 GB
33
+ # MTP draft head Q8_0 ~0.44 GB
34
+ # mmproj F16 (vision) ~1.14 GB
35
+ # KV q8_0/q8_0 @262144 ~4-5 GB (Gemma is KV-cheap: most layers are
36
+ # sliding-window; only the global layers
37
+ # carry full context)
38
+ # => ~20-21 GB, leaving headroom for the ub2048 compute buffers.
39
+ # If this OOMs, step LLAMA_CTX_SIZE down (262144 -> 196608 -> 131072) before
40
+ # touching quant or dropping the draft head.
41
+ # =====================================================================
42
+ LLAMA_BIN=/home/cogtek/llama.cpp/.worktrees/latest-master/build/bin/llama-server
43
+ LLAMA_MODEL=/home/cogtek/Downloads/gemma-4-26B-A4B-it-UD-IQ4_XS.gguf
44
+ LLAMA_DRAFT_MODEL=/home/cogtek/Downloads/mtp-gemma-4-26B-A4B-it-Q8_0.gguf
45
+
46
+ # Vision projector MUST be pinned. The launch script's auto-discovery falls
47
+ # back to a bare `mmproj*F16.gguf` glob in the model dir, which would match
48
+ # the Qwen projector sitting in the same directory and load a mismatched
49
+ # vision tower. Pin the Gemma-matched one explicitly.
50
+ LLAMA_MMPROJ=/home/cogtek/Downloads/mmproj-gemma-4-26B-A4B-F16.gguf
51
+
52
+ LLAMA_HOST=0.0.0.0
53
+ LLAMA_PORT=8080
54
+ # Full native context (gemma4.context_length=262144), funded by dropping MTP.
55
+ #
56
+ # Sizing is measured, not guessed. From this server's own state-save lines,
57
+ # KV costs 331.969 MiB for 17071 tokens = ~0.0194 MiB/token, so the extra
58
+ # 131072 tokens cost ~2.5 GB — against the 2.0 GB that MTP gave back, i.e.
59
+ # roughly a wash against the 21.1 GB the MTP build occupied.
60
+ #
61
+ # History worth keeping: 262144 @ --parallel 2 with ub2048 DID OOM earlier.
62
+ # The mmproj is allocated LAST, so that failure surfaces as a vision-tower
63
+ # cudaMalloc abort inside clip_model_loader rather than an obvious KV overflow
64
+ # — do not read that error as "the projector is broken".
65
+ #
66
+ # If this OOMs, step to 196608 before touching quant or dropping vision.
67
+ #
68
+ # CONTEXT BUDGET — why parallel is 2, at zero VRAM cost
69
+ # --ctx-size is the TOTAL across slots; each slot gets ctx_size / parallel, so
70
+ # moving 1 -> 2 repartitions the SAME KV rather than allocating more. Delivery
71
+ # tuning holds a session at <130k (PROXY_CONTEXT_WINDOW=130000), so a single
72
+ # 262144 slot could never use more than half its own KV.
73
+ #
74
+ # parallel 1 -> 1 x 262144 : 131072 of KV unreachable, 1 concurrent session
75
+ # parallel 2 -> 2 x 131072 : every slot at the target, 2 sessions <-- optimal
76
+ # parallel 3 -> 3 x 87381 : slots fall BELOW the 130k target
77
+ #
78
+ # 3x131072 would need ctx 393216 ~= 7.6 GB of KV at the measured 0.0194
79
+ # MiB/token, landing near 23.8/24.5 GB — too little margin, don't.
80
+ LLAMA_CTX_SIZE=262144
81
+ LLAMA_PARALLEL=2
82
+ LLAMA_THREADS=16
83
+ LLAMA_GPU_LAYERS=99
84
+
85
+ # Gemma degrades under aggressive KV quant and is KV-cheap anyway (sliding
86
+ # window on most layers) — q8_0/q8_0 is the right trade here, NOT q4_0.
87
+ LLAMA_CACHE_TYPE_K=q8_0
88
+ LLAMA_CACHE_TYPE_V=q8_0
89
+
90
+ # Agent workloads are prefill-bound (big tool-result payloads), so ubatch is
91
+ # worth VRAM — but ub2048 compute buffers are what tipped this card into OOM
92
+ # alongside the vision tower. 1024 keeps most of the prefill win.
93
+ LLAMA_BATCH_SIZE=1024
94
+ LLAMA_UBATCH_SIZE=1024
95
+
96
+ # --- MTP speculative decoding: OFF, and that is the measured choice ------
97
+ # A/B on this exact box, 1200-token generations, 2 samples per arm:
98
+ # MTP on : 105.9 / 101.8 t/s 21071 MiB
99
+ # MTP off: 103.8 / 104.7 t/s 19047 MiB
100
+ # MTP is worth nothing on this MoE and costs 2.0 GB. That matches the PR
101
+ # author's own report (">2x on dense gemma4, no speed-up on the MoE") — the
102
+ # A4B only activates ~4B params per token, so the trunk decode is already
103
+ # cheap enough that verifying a draft costs about what generating did.
104
+ #
105
+ # The 2.0 GB is NOT just the 440 MB draft head: the MTP path allocates its own
106
+ # f16 draft KV context (cache_k=f16, cache_v=f16, ctx_dft=yes) alongside it.
107
+ # Spending that on context instead is what funds ctx 262144 below.
108
+ #
109
+ # Flip ENABLE_SPEC_DECODING back to true to re-test (e.g. on a dense Gemma 4,
110
+ # where it genuinely is >2x); the draft path and its tuned params are kept
111
+ # intact below so it is a one-word change.
112
+ LLAMA_ENABLE_SPEC_DECODING=false
113
+ LLAMA_SPEC_TYPE=draft-mtp
114
+ LLAMA_DRAFT_MAX=4
115
+ LLAMA_DRAFT_MIN=1
116
+ LLAMA_DRAFT_P_MIN=0.7
117
+ LLAMA_DRAFT_GPU_LAYERS=99
118
+
119
+ # Gemma's own guidance: no repeat penalty.
120
+ LLAMA_REPEAT_PENALTY=1.0
121
+ LLAMA_CACHE_REUSE=256
122
+ LLAMA_SLOT_SAVE_PATH=/home/cogtek/.cache/inference/kv-slots
123
+ LLAMA_LOG_FILE=/home/cogtek/llama.cpp/llama-server.log
124
+ LLAMA_N_PREDICT=16384
125
+
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
128
+ # profile emits a format Gemma was never trained on and silently destroys
129
+ # tool calling.
130
+ LLAMA_CHAT_TEMPLATE_FILE=embedded
131
+
132
+ # EXTRA_ARGS append last, so --temp here overrides the script's --temp 0.3.
133
+ # Gemma sampling defaults: temp 1.0 / top-k 64 / top-p 0.95 / min-p 0.0.
134
+ # --jinja is REQUIRED: it turns on server-side rendering + parsing of Gemma's
135
+ # tool-call DSL into OpenAI-shaped tool_calls, which is what the proxy and
136
+ # opencode consume. NOTE: no --reasoning-format deepseek here — that is a
137
+ # Qwen <think> convention and does not apply to Gemma.
138
+ #
139
+ # FLAG COMPATIBILITY: these are the pr23398 build's spellings, which differ
140
+ # from mainline 8780's. In particular the checkpoint-spacing flag here is
141
+ # --checkpoint-min-step; mainline's --checkpoint-every-n-tokens does NOT exist
142
+ # on this binary and makes the server exit 1 at startup. Do not copy EXTRA_ARGS
143
+ # across from the Qwen profile (which runs on mainline) without re-checking
144
+ # each flag against `llama-server --help` for THIS binary.
145
+ LLAMA_EXTRA_ARGS=--metrics --jinja --mlock --prio 2 --temp 1.0 --top-k 64 --top-p 0.95 --min-p 0.0 --ctx-checkpoints 32 --checkpoint-min-step 2048 --cache-ram 8192
@@ -0,0 +1,69 @@
1
+ # =====================================================================
2
+ # Qwen 3.6 35B-A3B (MoE, IQ4_XS) @ 260000 ctx / 2 slots — 2026-07-28
3
+ # Service: uap-llama-server.service -> scripts/run-llama-server-continuity.sh
4
+ # Install: cp to ~/.config/uap/llama-server.env.qwen36-35b-a3b
5
+ #
6
+ # CONTEXT BUDGET — the reason parallel is 2 and not 1 or 3
7
+ # llama.cpp treats --ctx-size as the TOTAL across slots; each slot gets
8
+ # ctx_size / parallel. Delivery tuning holds a session at <130k to stay in the
9
+ # model's competent range (PROXY_CONTEXT_WINDOW=130000), so any KV beyond 130k
10
+ # in a single slot is unreachable — it can never be filled.
11
+ #
12
+ # parallel 1 -> 1 x 260000 : 130000 of KV permanently idle
13
+ # parallel 2 -> 2 x 130000 : exact fit, 2 concurrent sessions <-- optimal
14
+ # parallel 3 -> 3 x 86666 : each slot now BELOW the 130k target
15
+ #
16
+ # So 2 is not a compromise, it is the only division that both fills the KV and
17
+ # keeps every slot at the target window. Raising ctx to 390000 for 3x130000 was
18
+ # tried previously and OOMs on this card.
19
+ #
20
+ # Keep PROXY_CONCURRENCY_LIMIT equal to the slot count. If the proxy admits more
21
+ # concurrent contexts than there are slots, the extra one evicts a resident slot
22
+ # and that costs a FULL prompt reprocess — far worse than queueing.
23
+ # =====================================================================
24
+ LLAMA_BIN=/home/cogtek/llama.cpp/.worktrees/latest-master/build/bin/llama-server
25
+ LLAMA_MODEL=/home/cogtek/Downloads/Qwen3.6-35B-A3B-UD-IQ4_XS.gguf
26
+ LLAMA_MMPROJ=/home/cogtek/Downloads/mmproj-F16.gguf
27
+
28
+ LLAMA_HOST=0.0.0.0
29
+ LLAMA_PORT=8080
30
+ LLAMA_CTX_SIZE=260000
31
+ LLAMA_PARALLEL=2
32
+ LLAMA_THREADS=16
33
+ LLAMA_GPU_LAYERS=99
34
+
35
+ # Qwen tolerates q4_0 KV well (unlike Gemma) and this model is large — 17.7 GB
36
+ # of weights — so the cheap KV is what makes 260000 total fit at all.
37
+ LLAMA_CACHE_TYPE_K=q4_0
38
+ LLAMA_CACHE_TYPE_V=q4_0
39
+
40
+ LLAMA_BATCH_SIZE=512
41
+ LLAMA_UBATCH_SIZE=512
42
+
43
+ # Speculative decoding OFF, deliberately. A Qwen3.6-35B-A3B-UD-IQ4_XS-MTP.gguf
44
+ # exists on disk, but this is a MoE (A3B = ~3B active/token) and the Gemma 26B
45
+ # A4B A/B on this same box showed MTP is a no-op on MoE while costing ~2 GB
46
+ # (draft head + its own f16 draft KV). Do not wire it without re-measuring.
47
+ # Draft-model spec also crashes the Qwen3.x hybrid-memory (GDN) seq_add path.
48
+ LLAMA_ENABLE_SPEC_DECODING=false
49
+ LLAMA_SPEC_TYPE=none
50
+ LLAMA_DRAFT_MAX=3
51
+ LLAMA_DRAFT_MIN=1
52
+ LLAMA_DRAFT_P_MIN=0.75
53
+
54
+ LLAMA_REPEAT_PENALTY=1.0
55
+ LLAMA_CACHE_REUSE=256
56
+ LLAMA_SLOT_SAVE_PATH=/home/cogtek/.cache/inference/kv-slots
57
+ LLAMA_LOG_FILE=/home/cogtek/llama.cpp/llama-server.log
58
+ LLAMA_N_PREDICT=16384
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
63
+
64
+ # FLAG DRIFT: upstream renamed --checkpoint-every-n-tokens (old b8780 spelling,
65
+ # which this profile used until 2026-07-28) to --checkpoint-min-step. An unknown
66
+ # flag makes llama-server exit 1, and systemd then burns its restart budget
67
+ # looping on it. Re-check every flag here against `llama-server --help` whenever
68
+ # LLAMA_BIN moves.
69
+ LLAMA_EXTRA_ARGS=--metrics --jinja --mlock --prio 2 --reasoning auto --reasoning-format deepseek --reasoning-budget 8000 --ctx-checkpoints 64 --checkpoint-min-step 2048 --cache-ram 16384