Skip to content

stephen-rowan/Attunement-through-Iterative-Oscillatory-Networks

Repository files navigation

Attunement-through-Iterative-Oscillatory-Networks

AION Educational Simulation

An interactive educational simulation of the AION (Attunement through Iterative Oscillatory Networks) model — a quantum-inspired neural architecture where meaning emerges through phase synchronization among coupled oscillators.

Overview

This project provides a Streamlit-based web application that demonstrates the AION model through:

  • Real-time visualization of oscillators on a unit circle
  • Resonance index tracking over time
  • Interactive parameter controls
  • Educational content explaining key concepts

Core Concept: In the AION model, phase coupling represents how meaning emerges through interactions—oscillators "communicate" through their phase relationships, leading to synchronized behavior. This mirrors how neurons in the brain communicate through synchronized firing patterns to create coherent perceptions and meaning.

Features

  • Real-time Simulation: Watch oscillators synchronize through the Kuramoto model
  • Interactive Controls: Adjust number of oscillators, coupling strength, time step, and animation speed
  • Visualizations:
    • Unit circle plot showing oscillator positions
    • Resonance index chart tracking synchronization over time
  • Educational Content: Learn about oscillators, phase, resonance, and attunement

Setup Instructions

Prerequisites

  • Python 3.11 or higher
  • pip (Python package manager)

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd Attunement-through-Iterative-Oscillatory-Networks
  2. Install dependencies:

    pip install -r requirements.txt

Running the Application

Start the Streamlit application:

streamlit run src/app.py

The application will open in your default web browser at http://localhost:8501.

Usage Guide

Basic Operation

  1. Start Simulation: The simulation auto-starts when you load the page
  2. Observe Behavior: Watch oscillators converge and cluster together on the unit circle as they synchronize
  3. Monitor Resonance: Track the resonance index increasing from low values (0.1-0.3) toward 1.0 as synchronization occurs
  4. Control Simulation: Use pause/resume/reset buttons to control execution

Expected Behavior

Initial State:

  • Oscillators start randomly distributed around the unit circle
  • Resonance index R is typically low (0.1-0.3)
  • Each oscillator rotates at its own intrinsic frequency

With Coupling (K > 0):

  • Oscillators gradually converge and cluster together on the circle
  • Resonance index R increases over time toward 1.0
  • The cluster rotates around the circle as a synchronized group
  • Higher coupling strength (K) leads to faster convergence

Perfect Synchronization:

  • All oscillators cluster at approximately the same phase
  • Resonance index R approaches 1.0
  • The entire group rotates together as one unit

No Coupling (K = 0):

  • Oscillators rotate independently
  • They remain spread out around the circle
  • Resonance index R stays low

Parameters

  • Number of Oscillators (N): Range [1, 1000] - Controls how many oscillators are in the network
  • Coupling Strength (K): Range [0, 10] - Controls how strongly oscillators influence each other
    • K = 0: No synchronization, oscillators rotate independently
    • K = 2-3: Moderate coupling, gradual convergence and clustering
    • K > 5: Strong coupling, rapid synchronization into tight cluster
  • Time Step (Δt): Range (0, 1] - Controls simulation time increment
  • Animation Speed: Range [0.1, 10.0] - Controls visual update rate

Educational Concepts

The application includes explanations for:

  • Oscillator: A node in the network with a phase and intrinsic frequency. Watch how oscillators converge and cluster together as they synchronize.
  • Phase: Angular position on the unit circle [0, 2π). As oscillators synchronize, their phases converge, causing them to cluster on the circle.
  • Resonance: Degree of phase synchronization (0 = desynchronized/spread out, 1 = perfectly synchronized/clustered). The resonance index increases as oscillators converge.
  • Attunement: The process of oscillators aligning their phases through coupling, resulting in the visible clustering behavior you observe in the visualization.

Tips for Observation

  • To see convergence: Set coupling strength (K) to 2.0-4.0 and let the simulation run for 10-20 seconds
  • To see faster clustering: Increase K to 5.0-7.0
  • To see independent rotation: Set K to 0
  • Watch the resonance chart: The line should trend upward as oscillators converge
  • Check the unit circle: Blue dots should gradually cluster together over time

Project Structure

src/
├── aion/
│   ├── models/          # Core simulation logic
│   ├── visualization/   # Plotly visualization components
│   └── ui/              # Streamlit UI components
├── app.py               # Main Streamlit entry point
└── config.py            # Default configuration values

tests/
├── unit/                # Unit tests for core logic
└── integration/         # Integration tests for UI flows

Testing

Run the test suite:

pytest

Run with coverage:

pytest --cov=src --cov-report=html

Technical Details

Kuramoto Equation

The phase update for oscillator j:

dθ_j/dt = ω_j + (K/N) Σ sin(θ_k - θ_j)

The coupling term (K/N) Σ sin(θ_k - θ_j) represents phase coupling—the mechanism by which oscillators influence each other's phases. This phase coupling enables oscillators to "communicate" through their phase relationships, leading to synchronized behavior and the emergence of meaning through collective interactions.

Resonance Index

The degree of synchronization:

R = |(1/N) Σ e^(iθ_j)|

Where R = 0 indicates complete desynchronization and R = 1 indicates perfect synchronization. The resonance index measures how effectively phase coupling has enabled oscillators to communicate and align, creating coherent collective behavior.

Phase Coupling and Meaning

Phase coupling is the fundamental mechanism in the AION model that enables meaning to emerge:

  • Oscillators "communicate" through their phase relationships
  • Phase differences create coupling forces that pull oscillators toward alignment
  • As oscillators synchronize, coherent patterns emerge from their interactions
  • This mirrors how neurons communicate through synchronized firing to create perceptions
  • The clustering and synchronization you observe represents the emergence of meaning through phase-based communication

Phase Coupling vs. Reinforcement Learning

While phase coupling shares some similarities with reinforcement learning, there are important differences:

Similarities:

  • Both use feedback mechanisms to adjust behavior over time
  • Both converge to stable or optimal states
  • Both produce emergent behavior from interactions

Key Differences:

Aspect Phase Coupling Reinforcement Learning
Rewards Implicit (energy minimization) Explicit (reward signals)
Nature Deterministic (differential equations) Often stochastic (exploration)
Scope Collective (all oscillators interact) Typically individual (agent-environment)
Process Continuous phase updates Discrete actions and states
Exploration No exploration needed Requires exploration
Type Physics-based self-organization Algorithm-based learning

In the AION Context: Phase coupling is more similar to:

  • Gradient descent: Moving toward lower energy states
  • Self-organization: Emergent order from local interactions
  • Collective intelligence: Group behavior emerging from individual interactions

Unlike reinforcement learning, phase coupling doesn't require explicit rewards or exploration—the system naturally evolves toward synchronized states through the physics of phase interactions, representing a form of emergent meaning rather than goal-directed learning.

AION vs. Diffusion Models

While the AION model shares some mathematical similarities with diffusion models (used in generative AI), there are important differences:

Similarities:

  • Both use differential equations to model dynamics over time
  • Both can show transitions from disorder to order
  • Both can involve stochastic processes (though AION is often deterministic)
  • Both can be viewed as optimization processes

Key Differences:

Aspect AION/Kuramoto Diffusion Models
Purpose Synchronization Generative (create new data)
Process Disorder → Order (synchronization) Data → Noise → Denoise → New Data
Goal Achieve phase alignment Learn data distribution
Output Synchronized oscillators Generated images/text/etc.
Nature Often deterministic Stochastic (noise-driven)
Learning No learning (physics-based) Requires training on data
Mechanism Phase coupling Noise diffusion and denoising

In the AION Context: The AION model is more similar to:

  • Reaction-diffusion systems: Patterns emerge from local interactions
  • Self-organization: Order emerges from collective dynamics
  • Gradient flows: Moving toward stable states (energy minimization)

Unlike diffusion models, AION is not generative—it doesn't create new data. Instead, it focuses on synchronization and the emergence of meaning through phase alignment, representing a form of physics-based self-organization rather than learned data generation.

AI Applications and RAG Workflows

The AION model's phase coupling mechanism has potential applications in AI systems, particularly in Retrieval-Augmented Generation (RAG) workflows:

RAG Workflow Applications

1. Document Embedding Synchronization

  • Represent documents as oscillators with phases derived from embeddings
  • Phase coupling aligns semantically similar documents through synchronization
  • Clustered documents form coherent retrieval groups, improving search quality

2. Query-Document Alignment

  • Use phase coupling to align query representations with relevant document representations
  • Synchronization strength based on semantic similarity improves relevance matching
  • Better alignment leads to more accurate retrieval

3. Multi-Modal Binding

  • Bind text, images, and other modalities through phase synchronization
  • Similar to neuro-symbolic binding, different modalities synchronize to form unified representations
  • Enables coherent multi-modal RAG systems

4. Context Aggregation

  • Synchronize multiple retrieved contexts before generation
  • Phase coupling creates coherent aggregated context from multiple sources
  • Reduces contradictions and improves generation quality

How It Would Work

  1. Representation: Map embeddings/vectors to oscillator phases (e.g., use embedding angles or projections)
  2. Frequency Assignment: Assign intrinsic frequencies to documents representing their baseline importance or relevance
  3. Coupling: Define coupling strength based on similarity, relevance, or learned relationships
  4. Synchronization: Let phases align through Kuramoto dynamics
  5. Emergent Meaning: Use synchronized clusters as coherent representations for retrieval or generation

Frequency in RAG Context

When nodes represent documents in a RAG system, frequency (ω) takes on a specific meaning:

What Frequency Represents:

  • Intrinsic Relevance/Importance: A document's baseline importance or relevance score that exists independently of queries or other documents
  • Query-Independent Activity: How "active" or prominent a document is in the knowledge base
  • Domain-Specific Centrality: How central a document is to its domain

Possible Interpretations:

  • Citation-based: Documents with more citations have higher frequency
  • Recency-based: More recent documents have higher frequency
  • Authority-based: Documents from authoritative sources have higher frequency
  • Learned Importance: Frequency learned from usage patterns or relevance feedback

How It Works:

  • Each document gets an intrinsic frequency (ω) representing its baseline importance
  • Documents with higher frequency have more "influence" in the synchronization process
  • Phase coupling still aligns documents based on semantic similarity
  • Synchronization clusters semantically similar documents, with important documents having more weight
  • Documents with different importance levels can still synchronize if semantically similar

Example:

  • Document A (high frequency, ω=2.0): Important research paper with many citations
  • Document B (low frequency, ω=0.5): Supporting material or less authoritative source
  • With coupling: They can still synchronize if semantically similar, but the important document has more influence in the cluster

In RAG systems, frequency represents each document's intrinsic importance or relevance, independent of queries or other documents, while phase coupling handles the interactions and synchronization between documents.

Other AI Applications

  • Attention Mechanisms: Model attention as synchronization between query and key representations
  • Semantic Clustering: Use phase synchronization to cluster semantically related concepts
  • Knowledge Graph Alignment: Align entities and relations through phase coupling
  • Multi-Agent Coordination: Coordinate multiple AI agents through phase synchronization

Challenges and Adaptations

  • Embedding-to-Phase Mapping: Convert high-dimensional embeddings to phases (e.g., using angles, projections, or learned mappings)
  • Coupling Definition: Define meaningful coupling between representations (similarity-based, learned, or task-specific)
  • Scale: Handle large numbers of documents/embeddings efficiently (may require approximations or hierarchical approaches)
  • Integration: Combine with existing RAG pipelines (embedding models, vector databases, LLMs)

Conceptual Connection

In RAG workflows, phase coupling could:

  • Improve Retrieval: Clustering related documents through synchronization
  • Enhance Context Understanding: Creating synchronized representations from multiple sources
  • Enable Multi-Modal Binding: Binding different data types through phase alignment
  • Create Coherent Aggregation: Forming unified context from diverse sources before generation

The phase coupling mechanism represents a novel approach to creating coherent, synchronized representations from diverse information sources—a key challenge in modern AI systems.

License

[Add license information here]

Contributing

[Add contributing guidelines here]

About

An interactive educational simulation of the AION (Attunement through Iterative Oscillatory Networks) model — a quantum-inspired neural architecture where meaning emerges through phase synchronization among coupled oscillators.

Resources

Stars

Watchers

Forks

Contributors