Entropy-RAG
Entropy-Regulated Retrieval-Augmented Reasoning Author: Steven Reid (RRG314 Research Group) License: Apache 2.0 Version: 1.0.0
Overview
Entropy-RAG is a retrieval-augmented reasoning (RAG) framework based on physical and mathematical principles of entropy regulation. Conventional RAG systems retrieve the top-k most similar documents using cosine similarity alone, which often leads to semantic collapse — overly narrow or repetitive results.
Entropy-RAG models retrieval as an entropy-regulated diffusion process, balancing focus and diversity using an adaptive coupling parameter Ω (Omega). This allows retrieval to behave like a self-stabilizing physical system, maintaining semantic equilibrium across reasoning tasks.
Theoretical Basis
The system draws from:
- Recursive Entropic Field Theory (REFT): entropy as a regulator of recursive system stability
- RDT Kernel: nonlinear diffusion equation ∂L/∂t = -α·log(L) + D·∇²L
- Topological Adam: optimizer coupling gradients through energy feedback
Entropy-RAG treats retrieval as a diffusion field evolving toward equilibrium, governed by information entropy rather than temperature or noise.
Design Principles
Entropy-RAG is not a neural network itself. It is a modular retrieval and reasoning layer that can be attached to any language model (Flan-T5, LLaMA, GPT, etc.). Its role is to maintain stability and diversity in reasoning chains.
Main design goals:
- Preserve contextual diversity while staying relevant
- Prevent mode collapse in long or multi-hop retrievals
- Quantify semantic entropy in the information field
- Create a bridge between physics-based and AI-based reasoning
Features
- Entropy-balanced retrieval with adaptive Ω regulation
- Topic diversity control using entropy feedback
- Works with Hugging Face sentence-transformers
- Evaluation metrics: semantic diversity, lexical entropy, coherence
- Fully differentiable and compatible with fine-tuning pipelines
Installation
git clone https://github.com/rrg314/entropy-rag.git
cd entropy-rag
pip install -e .
Quick Start Example
from entropy_rag.entropy_index import build_index
from entropy_rag.retriever import EntropyBalancedSelector, EntropySelectorConfig
docs = [
"Entropy stabilizes diffusion by regulating potential energy.",
"Topological Adam introduces alpha-beta coupling in optimization.",
"Nonlinear PDEs improve stability in differentiable physics."
]
index = build_index(docs, n_topics=3)
selector = EntropyBalancedSelector(index, EntropySelectorConfig(Omega_mode='median'))
results = selector.retrieve('how does entropy stabilize diffusion?', k=5)
for r in results:
print('-', r)
Evaluation Example
from entropy_rag.evaluator import evaluate_entropy_rag
queries = [
'how does entropy regulate diffusion?',
'why are nonlinear PDEs important for stability?',
]
evaluate_entropy_rag(index, queries)
Example output:
| Metric | Mean | Description |
|---|---|---|
| Semantic Diversity | 0.659 | Topic variety |
| Lexical Entropy | 2.187 | Vocabulary balance |
| Context Coherence | 0.752 | Consistency of retrieved information |
Research Context
Entropy-RAG extends physical entropy models to machine learning. It combines energy-based optimization, diffusion physics, and information theory to form a retrieval engine that self-stabilizes like a physical field system.
Applications include:
- Physics-informed reasoning in neural architectures
- Long-context document retrieval
- Entropy-regulated AI systems for interpretability and balance
Future Work
- Adaptive Ω-learning from corpus feedback
- Multi-modal (text + image) retrieval
- Symbolic reasoning integration
- Empirical benchmarking vs. standard RAG frameworks
Citation
Reid, S. (2025). Entropy-Regulated Retrieval-Augmented Reasoning (Entropy-RAG). RRG314 Research Group.
License
Apache License 2.0 © 2025 Steven Reid See LICENSE for details.
Metadata
Release files for entropy-rag 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 | Provenance | Actions |
|---|---|---|---|---|
| entropy_rag-1.0.1.tar.gz | 6.1 kB | Without provenance | Details for entropy_rag-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| entropy_rag-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for entropy_rag-1.0.1-py3-none-any.whl |
Total release size: 13.0 kB
Release files / entropy_rag-1.0.1.tar.gz
| Download URL | entropy_rag-1.0.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab4bb5437f3d6f7e59b877512c5350a12ca8febe7246303ff8de295b8af91386
|
|
BLAKE2b-256 checksum How to use checksums |
d271207931e0cb48e8f4ced931673a59976b13fe1dd5809c12705111b962888e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / entropy_rag-1.0.1-py3-none-any.whl
| Download URL | entropy_rag-1.0.1-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
accdf2b37f5b1dc96fb154b7d91b998538045202b6d1d8e293171f154074e025
|
|
BLAKE2b-256 checksum How to use checksums |
f599e04fef94d325688227b42542b0b5008d222b0efc324999a7b28311c3b7bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for entropy-rag 1.0.1
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.