Skip to main content

Toroidal attention constraints for reducing LLM hallucination

Project description

Topological Constraints for Coherent Language Models

Why Geometry Prevents Hallucination

Sylvain Cormier | Paraxiom Research | January 2026

Key Result

  • 40% lower semantic drift than baseline attention
  • 28x lower drift than random sparsity (negative control)
  • Proves: topology matters, not just compute reduction

Installation

pip install topological-coherence

Usage

from topological_coherence import ToroidalAttention, TinyTransformer

# Use toroidal attention in your model
attn = ToroidalAttention(d_model=64, n_heads=4, max_seq_len=64)

# Or use the full demo transformer
model = TinyTransformer(
    vocab_size=144,
    d_model=64,
    n_heads=4,
    attention_type="toroidal"  # or "baseline", "random"
)

Abstract

Residual geometry determines whether reasoning is stable. We show that transformer latent dynamics, operating on unconstrained vector spaces, lack the conserved quantities necessary for bounded inference.

Toroidal (periodic) constraints on attention provide a spectral gap guarantee that suppresses non-resonant modes, reducing semantic drift.

Links

Citation

@misc{cormier2026topological,
  author = {Cormier, Sylvain},
  title = {Topological Constraints for Coherent Language Models},
  year = {2026},
  publisher = {Zenodo},
  doi = {10.5281/zenodo.18187835}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topological_coherence-0.1.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

topological_coherence-0.1.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file topological_coherence-0.1.2.tar.gz.

File metadata

  • Download URL: topological_coherence-0.1.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for topological_coherence-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e0a9d9eb8354aec343c9117895f33c6230d7b3be4cb520c4d8fd362a4707e704
MD5 b16b4cfcb173b5b6bba7334bdc8b5892
BLAKE2b-256 fbe119b24b2f049585cac210931e3c64bd1027c10fd906da410a267e63bc6121

See more details on using hashes here.

File details

Details for the file topological_coherence-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for topological_coherence-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 25988e095666fc36100d8cf7b4c11dec08e54b35300d825e9189f2f907eb0707
MD5 9934d2090ea433612defe5ddcd713805
BLAKE2b-256 263782a742ff045586eb60f462042d1995d0c9259b30985d6e1216a61c8fb027

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page