kulono / multi-model-verifier
blob · README.md · md
← filesrepo
README.mdmd
1# multi-model-verifier
2
3> One prompt, every model. If they disagree, hold the action.
4
5## The problem
6
7A single model can hallucinate — and you have no way to know. When the same
8question is asked to three or four independent models, **agreement is evidence,
9disagreement is a signal**. No mainstream agent framework ships a consensus gate.
10
11## What this does
12
131. Broadcasts the same prompt to all configured models (in parallel)
142. Collects answers, computes a **divergence score** (0 = unanimous, 1 = chaos)
153. Picks the majority answer as consensus and emits recommendations
164. Exposes a `blocked` flag so high-stakes actions can be gated
17
18Provider-agnostic: you supply a `query(model_id, prompt) -> (text, latency)` callable.
19
20## Install
21
22```bash
23pip install multi-model-verifier
24```
25
26## Usage
27
28```python
29from multi_model_verifier import broadcast_and_verify, execute_verify_multi
30
31def query(model_id: str, prompt: str):
32 # your OpenAI/Anthropic/DeepSeek call here
33 return answer_text, latency_seconds
34
35audit = broadcast_and_verify(
36 models=["gpt-4o", "claude-sonnet", "deepseek-v3"],
37 prompt="Is it safe to delete the production table?",
38 query=query,
39)
40print(audit.to_summary())
41
42# Tool-style gate:
43res = execute_verify_multi(models, prompt, query, threshold=0.3)
44if res["blocked"]:
45 raise PermissionError("Models disagree — action held for review")
46```
47
48## Design
49
50- `audit.py` — `ModelAnswer`, `VerificationAudit`, `compare_answers` (consensus math)
51- `broadcast.py` — parallel fan-out + `execute_verify_multi` gate wrapper
52
53Extracted from the tical-code agent mesh, where it runs as the `verify_multi`
54tool before high-risk actions.
55
56## License
57
58AGPL-3.0. See LICENSE.
59
100%