Repository navigation
Model-capability guardrails + larger-model prerequisites (anti-fabrication, KV-cache quant, per-model n_ctx, Gemma-12B tool parsing) - #1345
Conversation
Anti-fabrication guard: detect and suppress responses where the model
claims first-person actions ("I created", "successfully updated", etc.)
without any actual tool calls — the 12B@8K fabrication pattern observed
in #1329. Tool-failure surfacing: append a warning note when tools
errored but the model's narrative omits any mention of failure.
KV-cache quantization: add KvCacheQuantType (Q8_0/Q4_0) to ChatConfig
and wire type_k/type_v through to LlamaContextParams in the llama.cpp
context — Q8_0 halves KV memory footprint with negligible quality loss,
unblocking larger models (12B@32K KV cache drops from 10.24GB to ~5GB).
Per-model n_ctx: daemon now reads context_window and default_temperature
from the model catalog (GgufModelManager::model_spec_for) rather than
falling back to ChatConfig::default()'s hardcoded 32_768.
Co-Authored-By: Claude <[email protected]>
…and KV quant wiring
Anti-fabrication guard: replace all_tool_executions.is_empty() with a
dedicated any_real_tool_calls boolean set when tool calls execute. The
old condition prevented the guard from firing in the final iteration of
any multi-iteration turn where a prior iteration made real tool calls —
exactly the scenario where a 12B model is most likely to fabricate.
Tool-failure surfacing: replace the model's response text entirely rather
than appending a warning note. Appending produced contradictory output
("The node was updated successfully. ⚠️ Note: ... encountered an error.")
KV cache quantization: add type_k/type_v to ChatModelSpec and CatalogEntry,
propagate through model_spec_for → daemon ChatConfig construction. Set
Q8_0 on gemma-4-31b-q4km (halves the ~10GB F16 KV cache at 32K context,
making 31B viable on 24GB Apple Silicon). Re-export KvCacheQuantType from
nlp-engine public API.
Skipped: trailing-space sentinel asymmetry in "i set "/"i made " — the
false-negative case (sentence-final phrase with no following character)
is implausible in real model output.
Skipped: recommended_model_spec/model_spec_for deduplication — cleanup
with no behavioral effect.
Co-Authored-By: Claude <[email protected]>
Review fixes (commit daeeadd)3 confirmed bugs addressed:
2 findings skipped:
|
…ation, KV-cache quant, per-model n_ctx, Gemma-12B tool parsing) (#1345) * Add model-capability guardrails and larger-model prerequisites (#1332) Anti-fabrication guard: detect and suppress responses where the model claims first-person actions ("I created", "successfully updated", etc.) without any actual tool calls — the 12B@8K fabrication pattern observed in #1329. Tool-failure surfacing: append a warning note when tools errored but the model's narrative omits any mention of failure. KV-cache quantization: add KvCacheQuantType (Q8_0/Q4_0) to ChatConfig and wire type_k/type_v through to LlamaContextParams in the llama.cpp context — Q8_0 halves KV memory footprint with negligible quality loss, unblocking larger models (12B@32K KV cache drops from 10.24GB to ~5GB). Per-model n_ctx: daemon now reads context_window and default_temperature from the model catalog (GgufModelManager::model_spec_for) rather than falling back to ChatConfig::default()'s hardcoded 32_768. Co-Authored-By: Claude <[email protected]> * Address review: fix fabrication guard scope, tool-failure messaging, and KV quant wiring Anti-fabrication guard: replace all_tool_executions.is_empty() with a dedicated any_real_tool_calls boolean set when tool calls execute. The old condition prevented the guard from firing in the final iteration of any multi-iteration turn where a prior iteration made real tool calls — exactly the scenario where a 12B model is most likely to fabricate. Tool-failure surfacing: replace the model's response text entirely rather than appending a warning note. Appending produced contradictory output ("The node was updated successfully.⚠️ Note: ... encountered an error.") KV cache quantization: add type_k/type_v to ChatModelSpec and CatalogEntry, propagate through model_spec_for → daemon ChatConfig construction. Set Q8_0 on gemma-4-31b-q4km (halves the ~10GB F16 KV cache at 32K context, making 31B viable on 24GB Apple Silicon). Re-export KvCacheQuantType from nlp-engine public API. Skipped: trailing-space sentinel asymmetry in "i set "/"i made " — the false-negative case (sentence-final phrase with no following character) is implausible in real model output. Skipped: recommended_model_spec/model_spec_for deduplication — cleanup with no behavioral effect. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude <[email protected]>
Closes #1332