Cellular Reasoning Fabric (CRF)
A bio-inspired alternative to the Transformer architecture for language modeling.
What is CRF?
The Cellular Reasoning Fabric replaces self-attention with a population of autonomous, communicating cells that:
- Communicate via k-nearest-neighbor message passing (not global attention)
- Split when energy is high (allocate more compute)
- Die when energy is low (free resources)
- Merge when states are similar (consolidate knowledge)
- Uses O(N*k) routing instead of O(N^2) attention
Benchmark Results
| Benchmark | CRF Perplexity | Transformer Perplexity | CRF Advantage |
|---|---|---|---|
| Synthetic | 6.69 | 21.14 | 3.2x |
| ARC Reasoning | 17.36 | 53.04 | 3.1x |
| Arithmetic | 22.37 | 62.75 | 2.8x |
| Chain-of-Thought | 21.96 | 60.10 | 2.7x |
| Code Generation | 23.95 | 60.29 | 2.5x |
Model Details
| Property | Value |
|---|---|
| Parameters | 33,890 |
| d_model | 64 |
| d_hidden | 32 |
| Initial Cells | 16 |
| Max Cells | 64 |
| CRF Steps | 4 |
| k-Neighbors | 3 |
| FLOPs/forward | 858,176 |
Dynamic Cell Population
The CRF model features a fully operational cell lifecycle:
- Splits: 12-16 per forward pass (cells divide to add compute)
- Merges: 2+ per forward pass (redundant cells consolidate)
- Deaths: Cells with depleted energy are removed
- Energy tracking: Diagnostic metrics for monitoring cell health
Usage
import torch
from src.crf_reasoning.crf_vectorized import CRFLanguageModel, AblationConfig
cfg = AblationConfig()
model = CRFLanguageModel(
vocab_size=256,
d_model=64,
d_hidden=32,
n_init_cells=16,
max_cells=64,
n_crf_steps=4,
k_neighbors=3,
cfg=cfg,
)
# Load weights
state_dict = torch.load("crf_model.pt", map_location="cpu")
model.load_state_dict(state_dict)
# Forward pass with metrics
x = torch.randint(0, 256, (1, 32))
logits, loss, metrics = model(x, targets=x, collect_metrics=True)
print(f"Splits: {metrics.n_splits}, Merges: {metrics.n_merges}")
Limitations
- Small-scale experiments (d_model=64, seq_len=32, 400 training samples)
- Single seed - multi-seed validation needed
- Inference latency is 4-8x higher than Transformer
- Not yet tested on large-scale benchmarks (MMLU, HumanEval)
Citation
If you use this work, please cite:
@misc{usman2026crf,
title={Cellular Reasoning Fabric: A Bio-Inspired Alternative to Transformers},
author={Yasir Usman},
year={2026},
publisher={Hugging Face},
url={https://huggingface.co/YasirUsman/cellular-reasoning-fabric}
}
License
MIT
- Downloads last month
- 20