dutifulbob commited on
Commit
13c8d04
·
unverified ·
1 Parent(s): 3da6507

docs: add local model capability profile plan

Browse files
README.md CHANGED
@@ -18,3 +18,7 @@ diff explorer.
18
  Latest report:
19
 
20
  - `gepa-evalstate-qwen-overlay-c4-full-20260616T172947Z/final-report.html`
 
 
 
 
 
18
  Latest report:
19
 
20
  - `gepa-evalstate-qwen-overlay-c4-full-20260616T172947Z/final-report.html`
21
+
22
+ Plans:
23
+
24
+ - `experiments/2026-06-18-local-model-capability-profile-plan.md`
experiments/2026-06-18-local-model-capability-profile-plan.md ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Local Model Capability Profile Plan
2
+
3
+ Date: 2026-06-18
4
+
5
+ ## Problem
6
+
7
+ LocalPager, LocalPi, and vLLM currently have separate partial truths about the
8
+ loaded model.
9
+
10
+ - vLLM is started with runtime flags such as model id, context length, tool
11
+ parser, reasoning parser, max sequences, and batching limits.
12
+ - LocalPager worker config separately stores model id, endpoint, context window,
13
+ output token cap, timeout, and concurrency.
14
+ - Pi receives a generated `pi-config-runtime/models.json` snapshot that tells it
15
+ whether the selected model supports reasoning and which thinking request
16
+ format to use.
17
+
18
+ When these drift, the client can silently do the wrong thing. The concrete
19
+ failure found on 2026-06-18 was:
20
+
21
+ - vLLM served `nvidia/Gemma-4-26B-A4B-NVFP4` with `--reasoning-parser gemma4`.
22
+ - A direct vLLM request with `chat_template_kwargs.enable_thinking=true` returned
23
+ a real `reasoning` block.
24
+ - The generated Pi config still said `"reasoning": false`.
25
+ - LocalPi warned `thinking: off (clamped from medium)`.
26
+
27
+ vLLM did not advertise that thinking was off. Its `/v1/models` response exposed
28
+ the model id and `max_model_len`, but no reasoning capability field.
29
+
30
+ ## Goal
31
+
32
+ Create one source of truth for local model serving capabilities, then generate
33
+ the vLLM server command, LocalPager worker config, and Pi model config from that
34
+ source.
35
+
36
+ The desired invariant is:
37
+
38
+ > If port 8000 serves Gemma with reasoning enabled, LocalPager and Pi must know
39
+ > that Gemma is loaded, reasoning is supported, and the correct request shape is
40
+ > `chat_template_kwargs.enable_thinking`.
41
+
42
+ ## Proposed Design
43
+
44
+ Add a local model profile file. It should be explicit, small, and checked into
45
+ LocalPager examples for known setups. Local machine copies can live under
46
+ `~/.config/localpager/`.
47
+
48
+ Example:
49
+
50
+ ```json
51
+ {
52
+ "id": "gemma4-26b-a4b-nvfp4",
53
+ "model": "nvidia/Gemma-4-26B-A4B-NVFP4",
54
+ "base_url": "http://127.0.0.1:8000/v1",
55
+ "server": {
56
+ "runtime": "vllm",
57
+ "host": "127.0.0.1",
58
+ "port": 8000,
59
+ "max_model_len": 32768,
60
+ "max_num_seqs": 16,
61
+ "max_num_batched_tokens": 32768,
62
+ "tool_call_parser": "gemma4",
63
+ "reasoning_parser": "gemma4",
64
+ "moe_backend": "cutlass",
65
+ "kv_cache_dtype": "fp8"
66
+ },
67
+ "client": {
68
+ "context_window": 32768,
69
+ "max_tokens": 4096,
70
+ "timeout_ms": 300000,
71
+ "concurrency": 16
72
+ },
73
+ "capabilities": {
74
+ "tools": true,
75
+ "reasoning": true,
76
+ "thinking_format": "qwen-chat-template"
77
+ }
78
+ }
79
+ ```
80
+
81
+ `thinking_format: "qwen-chat-template"` is the current Pi-compatible way to send:
82
+
83
+ ```json
84
+ {
85
+ "chat_template_kwargs": {
86
+ "enable_thinking": true,
87
+ "preserve_thinking": true
88
+ }
89
+ }
90
+ ```
91
+
92
+ That request shape was verified against the local Gemma NVFP4 vLLM server.
93
+
94
+ ## Implementation Steps
95
+
96
+ 1. Add a typed model profile schema in LocalPager.
97
+ 2. Add example profiles for:
98
+ - `nvidia/Qwen3.6-35B-A3B-NVFP4`
99
+ - `nvidia/Gemma-4-26B-A4B-NVFP4`
100
+ 3. Change the vLLM launcher to read the profile and emit the server command.
101
+ 4. Change LocalPager Agent to read the same profile when generating
102
+ `pi-config-runtime/models.json`.
103
+ 5. Change LocalPager worker config examples to be generated from, or validated
104
+ against, the same profile.
105
+ 6. Keep model-name heuristics only as fallback behavior.
106
+ 7. Add explicit override fields:
107
+ - `LOCALPAGER_AGENT_REASONING`
108
+ - `LOCALPAGER_AGENT_THINKING_FORMAT`
109
+ - `LOCALPAGER_AGENT_PROFILE`
110
+ 8. Add preflight checks before benchmarks.
111
+
112
+ ## Preflight Checks
113
+
114
+ Before a benchmark or classifier run:
115
+
116
+ 1. Query `/v1/models`.
117
+ 2. Verify exactly one expected model is served.
118
+ 3. Verify served model id matches the profile and LocalPager worker config.
119
+ 4. Verify server-reported context length does not exceed the profile in an
120
+ unexpected way.
121
+ 5. Generate Pi config from the profile.
122
+ 6. Launch a tiny Pi/localpager-agent request with `--thinking medium`.
123
+ 7. Fail if Pi reports `thinking: off (clamped from medium)`.
124
+ 8. Send a direct OpenAI-compatible request with the profile's thinking format.
125
+ 9. Fail if no `reasoning` field is returned for a reasoning-enabled profile.
126
+ 10. Fail if `worker.max_concurrency` exceeds `server.max_num_seqs`.
127
+
128
+ ## Why This Is Better Than Name Guessing
129
+
130
+ Name guessing is brittle. It failed for `nvidia/Gemma-4-26B-A4B-NVFP4` because
131
+ the existing mapping recognized older Gemma 12B names but not the new NVIDIA
132
+ Gemma 4 NVFP4 id.
133
+
134
+ Server discovery is also insufficient. vLLM's OpenAI-compatible `/v1/models`
135
+ endpoint does not advertise thinking support or the required thinking request
136
+ format.
137
+
138
+ The stable solution is explicit capability declaration plus a runtime preflight.
139
+
140
+ ## Acceptance Criteria
141
+
142
+ - Gemma NVFP4 profile generates Pi config with:
143
+
144
+ ```json
145
+ {
146
+ "reasoning": true,
147
+ "compat": {
148
+ "thinkingFormat": "qwen-chat-template"
149
+ }
150
+ }
151
+ ```
152
+
153
+ - Qwen NVFP4 profile keeps its existing thinking behavior.
154
+ - Running LocalPi/LocalPager Agent with Gemma and `--thinking medium` no longer
155
+ clamps to off.
156
+ - Direct vLLM probe for Gemma returns a non-empty `reasoning` field.
157
+ - A mismatch between served model and LocalPager worker config fails preflight
158
+ before any benchmark starts.
159
+ - Benchmarks record the profile file used for the run.
160
+
161
+ ## Open Questions
162
+
163
+ - Should profiles live in LocalPager only, or should LocalPi also understand the
164
+ same file format directly?
165
+ - Should the profile schema allow multiple served models, or keep one model per
166
+ vLLM server process?
167
+ - Should preflight be a standalone command, a runner option, or both?
168
+ - Should vLLM server launch and LocalPager worker config be generated files or
169
+ validated hand-written files?