Span-level hallucination detection for tool-calling dialogues. Starting from ToolACE, it injects controlled hallucinations into faithful assistant answers, then evaluates baseline detectors on how well they recover the hallucinated spans.
Three datasets are built from the same base dialogues, one corruption each:
Each dataset is balanced: every injected dialogue yields a clean (label 0, no spans) and a corrupted (label 1, one span) example in RAGTruth format.
The project uses uv. It resolves and installs
everything (including the project itself) on first run, so no separate install
step is needed — just prefix commands with uv run. To sync the environment
ahead of time:
uv sync
Also works with pixi: run
pixi installonce, then swapuv runforpixi runin the commands below.
Dataset building runs the injector through litellm.
The default generator is a local Ollama model (INJECT_MODEL / OLLAMA_API_BASE
in tool_call_eval/config.py); point --model at any
litellm-supported id to use a cloud backend instead.
Step 1 — build the datasets (writes data/{type}.parquet):
uv run tce-build --target 300
--target — number of positive (hallucinated) examples per type (default 300)--model — litellm model id used for injection--repo-id — if set, also push each type to this HF dataset repo as its own
config, loadable via load_dataset(repo_id, type)--private — create the HF dataset repo as private (used with --repo-id)Step 2 — evaluate baselines (writes results/baseline_results.json and prints a table):
uv run tce-eval --methods lettucedetect
--methods — one or more of lettucedetect, lookbacklens--types — subset of contradiction overgeneration missing_tool (default: all)data/*.parquet — the three labeled datasetsresults/baseline_results.json — per-method, per-type scoresScoring (tool_call_eval/metrics.py) reports character-level span precision/recall/F1, plus example-level detection F1 and accuracy (any predicted span vs. any gold span).
Jupyter Notebook
80.9%
Python
19.1%
Span-level hallucination detection for tool-calling dialogues. Starting from ToolACE, it injects controlled hallucinations into faithful assistant answers, then evaluates baseline detectors on how well they recover the hallucinated spans.
Three datasets are built from the same base dialogues, one corruption each:
Each dataset is balanced: every injected dialogue yields a clean (label 0, no spans) and a corrupted (label 1, one span) example in RAGTruth format.
The project uses uv. It resolves and installs
everything (including the project itself) on first run, so no separate install
step is needed — just prefix commands with uv run. To sync the environment
ahead of time:
uv sync
Also works with pixi: run
pixi installonce, then swapuv runforpixi runin the commands below.
Dataset building runs the injector through litellm.
The default generator is a local Ollama model (INJECT_MODEL / OLLAMA_API_BASE
in tool_call_eval/config.py); point --model at any
litellm-supported id to use a cloud backend instead.
Step 1 — build the datasets (writes data/{type}.parquet):
uv run tce-build --target 300
--target — number of positive (hallucinated) examples per type (default 300)--model — litellm model id used for injection--repo-id — if set, also push each type to this HF dataset repo as its own
config, loadable via load_dataset(repo_id, type)--private — create the HF dataset repo as private (used with --repo-id)Step 2 — evaluate baselines (writes results/baseline_results.json and prints a table):
uv run tce-eval --methods lettucedetect
--methods — one or more of lettucedetect, lookbacklens--types — subset of contradiction overgeneration missing_tool (default: all)data/*.parquet — the three labeled datasetsresults/baseline_results.json — per-method, per-type scoresScoring (tool_call_eval/metrics.py) reports character-level span precision/recall/F1, plus example-level detection F1 and accuracy (any predicted span vs. any gold span).
Jupyter Notebook
80.9%
Python
19.1%