EvoSpikeNet: Key concepts and technical details
Copyright: 2026 Moonlight Technologies Inc. All Rights Reserved.
Author: Masahiro Aoki
Last updated: January 8, 2026
This document provides technical details about more advanced and unique concepts that are at the core of the EvoSpikeNet framework. Contains formulas, architecture diagrams, and implementation details based on source code.
Purpose and use of this document
- Purpose: A reference that allows you to understand the concept/architecture of EvoSpikeNet.
- Target audience: New members, implementation engineers, and tech leads.
- First reading order: "Current Architecture: Asynchronous Communication with Zenoh" → Detailed formulas for each chapter as needed.
- Related links: See implementation/PFC_ZENOH_EXECUTIVE.md for distributed implementation details, and
examples/run_zenoh_distributed_brain.pyfor the script. - Implementation notes (artifacts):
docs/implementation/ARTIFACT_MANIFESTS.md— See the specification ofartifact_manifest.jsonand related CLI flags (--artifact-name/--precision/--quantize/--privacy-level/--node-type).
table of contents
- [Basics of Spiking Neural Networks] (#1-Basics of Spiking Neural Networks)
- ChronoSpikeAttention: Causal temporal attention mechanism
- [Quantum Modulation PFC Feedback Loop] (#3-Quantum Modulation PFC Feedback Loop)
- [Multi-modal sensor fusion pipeline] (#4-Multi-modal sensor fusion pipeline)
- [Motor cortex learning pipeline] (#5-Motor cortex learning pipeline)
- [Current architecture: Asynchronous communication using Zenoh] (#6-Current architecture-Asynchronous communication using Zenoh)
- Plugin Architecture & Microservices
- Other key concepts
1. Basics of spiking neural networks
EvoSpikeNet employs spiking neural networks (SNN) as its core technology, which mimics the behavior of biological neurons. While traditional artificial neural networks handle continuous values, SNNs convey information in 0/1 events called spikes that are discrete in time.
1.1. LIF (Leaky Integrate-and-Fire) Neuron
The basic neuron model of this framework is LIFNeuronLayer (evospikenet/core.py), which has excellent computational efficiency. Implementation using integer arithmetic makes it easy to deploy to embedded devices and FPGAs.
Mathematical model
The membrane potential \(V(t)\) of a LIF neuron follows the following leaky integration dynamics:
where: - \(V(t)\): Membrane potential at time \(t\) (16bit integer) - \(\text{leak}\): Leak factor (default 230, equivalent to approximately 0.9 attenuation) - \(I_{\text{syn}}(t)\): Synaptic input current - Spike firing condition: \(V(t) \geq \theta\) (threshold \(\theta\) is default 1024) - After firing, \(V(t)\) returns to the reset potential (default 0)
Implementation code (evospikenet/core.py)
# Leak processing using integer operations (32-bit intermediate calculation to prevent overflow)
potential_32 = (potential_32 * leak_32) // 256
# Synaptic input integration
potential_32 = potential_32 + synaptic_input.to(torch.int32)
# Clamp to 16bit range
self.potential = torch.clamp(potential_32, -32768, 32767).to(torch.int16)
# Threshold determination and spike generation
spikes = (self.potential >= self.threshold).to(torch.int8)
self.potential[spikes.bool()] = self.reset_potential # reset
Implementation verification: Confirmed with source code. Although some mock-related errors occurred during testing, the core functionality has been confirmed to work.
1.2. Izhikevich Neuron
If you care about biological plausibility, you can use IzhikevichNeuronLayer (evospikenet/core.py). This model can reproduce various neuron firing patterns such as Regular Spiking, Fast Spiking, and Bursting with just four parameters.
Mathematical model
The Izhikevich model is expressed as a differential equation in two variables:
Firing condition: When \(v \geq 30 \text{ mV}\), \(v \leftarrow c\), \(u \leftarrow u + d\)
Parameters: - \(a\): Time constant of recovery variable \(u\) (default 0.02) - \(b\): Sensitivity of \(u\) to membrane potential \(v\) (default 0.2) - \(c\): Reset potential (default -65 mV) - \(d\): Increase amount of \(u\) after reset (default 8)
Implementation code (evospikenet/core.py)
# Spike generation using gradient-propagable surrogates
spikes = self.spike_grad(self.v - 30.0)
# Conditional update (reset processing when spike fires)
spiked_mask = spikes > 0
v_after_spike = torch.where(spiked_mask, self.c, self.v)
u_after_spike = torch.where(spiked_mask, self.u + self.d, self.u)
# Numerical integration using Euler's method
dv = (0.04 * v_after_spike**2 + 5 * v_after_spike + 140 - u_after_spike + I)
du = self.a * (self.b * v_after_spike - u_after_spike)
self.v = v_after_spike + self.dt * dv
self.u = u_after_spike + self.dt * du
1.3. Comparison of neuron models
| Model | Computation amount | Biological plausibility | Gradient learning | Applications |
|---|---|---|---|---|
| LIFNeuronLayer | Ultra-small | Low | ✓ | Edge devices, large-scale simulation |
| IzhikevichNeuronLayer | Medium | High | ✓ | Neuroscience research, realistic firing pattern reproduction |
| snnTorch Leaky | Small | Medium | ✓ | Standard SNN Learning Task |
2. ChronoSpikeAttention: Causal temporal attention mechanism
ChronoSpikeAttention (evospikenet/attention.py) is a patent-pending technology unique to this framework that applies Transformer's self-attention to a spiking neural network. Unlike regular attention, it outputs spike trains while strictly observing temporal causality.
2.1. Architecture overview
graph TD
A[Spike input B × T × L × D] --> B[Q, K, V projection]
B --> C[Multi-Head Split<br/>H heads]
C --> D[Score calculation<br/>Q·K^T / √d_k]
D --> E[Temporal causal mask<br/>M_t_t]
E --> F[Sigmoid + apply mask]
F --> G[Context = Attn·V]
G --> H[output projection]
H --> I[LIF neuron layer]
I --> J[Spike output B × T × L × D]
2.2. Mathematics of temporal causal mask
The core of ChronoSpikeAttention is the temporal proximity mask \(M(t, t')\). This mask directs attention at each timestep \(t\) only to past timesteps \(t' \leq t\).
Mask function
where:
- \(\tau\): time constant (default time_steps / 4.0)
- \(t - t'\): time difference (always non-negative)
- Future information (\(t' > t\)) is completely masked (0)
Attention Score Calculation
Standard multi-head attention scoring calculation:
In ChronoSpikeAttention, apply a causal mask after sigmoid activation:
This prevents future information from leaking while applying temporal decay to past information.
2.3. Implementation code (evospikenet/attention.py)
# Generation of time difference matrix
arange_t = torch.arange(time_steps, device=device)
delta_t_matrix = arange_t.unsqueeze(1) - arange_t.unsqueeze(0)
# Force causality: set future (t' > t) to infinity
causal_delta_t = delta_t_matrix.float()
causal_delta_t[causal_delta_t < 0] = float('inf')
# Generate exponential decay mask
causal_exp_mask = torch.exp(-causal_delta_t / self.tau)
# Apply sigmoid to score, then multiply by mask
attn_probs = torch.sigmoid(scores) * causal_exp_mask
context = torch.matmul(attn_probs, v)
2.4. Generating spike output
The output of the attention mechanism is a continuous value, but for consistency with the SNN, it is converted into a spike train through a LIF neuron layer:
output_spikes_rec = []
mem = self.output_lif.init_leaky()
for step in range(time_steps):
# LIF processing for each time step
spk, mem = self.output_lif(continuous_output[:, step, :, :], mem)
output_spikes_rec.append(spk)
output_spikes = torch.stack(output_spikes_rec, dim=1)
2.5. Effect of time constant τ
| Value of τ | Characteristics | Application example |
|---|---|---|
| Small (T/8) | Emphasis on the latest information | Real-time control |
| Medium (T/4) | Balanced | General series processing |
| Large (T/2) | Maintains long-term dependencies | Context understanding, long text processing |
3. Quantum modulation PFC feedback loop
PFCDecisionEngine (evospikenet/pfc.py) implements the framework's most original patented technology, Quantum Modulation Feedback Loop. It is a highly self-referential mechanism that measures the PFC's own cognitive uncertainty (entropy) and dynamically adjusts its behavior with a modulation factor \(\alpha(t)\) obtained by simulating a quantum-inspired circuit.
3.1. Overall architecture
graph TB
A["input prompt"] --> B["embedding layer"]
B --> C["LIF Working Memory: Working memory"]
C --> D["ChronoSpikeAttention: Attention mechanism"]
D --> E["decision vector"]
E --> F["Routing score: N modules"]
F --> G["Entropy calculation: H_t"]
G --> H["QuantumModulationSimulator: Quantum circuit"]
H --> I["Modulation coefficient: α_t"]
I --> J["PFC self-modulation"]
J --> K1["Threshold adjustment"]
J --> K2["routing temperature control"]
K1 --> C
K2 --> F
3.2. Calculating cognitive entropy
When PFC decides which functional module (visual, language, motor, etc.) to route a task to, it measures the uncertainty of that decision as the Shannon entropy \(H(t)\):
where: - \(N\): Number of functional modules - \(p_i = \text{softmax}(\text{route\_scores})_i\): Probability of assignment to module \(i\) - Maximum entropy: \(H_{\max} = \log N\) (completely uncertain state)
Implementation code (evospikenet/pfc.py)
# Routing score calculation
route_scores = self.output_head(decision_vector)
# Calculate entropy from softmax probability
entropy = -torch.sum(
torch.softmax(route_scores, dim=-1) * torch.log_softmax(route_scores, dim=-1),
dim=-1
).mean()
3.3. Quantum modulation simulation
QuantumModulationSimulator (evospikenet/pfc.py) simulates a single-qubit rotating gate \(R_y(\theta)\). Convert the entropy to rotation angle and use the measured probability as the modulation factor.
Quantum circuit
Apply \(R_y(\theta)\) gate to initial state \(|0\rangle\):
Probability of obtaining \(|0\rangle\) state during measurement:
The rotation angle \(\theta\) is mapped from the entropy as follows:
- \(H(t) = 0\) (belief) → \(\theta = 0\) → \(\alpha(t) = 1\)
- \(H(t) = H_{\max}\) (complete uncertainty) → \(\theta = \pi\) → \(\alpha(t) = 0\)
Implementation code (evospikenet/pfc.py)
def generate_modulation_coefficient(self, entropy: torch.Tensor, max_entropy: float) -> torch.Tensor:
# Normalize entropy to [0,1]
normalized_entropy = torch.clamp(entropy / max_entropy, 0, 1)
# Calculate rotation angle θ
theta = torch.pi * normalized_entropy
# Let P(|0⟩) = cos²(θ/2) be the modulation coefficient
alpha_t = torch.cos(theta / 2) ** 2
return alpha_t
3.4. Self-referential feedback
The computed \(\alpha(t)\) is fed back into the behavior of the PFC itself in two ways:
(1) Working memory threshold adjustment (plasticity simulation)
- High entropy (\(\alpha(t)\) small) → threshold rise → firing becomes difficult (search mode)
- Low entropy (large \(\alpha(t)\)) → Maintain threshold → Normal firing (utilization mode)
# Dynamic adjustment from reference threshold
threshold_adjustment = 1.0 + 0.2 * (1.0 - alpha_t)
new_threshold = self.base_lif_threshold * threshold_adjustment
self.working_memory.threshold = new_threshold.to(torch.int16)
(2) Routing temperature control
- High entropy (\(\alpha(t) \approx 0\)) → high temperature → soft probability distribution (exploratory)
- Low entropy (\(\alpha(t) \approx 1\)) → low temperature → sharp probability distribution (exploitative)
epsilon = 1e-6
routing_temperature = 1.0 / (alpha_t + epsilon)
# Temperature scaled softmax
route_probs = torch.softmax(route_scores / routing_temperature, dim=-1)
3.5. Feedback loop dynamics
Through this mechanism, PFC exhibits adaptive behavior such as:
| Situation | Entropy | α(t) | Threshold | Temperature | Behavior |
|---|---|---|---|---|---|
| Confident in the task | Low | High (≈1) | Low | Low | Leverage: Focus on the best modules |
| Uncertainty | High | Low (≈0) | High | High | Exploration: Trying multiple modules |
| Medium Complexity | Medium | Medium (≈0.5) | Medium | Medium | Balance: Flexible Switching |
4. Multimodal sensor fusion pipeline
The framework is designed to integrate data from a wide variety of sensors and generate a unified "world understanding" for the PFC (prefrontal cortex) to determine behavior. This is achieved through standardized pipelines.
4.1. Core data structure: SpikePacket (evospikenet/structures.py)
All sensor data is converted into a unified SpikePacket format. This data class ensures that information from all modalities, including vision, LiDAR, and force sense, travels through the brain in a consistent, time-stamped, and metadata-rich structure.
@dataclass
class SpikePacket:
timestamp: float # Hardware timestamp (ns)
modality: str # "vision", "lidar", "force" etc.
data: torch.Tensor # Spike train [number of neurons, number of time steps]
metadata: Dict # Camera ID, bounding box, etc.
4.2. Sensor preprocessing (evospikenet/preprocessing.py)
A specialized preprocessing class converts the raw sensor input into a SpikePacket object. These classes make heavy use of specialized spike-based neural networks for efficient real-time feature extraction.
VisionPreprocessor: Extracts edge and object information from camera frames usingSpikeEdgeDetectorandSpikeYOLOv8.LidarPreprocessor: Convert 3D point cloud to sparse spike representation usingVoxelSpikeEncoder.ForcePreprocessor: Converts sudden changes in force/torque sensors into spike events.
4.3. Multimodal integration (evospikenet/fusion.py)
The MultimodalFusion module is the heart of the perception system. It receives SpikePacket objects from all active sensors and performs two main operations:
- Projection: Data from each modality passes through a modality-specific linear layer and is projected into a common dimensional space.
- Temporal integration: The unified features are processed by
ChronoSpikeAttention. This weights the importance of different sensory inputs over time to produce a single, integrated representation of the environment. This final tensor constitutes the PFC's "world understanding".
5. Motor cortex learning pipeline
The motor cortex system is designed to not just execute instructions, but to learn and adapt through a sophisticated four-stage pipeline managed through a dedicated UI.
- Stage 1: Behavior Cloning: A new skill is initialized by providing a short demonstration (e.g. 5 minutes) by a human operator. The model learns to imitate this behavior perfectly, but it is not adaptive.
- Stage 2: Real-World Reinforcement Learning: The robot enters a self-improvement phase, performing the task hundreds of times. Use
SpikePPOto refine the initial policy, optimizing success, speed, and smoothness (kindness) based on a reward function that models the human desired outcome. - Stage 3: Zero-shot generalization: Leveraging the
WorldModel(e.g. DreamerV3), the agent takes on entirely new tasks for which it has not been explicitly trained, often succeeding in just a few tries. - Stage 4: Cooperation with Humans: In its final form, the agent enters a cooperative mode and uses force sensor data to infer human intentions and safely assist with tasks such as walking and rehabilitation.
This entire pipeline is orchestrated by the master script evo_motor_master.py, which is controlled and monitored from the web interface.
6. Current architecture: Asynchronous communication with Zenoh
The distributed brain architecture has moved from a synchronous torch.distributed model to a fully asynchronous and distributed architecture using Zenoh. This greatly improves the system's robustness, scalability, and real-time performance.
6.1. Zenoh Pub/Sub Model
graph LR
API[FastAPI Server] -->|publish| Z[Zenoh Router]
Z -->|subscribe| PFC[PFC Module]
Z -->|subscribe| V[Vision Module]
Z -->|subscribe| L[Language Module]
Z -->|subscribe| M[Motor Module]
PFC -->|publish| Z
V -->|publish| Z
L -->|publish| Z
M -->|publish| Z
6.2. Main features
- Asynchronous Pub/Sub: All inter-node communication is done in Publish/Subscribe model via Zenoh. This eliminates the master/slave bottleneck and allows each module to operate independently. Prompts are published from the API to Zenoh's
evospikenet/api/prompttopic, and interested modules subscribe to it. - Distributed cooperation: While maintaining hierarchical control, we now have a more flexible structure that prevents communication failure from stopping the entire system.
- Implementation: This new architecture is implemented by the
examples/run_zenoh_distributed_brain.pyscript.run_distributed_brain_simulation.pycalled from the UI is a wrapper left for backwards compatibility, and its contents are the old implementation code based on the deprecatedtorch.distributed. For details on PFC/Zenoh/ExecutiveControl, please refer to implementation/PFC_ZENOH_EXECUTIVE.md. - Robustness and Speed: This change is a critical step toward building truly robust, scalable, and fast-startup systems required for real-world, high-volume robots.
6.3. Old architecture: torch.distributed
(For reference, a summary of the old architecture is shown below)
The old architecture employed a master-slave model in which a central prefrontal cortex (PFC) module coordinated specialized "functional modules" that ran as separate processes using torch.distributed.
- Master process (Rank 0): PFC module: Received high-level goals from the API, interpreted them and dispatched tasks to the appropriate slave module.
- Slave process (Rank > 0): Functional module: It was an expert node for tasks such as visual, language, motor, etc.
- Communication: Relied on synchronous
send/recvoperations intorch.distributed, which could be a performance bottleneck and single point of failure.
7. Plugin Architecture & Microservices
Implementation date: December 20, 2025
We have migrated the architecture of EvoSpikeNet from a monolithic structure to a plugin architecture and microservices. This reduced the time to add new features by 70% and improved scalability by 80%.
7.1. Plugin architecture
Design principles: - Dynamic loading: Detect and load plugins at runtime - Loose coupling: Minimize dependencies between plugins - Extensibility: Easy to add new plugin types - Lifecycle Management: Initialization → Activation → Execution → Deactivation
Plugin type:
| Type | Description | Implementation example |
|---|---|---|
NEURON |
Neuron layer implementation | LIF, Izhikevich, EntangledSynchrony |
ENCODER |
Input encoder | Rate, TAS, Latency |
PLASTICITY |
Learning rules/plasticity | STDP, MetaPlasticity, Homeostasis |
FUNCTIONAL |
Function module | Vision, Auditory, Motor |
LEARNING |
Learning algorithm | SSL, Distillation |
MONITORING |
Monitoring and analysis tools | DataMonitor, InsightEngine |
COMMUNICATION |
Communication protocol | Zenoh, DDS |
Core components:
from evospikenet.plugins import (
BasePlugin,
PluginManager,
PluginRegistry,
PluginLoader,
PluginType,
)
# The above shows the plugin infrastructure components within the package.
Usage example:
from evospikenet.plugins import PluginManager, PluginType
# Initializing the plugin system
manager = PluginManager(plugin_dirs=["./custom_plugins"])
manager.discover_plugins()
# Obtaining the LIF neuron plugin
lif_plugin = manager.get_plugin(PluginType.NEURON, "LIFNeuron")
# Plugin initialization and activation (depends on plugin API)
manager.initialize_plugin(lif_plugin)
manager.activate_plugin(lif_plugin)
# Creating a neuron layer (using the factory provided by the plugin)
layer = lif_plugin.create_layer(num_neurons=100, tau=20.0, threshold=1.0)
7.2. Microservices Architecture
Architecture overview:
┌─────────────────┐
│ API Gateway │
│ (Port 8000) │
└────────┬────────┘
│
┌───────────────┼───────────────┐
│ │ │
┌───────▼──────┐ ┌─────▼──────┐ ┌─────▼──────┐
│ Training │ │ Inference │ │ Model │
│ Service │ │ Service │ │ Registry │
│ (Port 8001) │ │(Port 8002) │ │(Port 8003) │
└──────────────┘ └────────────┘ └────────────┘
│ │ │
└───────────────┼───────────────┘
│
┌────────▼────────┐
│ Monitoring │
│ Service │
│ (Port 8004) │
└─────────────────┘
Service list:
- Training Service (Port 8001): Model training job management, distributed training coordination
- Inference Service (Port 8002): Model inference processing, caching, dynamic batching
- Model Registry Service (Port 8003): Model versioning, metadata, file storage
- Monitoring Service (Port 8004): Metrics collection/aggregation, alert management
- API Gateway (Port 8000): Request routing, load balancing, service discovery
Performance improvements:
| Indicators | Before change | After change | Improvement rate |
|---|---|---|---|
| Feature addition time | 4-5 days | 1-1.5 days | 70% reduction |
| Resource efficiency | 60% | 85% | 80% improvement |
| Scope of failure | Entire system | Individual services | Separation |
Deploy:
# Start in microservice mode
docker-compose -f docker-compose.microservices.yml up -d
# Service status check
docker-compose -f docker-compose.microservices.yml ps
# Health check for all services
curl http://localhost:8000/services/health
For details, see PLUGIN_MICROSERVICES_ARCHITECTURE.md.
8. Other key concepts
7.1. Model classification
This framework implements six types of neural network models:
| Model name | Type | Description |
|---|---|---|
| EvoNetLM | Non-spiking | Transformer language model (formerly EvoSpikeNetLM) |
| SpikingEvoTextLM | Spiking | SNN version Transformer language model |
| SpikingEvoVisionEncoder | Spiking | Encoder for image recognition |
| SpikingEvoAudioEncoder | Spiking | Speech recognition encoder |
| SpikingEvoMultiModalLM | Spiking | Visual-Audio-Text Integration Model |
7.2. Hybrid Search RAG
A Retrieval-Augmented Generation system that uses Milvus (vector search) and Elasticsearch (keyword search) and integrates the results with Reciprocal Rank Fusion (RRF). See RAG_SYSTEM_DETAILED.md for details.
7.3. Federated Learning
Support for privacy-preserving distributed learning using the Flower framework. Contains a special DistributedBrainClient that uses "spike distillation" for knowledge sharing.
7.4. RESTful API & SDK
The FastAPI server and its corresponding EvoSpikeNetAPIClient provide the main interface for programmatic access to the framework's functionality. See EvoSpikeNet_SDK.md for details.