Skip to main content

HalluStream

CI Open in Colab

HalluStream catches a language model making things up while it writes. A small linear probe reads the model's hidden states and flags the names, dates, places and titles it is probably inventing. It doesn't generate extra text or search the web, and it adds about 3–7% to generation time.

The project page replays real runs with the flags appearing live.

Qwen3-4B writing a biography; likely made-up facts are highlighted as each sentence is checked

A real, unedited run with Qwen3-4B (recorded with the previous version of the detector). The flags land on invented facts: her birth date, her mother, a brother, and films and years she was never in.

Quick start

pip install "hallustream[entities] @ git+https://github.com/pranav-sethia/hallustream"
hallustream "Tell me about A Caribbean Mystery."

That answers the question and highlights the details that are likely made up. There is also hallustream chat, score for checking an answer the model already wrote, and batch for whole files. From Python:

from hallustream import Detector

det = Detector.from_pretrained("qwen3-4b")
report = det.generate("Tell me a bio of Kiara Advani.")
print(report.summary())

It needs a GPU or an Apple Silicon Mac for Qwen3-4B, and Python 3.10 or newer. The Colab notebook runs on the free tier. More in LIBRARY.md.

Results

Every test below was written down in EVAL_PROTOCOL.md before it was run, choices were made on separate validation data, and each test set was scored once. The details are in RESULTS.md.

Against the paper it builds on

The probe comes from Obeso et al. (2025), who released probes for several models. I ran their released probes through my own pipeline, then changed two things: the layer is picked on validation instead of fixed near the end, and the training is tuned on validation. The model is never changed. On the paper's own data and test sets, scored on exactly the same details as the paper's released probes:

AUROC on LongFact / LongFact++ Paper's linear probe Paper's LoRA probe (fine-tunes the model) HalluStream
Qwen2.5-7B 0.839 / 0.847 0.884 / 0.889 0.894 / 0.896
Llama-3.1-8B 0.848 / 0.862 0.889 / 0.900 0.872 / 0.891

HalluStream beats the paper's linear probe on both models (+0.050 to +0.055 on Qwen2.5-7B, +0.024 to +0.029 on Llama-3.1-8B), and on Qwen2.5-7B it also beats the probe that fine-tunes the model (+0.010 / +0.008). On Llama-3.1-8B, the model with the most training data in the paper, fine-tuning still wins (by 0.017 / 0.009). On the paper's HealthBench set of medical answers, never used here before, the same holds: 0.874 against 0.849 (linear) and 0.892 (LoRA). Every difference holds at 95% confidence.

On the model's own writing

The paper trains on other models' answers. HalluStream also adapts the probe to the model's own writing. Tested on Qwen3-4B's texts about people and other subjects drawn fresh from Wikipedia after the detector was frozen:

AUROC 437 new people 498 new subjects
The model's own confidence (max entropy) 0.660 0.684
The paper's recipe on Qwen3-4B 0.814 0.780
HalluStream 0.874 0.854

Comparing only details about the same subject, which removes the easy part of telling obscure subjects from famous ones, HalluStream still leads the model's confidence 0.87 to 0.75 and 0.85 to 0.75. Its risk reads as a probability: of the details it gives 90–100% risk, 96% are unsupported.

Inside SHARS

SHARS (ICML 2026) reduces hallucination by writing an answer one sentence at a time and redoing sentences whose facts look doubtful. Its own detector samples extra answers for every fact. I swapped in HalluStream, changed nothing else, and ran both detectors at several settings on all 182 of SHARS's test people:

False against true claims per person for each detector and setting

The two detectors trace about the same trade-off between true and false claims, and HalluStream gets there 4.5–6x faster end to end (34–49 s per biography against 211–222 s), with about 140x less time spent on detection. At the same answer rate it has the same numbers of true and false claims; set more cautiously it goes further, down to 1.7 false claims per person. A first comparison reported 44% fewer false claims than SHARS's detector; that compared a cautious HalluStream setting with a permissive one of SHARS's, and the runs at matched settings above replace it.

How it was tested

  • Pre-registered: each test's settings and pass bars were committed before it ran. Experiments that were stopped are kept in the protocol's appendix with their outcomes.
  • Reproduced first: the paper's released Qwen2.5-7B probe, run through this pipeline, gives 0.8384 / 0.8469 against the published 0.8383 / 0.8467.
  • Fresh test data: the own-writing test used 1,100 people and subjects sampled after the detector was frozen.
  • A validated fact checker: labels come from Gemini reading the subject's Wikipedia page. Against FActScore's human labels it gets 89% balanced accuracy on 11,049 facts. A stronger model re-checking its labels blind agreed on 84–91%; it marks made-up details reliably and leans toward accepting doubtful ones.

Limits

The probe needs the model's hidden states, so it works on open-weight models, and each model needs its own probe; the bundled one is for Qwen3-4B-Instruct-2507. It holds back what the model would make up but can't add facts the model doesn't know; when a source is available, retrieval does that better (an early pilot here reached 96% precision by retrieving the person's Wikipedia page). The own-writing labels come from a fact checker that only reads Wikipedia, and the adapted probe was fitted on that checker's labels; a stronger judge did not confirm its precision gains inside SHARS.

Repository

  • src/hallustream/: the library (detector, probe, entity finder, CLI, SHARS plug-in, bundled weights)
  • src/hallustream/research/: data, training, evaluation, the fact checker and the analysis scripts
  • modal_jobs/: the GPU and batch jobs, run on Modal
  • configs/: frozen settings and fixed lists of people and subjects
  • results/public/: labels, scores and texts behind every reported number
  • notebooks/: the Colab quickstart
  • tests/: unit tests and a package install test, run in CI

Data sources and licenses are in DATA.md.

Credits

To cite this project, see CITATION.cff.

License

Apache-2.0

Metadata

Release files for hallustream 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hallustream 0.2.0
File Size Uploaded Provenance Actions
hallustream-0.2.0.tar.gz 180.9 kB Without provenance Details for hallustream-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hallustream 0.2.0
File Interpreter ABI Platform Actions
hallustream-0.2.0-py3-none-any.whl Python 3 none any Details for hallustream-0.2.0-py3-none-any.whl

Total release size: 287.5 kB

Release files / hallustream-0.2.0.tar.gz

Download URL hallustream-0.2.0.tar.gz
Size 180.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ce013d8900592e7b95bef842350dd7691da6135002bafad54385357c26a1a5a1
BLAKE2b-256 checksum
How to use checksums
aa232f9c719528f8f7bfdfd7d44925ad30c7d5523f8bb466f6404c3aa675330c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Release files / hallustream-0.2.0-py3-none-any.whl

Download URL hallustream-0.2.0-py3-none-any.whl
Size 106.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e75f36a84c8f4dff672b364f0c988abe901b4fb2dd9f2a2ac3bee8d7e20d9a8b
BLAKE2b-256 checksum
How to use checksums
4e024c10ae18d1c96bd0629a380e27c7dcc806626a59f6d60c25ee0809de796b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Security for hallustream 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page