Atomic Trust™ TPF
Free uncertainty quantification for diffusion language models.
The Discovery
TPF (Tokens-Per-Forward) reveals generation confidence in diffusion LLMs at zero cost.
| Query | TPF | Interpretation |
|---|---|---|
| 7 × 8 = ? | 13.58 | High confidence (pattern retrieval) |
| 23 × 17 = ? | 2.68 | Low confidence (active computation) |
Your model is telling you when it's uncertain. Listen.
Correlation: r = -0.88 (p < 0.001) between TPF and output entropy across 28 benchmarks.
Inverse Signal: Hallucination Detection
Low TPF on uncertain query → Expected (honest uncertainty)
High TPF on uncertain query → Potential fabrication (flag for review)
This bidirectional signal is structurally unavailable in autoregressive models.
FlashAPCE: Attention Verification
FlashAPCE enables attention verification inside FlashAttention's tiled computation without materializing the O(n²) attention matrix.
Verification signals extracted in-kernel:
- Conservation deviation
- Entropy fingerprint
- Attention distribution metrics
Performance: Sub-1% overhead on 7B+ parameter models.
Velado's Contradiction Theorem: D(ε) × I(ε) ≥ κ
Attacks cannot simultaneously achieve high impact AND low detectability. This is a mathematical bound, not a heuristic.
Installation
pip install atomictrust-tpf
Optional GPU dependencies:
pip install atomictrust-tpf[gpu] # torch + triton
pip install atomictrust-tpf[full] # + vllm, transformers
Quick Start
from atomictrust_tpf import TPFRLMHybrid
router = TPFRLMHybrid()
result = router.generate("What is 23 × 17?")
print(f"Answer: {result.text}")
print(f"TPF: {result.tpf_metrics.tpf:.2f}")
print(f"Route: {result.route.name}")
Architecture
┌─────────────────────────────────────────────────────────┐
│ Atomic Trust™ TPF Router │
├─────────────────────────────────────────────────────────┤
│ 1. Semantic Pre-Filter │
│ └── Catches temporal/ambiguous queries │
├─────────────────────────────────────────────────────────┤
│ 2. Diffusion Generation │
│ └── Extracts TPF + Entropy (zero-cost signals) │
├─────────────────────────────────────────────────────────┤
│ 3. Confidence-Based Routing │
│ ├── High TPF → Direct response │
│ ├── Low TPF → Escalate for verification │
│ └── Anomalous TPF → Flag for review │
├─────────────────────────────────────────────────────────┤
│ 4. FlashAPCE Verification │
│ └── Velado's Theorem guarantee │
└─────────────────────────────────────────────────────────┘
Validation
# Run test suite
pytest tests/ -v
# Quick validation
python -c "from atomictrust_tpf import TPFRLMHybrid; print('OK')"
Citation
If you use this work, please cite:
@article{velado2025tpf,
title = {Parallel Decoding as Intrinsic Uncertainty:
Tokens-Per-Forward Reveals Generation Confidence
in Diffusion Language Models},
author = {Velado, Rafael},
year = {2025},
doi = {10.5281/zenodo.18111467}
}
@article{velado2025contradiction,
title = {Velado's Contradiction Theorem: Mathematical
Guarantees for Attention Verification},
author = {Velado, Rafael},
year = {2025},
doi = {10.5281/zenodo.18079657}
}
Patents
This work is protected under US Provisional Patent Applications:
- US 63/951,960 — TPF-Based Confidence Routing (filed Dec 31, 2025)
- US 63/948,782 — FlashAPCE Attention Verification (filed Dec 26, 2025)
Open source under Apache 2.0 for research and evaluation. Commercial licensing: licensing@atomic-trust.com
Author
Rafael Velado LinkedIn · Atomic Trust™
License
Apache 2.0 with patent grant. See LICENSE.
Atomic Trust™ is a trademark of Rafael Velado.
Metadata
Release files for atomictrust-tpf 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| atomictrust_tpf-1.0.1.tar.gz | 29.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| atomictrust_tpf-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.6 kB
Release files / atomictrust_tpf-1.0.1.tar.gz
| Download URL | atomictrust_tpf-1.0.1.tar.gz |
|---|---|
| Size | 29.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6de31b63f99a7f79cf28236c4dd03bf7dec823dc46df072daa34b234d5dbf2f0
|
|
BLAKE2b-256 checksum How to use checksums |
c7aa95cd320013dd26d5ae6912090cd9eaa0b8a5bfff0e460634ff47021ffb9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / atomictrust_tpf-1.0.1-py3-none-any.whl
| Download URL | atomictrust_tpf-1.0.1-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
640abcfa961dbe2206b71a3b9f853c2f7a4ae64322db827c518f0e3b601d83e5
|
|
BLAKE2b-256 checksum How to use checksums |
50b761ddaa9bc9e5affd483bc5c9c5771a640120a102012462e1ff822d69fddc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|