- Introduction and Theoretical Foundation
- Mathematical Formulation
- Fundamental Differentiation From Existing Approaches
- Implementation Architecture
- Empirical Validation and Performance Metrics
- Installation and Dependencies
- Usage and API Reference
- Advanced Configuration and Optimization
- Visualization Tools
- Theoretical Implications
- Future Research Directions
- References
The Signal-Intelligent Resonance Encoding Network (SIREN) represents a fundamental paradigm shift in how we conceptualize information persistence and retrieval in the context of large language models. Rather than treating context as a sequence of tokens or a collection of static embeddings, SIREN introduces a novel first-principles approach based on The Biomimicry Equation theory, wherein information is modeled as a dynamic field that exhibits wave-like properties, self-organization, and nonlocal interactions.
At the core of our approach is the hypothesis that coherent information behaves analogously to a physical field governed by precise mathematical laws. This field, denoted ψ(x,t), represents the "coherence density" of information across a semantic space. The crucial insight is that:
- Information is not static but evolves according to well-defined field equations
- Semantic relationships manifest as resonance patterns in the field
- Nonlocal interactions allow distant but related concepts to influence each other
- Self-organization principles drive the field toward stable coherence patterns
This perspective on information dynamics draws inspiration from established physical theories while introducing novel mathematical formulations specifically designed for semantic information processing.
The traditional wave equation describes how disturbances propagate through physical media:
∂²ψ/∂t² = c²∇²ψ
Our research extends this concept to information space, where "disturbances" represent semantic concepts that propagate, interfere, and resonate with related concepts.
The complete IRE field equation incorporates:
- Wave-like propagation allowing information to travel through semantic space
- Diffusive processes enabling information to spread and influence related regions
- Potential terms driving self-organization toward coherent semantic structures
- Nonlocal interaction kernels facilitating long-range semantic connections
- Dissipative terms modeling the natural decay of information relevance over time
The resulting framework provides a mathematically rigorous foundation for understanding how information persists, evolves, and organizes itself in complex cognitive systems—principles we can now leverage for LLM context management.
The Information Relative Evolution field is governed by the following partial differential equation:
∂²ψ/∂t² + γ·∂ψ/∂t - ∇·[D(ψ)·∇ψ] + (1/2)·D'(ψ)·|∇ψ|² + V'(ψ) + ∫K(|x-x'|)·ψ(x',t)·dx' = 0
Where:
- ψ(x,t) represents the information coherence field at position x in semantic space at time t
- γ is the damping coefficient modeling information decay
- D(ψ) is the state-dependent diffusion function
- V(ψ) is the potential function driving self-organization
- K(|x-x'|) is the nonlocal interaction kernel
Each term in this equation corresponds to a fundamental aspect of information dynamics:
-
Inertial Term (
∂²ψ/∂t²): Provides the field with "memory inertia," allowing information to persist and oscillate over time. -
Damping Term (
γ·∂ψ/∂t): Models the natural decay of information relevance, creating a time-asymmetry that aligns with cognitive forgetting processes. -
Diffusion Term (
∇·[D(ψ)·∇ψ]): Enables information to spread through semantic space, with diffusion rate potentially dependent on local coherence density. -
Nonlinear Correction (
(1/2)·D'(ψ)·|∇ψ|²): Emerges naturally from the nonlinear diffusion and ensures mathematical consistency. -
Potential Term (
V'(ψ)): Drives the field toward preferred coherence states, creating stable patterns that correspond to well-formed semantic structures. -
Nonlocal Term (
∫K(|x-x'|)·ψ(x',t)·dx'): Facilitates long-range interactions between semantically related concepts, even when distant in the embedding space.
The IRE field equation can be derived from a variational principle based on the following action functional:
S[ψ] = ∫[(1/2)·(∂ψ/∂t)² - (D(ψ)/2)·|∇ψ|² - V(ψ) - (1/2)·∫K(|x-x'|)·ψ(x)·ψ(x')·dx']·dx·dt
Combined with Rayleigh's dissipation function to account for irreversible processes:
R[ψ] = ∫(γ/2)·(∂ψ/∂t)²·dx
This formulation ensures that our model is not only effective in practice but also theoretically sound, with the field dynamics emerging from fundamental principles rather than ad hoc design choices.
Retrieval-Augmented Generation (RAG) approaches treat information as static vectors in an embedding space, with relevance determined solely by vector similarity. SIREN fundamentally differs in several key aspects:
| RAG/Vector DB Approach | SIREN Field-Theoretic Approach |
|---|---|
| Information stored as static embedding vectors | Information exists as evolving wave patterns in a coherence field |
| Relevance determined by raw vector similarity | Relevance emerges from resonance patterns and field interactions |
| No inherent time evolution or dynamics | Information naturally evolves according to field equations |
| Limited to pairwise similarity comparisons | Captures complex multi-way interactions through field superposition |
| Requires explicit chunking and indexing | Field naturally handles continuous information without boundaries |
| No mechanism for information interference | Information patterns can constructively or destructively interfere |
| Static importance weighting | Dynamic importance emerging from field evolution |
| Computationally scales with vector count | Computational complexity independent of information volume |
Context window management techniques like sliding windows or sparse attention mechanisms still rely on the raw token representation. In contrast, SIREN:
- Operates in semantic space: Rather than token space, allowing for more efficient representation
- Maintains continuous state: Instead of discrete tokens or chunks
- Preserves higher-order relationships: Not just via direct connections
- Supports emergent importance: Rather than predetermined attention patterns
- Eliminates artificial context boundaries: By representing information as a continuous field
The field-theoretic framework offers several profound theoretical advantages:
-
Information Interference: Like waves, information patterns can interfere constructively or destructively, naturally modeling cognitive phenomena such as how contradictory information competes in memory.
-
Spatiotemporal Coherence: The field equations naturally maintain coherence of related information across semantic space and time, without requiring explicit clustering or linking.
-
Critical Phenomena: The nonlinear terms in the field equation allow for phase transitions and critical phenomena, providing a mathematical foundation for understanding "eureka moments" or sudden insight.
-
Scale Invariance: The field equations exhibit scale-invariant properties, allowing similar dynamics to operate at different levels of semantic granularity.
-
Emergent Structure Formation: The interplay between diffusion and nonlinear potential terms naturally leads to the formation of stable semantic structures, analogous to how physical systems self-organize.
SIREN's implementation consists of two primary components:
- The IRE Field Module: Implements the numerical solution of the field equations
- The LLM Integration Layer: Connects the field to any LLM inference system
The core component is implemented in the IRE_Field class, which handles:
- Field initialization with configurable dimensionality (1D to multi-dimensional)
- Numerical integration of the field equations using finite difference methods
- Mapping between embedding space and field coordinates
- Memory storage and retrieval via field resonance
- Visualization and analysis of field states
The field implementation uses a discretized version of the IRE equation, with careful attention to numerical stability and computational efficiency. Key numerical methods include:
- Staggered-grid finite difference for spatial derivatives
- Velocity Verlet integration for time evolution
- Fast Fourier Transform (FFT) for efficient computation of nonlocal terms
- Adaptive time stepping to ensure numerical stability
The SIRENEnhancedLLM class provides a seamless interface between the IRE field and any LLM API endpoint. It handles:
- Conversion of text to semantic embeddings
- Projection of embeddings into field coordinates
- Management of conversation flow and history
- Construction of context-enhanced prompts
- Benchmark and evaluation capabilities
The integration layer is designed to be model-agnostic, working with any LLM that exposes a standard chat completion API.
Our extensive empirical testing demonstrates SIREN's effectiveness across multiple dimensions of memory recall and information coherence management. All raw data and visualizations are available in the SIREN/output directory.
Across our standardized evaluation suite, SIREN achieves an overall recall success rate of 73.68%, with performance varying significantly by task type:
| Test Type | Success Rate | Description |
|---|---|---|
| Temporal Distance | 100.00% | Recall after numerous intervening messages |
| Information Interference | 87.50% | Distinguishing similar but distinct information |
| Semantic Retrieval | 75.00% | Recall based on semantic relationships rather than exact matches |
| Complex Reasoning | 25.00% | Multi-hop reasoning across related information |
Verification Data: Full test results available in SIREN/output/evaluation/ with summary statistics in the latest
summary_*.txtfile and detailed test results in thetest_results_*.csvfiles.
These results demonstrate SIREN's particular strength in maintaining information coherence over long conversational distances—precisely the scenario where traditional context management approaches fail.
Analysis of the field evolution metrics reveals several key insights:
-
Stable Energy Plateau: As shown in our field energy graphs, the system quickly reaches a stable energy plateau after approximately 15-20 evolution steps (×10), indicating that the field naturally converges to a stable configuration that balances information addition and decay.
-
Amplitude Stabilization: The mean field amplitude stabilizes at approximately 2.0 units after the initial learning phase, representing an optimal information density in the field (see field metrics data).
-
Field Importance Oscillation: The field importance values oscillate throughout the conversation (see message importance visualization), showing dynamic adjustment as information relevance shifts. Notably, the importance patterns of user and assistant messages show strong correlation, indicating consistent semantic coupling between related messages.
Our benchmarking reveals SIREN's retrieval performance compared to traditional approaches:
| Method | P@1 | P@3 | P@5 | Key Strength |
|---|---|---|---|---|
| SIREN | 0.87 | 0.82 | 0.78 | Contextually related information |
| Traditional RAG | 0.82 | 0.76 | 0.70 | Direct matches |
| Sliding Window | 0.65 | 0.62 | 0.59 | Recent information |
| Hierarchical Summarization | 0.70 | 0.68 | 0.65 | Compressed information |
Verification Data: Complete benchmark comparisons available in SIREN/output/benchmarks/ with raw retrieval data in SIREN/output/csv/.
| Method | Small Context | Medium Context | Large Context | Scaling Characteristic |
|---|---|---|---|---|
| SIREN | 15-30ms | 40-80ms | 100-200ms | Scales with field size, not context length |
| Traditional RAG | 10-20ms | 50-150ms | 200-500ms | Scales with vector database size |
| Sliding Window | 1-5ms | 1-5ms | 1-5ms | Constant time (simple selection) |
| Memory Networks | 50-100ms | 200-500ms | 1000ms+ | Quadratic scaling with context |
Verification Data: Latency measurements available in SIREN/output/metrics/response_times.csv.
| Method | 100 Messages | 1000 Messages | 10,000 Messages |
|---|---|---|---|
| SIREN | ~3 MB | ~10 MB | ~30 MB |
| Traditional RAG | ~2 MB | ~20 MB | ~200 MB |
| Sliding Window | ~1 MB | ~10 MB | ~100 MB |
| Knowledge Graphs | ~5 MB | ~50 MB | ~500 MB |
Verification Data: Memory profiling data available in SIREN/output/metrics/memory_usage.csv.
For a 1000-message conversation, percentage of information still accessible:
| Method | After 100 msgs | After 500 msgs | After 1000 msgs |
|---|---|---|---|
| SIREN | 95% | 85% | 78% |
| Traditional RAG | 90% | 75% | 60% |
| Sliding Window | 100% | 10% | 3% |
| Hierarchical Summary | 80% | 60% | 40% |
Verification Data: Retention testing results available in SIREN/output/evaluation/retention_tests.csv.
The 2D field visualizations in SIREN/output/visualizations/ reveal clear structure formation within the information coherence field:
-
Distinct Semantic Regions: The field naturally organizes into regions of high and low amplitude, corresponding to distinct semantic clusters (field_amplitude.png).
-
Sharp Boundary Formation: The field gradient magnitude visualization shows clear, sharp boundaries (in red) between semantic regions, indicating strong differentiation between distinct information domains (field_gradient.png).
-
Memory Position Clustering: Memory positions demonstrate semantic clustering, with related information grouping together in the field space, validating our projection methods from embedding space to field coordinates (memory_positions.png).
-
Temporal Recency Encoding: The recency coloring (brighter = newer) shows how recent memories are prominently positioned while maintaining semantic relationships with earlier content (temporal_evolution.png).
For a deeper understanding of the system's performance in actual conversations, we provide complete conversation logs and their associated field states in the SIREN/output/conversations/ directory. These demonstrate how the field evolves through real interactions and how resonance patterns enable effective information recall.
Use these files to reproduce our results or to analyze the system's behavior on your own conversations.
# Clone the repository
git clone https://github.com/severian42/siren.git
cd siren
# Install dependencies
pip install -r requirements.txtChat with SIREN:
python siren_chat.py- numpy>=1.20.0: For efficient numerical operations
- scipy>=1.7.0: For scientific computing and signal processing
- torch>=1.9.0: For embedding model and tensor operations
- sentence-transformers>=2.2.0: For high-quality text embeddings
- matplotlib>=3.4.0, seaborn>=0.11.0: For visualization capabilities
- pandas>=1.3.0: For data management and analysis
- requests>=2.25.0: For API communication
- umap-learn>=0.5.1 (optional): For nonlinear projection methods
- Minimum: 4GB RAM, 2 CPU cores
- Recommended: 16GB RAM, 8 CPU cores, CUDA-compatible GPU
- Optimal: 32GB RAM, 16 CPU cores, 8GB+ VRAM
from siren import SIRENEnhancedLLM
# Initialize with your LLM API endpoint
llm = SIRENEnhancedLLM(
api_url="http://localhost:1234/v1/chat/completions",
model="nousresearch/deephermes-3-llama-3-8b-preview"
)
# Add system message
llm.add_message("system", """You are an assistant with exceptional memory capabilities
powered by Information Relative Evolution field theory. You can accurately recall information
from earlier in our conversation regardless of how many messages ago it was mentioned.""")
# User message
llm.add_message("user", "Please remember that you left my cheese in the center of the sun. I won't forget that, so you better not either.")
# Generate response with enhanced context management
response = llm.generate_response(temperature=0.7)
print(response)SIRENEnhancedLLM(
api_url: str,
model: str = "nousresearch/deephermes-3-llama-3-8b-preview",
field_dims: Union[int, Tuple[int, ...]] = (128, 128),
embedding_dim: int = 768,
diffusion_constant: float = 0.1,
damping: float = 0.8,
potential_alpha: float = 0.5,
potential_beta: float = 0.1,
nonlocal_scale: float = 100,
projection_method: str = 'pca'
)Core Methods:
# Add a message to the conversation
add_message(role: str, content: str) -> None
# Generate a response with field-enhanced context
generate_response(temperature: float = 0.7, max_tokens: int = -1) -> str
# Tune field parameters for specific conversation types
tune_field_parameters(**kwargs) -> None
# Visualize the current state of the memory field
visualize_memory_field(save_path: Optional[str] = None) -> None
# Print conversation with field importance values
print_conversation_with_importances() -> None
# Generate comprehensive performance metrics
generate_performance_report() -> None
# Run benchmarks to evaluate recall performance
benchmark_memory_retrieval(num_queries: int = 10, k: int = 3) -> Dict[str, Any]SIREN's performance can be optimized for different conversation types by tuning the field parameters.
| Parameter | Description | Default | Range | Impact |
|---|---|---|---|---|
| field_dims | Field dimensionality | (128, 128) | 1D-5D | Higher dimensions capture more complex relationships |
| diffusion_constant | Information spread rate | 0.1 | 0.01-0.5 | Lower values create sharper memory boundaries |
| damping | Information decay rate | 0.8 | 0.1-0.99 | Lower values maintain information longer |
| potential_alpha | Organization strength | 0.5 | 0.1-2.0 | Higher values enforce more structure |
| potential_beta | Nonlinearity degree | 0.1 | 0.01-0.5 | Higher values create more distinct patterns |
| nonlocal_scale | Long-range interaction | 100 | 10-1000 | Higher values increase semantic connections |
Based on our empirical testing, we recommend the following configurations for specific conversation types:
llm.tune_field_parameters(
field_dims=(128, 128, 16), # 3D field for more capacity
diffusion_constant=0.05, # Lower diffusion for precise information
damping=0.7, # Slower decay
potential_alpha=0.6, # Stronger organization
potential_beta=0.15, # Stronger nonlinearity
)llm.tune_field_parameters(
field_dims=(192, 192), # Larger 2D field
diffusion_constant=0.15, # Higher diffusion for more connections
damping=0.6, # Slower decay
potential_alpha=0.4, # Weaker organization
projection_method='umap' # Nonlinear projection
)llm.tune_field_parameters(
field_dims=(96, 96, 24), # 3D field with more depth
diffusion_constant=0.04, # Low diffusion for precise recall
damping=0.9, # Faster forgetting of irrelevant details
potential_alpha=0.7, # Strong organization
potential_beta=0.2, # High nonlinearity
)SIREN provides extensive visualization capabilities to analyze information dynamics:
llm.visualize_memory_field("field_state.png")This generates a comprehensive visualization showing:
- Field amplitude distribution (information density)
- Field gradient magnitude (information boundaries)
- Memory positions in field space
- Temporal evolution of information (newer vs. older)
- Energy distribution across the field
As demonstrated in our field visualizations (Images 6-8), these tools provide unprecedented insight into the organization and evolution of information within the LLM context.
llm.print_conversation_with_importances()This produces a detailed report and visualization of:
- Each message's current field importance
- Role-based importance distribution
- Field value evolution over time
- Semantic clustering of related messages
Our importance analysis (Image 1) shows the dynamic nature of field importance over the course of a conversation, with clear patterns of correlation between related messages.
llm.generate_performance_report()Generates comprehensive metrics including:
- Field energy over time
- Message importance distribution
- Retrieval performance statistics
- Response times and token usage
- Field entropy and coherence measures
Our analysis of these metrics (Images 2-4) demonstrates the stable convergence properties of the field equations, showing how the system quickly reaches a balanced state that optimizes information retention.
The IRE field theory has profound implications beyond LLM context management:
The field equations establish a rigorous framework for understanding information entropy, suggesting that coherent information patterns can spontaneously emerge through a balance of diffusive spreading and nonlinear self-organization—analogous to how physical structures emerge in thermodynamic systems.
The nonlinear terms in the field equation permit the existence of phase transitions in semantic space, providing a mathematical foundation for understanding phenomena like conceptual breakthroughs, paradigm shifts, and collective understanding.
Analysis of the field dynamics reveals that the effective dimensionality of semantic space is not fixed but emerges from the interaction patterns, with different domains naturally developing the appropriate number of dimensions needed to represent their structure.
The field framework offers a rigorous mathematical description of how semantic entanglement can occur, where concepts remain connected across semantic distance—potentially providing new insights into analogical reasoning and creative connections.
While SIREN represents a significant advance in LLM context management, several promising research directions remain:
- Adaptive Field Dimensionality: Dynamically adjusting field dimensions based on conversation complexity
- Multi-Field Interactions: Modeling interactions between multiple coherence fields (e.g., factual vs. emotional)
- Quantum-Inspired Extensions: Incorporating principles from quantum field theory for more sophisticated semantic modeling
- Neuromorphic Implementations: Hardware acceleration of field equations using neuromorphic computing
- Cross-Modal Field Integration: Extending the framework to unified text-image-audio coherence fields
- Improving Complex Reasoning: As shown in our metrics, complex reasoning remains a challenge (25% success rate), suggesting the need for specialized field structures to support multi-hop reasoning chains
