Hallucination Blocker
Reduce AI hallucinations with five research-backed verification strategies — from zero-latency prompt scaffolds to multi-agent fact checking. Manage filters from the dashboard, CLI, or SDK.
Strategies
Each filter combines a built-in heuristic detector (fabricated citations, suspicious statistics, fake DOIs/URLs, overconfident claims) with any of five active strategies:
Request-time — modify the prompt, add no latency
reactstrategyReAct (Yao et al. 2022) — injects a Thought/Action/Observation reasoning scaffold into the system prompt so the model reasons about certainty before answering.
toolformerstrategyToolformer (Schick et al. 2023) — injects verify_calculation and flag_uncertain_claim tools; the model self-verifies math and flags claims it cannot confirm.
Response-time — call a verification LLM, add latency
covestrategyChain of Verification (Dhuliawala et al. 2023) — extracts claims, answers verification questions independently, and rewrites the response if discrepancies are found.
self_ragstrategySelf-RAG (Asai et al. 2023) — scores each claim with ISREL/ISSUP/ISUSE reflection tokens; revises the response when overall confidence falls below your threshold.
marchstrategyMARCH (2025) — runs up to 5 specialist agents in parallel (fact-checker, consistency, completeness, source evaluation, bias), then synthesizes a corrected response.
react + toolformer (free, zero latency). Add cove or self_rag for factual workloads. Reserve march for high-stakes content — it makes N+1 verification calls per response.Dashboard
Navigate to Dashboard → Anti-Halluc in the sidebar. You'll see every hallucination filter on your account with its status, sensitivity, and active strategies.
Click New Filter. Name it, pick a heuristic sensitivity (low / medium / high), and check the strategies you want — each one is labeled request-time or response-time.
Selecting CoVe, Self-RAG, or MARCH reveals the verification model settings. Defaults to gpt-4o-mini via OpenAI; leave the API key blank to reuse your agent's own provider key. The Advanced panel exposes per-strategy knobs.
Select the filter when creating an agent, or attach it to an existing key with the CLI or SDK (see below). A filter that isn't attached to any key does nothing.
What you'll see
Status dot
green = enabled, gray = disabled
Sensitivity tag
heuristic detection threshold
Strategy chips
active strategies on this filter
Toggle
enable / disable without deleting
Create a Filter
/v1/user/filtersBody Parameters
namestringrequiredFilter name
filter_typestringrequiredMust be HALLUCINATION_BLOCKER
actionstringrequiredWhat to do on detection
Options: WARN, BLOCK, REDACT
apply_tostringrequiredUse RESPONSE for hallucination filters
configobjectrequiredStrategy configuration — see Config Reference below
curl -X POST https://api.metriqual.com/v1/user/filters \
-H "Authorization: Bearer YOUR_JWT" \
-H "Content-Type: application/json" \
-d '{
"name": "prod-hallucination-guard",
"filter_type": "HALLUCINATION_BLOCKER",
"action": "WARN",
"apply_to": "RESPONSE",
"config": {
"sensitivity": "medium",
"strategies": ["react", "cove"],
"verification_model": "gpt-4o-mini",
"verification_provider": "openai"
}
}'import { MQL } from '@metriqual/sdk';
const mql = new MQL({ token: 'YOUR_JWT' });
const filter = await mql.hallucination.create({
name: 'prod-hallucination-guard',
config: {
sensitivity: 'medium',
strategies: ['react', 'cove'],
verificationModel: 'gpt-4o-mini',
verificationProvider: 'openai',
},
// optional: attach immediately
proxyKeyId: 'mql-your-proxy-key',
});# Interactive (prompts for strategies & model)
mql hallucination create
# One-shot, attached to a key
mql hallucination create -n "prod-guard" \
-s react,cove --key mql-your-proxy-keyPresets
Available presets
strictpresetAll 5 strategies, high sensitivity, 5 MARCH agents. Maximum protection, maximum latency.
balancedpresetCoVe + Self-RAG, medium sensitivity. Good default for factual workloads.
fastpresetReAct + Toolformer only. Zero added latency, no verification LLM calls.
heuristicpresetPattern detection and disclaimers only — no active strategies.
// Create directly from a preset
await mql.hallucination.createFromPreset('balanced', {
name: 'balanced-guard',
proxyKeyId: 'mql-your-proxy-key',
});
// Or inspect & customize a preset first
const cfg = mql.hallucination.getPreset('balanced');
cfg.verificationModel = 'claude-3-5-haiku-20241022';
cfg.verificationProvider = 'anthropic';
await mql.hallucination.create({ name: 'custom', config: cfg });mql hallucination from-template
# → pick strict / balanced / fast / heuristicAttach to a Proxy Key
/v1/proxy-keys/:proxy_key/filtersPass the proxy key string (mql-...), not the filter ID, in the URL. Detaching works the same way with the filter removed from the list.
await mql.hallucination.attach('filter-id', 'mql-your-proxy-key');
await mql.hallucination.detach('filter-id', 'mql-your-proxy-key');mql hallucination attach FILTER_ID mql-your-proxy-key
mql hallucination detach FILTER_ID mql-your-proxy-key# Replaces ALL filter associations for the key
curl -X PATCH https://api.metriqual.com/v1/proxy-keys/mql-your-key/filters \
-H "Authorization: Bearer YOUR_JWT" \
-H "Content-Type: application/json" \
-d '{ "filter_ids": ["filter-uuid-1", "filter-uuid-2"] }'List, Update, Toggle, Delete
Hallucination filters live alongside your other content filters; the SDK's hallucination namespace pre-filters to HALLUCINATION_BLOCKER type. Updates merge into the existing config on the CLI; the SDK replaces the config object you pass.
const { filters } = await mql.hallucination.list();
await mql.hallucination.update('filter-id', {
sensitivity: 'high',
strategies: ['react', 'cove', 'march'],
marchNumAgents: 5,
});
await mql.hallucination.toggle('filter-id');
await mql.hallucination.delete('filter-id');mql hallucination list
mql hallucination update FILTER_ID \
--sensitivity high -s react,cove,march
mql hallucination toggle FILTER_ID
mql hallucination delete FILTER_ID -yTest Detection
/v1/filters/testRun the heuristic detector against sample text without creating a filter — useful for tuning sensitivity before deploying. Returns a risk level, score, and the individual signals found.
const result = await mql.hallucination.test(
'Smith et al. (2019) showed 87.3% improvement.',
{ sensitivity: 'medium' }
);
console.log(result.riskLevel); // 'Medium'
result.signals.forEach(s =>
console.log(s.category, s.score, s.excerpt));mql hallucination test \
-c "Smith et al. (2019) showed 87.3% improvement."Config Reference
config object (REST uses snake_case, TS SDK uses camelCase)
sensitivitystringHeuristic detection threshold
Default: medium
Options: low, medium, high
strategiesstring[]Active strategies to run
Default: []
Options: react, toolformer, cove, self_rag, march
verification_providerstringProvider for verification LLM calls
Default: openai
Options: openai, anthropic, gemini, mistral
verification_modelstringModel for verification passes
Default: gpt-4o-mini
verification_api_keystringKey for the verification model. Falls back to the agent’s own provider key when omitted.
timeout_secsnumberPer-strategy timeout. On timeout the original response is returned unmodified.
Default: 30
cove_max_questionsnumberCoVe: max verification questions generated
Default: 5
self_rag_confidence_thresholdnumberSelf-RAG: 0–1; responses scoring below this are revised
Default: 0.7
self_rag_mark_uncertainbooleanSelf-RAG: mark claims [UNCERTAIN] instead of removing them
Default: true
march_num_agentsnumberMARCH: parallel specialist agents (1–5)
Default: 3