| Crates.io | atomic-neural-transistors |
| lib.rs | atomic-neural-transistors |
| version | 0.4.1 |
| created_at | 2026-01-07 02:47:07.40654+00 |
| updated_at | 2026-01-22 03:05:16.524367+00 |
| description | Ultra-small (<5K param) composable ternary neural primitives for CPU-only AI |
| homepage | |
| repository | https://github.com/blackfall-labs/atomic-neural-transistors |
| max_upload_size | |
| id | 2027352 |
| size | 4,705,906 |
Ultra-small (<5K param) composable neural primitives for real-time AI
ANTs are the transistors of neural computing - atomic units that perform single operations with high precision and compose into larger systems.
Just as silicon transistors:
ANTs:
| ANT | Accuracy | Size | Purpose |
|---|---|---|---|
are_equal |
99.5% | 812 KB | Compare two embeddings |
is_empty |
100% | 209 KB | Detect zero embeddings |
contains |
~97% | 1.8 MB | Query in sequence |
has_duplicate |
100% | 1.8 MB | Duplicate detection |
use atomic_neural_transistors::{AtomicNeuralTransistor, AtomicConfig};
use candle_core::{Device, DType};
use candle_nn::{VarBuilder, VarMap};
// Create a tiny ANT
let device = Device::Cpu;
let varmap = VarMap::new();
let vb = VarBuilder::from_varmap(&varmap, DType::F32, &device);
let ant = AtomicNeuralTransistor::new(&AtomicConfig::tiny(32, 1), vb)?;
println!("Parameters: {}", ant.param_count()); // ~1.5K
Complex operations compose from primitives without additional training:
use atomic_neural_transistors::composition::{contains, has_duplicate, PerfectEquality};
let checker = PerfectEquality;
// contains = OR(AreEqual(query, seq[i]) for all i)
assert!(contains(&checker, 5, &[1, 2, 3, 5, 7]));
// has_duplicate = OR(AreEqual(seq[i], seq[j]) for all i < j)
assert!(has_duplicate(&checker, &[1, 2, 3, 2, 5]));
atomic-neural-transistors/
├── src/
│ ├── config/ # AtomicConfig
│ ├── core/ # AtomicNeuralTransistor (the fundamental ANT)
│ ├── ants/ # Specialized ANTs
│ │ ├── compare.rs # CompareANT
│ │ ├── diff.rs # DiffANT
│ │ ├── merge.rs # MergeANT
│ │ ├── gate.rs # GateANT
│ │ └── classifier.rs# ClassifierANT
│ ├── composition/ # Composition algebra
│ │ ├── sequence.rs # contains, has_duplicate, etc.
│ │ └── grid.rs # Grid operations
│ └── pretrained/ # Model loading
└── models/ # Pretrained weights
| ANT | Purpose | Params |
|---|---|---|
CompareANT |
Binary similarity | ~1.5K |
DiffANT |
Difference embedding | ~3K |
MergeANT |
Combine signals | ~3K |
GateANT |
Attention routing | ~2K |
ClassifierANT |
Multi-class | ~5-10K |
# Basic ANT usage
cargo run --example basic_usage
# Composition algebra
cargo run --example composition
# Sudoku validation
cargo run --example sudoku_check
A 117M param model allocates capacity across all tasks. ANTs dedicate 100% of their capacity to one operation.
Unlike end-to-end training where errors compound, ANT composition maintains component accuracy. If AreEqual achieves 99.5%, composed operations inherit this precision.
ANTs run on:
MIT OR Apache-2.0
@software{ant2024,
title={Atomic Neural Transistors},
author={Blackfall Labs},
year={2024},
url={https://github.com/blackfall-labs/atomic-neural-transistors}
}