Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- bayesian-inference
|
| 4 |
+
- liquid-networks
|
| 5 |
+
- uncertainty-quantification
|
| 6 |
+
- classics-revival
|
| 7 |
+
- experimental
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
library_name: pytorch
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Liquid Bayes Chain - The Classics Revival
|
| 13 |
+
|
| 14 |
+
**Probabilistic Control of Continuous Dynamics with Bayesian Feedback**
|
| 15 |
+
|
| 16 |
+
**Experimental Research Code** - Functional but unoptimized, expect rough edges
|
| 17 |
+
|
| 18 |
+
## What Is This?
|
| 19 |
+
|
| 20 |
+
Liquid Bayes Chain combines liquid neural networks with Bayesian inference to create a system where probabilistic confidence directly modulates continuous dynamics. The network's liquid state evolves based on Bayesian uncertainty, creating adaptive exploration-exploitation behavior.
|
| 21 |
+
|
| 22 |
+
**Core Innovation**: Bayesian confidence estimates control liquid time constants and dynamics, creating a feedback loop between probabilistic reasoning and continuous neural evolution.
|
| 23 |
+
|
| 24 |
+
## Architecture Highlights
|
| 25 |
+
|
| 26 |
+
- **Confidence-Modulated Dynamics**: Bayesian uncertainty controls liquid evolution speed
|
| 27 |
+
- **Adaptive Time Constants**: Neural dynamics adjust based on confidence levels
|
| 28 |
+
- **Probabilistic Feedback Loop**: Continuous dynamics inform Bayesian updates
|
| 29 |
+
- **Multi-Step Chain Processing**: Sequential confidence-guided evolution steps
|
| 30 |
+
- **Uncertainty Quantification**: Full probabilistic output with confidence measures
|
| 31 |
+
- **Exploration-Exploitation Balance**: High confidence → stability, low confidence → exploration
|
| 32 |
+
|
| 33 |
+
## Quick Start
|
| 34 |
+
```python
|
| 35 |
+
from liquid_bayes import LiquidBayesChain
|
| 36 |
+
|
| 37 |
+
# Create liquid-Bayesian system
|
| 38 |
+
model = LiquidBayesChain(
|
| 39 |
+
input_dim=32,
|
| 40 |
+
state_dim=64,
|
| 41 |
+
output_dim=10,
|
| 42 |
+
num_chain_steps=4
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
# Process input with uncertainty quantification
|
| 46 |
+
input_signal = torch.randn(batch_size, input_dim)
|
| 47 |
+
output = model(input_signal, return_chain_states=True)
|
| 48 |
+
|
| 49 |
+
# Get uncertainty information
|
| 50 |
+
uncertainty_info = model.predict_with_uncertainty(input_signal)
|
| 51 |
+
print(f"Confidence: {uncertainty_info['confidence'].mean():.3f}")
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## Current Status
|
| 55 |
+
- **Working**: Liquid dynamics, Bayesian networks, confidence modulation, chain evolution, uncertainty quantification
|
| 56 |
+
- **Rough Edges**: No benchmarking on standard tasks, chain length optimization needed
|
| 57 |
+
- **Still Missing**: Advanced Bayesian structures, variational inference, distributed chain processing
|
| 58 |
+
- **Performance**: Good convergence on toy problems, needs validation on real tasks
|
| 59 |
+
- **Memory Usage**: Moderate, scales with chain length and state dimension
|
| 60 |
+
- **Speed**: Sequential chain processing, parallelization opportunities exist
|
| 61 |
+
|
| 62 |
+
## Mathematical Foundation
|
| 63 |
+
The liquid dynamics evolve according to:
|
| 64 |
+
```
|
| 65 |
+
dx/dt = -x/τ(confidence) + W_rec·σ(x) + W_in·u + noise(1-confidence)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
Bayesian confidence estimation uses:
|
| 69 |
+
```
|
| 70 |
+
P(belief|evidence) ∝ P(evidence|belief) × P(belief)
|
| 71 |
+
confidence = 1 - H(P(belief|evidence))
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
Where H is Shannon entropy. High confidence leads to stable dynamics (large τ), while low confidence increases exploration through noise injection and faster adaptation.
|
| 75 |
+
|
| 76 |
+
The chain processes through multiple steps:
|
| 77 |
+
```
|
| 78 |
+
x_{t+1} = LiquidEvolution(x_t, u, confidence_t)
|
| 79 |
+
confidence_{t+1} = BayesianUpdate(x_{t+1})
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
## Research Applications
|
| 83 |
+
- **Adaptive control systems with uncertainty**
|
| 84 |
+
- **Robotics with confidence-aware planning**
|
| 85 |
+
- **Financial modeling with risk adaptation**
|
| 86 |
+
- **Autonomous systems requiring exploration-exploitation**
|
| 87 |
+
- **Scientific computing with adaptive dynamics**
|
| 88 |
+
|
| 89 |
+
## Installation
|
| 90 |
+
```bash
|
| 91 |
+
pip install torch numpy scipy
|
| 92 |
+
# Download liquid_bayes.py from this repo
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
## The Classics Revival Collection
|
| 96 |
+
|
| 97 |
+
Liquid Bayes Chain is part of a larger exploration of foundational algorithms enhanced with modern neural techniques:
|
| 98 |
+
|
| 99 |
+
- Evolutionary Turing Machine
|
| 100 |
+
- Hebbian Bloom Filter
|
| 101 |
+
- Hopfield Decision Graph
|
| 102 |
+
- **Liquid Bayes Chain** ← You are here
|
| 103 |
+
- Liquid State Space Model
|
| 104 |
+
- Möbius Markov Chain
|
| 105 |
+
- Memory Forest
|
| 106 |
+
|
| 107 |
+
## Citation
|
| 108 |
+
```bibtex
|
| 109 |
+
@misc{liquidbayes2025,
|
| 110 |
+
title={Liquid Bayes Chain: Probabilistic Control of Continuous Dynamics},
|
| 111 |
+
author={Jae Parker 𓅸 1990two},
|
| 112 |
+
year={2025},
|
| 113 |
+
note={Part of The Classics Revival Collection}
|
| 114 |
+
}
|
| 115 |
+
```
|