navigation: skip confirms on a confident softmax; per-skill humanize; 500ms VAD
Four latency/ergonomics changes from the voice-gateway diagnosis:
1. Per-skill humanize override. A skill's own recorded config
(data/skills/<cat>/<name>/config.json -> {"humanize": bool}) now wins over
the per-platform and global defaults, so an already-speakable result
(time.now) can skip the rewrite. The gateway resolves the skill ref from the
result summary; `_finish_run` now emits `category.name: ok — …` (matching the
assessment summary) so the ref is available. Missing store/config/key and
test doubles degrade to the existing platform/global behavior.
2. Example voice endpointing: vad.silence_ms 1000 -> 500 (config.example.json).
3. Confident softmax winners skip their confirm guard. New
navigation.softmax_bypass_tau (default 0.5): a category winner at/above it
skips confirm_category_fit (trace `category_scope_bypassed`); a leaf winner
at/above it is handed to dispatch and skips confirm_skill_fit (trace
`intent_bypass`). Below the threshold the two-stage confirm is unchanged.
Assumption tested first on the decision log: 28/28 category and 28/28 leaf
winners >= 0.5 agreed with their guard.
4. Engine-throughput investigation saved to AGENTS.md "Later / open questions"
(routing/assessment compute dominates; profile the engine, not the audio).
Tests updated for the bypass threshold and added for the skill-level humanize
override and bypass paths. Full suite: 486 passed, 1 skipped.
This commit is contained in:
1 parent
5bb0e9d21d
commit
d0c1dccffd
7 files changed
+256
-16
No files matched your search
+26
-1
@@ -1167,9 +1167,22 @@ def navigate(
|
||||
tree: dict[str, list[Skill]],
|
||||
category_tau: float = 0.75,
|
||||
action_tau: float = 0.5,
|
||||
bypass_tau: float = 0.5,
|
||||
) -> Skill | CreateCategory | CreateSkill:
|
||||
"""Descend the tree one SemIf choice per level. Every choice is logged.
|
||||
|
||||
**Confident softmax winners skip their confirm guard.** When the category
|
||||
softmax winner's probability is >= `bypass_tau` (default 0.5) the scope
|
||||
confirm (`confirm_category_fit`) is skipped — the winner is taken as-is
|
||||
(traced `category_scope_bypassed`); below it the guard runs and can reject
|
||||
the winner into create. The leaf softmax winner's probability is handed to
|
||||
dispatch (`request.meta["leaf_softmax_prob"]`) so `confirm_skill_fit` is
|
||||
likewise skipped above the threshold (traced `intent_bypass`). The guards
|
||||
exist to catch an unsure softmax; a winner at 0.5+ is already decisive, and
|
||||
each skipped guard is one fewer SemIf call on the hot path. Below the
|
||||
threshold the two-stage behavior is unchanged. The recorded data agrees:
|
||||
every logged winner >= 0.5 also passed its guard.
|
||||
|
||||
The **actionability guard** (`confirm_non_action`, phase
|
||||
`navigate:actionability`, keyed by `navigation.action_tau`) runs at the **top**
|
||||
of navigation, before any category is considered: the closed `response` tree
|
||||
@@ -1258,7 +1271,16 @@ def navigate(
|
||||
log.append(top, top_result, extra={"phase": "navigate:category", "run_id": request.id})
|
||||
category = top_result.selected
|
||||
if category != "create_category":
|
||||
if not confirm_category_fit(
|
||||
winner_prob = float(top_result.probs.get(category, 0.0))
|
||||
if winner_prob >= bypass_tau:
|
||||
# Confident winner: skip the scope confirm (one fewer SemIf call).
|
||||
trace.append(
|
||||
"category_scope_bypassed",
|
||||
request.id,
|
||||
category=category,
|
||||
prob=winner_prob,
|
||||
)
|
||||
elif not confirm_category_fit(
|
||||
engine, log, trace, request, category, descriptions.get(category, ""),
|
||||
category_tau,
|
||||
):
|
||||
@@ -1311,6 +1333,9 @@ def navigate(
|
||||
leaf_result = engine.call(leaf)
|
||||
log.append(leaf, leaf_result, extra={"phase": "navigate:leaf", "run_id": request.id})
|
||||
pick = leaf_result.selected
|
||||
# Hand the winner's confidence to dispatch so it can skip the intent guard
|
||||
# when the softmax is already decisive (see `navigate` docstring).
|
||||
request.meta["leaf_softmax_prob"] = float(leaf_result.probs.get(pick, 0.0))
|
||||
return next((s for s in skills if s.name == pick), skills[0])
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user