1990two commited on
Commit
297eb9d
·
verified ·
1 Parent(s): da2e429

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +123 -0
README.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - state-space-models
4
+ - liquid-networks
5
+ - sequence-modeling
6
+ - classics-revival
7
+ - experimental
8
+ license: apache-2.0
9
+ library_name: pytorch
10
+ ---
11
+
12
+ # Liquid State Space Model - The Classics Revival
13
+
14
+ **Continuous-Time Adaptive Sequence Processing with Learned Dynamics**
15
+
16
+ **Experimental Research Code** - Functional but unoptimized, expect rough edges
17
+
18
+ ## What Is This?
19
+
20
+ Liquid State Space Model enhances traditional state space models with liquid neural network dynamics and adaptive time constants. The system learns content-dependent time evolution, making it naturally adaptive to different sequence characteristics and potentially more efficient than transformers for long sequences.
21
+
22
+ **Core Innovation**: Time constants and state dynamics adapt based on input content, creating a continuous-time sequence processor that adjusts its temporal behavior to match data requirements.
23
+
24
+ ## Architecture Highlights
25
+
26
+ - **Adaptive Time Constants**: Learn content-dependent evolution speeds
27
+ - **Continuous-Time Dynamics**: Proper differential equation integration
28
+ - **HiPPO Initialization**: Theoretically grounded memory representation
29
+ - **Liquid Evolution**: Neural ODEs for state transitions
30
+ - **Efficient Long Sequences**: O(L) complexity vs O(L²) attention
31
+ - **Language Model Ready**: Drop-in transformer replacement
32
+
33
+ ## Quick Start
34
+ ```python
35
+ from liquid_state_space import LiquidSSMLanguageModel
36
+
37
+ # Create liquid SSM language model
38
+ model = LiquidSSMLanguageModel(
39
+ vocab_size=32000,
40
+ d_model=512,
41
+ state_dim=256,
42
+ num_layers=6,
43
+ max_seq_len=2048
44
+ )
45
+
46
+ # Process sequences
47
+ input_ids = torch.randint(0, 32000, (batch_size, seq_len))
48
+ outputs = model(input_ids, labels=target_ids)
49
+
50
+ # Generate text
51
+ generated = model.generate(
52
+ input_ids[:1],
53
+ max_length=100,
54
+ temperature=1.0
55
+ )
56
+ ```
57
+
58
+ ## Current Status
59
+ - **Working**: Adaptive time constants, continuous dynamics, HiPPO matrices, language modeling, text generation
60
+ - **Rough Edges**: No optimization for very long sequences (>4k), numerical stability could be improved
61
+ - **Still Missing**: Distributed training, advanced initialization schemes, memory compression
62
+ - **Performance**: Competitive with small transformers, needs scaling validation
63
+ - **Memory Usage**: Lower than transformers for long sequences, higher for short ones
64
+ - **Speed**: Good sequential processing, benefits from specialized ODE solvers
65
+
66
+ ## Mathematical Foundation
67
+ The core state space model follows:
68
+ ```
69
+ dx/dt = A(t,x)·x + B·u
70
+ y = C·x + D·u
71
+ ```
72
+
73
+ With adaptive time constants:
74
+ ```
75
+ τ(x,u) = base_τ × (1 + η·MLP([x;u]))
76
+ effective_dt = min(target_dt, min(τ)/10)
77
+ ```
78
+
79
+ HiPPO matrices initialize A for optimal memory:
80
+ ```
81
+ A_ij = √(2i+1)√(2j+1) if i > j
82
+ A_ii = -(2i+1)
83
+ ```
84
+
85
+ Liquid evolution uses:
86
+ ```
87
+ dx/dt = -x/τ + A·x + B·u + noise·exploration_rate
88
+ ```
89
+
90
+ ## Research Applications
91
+ - **Long-range sequence modeling**
92
+ - **Time series prediction with adaptive dynamics**
93
+ - **Scientific computing with learned ODEs**
94
+ - **Efficient transformer alternatives**
95
+ - **Continuous-time natural language processing**
96
+
97
+ ## Installation
98
+ ```bash
99
+ pip install torch numpy scipy
100
+ # Download liquid_state_space.py from this repo
101
+ ```
102
+
103
+ ## The Classics Revival Collection
104
+
105
+ Liquid State Space Model is part of a larger exploration of foundational algorithms enhanced with modern neural techniques:
106
+
107
+ - Evolutionary Turing Machine
108
+ - Hebbian Bloom Filter
109
+ - Hopfield Decision Graph
110
+ - Liquid Bayes Chain
111
+ - **Liquid State Space Model** ← You are here
112
+ - Möbius Markov Chain
113
+ - Memory Forest
114
+
115
+ ## Citation
116
+ ```bibtex
117
+ @misc{liquidssm2025,
118
+ title={Liquid State Space Model: Continuous-Time Adaptive Sequence Processing},
119
+ author={Jae Parker 𓅸 1990two},
120
+ year={2025},
121
+ note={Part of The Classics Revival Collection}
122
+ }
123
+ ```