Implementation:0sec labs 0 TriageFunnel
| Knowledge Sources | |
|---|---|
| Domains | Binary_Analysis, LLM_Reasoning, Triage |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete tool for cheap-to-expensive LLM-driven hypothesis triage provided by the 0verse agent module.
Description
The TriageFunnel class ranks every static hypothesis with a cheap structural score (cheap_score), then escalates only the top escalate_top candidates above escalate_threshold to an expensive LLM agent (TriageAgent). The rest receive a cheap structural verdict. This cascade keeps LLM cost bounded while preserving recall. An optional rank_bonus flywheel lifts findings matching known-fruitful past patterns — it influences only queue order and escalation gating, never the verdict. Deterministic given a deterministic LLM.
Usage
Import this class when you need to rank and triage a large set of static vulnerability hypotheses before dynamic confirmation. It is the Stage 4 component of the 0verse pipeline.
Code Reference
Source Location
- Repository: 0security
- File: 0verse/src/zeroverse/agent.py:L218-263
Signature
class TriageFunnel:
def __init__(
self,
llm: LLM,
*,
escalate_top: int = 8,
escalate_threshold: float = 0.45,
seed_bug_class: str | None = None,
rank_bonus: Callable[[Finding], float] | None = None,
) -> None: ...
def run(
self,
findings: list[Finding],
context_for: Any, # callable: Finding -> str (decompiled context)
) -> list[RankedHypothesis]: ...
@dataclass
class RankedHypothesis:
finding: Finding
score: float # cheap structural score 0..1
escalated: bool # whether the LLM agent evaluated it
verdict: Verdict # is_real, bug_class, severity, explanation, input_example
Import
from zeroverse.agent import TriageFunnel, TriageAgent, MockLLM, LLM
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| llm | LLM | Yes | Provider-neutral LLM protocol (or MockLLM for testing) |
| escalate_top | int | No | Max candidates escalated to LLM (default 8) |
| escalate_threshold | float | No | Cheap score cutoff for escalation (default 0.45) |
| seed_bug_class | str | No | Variant-analysis framing for the LLM |
| rank_bonus | Callable | No | Flywheel ordering bonus function |
| findings | list[Finding] | Yes | Static hypotheses from scan/foxguard/bugclasses |
| context_for | Callable | Yes | Function returning decompiled context per finding |
Outputs
| Name | Type | Description |
|---|---|---|
| return | list[RankedHypothesis] | Ranked hypotheses with Verdict (is_real, bug_class, severity, explanation, input_example) |
Usage Examples
With MockLLM (no API key needed)
from zeroverse.agent import TriageFunnel, MockLLM
funnel = TriageFunnel(MockLLM(), escalate_top=5)
ranked = funnel.run(findings, context_for=lambda f: f"Function {f.function}")
for rh in ranked:
print(f"{rh.finding.function} → score={rh.score:.2f} escalated={rh.escalated}")
if rh.escalated:
print(f" verdict: is_real={rh.verdict.is_real} class={rh.verdict.bug_class}")
With a real LLM provider
from zeroverse.agent import TriageFunnel
from zeroverse.llm.providers import build_llm
llm = build_llm(provider="openai", model="gpt-4o")
funnel = TriageFunnel(llm, escalate_top=10, seed_bug_class="cmdi")
ranked = funnel.run(findings, context_for)