Commit f140654
feat(cli): --chat flag now correctly routes to per-family chat templates
The previous --chat fell through to Llama 3 template for all non-Gemma
models, causing Phi-3.5 and Qwen family models to produce garbage output.
New detection order by model config + filename:
1. Gemma 4 → <|turn>user\n...<turn|>\n<|turn>model\n
(skip <|think|> — no logit suppression in CLI)
2. Gemma 2/3 → <start_of_turn>user\n...<end_of_turn>
3. Phi-3/4 → <|user|>...<|end|>\n<|assistant|>\n
4. Llama 3.x → <|start_header_id|>user<|end_header_id|>\n\n...<|eot_id|>
5. Default → ChatML (Qwen/Qwen2/Qwen3/Qwen3.5)
Verified with --chat -p "What is 2+2?":
- Phi-3.5 Q8_0: "The answer to...4. The sum of two and two equals four..."
- Llama 3.1 8B: "The answer to 2 + 2 is: 4"
- Llama 3.2 3B: "4"
- Qwen2.5-0.5B: coherent English (0.5B model limit)
- Gemma 4 E2B: partial (thinking-mode interaction)
- Qwen3.5-4B: DeltaNet short-prompt issue persists (known)
All 35 unit tests + 7 regression tests pass.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 1e8698b commit f140654
1 file changed
Lines changed: 32 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1244 | 1244 | | |
1245 | 1245 | | |
1246 | 1246 | | |
1247 | | - | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
1248 | 1254 | | |
1249 | 1255 | | |
1250 | 1256 | | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
1251 | 1270 | | |
1252 | | - | |
1253 | | - | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
1254 | 1274 | | |
1255 | | - | |
| 1275 | + | |
1256 | 1276 | | |
1257 | | - | |
1258 | 1277 | | |
1259 | 1278 | | |
1260 | | - | |
1261 | | - | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
1262 | 1284 | | |
1263 | 1285 | | |
1264 | 1286 | | |
1265 | 1287 | | |
1266 | | - | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
1267 | 1291 | | |
1268 | 1292 | | |
1269 | 1293 | | |
| |||
0 commit comments