Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- bloom-filters
|
| 4 |
+
- hebbian-learning
|
| 5 |
+
- associative-memory
|
| 6 |
+
- classics-revival
|
| 7 |
+
- experimental
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
library_name: pytorch
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Hebbian Bloom Filter - The Classics Revival
|
| 13 |
+
|
| 14 |
+
**Self-Organizing Probabilistic Memory with Associative Learning**
|
| 15 |
+
|
| 16 |
+
**Experimental Research Code** - Functional but unoptimized, expect rough edges
|
| 17 |
+
|
| 18 |
+
## What Is This?
|
| 19 |
+
|
| 20 |
+
Hebbian Bloom Filter combines probabilistic membership testing with Hebbian-style associative learning. Instead of static hash functions, the filter learns associations between items and adapts its hash patterns based on co-occurrence, creating a self-organizing memory system.
|
| 21 |
+
|
| 22 |
+
**Core Innovation**: Hash functions that strengthen based on item associations using Hebbian "fire together, wire together" principles, enabling similarity-based retrieval beyond simple membership testing.
|
| 23 |
+
|
| 24 |
+
## Architecture Highlights
|
| 25 |
+
|
| 26 |
+
- **Learnable Hash Functions**: Neural networks that adapt based on item co-occurrence
|
| 27 |
+
- **Hebbian Plasticity**: Hash weights strengthen when items appear together
|
| 28 |
+
- **Associative Retrieval**: Find similar items through learned co-activation patterns
|
| 29 |
+
- **Confidence Estimation**: Probabilistic membership with uncertainty quantification
|
| 30 |
+
- **Temporal Decay**: Forgetting mechanisms prevent overfitting to old patterns
|
| 31 |
+
- **Ensemble Filtering**: Multiple filters vote for robust membership decisions
|
| 32 |
+
|
| 33 |
+
## Quick Start
|
| 34 |
+
```python
|
| 35 |
+
from hebbian_bloom import AssociativeHebbianBloomSystem
|
| 36 |
+
|
| 37 |
+
# Create self-organizing memory system
|
| 38 |
+
system = AssociativeHebbianBloomSystem(
|
| 39 |
+
capacity=10000,
|
| 40 |
+
vector_dim=64,
|
| 41 |
+
num_filters=3
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
# Add items with associations
|
| 45 |
+
system.add_item("apple", associated_items=["red", "fruit", "healthy"])
|
| 46 |
+
system.add_item("banana", associated_items=["yellow", "fruit", "potassium"])
|
| 47 |
+
|
| 48 |
+
# Query membership with confidence
|
| 49 |
+
is_member = system.query_item("apple")
|
| 50 |
+
|
| 51 |
+
# Find associative memories
|
| 52 |
+
similar = system.find_associations("fruit", top_k=5)
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
## Current Status
|
| 56 |
+
- **Working**: Hebbian learning, associative retrieval, confidence estimation, ensemble voting, temporal decay
|
| 57 |
+
- **Rough Edges**: No benchmarking against standard Bloom filters, hash collision handling could be improved
|
| 58 |
+
- **Still Missing**: Advanced forgetting policies, distributed storage, memory compression techniques
|
| 59 |
+
- **Performance**: Functional on medium datasets, needs optimization for large-scale deployment
|
| 60 |
+
- **Memory Usage**: Higher than standard Bloom filters due to learning components
|
| 61 |
+
- **Speed**: Competitive for retrieval, slower for complex association queries
|
| 62 |
+
|
| 63 |
+
## Mathematical Foundation
|
| 64 |
+
The Hebbian learning rule updates hash function weights based on co-activation:
|
| 65 |
+
```
|
| 66 |
+
Δw_ij = η × h_i(x) × h_j(y) × similarity(x, y)
|
| 67 |
+
```
|
| 68 |
+
Where `h_i(x)` and `h_j(y)` are hash activations for co-occurring items `x` and `y`.
|
| 69 |
+
|
| 70 |
+
Confidence estimation combines:
|
| 71 |
+
- **Bit confidence**: `C_bit = mean(confidence_array[indices])`
|
| 72 |
+
- **Hash confidence**: `C_hash = mean(hash_activation_strengths)`
|
| 73 |
+
- **Access confidence**: `C_access = normalized_access_frequency`
|
| 74 |
+
|
| 75 |
+
Final confidence: `C_total = α×C_bit + β×C_hash + γ×C_access`
|
| 76 |
+
|
| 77 |
+
## Research Applications
|
| 78 |
+
- **Large-scale similarity search systems**
|
| 79 |
+
- **Adaptive caching with learned associations**
|
| 80 |
+
- **Memory-augmented recommendation systems**
|
| 81 |
+
- **Biologically-inspired information retrieval**
|
| 82 |
+
- **Self-organizing knowledge bases**
|
| 83 |
+
|
| 84 |
+
## Installation
|
| 85 |
+
```bash
|
| 86 |
+
pip install torch numpy
|
| 87 |
+
# Download hebbian_bloom.py from this repo
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## The Classics Revival Collection
|
| 91 |
+
|
| 92 |
+
Hebbian Bloom Filter is part of a larger exploration of foundational algorithms enhanced with modern neural techniques:
|
| 93 |
+
|
| 94 |
+
- Evolutionary Turing Machine
|
| 95 |
+
- **Hebbian Bloom Filter** ← You are here
|
| 96 |
+
- Hopfield Decision Graph
|
| 97 |
+
- Liquid Bayes Chain
|
| 98 |
+
- Liquid State Space Model
|
| 99 |
+
- Möbius Markov Chain
|
| 100 |
+
- Memory Forest
|
| 101 |
+
|
| 102 |
+
## Citation
|
| 103 |
+
```bibtex
|
| 104 |
+
@misc{hebbianbloom2025,
|
| 105 |
+
title={Hebbian Bloom Filter: Self-Organizing Probabilistic Memory},
|
| 106 |
+
author={Jae Parker 𓅸 1990two},
|
| 107 |
+
year={2025},
|
| 108 |
+
note={Part of The Classics Revival Collection}
|
| 109 |
+
}
|
| 110 |
+
```
|