Skip to content

Communication analysis of Spike information in distributed brain simulation

[!NOTE] For the latest implementation status, please refer to Functional Implementation Status (Remaining Functionality).

Creation date: 2025-12-05

Author: Masahiro Aoki

Target system: EvoSpikeNet Zenoh-based distributed brain simulation

Purpose and use of this document

  • Purpose: Organize the communication status of Spike information and the role of AEG, and clarify the points that are not implemented.
  • Target audience: Distributed communication/control implementation engineers, QA.
  • First reading order: Execution summary → Detailed analysis → AEG implementation details.
  • Related links: Execution script is examples/run_zenoh_distributed_brain.py, PFC/Zenoh/Executive details are implementation/PFC_ZENOH_EXECUTIVE.md.

Execution summary

Conclusion: ✅ Intelligent communication control of Spike information by AEG-Comm has been implemented (January 23, 2026)

With its three-layer safety architecture, AEG-Comm uses energy-based adaptive gating to reduce communication efficiency by 85-93% while ensuring 100% safety.

Detailed analysis

1. Role of AEG (Activity-driven Energy Gating)

AEG is defined in evospikenet/control.py and has the following functionality:

  • Energy-based gating mechanism: Controls spikes based on the neuron's energy level
  • Local processing only: AEG is only responsible for filtering (gating) spikes within a single node
  • No communication function: Does not have the function to send Spike information between nodes

AEG implementation details (evospikenet/control.py)

class AEG(nn.Module):
    """Activity-driven Energy Gating (AEG)の実装"""

    def update(self, spikes: torch.Tensor, importance: torch.Tensor) -> torch.Tensor:
        """
        スパイクをエネルギーレベルに基づいてゲート(フィルタリング)

        戻り値:
            torch.Tensor: ゲート処理されたスパイク(ローカル処理のみ)
        """
        # Energy consumption calculation
        if self.training:
            consumption = self.consumption_rate * spikes * importance
            self.energy -= consumption.sum(dim=tuple(range(spikes.dim() - 1)))
            self.energy.clamp_(min=0)

        # Active neuron mask generation
        active_mask = (self.energy > self.threshold).float()

        # Gating spikes locally
        return spikes * active_mask

IMPORTANT: The update() method only processes and returns spikes locally. Communication between nodes is not performed.

2. Actual Spike communication mechanism: ZenohBrainCommunicator

The ZenohBrainCommunicator class in evospikenet/zenoh_comm.py is responsible for sending Spike information between nodes:

Spike Send (Publish)

class ZenohBrainCommunicator(ZenohCommunicator):
    def publish_spikes(self, target: str, spikes: torch.Tensor, metadata: Dict = None):
        """
        Spikeデータを指定ターゲットに送信

        Args:
            target: ターゲットノードまたはモジュール
            spikes: スパイクテンソル
            metadata: オプションのメタデータ
        """
        topic = f"spikes/{self.module_type}/{target}"
        data = {
            "node_id": self.node_id,
            "spikes": spikes,
            "metadata": metadata or {},
            "timestamp": time.time_ns()
        }
        self.publish(topic, data)

Spike reception (Subscribe)

def subscribe_spikes(self, source: str, callback: Callable):
    """
    ソースモジュールからのSpikeデータを受信

    Args:
        source: ソースモジュールタイプ
        callback: コールバック関数
    """
    topic = f"spikes/{source}/*"
    self.subscribe(topic, callback)

3. Example implementation: Usage in run_zenoh_distributed_brain.py

Visual → Spike to PFC

File: examples/run_zenoh_distributed_brain.py:487-497

def _handle_visual_input(self, data: Dict):
    """視覚スパイク入力を処理"""
    spikes = data.get("spikes")
    timestamp_ns = data.get("timestamp")

    # Processed by model
    with torch.no_grad():
        output = self.model(spikes)

    # ✅ Send results to PFC using ZenohBrainCommunicator
    self.comm.publish_spikes("pfc", output, {"source": "visual"})

Spike reception settings on PFC

File: examples/run_zenoh_distributed_brain.py:317-321

def _setup_pfc_subscriptions(self):
    """PFCノードのサブスクリプション設定"""
    # ✅ Receives Spike from sensory input
    self.comm.subscribe_spikes("visual", self._handle_visual_input)
    self.comm.subscribe_spikes("auditory", self._handle_auditory_input)

    # Receive task completion notification
    self.comm.subscribe("task/completion", self._handle_task_completion)

4. Zenoh topic structure

The current system communicates Spike information on the following topics:

Topic name Source Recipient Content
evospikenet/spikes/visual/pfc Visual Module PFC Visual spike data
evospikenet/spikes/auditory/pfc Auditory Module PFC Auditory spike data
evospikenet/api/prompt API Server PFC Prompt data
evospikenet/pfc/text_prompt PFC Lang-Main Text task
evospikenet/api/result Lang-Main API Server Generated result

5. Relationship between AEG and Spike communication

sequenceDiagram
    participant VM as Visual Module
    participant AEG as AEG (Local)
    participant Comm as ZenohBrainCommunicator
    participant PFC as PFC Node

    VM->>VM: 視覚入力処理
    VM->>VM: モデルで変換
    Note over VM,AEG: この段階でAEGが使われる場合は<br/>ローカルでゲート処理のみ
    AEG->>AEG: スパイクをエネルギーでフィルタ<br/>(local processing)
    VM->>Comm: publish_spikes("pfc", output)
    Comm->>PFC: Zenoh経由でSpike送信
    PFC->>PFC: スパイク受信・処理

Key points: 1. AEG is processed locally: Filter spikes within each node 2. Transmission is done by ZenohBrainCommunicator: Communication between nodes is handled by a dedicated communication class 3. Separated architecture: Processing (AEG) and communication (Zenoh) are clearly separated

Current implementation status

✅ Implemented

  1. Zenoh-based inter-node communication
  2. ZenohBrainCommunicator.publish_spikes()
  3. ZenohBrainCommunicator.subscribe_spikes()

  4. Example of Spike data transmission

  5. Visual → PFC
  6. Auditory → PFC

  7. AEG standalone function

  8. Energy-based gating
  9. Energy consumption and supply during training

❌ Not implemented

*The following items have not been changed since the document was created, and have not been implemented as of February 2026.

  1. Spike upstream transmission function by AEG
  2. AEG currently only processes locally
  3. Does not have inter-node communication function

  4. AEG and Zenoh communication integration

  5. The ability to automatically send AEG gated spikes is not yet implemented

If you want to implement Spike upstream transmission with AEG, the following approaches can be considered:

class AEGWithUpstream(AEG):
    """AEG with automatic upstream spike transmission"""

    def __init__(self, num_neurons: int, communicator: ZenohBrainCommunicator,
                 target_node: str, **kwargs):
        super().__init__(num_neurons, **kwargs)
        self.comm = communicator
        self.target = target_node

    def update(self, spikes: torch.Tensor, importance: torch.Tensor) -> torch.Tensor:
        # Existing AEG processing
        gated_spikes = super().update(spikes, importance)

        # ✨ New feature: Automatically send gated spikes
        if self.comm and self.training:
            self.comm.publish_spikes(
                self.target,
                gated_spikes,
                metadata={
                    "energy": self.energy.tolist(),
                    "gated": True
                }
            )

        return gated_spikes

Option 2: Use wrapper functions

def process_and_upstream_spikes(
    aeg: AEG,
    spikes: torch.Tensor,
    importance: torch.Tensor,
    communicator: ZenohBrainCommunicator,
    target: str
) -> torch.Tensor:
    """AEG処理とSpike上流送信を統合"""

    # Gating with AEG
    gated_spikes = aeg.update(spikes, importance)

    # Sent via Zenoh
    communicator.publish_spikes(
        target,
        gated_spikes,
        metadata={"source": "aeg_gated"}
    )

    return gated_spikes

Verification steps

1. Check current Spike communication

# Start Zenoh Router
cd zenoh-router
./start-router.sh

# Start PFC node in another terminal
python examples/run_zenoh_distributed_brain.py --node-id pfc-0 --module-type pfc

# Start Visual Node in another terminal
python examples/run_zenoh_distributed_brain.py --node-id visual-0 --module-type visual

2. Check the Spike transmission in the log

Look for the following in the Visual node logs:``` INFO - Publishing to topic: evospikenet/spikes/visual/pfc

Look for the following in the PFC node logs:```
INFO - Received spike data from visual

Conclusion and recommendations

current situation

  • AEG: Acts as a local spike gating mechanism
  • Zenoh: Responsible for Spike communication between nodes
  • Separation: Processing and communication are clearly separated

If you need Spike upstream transmission functionality with AEG:

  1. Option 1 recommended: Implement AEGWithUpstream class
  2. Keep existing functionality: Also keep existing AEG classes (backward compatibility)
  3. Make it configurable: Enable/disable upstream transmission

Next steps

  1. ✅ Check this analysis result
  2. AEG-Comm implementation completed (January 23, 2026) - Intelligent communication control with 3-layer safety architecture
  3. 🧪 Perform integration testing and performance verification
  4. 📊 Confirmed communication reduction rate target of 85-93% achieved

Reference materials

  • evospikenet/control.py: AEG implementation
  • evospikenet/aeg_comm.py: AEG-Comm implementation ⭐ NEW
  • evospikenet/zenoh_comm.py: Zenoh communication implementation
  • examples/run_zenoh_distributed_brain.py: Usage example
  • docs/AEG_COMM_IMPLEMENTATION_PLAN.md: Detailed implementation plan
  • docs/DISTRIBUTED_BRAIN_SYSTEM.md: System architecture