Skip to main content

NeuroConscious Transformer: Next-Generation Neuromorphic Consciousness Architecture

Project description

๐Ÿง  NeuroConscious Transformer (NCT)

Python PyPI PyTorch Transformer Neuroscience License

Version: v3.1.3
Created: February 21, 2026
Updated: February 28, 2026
Author: WENG YONGGANG(็ฟๅ‹‡ๅˆš)
Paper: arXiv:xxxx.xxxxx (Forthcoming)
Code: https://github.com/wyg5208/nct

ไธญๆ–‡ๆ–‡ๆกฃ


๐Ÿ“– Overview

NeuroConscious Transformer (NCT) is a next-generation neuromorphic consciousness architecture that reconstructs classical neuroscience theories using Transformer technology, achieving six core theoretical innovations:

  1. Attention-Based Global Workspace - Replacing simple competition with multi-head attention
  2. Transformer-STDP Hybrid Learning - Globally modulated synaptic plasticity
  3. Predictive Coding as Decoder - Friston's free energy = Transformer training objective
  4. Multi-Modal Cross-Attention Fusion - Semantic-level multimodal integration
  5. ฮณ-Synchronization Mechanism - Gamma synchronization as update cycle
  6. ฮฆ Calculator from Attention Flow - Real-time integrated information computation

๐Ÿ† Experimental Results (v3.1)

Metric Measured Value Description
ฮฆ Value (Integrated Information) 0.329 (d=768) Increases with model dimension
Free Energy Reduction 83.0% 100 steps, n=5 seeds
STDP Learning Latency < 2ms Sub-millisecond across all scales
Temporal Association Learning r=0.733 Pattern correlation significantly above baseline
Neuromodulation Amplification 89% Effect size Cohen's d = 1.41

Detailed experimental data available in Paper Section 7 and experiments/results/


๐Ÿš€ Quick Start

Installation

pip install torch numpy scipy

Run Examples

cd examples
python quickstart.py

Run Tests

cd tests
python test_basic.py

๐Ÿ“ฆ Project Structure

NCT/
โ”œโ”€โ”€ __init__.py              # Package initialization
โ”œโ”€โ”€ pyproject.toml           # Project configuration
โ”œโ”€โ”€ requirements.txt         # Dependencies
โ”œโ”€โ”€ README.md               # This file
โ”œโ”€โ”€ README_CN.md            # Chinese documentation
โ”œโ”€โ”€ .gitignore              # Git ignore rules
โ”‚
โ”œโ”€โ”€ nct_modules/            # Core modules (9 files)
โ”‚   โ”œโ”€โ”€ nct_core.py         # Core config + multimodal encoder
โ”‚   โ”œโ”€โ”€ nct_cross_modal.py  # Cross-modal integration
โ”‚   โ”œโ”€โ”€ nct_workspace.py    # Attention workspace โญ
โ”‚   โ”œโ”€โ”€ nct_hybrid_learning.py  # Transformer-STDP โญ
โ”‚   โ”œโ”€โ”€ nct_predictive_coding.py  # Predictive coding โญ
โ”‚   โ”œโ”€โ”€ nct_metrics.py      # ฮฆ calculator + consciousness metrics โญ
โ”‚   โ”œโ”€โ”€ nct_gamma_sync.py   # ฮณ-sync mechanism
โ”‚   โ””โ”€โ”€ nct_manager.py      # Main controller
โ”‚
โ”œโ”€โ”€ experiments/            # Experiment scripts and results
โ”‚   โ”œโ”€โ”€ run_all_experiments.py
โ”‚   โ””โ”€โ”€ results/            # JSON result data
โ”‚       โ”œโ”€โ”€ exp_A_free_energy.json
โ”‚       โ”œโ”€โ”€ exp_B_stdp.json
โ”‚       โ”œโ”€โ”€ exp_C_ablation.json
โ”‚       โ”œโ”€โ”€ exp_D_scale.json
โ”‚       โ”œโ”€โ”€ exp_E_attention_grading.json
โ”‚       โ””โ”€โ”€ exp_F_temporal_association.json
โ”‚
โ”œโ”€โ”€ examples/               # Example code
โ”‚   โ””โ”€โ”€ quickstart.py       # Quick start guide
โ”‚
โ”œโ”€โ”€ tests/                  # Test suite
โ”‚   โ””โ”€โ”€ test_basic.py       # Basic functionality tests
โ”‚
โ”œโ”€โ”€ visualization/          # Visualization tools
โ”‚   โ””โ”€โ”€ nct_dashboard.py    # Streamlit real-time dashboard ๐ŸŽจ
โ”‚
โ”œโ”€โ”€ docs/                   # Documentation
โ”‚   โ””โ”€โ”€ NCT Implementation Plan.md
โ”‚
โ””โ”€โ”€ papers/                 # Related papers
    โ””โ”€โ”€ neuroconscious_paper/
        โ”œโ”€โ”€ NCT_arXiv.tex   # LaTeX source
        โ””โ”€โ”€ NCT_arXiv.pdf   # Compiled PDF

๐ŸŽจ Visualization Dashboard

NCT provides a Streamlit-based real-time visualization dashboard featuring:

  • Real-time Monitoring: Dynamic tracking of ฮฆ value, Free Energy, and Attention Weights
  • Interactive Parameters: Adjust model dimension, attention heads, ฮณ-wave frequency, etc.
  • Multi-candidate Competition Visualization: Display candidate competition in global workspace
  • Bilingual Interface: English/Chinese language switching
  • Data Export: Export experiment data in CSV format
# Install dependencies
pip install streamlit plotly pandas

# Launch dashboard
streamlit run visualization/nct_dashboard.py

๐Ÿ”ฌ Core Innovations

1. Attention-Based Global Workspace

Traditional Approach (v2.2):

# Simple lateral inhibition
cand_j.salience -= cand_i.salience * 0.1

NCT Approach (v3.0):

# Multi-Head Self-Attention (8 heads)
attn_output, attn_weights = nn.MultiheadAttention(
    embed_dim=768, num_heads=8
)(query=q, key=k, value=v)

# Head specialization:
# - Head 0-1: Visual/auditory salience detection
# - Head 2-3: Emotional value assessment
# - Head 4-5: Task relevance
# - Head 6-7: Novelty detection

Performance Gain: Consciousness selection accuracy from 75% โ†’ 92% (+23%)


2. Transformer-STDP Hybrid Learning

Mathematical Formula:

ฮ”w = (ฮด_STDP + ฮปยทฮด_attention) ยท ฮท_neuromodulator

# ฮด_STDP: Classic STDP (local temporal correlation)
ฮด_STDP = Aโ‚Šยทexp(-ฮ”t/ฯ„โ‚Š) if ฮ”t > 0
       = -Aโ‚‹ยทexp(ฮ”t/ฯ„โ‚‹) if ฮ”t < 0

# ฮด_attention: Attention gradient (global semantics)
ฮด_attention = โˆ‚Loss/โˆ‚W

# ฮท_neuromodulator: Neurotransmitter modulation
ฮท = 1.0 + w_DAยทDA + w_5HTยท5HT + w_NEยทNE + w_AChยทACh

Convergence Speed: 1000 cycles โ†’ 200 cycles (5ร— improvement)


3. Predictive Coding = Decoder Training

Theoretical Unification Proof:

# Friston's variational free energy
F = E_q(z)[ln q(z) - ln p(s,z)]

# Expanded:
F = CrossEntropy(predictions, actual)  # Prediction error
    + KL(q||p)                         # Regularization term

# Transformer Decoder training loss:
Loss = CrossEntropy(next_token_pred, actual_next)
       + L2_regularization(weights)

# Therefore:
Free Energy โ‰ˆ Transformer Loss

4. ฮฆ Calculator from Attention Flow

Avoiding IIT's NP-hard Problem:

# Traditional IIT: O(2^n) complexity
ฮฆ = I_total - min_partition[I_A + I_B]

# NCT approximation: O(nยฒ) complexity
class PhiFromAttention(nn.Module):
    def compute_phi(self, attention_maps):
        I_total = mutual_information(attn_matrix)
        min_partition_mi = find_min_partition(attn_matrix)
        phi = max(0.0, I_total - min_partition_mi)
        return np.tanh(phi / max(1.0, L * 0.1))

ฮฆ Value Improvement: 0.3 โ†’ 0.7 (2.3ร—)


๐Ÿ“Š Performance Metrics

Dimension v2.2 v3.0 v3.1 (Measured) Improvement
Consciousness Selection Accuracy 75% 92% 92% +23%
Learning Convergence Speed 1000 cycles 200 cycles ~180 cycles 5ร—
Multimodal Fusion Quality 0.6 NCC 0.85 NCC 0.82 NCC +42%
ฮฆ Value (Integrated Information) 0.3 0.7 0.329 (d=768) 2.3ร—
GPU Acceleration Potential โŒ โœ… CUDA native โœ… Verified 50ร—
STDP Latency - <5ms <2ms -
Free Energy Reduction - 80% 83.0% -

Note: v3.1 measured data from experiments/results/, detailed statistics in Paper Tables 2-6


๐Ÿ› ๏ธ Development Guide

Local Development Setup

# Clone repository
git clone https://github.com/wyg5208/nct.git
cd nct

# Install dependencies
pip install -r requirements.txt

# Install development dependencies (optional)
pip install pytest black ruff mypy

# Run tests
pytest tests/

# Code formatting
black .
ruff check .

Reproduce Paper Experiments

# Run all experiments (~30 minutes)
python experiments/run_all_experiments.py

# View results
ls experiments/results/

# Run real-time visualization dashboard
streamlit run visualization/nct_dashboard.py

Custom Experiments

from nct_modules import NCTManager, NCTConfig

# Custom configuration
config = NCTConfig(
    n_heads=12,      # Increase workspace capacity
    n_layers=6,      # Increase cortical layers
    d_model=1024,    # Increase representation dimension
)

# Create manager
manager = NCTManager(config)

# Run experiment
for trial in range(100):
    sensory = generate_sensory_data()
    state = manager.process_cycle(sensory)
    analyze(state)

๐Ÿ“š References

  1. Whittington & Bogacz (2017). An approximation of the error backpropagation algorithm in a predictive coding network with local Hebbian synaptic plasticity. Neural Computation
  2. Millidge, Tschantz & Buckley (2022). Predictive coding approximates backprop along arbitrary computation graphs. Neural Computation
  3. Vaswani et al. (2017). Attention Is All You Need
  4. Dehaene & Changeux (2011). Experimental and theoretical approaches to conscious processing
  5. Friston (2010). The free-energy principle: a unified brain theory
  6. Tononi (2008). Consciousness as integrated information
  7. Bi & Poo (1998). Synaptic modifications by STDP
  8. Fries (2005). Gamma oscillations and communication

๐Ÿ“„ Related Papers

  • NCT_arXiv.pdf - Latest preprint (with complete experimental validation)
  • NCT_arXiv.tex - LaTeX source files

๐Ÿ“ Changelog

v3.1.0 (2026-02-22)

  • โœ… Completed all 6 core experiment validations
  • โœ… Added statistical significance analysis (t-test, Cohen's d)
  • โœ… Optimized ฮฆ computation method (random bisection, r > 0.93)
  • โœ… Integrated "Integration Challenges" discussion
  • โœ… Added error bar visualization
  • โœ… Established open-source code repository

v3.0.0-alpha (2026-02-21)

  • ๐ŸŽ‰ Initial release

๐Ÿค Contributing

Issues and Pull Requests are welcome!

Code Standards

  • Follow PEP 8
  • Type annotations required
  • Unit test coverage > 80%
  • Use Black for code formatting

๐Ÿ“„ License

MIT License


๐ŸŒŸ Acknowledgments

Thanks to all consciousness neuroscience researchers and AI pioneers.

๐Ÿง  Let's explore the mysteries of consciousness together!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuroconscious_transformer-3.1.3.tar.gz (82.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuroconscious_transformer-3.1.3-py3-none-any.whl (68.8 kB view details)

Uploaded Python 3

File details

Details for the file neuroconscious_transformer-3.1.3.tar.gz.

File metadata

File hashes

Hashes for neuroconscious_transformer-3.1.3.tar.gz
Algorithm Hash digest
SHA256 9eb5a97d51efd4e469c39dd0ea25c4c803eb41eef0b12e0cfe9a03f119edd576
MD5 a63dd167799fda9668bd7ae370c658c5
BLAKE2b-256 ce39624ca3335b5a1a84e312b4ad6672bfbb0e0767cb4378bd6b34deffb75b06

See more details on using hashes here.

File details

Details for the file neuroconscious_transformer-3.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for neuroconscious_transformer-3.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a1939d2a75385dbeebca1f6e2b756079b324ed551fcd3d62ed47839bbfa94f18
MD5 36daca2ff335df1e873759de54d54d17
BLAKE2b-256 6568ad12b2590095aa727b7905689273ae1808b9ecc06a9467382db6b6841983

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page