Entropy-regulated retrieval-augmented reasoning system inspired by diffusion physics.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file entropy_rag-1.0.1.tar.gz.
File metadata
- Download URL: entropy_rag-1.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab4bb5437f3d6f7e59b877512c5350a12ca8febe7246303ff8de295b8af91386
|
|
| MD5 |
2672411bef7a24a95036a1d809e243b7
|
|
| BLAKE2b-256 |
d271207931e0cb48e8f4ced931673a59976b13fe1dd5809c12705111b962888e
|
File details
Details for the file entropy_rag-1.0.1-py3-none-any.whl.
File metadata
- Download URL: entropy_rag-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
accdf2b37f5b1dc96fb154b7d91b998538045202b6d1d8e293171f154074e025
|
|
| MD5 |
35895d3b3e6f689d35783f360105f200
|
|
| BLAKE2b-256 |
f599e04fef94d325688227b42542b0b5008d222b0efc324999a7b28311c3b7bb
|