@wiseaidev/lmm 0.1.15 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
  [![LMM](https://wiseai.dev/assets/logo.png)](https://wiseai.dev)
6
6
 
7
7
  [![Work In Progress](https://img.shields.io/badge/Work%20In%20Progress-orange)](https://github.com/wiseaidotdev/lmm)
8
+ [![Crates.io](https://img.shields.io/crates/v/lmm.svg)](https://crates.io/crates/lmm)
9
+ [![Docs.rs](https://docs.rs/lmm/badge.svg)](https://docs.rs/lmm)
8
10
  [![Crates.io Downloads](https://img.shields.io/crates/d/lmm)](https://crates.io/crates/lmm)
9
11
  [![PyPI version](https://img.shields.io/pypi/v/lmm-rs.svg)](https://pypi.org/project/lmm-rs/)
10
12
  [![NPM version](https://img.shields.io/npm/v/@wiseaidev/lmm.svg)](https://www.npmjs.com/package/@wiseaidev/lmm)
@@ -17,46 +19,44 @@
17
19
  [![Share On X](https://img.shields.io/badge/share%20on-X-03A9F4?logo=x)](https://twitter.com/share?url=https://github.com/wiseaidotdev/lmm&text=LMM%3A%20Large%20Mathematical%20Model%20%E2%80%94%20Encode%20Reality%20as%20Equations)
18
20
  [![Share On Linkedin](https://img.shields.io/badge/share%20on-linkedin-3949AB?logo=linkedin)](https://www.linkedin.com/shareArticle?url=https://github.com/wiseaidotdev/lmm&title=LMM%3A%20Large%20Mathematical%20Model)
19
21
 
20
- > **LMM** is a pure‑Rust framework that represents higher‑dimensional realities through symbolic mathematics and physics simulation, inspired by the Pharaonic model of intelligence: compress the world into durable, universal equations.
22
+ > **LMM (Large Mathematical Model)** is a pure‑Rust framework that models higher‑dimensional reality through symbolic mathematics and physics simulation; Inspired by the Pharaonic model of intelligence: compress the world into durable, universal equations. No training. No GPU. No API key.
23
+
24
+ | 🐧 Linux `(Recommended)` | 🪟 Windows | 🐳 Docker |
25
+ | :------: | :--------: | :--------: |
26
+ | ![lmm-linux](https://github.com/wiseaidotdev/lmm/blob/main/assets/linux.png) | ![lmm-windows](https://github.com/wiseaidotdev/lmm/blob/main/assets/linux.png) | ![lmm-linux](https://github.com/wiseaidotdev/lmm/blob/main/assets/linux.png) |
27
+ | [Download `lmm` binary](https://github.com/wiseaidotdev/lmm/releases/latest/download/lmm) | [Download `lmm.exe` binary](https://github.com/wiseaidotdev/lmm/releases/latest/download/lmm.exe) | `docker pull wiseaidev/lmm` |
28
+ | `cargo install lmm --features rust-binary` | `cargo install lmm --features rust-binary` | `docker run -it wiseaidev/lmm` |
29
+ | `lmm` ← launches CLI | `lmm` ← launches CLI | [Read DOCKER.md](https://github.com/wiseaidotdev/lmm/blob/main/DOCKER.md) |
21
30
 
22
31
  </div>
23
32
 
24
33
  ## 🎬 Demo
25
34
 
26
- The following is a proof-of-concept demonstration of the predictive engine generating coherent English sentences. It is powered purely by deterministic mathematical equations and structural Subject-Verb-Object loops, utilizing the standard Linux system dictionary (`/usr/share/dict/words`) as its vocabulary fallback to function.
27
-
28
- <video src="https://github.com/user-attachments/assets/f20ed16f-d90e-4983-bc47-0de2ce5c5a4f"></video>
29
-
30
- This engine supports a complete suite of text-generation CLI commands, including `summarize`, `sentence`, `paragraph`, `essay`, and `ask` enabling sophisticated multi-paragraph construction driven entirely by mathematics.
31
-
32
- <video src="https://github.com/user-attachments/assets/680d4ef4-bab1-47d4-84e8-86a11aa93294"></video>
33
-
34
- <video src="https://github.com/user-attachments/assets/299c280d-dcf3-484f-bf02-c37836811dcb"></video>
35
+ The following demonstrates the symbolic prediction engine generating coherent English sentences powered entirely by deterministic mathematical equations and structural Subject-Verb-Object grammar; No neural networks, no statistical models. The engine supports a full suite of CLI subcommands including `predict`, `summarize`, `sentence`, `paragraph`, `essay`, and `ask`, enabling multi-paragraph construction driven entirely by mathematics.
35
36
 
36
- <video src="https://github.com/user-attachments/assets/06ef5c15-7743-4d62-908f-52d22288de76"></video>
37
+ | | | |
38
+ |:---:|:---:|:---:|
39
+ | <video src="https://github.com/user-attachments/assets/f20ed16f-d90e-4983-bc47-0de2ce5c5a4f"></video> | <video src="https://github.com/user-attachments/assets/680d4ef4-bab1-47d4-84e8-86a11aa93294"></video> | <video src="https://github.com/user-attachments/assets/299c280d-dcf3-484f-bf02-c37836811dcb"></video> |
40
+ | <video src="https://github.com/user-attachments/assets/06ef5c15-7743-4d62-908f-52d22288de76"></video> | <video src="https://github.com/user-attachments/assets/3b4bba24-012b-487b-98c8-91e61336cead"></video> | <video src="https://github.com/user-attachments/assets/fc1d0adc-e2c3-421a-b6b6-4b21dcf3af06"></video> |
37
41
 
38
- <video src="https://github.com/user-attachments/assets/3b4bba24-012b-487b-98c8-91e61336cead"></video>
39
-
40
- <video src="https://github.com/user-attachments/assets/fc1d0adc-e2c3-421a-b6b6-4b21dcf3af06"></video>
41
-
42
- ## 🧠 Framework Overview
42
+ ## 🧠 What Does LMM Provide?
43
43
 
44
44
  LMM bridges multimodal perception and actionable scientific discovery through five tightly integrated layers:
45
45
 
46
- | Layer | Modules | Purpose |
47
- | -------------- | --------------------------------------------- | ------------------------------------------------------- |
48
- | **Perception** | `perception.rs`, `tensor.rs` | Raw bytes → normalised tensors |
49
- | **Symbolic** | `equation.rs`, `symbolic.rs`, `discovery.rs` | GP symbolic regression, differentiation, simplification |
46
+ | Layer | Modules | Purpose |
47
+ | -------------- | --------------------------------------------- | -------------------------------------------------------- |
48
+ | **Perception** | `perception.rs`, `tensor.rs` | Raw bytes → normalised tensors |
49
+ | **Symbolic** | `equation.rs`, `symbolic.rs`, `discovery.rs` | GP symbolic regression, differentiation, simplification |
50
50
  | **Physics** | `physics.rs`, `simulation.rs` | ODE models + Euler / RK4 / RK45 / leapfrog integrators |
51
- | **Causal** | `causal.rs` | SCM graphs, do-calculus interventions, counterfactuals |
52
- | **Cognition** | `consciousness.rs`, `world.rs`, `operator.rs` | Full perceive → encode → predict → act loop |
51
+ | **Causal** | `causal.rs` | SCM graphs, do-calculus interventions, counterfactuals |
52
+ | **Cognition** | `consciousness.rs`, `world.rs`, `operator.rs` | Full perceive → encode → predict → act loop |
53
53
 
54
54
  ### ⚙️ Architecture
55
55
 
56
56
  ```mermaid
57
57
  flowchart TD
58
58
  A["Raw Input\n(bytes / sensors)"]
59
- B["MultiModalPerception\n──► Tensor"]
59
+ B["MultiModalPerception\n → Tensor"]
60
60
  C["Consciousness Loop\nperceive → encode → predict\nevaluate → plan (lookahead)"]
61
61
  D["WorldModel\n(RK4 physics)"]
62
62
  E["SymbolicRegression\n(GP equation search)"]
@@ -73,726 +73,77 @@ flowchart TD
73
73
 
74
74
  ### 🔬 Key Capabilities
75
75
 
76
- - 🧬 **Genetic Programming**: real population-based symbolic regression that seeds templates (linear, quadratic, periodic) and enforces variable-containing equations.
77
- - 📐 **Symbolic Calculus**: automatic differentiation (chain rule, product rule), constant folding simplification.
78
- - 🌀 **Physics Suite**: Harmonic, Lorenz, Pendulum, SIR epidemic, N-body gravity: all implement `Simulatable`.
79
- - 🔢 **Field Calculus**: N-D gradient, Laplacian, divergence, 3-D curl (central differences).
80
- - 🔗 **Causal Reasoning**: structural causal models, `do(X=v)` interventions, counterfactual queries.
81
- - 🧩 **Neural Operators**: circular convolution with SGD kernel learning, Fourier spectral operators.
82
- - 🔤 **Text ↔ Equation**: encode any text into a symbolic equation; decode it back exactly (lossless via residuals).
83
- - 🔮 **Symbolic Prediction**: LMM-native text continuation via sliding-window GP regression and vocabulary anchoring.
84
- - 🎲 **Stochastic Enhancement**: synonym-bank word replacement (`--stochastic`) produces unique output every run while preserving mathematical sentence structure.
76
+ - 🧬 **Genetic Programming**: population-based symbolic regression with template seeding (linear, quadratic, periodic) and variable-enforcement guards.
77
+ - 📐 **Symbolic Calculus**: automatic differentiation (chain rule, product rule, trig) and constant-folding simplification.
78
+ - 🌀 **Physics Suite**: Harmonic Oscillator, Lorenz Attractor, Pendulum, SIR Epidemic, N-body Gravity; All implement `Simulatable`.
79
+ - 🔢 **Field Calculus**: N-D gradient, Laplacian, divergence, and 3-D curl via central differences.
80
+ - 🔗 **Causal Reasoning**: structural causal models, `do(X=v)` interventions, and counterfactual queries.
81
+ - 🧩 **Neural Operators**: circular convolution with SGD kernel learning and Fourier spectral operators.
82
+ - 🔤 **Text ↔ Equation**: losslessly encode any text string into a symbolic equation and recover it exactly via integer residuals.
83
+ - 🔮 **Symbolic Prediction**: equation-native text continuation using sliding-window GP regression and vocabulary anchoring.
84
+ - 🎲 **Stochastic Enhancement**: synonym-bank word replacement (`--stochastic`) delivers unique output each run while preserving mathematical sentence structure.
85
+ - 🎨 **Spectral Image Synthesis**: generate procedural PPM images from a text prompt by hashing it into Fourier wave components.
85
86
 
86
87
  ## 📦 Installation
87
88
 
88
- ### From Source
89
-
90
- ```sh
91
- git clone https://github.com/wiseaidotdev/lmm
92
- cd lmm
93
- cargo build --release --all-features
94
- ```
95
-
96
- The binary is at `./target/release/lmm`.
97
-
98
- ### Via Cargo
99
-
100
- ```sh
101
- cargo install lmm --all-features
102
- ```
103
-
104
- ### Via NPM
105
-
106
- ```sh
107
- npm install -g @wiseaidev/lmm
108
- ```
109
-
110
- ### Via Python
111
-
112
- ```sh
113
- pip install lmm-rs
114
- ```
115
-
116
- > [!NOTE]
117
- > Requires Rust 1.86+. Install via [rustup](https://rustup.rs).
118
-
119
- > [!TIP]
120
- > To enable internet-aware commands (`ask`), install with the `net` feature:
121
- >
122
- > ```sh
123
- > cargo install lmm --features cli,net
124
- > # or
125
- > cargo install lmm --all-features
126
- > ```
127
- >
128
- > Or build from source: `cargo build --release --features cli,net`
129
-
130
- ## 🚀 CLI Usage
131
-
132
- ```sh
133
- ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄ ▄▄▄
134
- ▀██▀ ███▄ ▄███ ███▄ ▄███
135
- ██ ██ ▀█▀ ██ ██ ▀█▀ ██
136
- ██ ██ ██ ██ ██
137
- ██ ██ ██ ██ ██
138
- ████████ ▀██▀ ▀██▄ ▀██▀ ▀██▄
139
-
140
- Large Mathematical Model · Equation-Based Intelligence
141
-
142
- The `lmm` CLI enables interaction with the Large Mathematical Model (LMM).
143
- It provides advanced equation discovery, physics simulation, causal
144
- inference, and unified sequence processing features.
145
-
146
- Usage: lmm <COMMAND>
147
- Commands:
148
- simulate Simulate continuous logical pathways
149
- discover Discover governing equations from data
150
- consciousness Evaluate conscious state coherence
151
- physics Run harmonic and chaotic physical models
152
- causal Perform causal interventions and counterfactuals
153
- field Compute tensor field gradients and divergences
154
- encode Encode continuous truth into discrete text
155
- decode Decode text back into dynamic equations
156
- predict Predict next sequence based on pattern logic
157
- summarize Extract key meaning via GP scoring
158
- sentence Generate a single structural sentence
159
- paragraph Generate a cohesive paragraph from a seed
160
- essay Structure a full essay with intro and conclusion
161
- ask Ask a question and get an equation-scored answer from the web
162
- imagen Generate an image from text via Spectral Field Synthesis
163
- help Print this message or the help of the given subcommand(s)
164
-
165
- Global Stochastic Flags (available on predict, summarize, sentence, paragraph, essay, ask):
166
- --stochastic Enable synonym-based randomization of output
167
- --probability Replacement rate 0.0 - 1.0 (default: 0.5)
168
-
169
- Options:
170
- -v, --verbose Show detailed output with formatting
171
- -h, --help Print help
172
- -V, --version Print version
173
- ```
174
-
175
- > [!TIP]
176
- > By default, all commands cleanly output their raw generated results. Provide the `--verbose` (or `-v`) flag to display full interactive banners, seed information, and boxed separators!
177
-
178
- ## 📖 Subcommand Reference
179
-
180
- ### 1. `simulate`: Harmonic Oscillator
181
-
182
- Runs a harmonic oscillator using the RK4 integrator.
183
-
184
- ```sh
185
- lmm simulate --step 0.01 --steps 200
186
- ```
187
-
188
- ```sh
189
- Simulated 200 steps with step_size=0.01
190
- Final state: [-0.41614683639502004, -0.9092974268937748]
191
- ```
192
-
193
- | Flag | Default | Description |
194
- | --------------- | ------- | --------------------------- |
195
- | `-s`, `--step` | `0.01` | Integration step size (Δt) |
196
- | `-t`, `--steps` | `100` | Number of integration steps |
197
-
198
- ### 2. `physics`: Physics Model Simulation
199
-
200
- Simulate one of four built-in physics models.
201
-
202
- ```sh
203
- # Lorenz chaotic attractor (σ=10, ρ=28, β=8/3)
204
- lmm physics --model lorenz --steps 500 --step-size 0.01
205
-
206
- # Nonlinear pendulum
207
- lmm physics --model pendulum --steps 300 --step-size 0.005
208
-
209
- # SIR epidemic model
210
- lmm physics --model sir --steps 1000 --step-size 0.5
211
-
212
- # Damped harmonic oscillator (default)
213
- lmm physics --model harmonic --steps 200
214
- ```
215
-
216
- **Lorenz example:**
217
-
218
- ```sh
219
- Lorenz: 500 steps. Final xyz: [-8.900269690476492, -7.413716837503834, 29.311877708359006]
220
- ```
221
-
222
- **SIR example:**
223
-
224
- ```sh
225
- SIR: 1000 steps. Final [S,I,R]: [58.797367656865795, 7.649993277129408e-15, 941.2026323431321]
226
- ```
227
-
228
- | Flag | Default | Description |
229
- | ------------------- | ---------- | ---------------------------------------------- |
230
- | `-m`, `--model` | `harmonic` | Model: `lorenz`, `pendulum`, `sir`, `harmonic` |
231
- | `-s`, `--steps` | `200` | Number of integration steps |
232
- | `-z`, `--step-size` | `0.01` | Step size Δt |
233
-
234
- ### 3. `discover`: Symbolic Regression
235
-
236
- Runs Genetic Programming (GP) to discover a symbolic equation from data.
237
-
238
- ```sh
239
- lmm discover --iterations 200
240
- ```
241
-
242
- ```sh
243
- Discovered equation: (x + (1.002465056833142 + x))
244
- ```
245
-
246
- The engine fits data points `(i*0.5, 2*i*0.5 + 1)` by default and finds the
247
- underlying linear law. Increase `--iterations` for more complex datasets.
248
-
249
- | Flag | Default | Description |
250
- | -------------------- | ----------- | ------------------------------------------------ |
251
- | `-d`, `--data-path` | `synthetic` | Data source (`synthetic` = built-in linear data) |
252
- | `-i`, `--iterations` | `100` | Number of GP evolution iterations |
253
-
254
- ### 4. `consciousness`: Perceive → Predict → Act Loop
255
-
256
- Runs one tick of the full consciousness loop: raw bytes → perception tensor →
257
- world model prediction → action plan.
258
-
259
- ```sh
260
- lmm consciousness --lookahead 5
261
- ```
262
-
263
- ```sh
264
- Consciousness ticked. New state: [0.0019607843137254832, -0.24901960784313726, -0.37450980392156863, 0.5]
265
- Mean prediction error: 0
266
- ```
267
-
268
- | Flag | Default | Description |
269
- | ------------------- | ------- | ---------------------------------- |
270
- | `-l`, `--lookahead` | `3` | Multi-step lookahead horizon depth |
271
-
272
- ### 5. `causal`: Causal Graph + do-Calculus
273
-
274
- Builds a 3-node Structural Causal Model (`x → y → z`) and applies an
275
- intervention `do(node = value)`, printing before/after values.
276
-
277
- ```sh
278
- # Intervene on x: set x = 10, observe how y and z change
279
- lmm causal --intervene-node x --intervene-value 10.0
280
- ```
281
-
282
- ```sh
283
- Before intervention: x=Some(3.0), y=Some(6.0), z=Some(7.0)
284
- After do(x=10): x=Some(10.0), y=Some(20.0), z=Some(21.0)
285
- ```
286
-
287
- The SCM is:
288
-
289
- - `y = 2 * x`
290
- - `z = y + 1`
291
-
292
- | Flag | Default | Description |
293
- | ------------------------- | ------- | -------------------------------------- |
294
- | `-n`, `--intervene-node` | `x` | Name of the node to intervene on |
295
- | `-v`, `--intervene-value` | `1.0` | Value to set the node to (do-calculus) |
296
-
297
- ### 6. `field`: Scalar Field Calculus
298
-
299
- Computes differential operators on a 1-D scalar field `f(i) = i²`.
300
-
301
- ```sh
302
- # Gradient: should approach 2i (central differences)
303
- lmm field --size 8 --operation gradient
304
-
305
- # Laplacian: should be ≈ 2 everywhere (second derivative of x²)
306
- lmm field --size 8 --operation laplacian
307
- ```
308
-
309
- ```sh
310
- Gradient of x²: [1.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 13.0]
311
- ```
312
-
313
- ```sh
314
- Laplacian of x²: [0.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 0.0]
315
- ```
316
-
317
- | Flag | Default | Description |
318
- | ------------------- | ---------- | ------------------------------------ |
319
- | `-s`, `--size` | `10` | Number of field points |
320
- | `-o`, `--operation` | `gradient` | Operation: `gradient` or `laplacian` |
321
-
322
- ### 7. `encode`: Text → Symbolic Equation
323
-
324
- This is the flagship demonstration of LMM's power. Any text is treated as a
325
- sequence of byte values indexed by position. The GP engine discovers a symbolic
326
- equation `f(x) ≈ byte[x]`. Integer residuals `(byte[x] - round(f(x)))` are
327
- stored alongside the equation, guaranteeing **lossless round-trip recovery**.
328
-
329
- ```sh
330
- lmm encode --text "The Pharaohs encoded reality in mathematics." \
331
- --iterations 150 --depth 5
332
- ```
333
-
334
- ```sh
335
- ╔══════════════════════════════════════════════════════╗
336
- ║ 📐 Encode · GP Symbolic Compression ║
337
- ╚══════════════════════════════════════════════════════╝
338
-
339
- 📝 Input : "The Pharaohs encoded reality in mathematics."
340
- 📏 Length : 44 chars
341
-
342
- -- Equation ----------------------------------
343
- Equation: ((-12.541407707100985 * sin((-0.4 + ((x * x) * 0.8837323816189393)))) + 94.96615109151574)
344
- Length: 44 chars
345
- MSE: 530.1715
346
- Max residual: 56
347
-
348
- -- Encoded Data ------------------------------
349
- {"eq":"((-12.541407707100985 * sin((-0.4 + ((x * x) * 0.8837323816189393)))) + 94.96615109151574)","len":44,"mse":530.171549,"res":[-16,15,6,-51,-3,13,2,8,-3,27,9,17,-51,-6,15,-2,12,-1,5,-7,-51,16,7,13,9,0,22,28,-51,22,13,-56,11,10,19,22,18,15,5,12,8,13,23,-49]}
350
-
351
- -- Round-trip Verify -------------------------
352
- ✅ PERFECT
353
- Decoded : "The Pharaohs encoded reality in mathematics."
354
-
355
- 💾 To decode later:
356
- lmm decode --equation "((-12.541407707100985 * sin((-0.4 + ((x * x) * 0.8837323816189393)))) + 94.96615109151574)" --length 44 --residuals "-16,15,6,-51,-3,13,2,8,-3,27,9,17,-51,-6,15,-2,12,-1,5,-7,-51,16,7,13,9,0,22,28,-51,22,13,-56,11,10,19,22,18,15,5,12,8,13,23,-49"
357
- ```
358
-
359
- > [!NOTE]
360
- > GP is stochastic: the discovered equation and residual values will differ across runs. The round-trip recovery is always ✅ PERFECT because the integer residuals correct for any approximation error.
361
-
362
- ```sh
363
- # Encode from a file
364
- lmm encode --input ./my_message.txt --iterations 200 --depth 5
365
- ```
366
-
367
- | Flag | Default | Description |
368
- | --------------- | ------------- | -------------------------------------------------- |
369
- | `-i`, `--input` | `-` | Path to a text file to encode (`-` = use `--text`) |
370
- | `-t`, `--text` | `Hello, LMM!` | Inline text (used when `--input` is `-`) |
371
- | `--iterations` | `80` | GP evolution iterations |
372
- | `--depth` | `4` | Maximum expression tree depth |
373
-
374
- ### 8. `decode`: Symbolic Equation → Text
375
-
376
- Reconstructs the original text from the equation and residuals printed by `encode`.
377
-
378
- ```sh
379
- lmm decode \
380
- --equation "(95.09620435614187 - cos(x))" \
381
- --length 44 \
382
- --residuals "-10,9,5,-64,-16,9,3,20,2,15,8,20,-62,7,15,3,15,5,7,6,-63,18,5,1,13,11,22,26,-64,9,15,-62,15,2,20,8,6,15,3,21,9,3,20,-49"
383
- ```
384
-
385
- ```sh
386
- ╔══════════════════════════════════════════════════════╗
387
- ║ 🔓 Decode · Equation to Text ║
388
- ╚══════════════════════════════════════════════════════╝
389
-
390
- 📐 Equation : (95.09620435614187 - cos(x))
391
- 📏 Length : 44
392
-
393
- -- Decoded Text ------------------------------
394
- The Pharaohs encoded reality in mathematics.
395
- ```
396
-
397
- | Flag | Required | Description |
398
- | ------------------- | -------- | --------------------------------------------------------------------------- |
399
- | `-e`, `--equation` | ✅ | Equation string (from `encode` output) |
400
- | `-l`, `--length` | ✅ | Number of characters to recover |
401
- | `-r`, `--residuals` | ✅ | Comma-separated residuals. Use `--residuals="-3,1,..."` for negative values |
402
-
403
- > [!IMPORTANT]
404
- > Use `--residuals="-3,..."` (with `=`) or quote the argument when residuals contain negative values to prevent the shell from treating them as flags.
405
-
406
- ### 9. `predict`: Symbolic Text Continuation
407
-
408
- The `predict` command acts as LMM's continuation engine. Unlike neural network LLMs that use massive statistical models, LMM strings together coherent English output using **Pure Mathematics**.
409
-
410
- It does this by operating on three distinct, deterministic signals:
411
-
412
- - **GP Trajectory Equation**: `f(pos) → word_byte_tone` (discovers long-range subject themes)
413
- - **GP Rhythm Equation**: `g(pos) → word_length` (discovers alternating phonetic cadence)
414
- - **Dictionary Grammar Engine**: Maps mathematical values to a curated pool of English nouns, verbs, adjectives with system dictionary fallback (`/usr/share/dict`), while flowing through cyclic Subject-Verb-Object (SVO) POS grammar loops.
415
-
416
- ```sh
417
- lmm predict --text "Wise AI built the first LMM" --window 10 --predict-length 80
418
- ```
419
-
420
- ```text
421
- ╔══════════════════════════════════════════════════════╗
422
- ║ 🔮 Predict · Symbolic Continuation ║
423
- ╚══════════════════════════════════════════════════════╝
424
-
425
- 📚 Dictionary: 63746 words loaded
426
- 📝 Input : "Wise AI built the first LMM"
427
- 🪟 Window : 6 words
428
- 📈 Trajectory: (x + 103.82300000000001)
429
- 🎵 Rhythm : (3.00402169780806 + sin(cos(cos(x))))
430
-
431
- -- Continuation ------------------------------
432
- Wise AI built the first LMM in the true soul often long time and an open path of a solid scope is the human
433
- ```
434
-
435
- > [!NOTE]
436
- > Text is parsed completely via pure equations over a carefully constructed English vocabulary pool, mapping geometric relationships and POS states into elegant and mysterious sentences.
437
-
438
- | Flag | Default | Description |
439
- | ------------------------ | --------------------------------- | ------------------------------------------------ |
440
- | `-i`, `--input` | `-` | Path to a text file (`-` = use `--text`) |
441
- | `-t`, `--text` | `The Pharaohs encoded reality in` | Inline text seed |
442
- | `-w`, `--window` | `32` | Context window in words |
443
- | `-p`, `--predict-length` | `16` | Approximate character budget for continuation |
444
- | `--iterations` | `80` | GP evolution iterations for the prediction model |
445
- | `--depth` | `4` | Maximum expression tree depth |
446
- | `--stochastic` | `false` | Enable synonym-based output randomization |
447
- | `--probability` | `0.5` | Word replacement rate (0.0 = none, 1.0 = all) |
448
-
449
- ### 10. `summarize`: Key Sentence Extraction
450
-
451
- Summarize distills a large body of text down to its most mathematically significant sentences. It scores each sentence by tracking tone deviations, length variances, and relative position.
452
-
453
- ```sh
454
- lmm summarize --text "The ancient Egyptians built the pyramids using advanced mathematical knowledge. Their understanding of geometry was extraordinary for the time. Modern engineers still struggle to replicate their precision. Mathematics was their sacred language of cosmic alignment." --sentences 2
455
- ```
456
-
457
- ```sh
458
- ╔══════════════════════════════════════════════════════╗
459
- ║ ✂️ Summarize · Key Sentence Extraction ║
460
- ╚══════════════════════════════════════════════════════╝
461
-
462
- 📝 Input : 264 chars
463
- 📊 Extracting 2 key sentences via GP scoring...
464
-
465
- -- Summary -----------------------------------
466
- 1. The ancient Egyptians built the pyramids using advanced mathematical knowledge.
467
- 2. Mathematics was their sacred language of cosmic alignment.
468
- ```
469
-
470
- | Flag | Default | Description |
471
- | ------------------- | ------- | ---------------------------------- |
472
- | `-t`, `--text` | `...` | Input text to summarize |
473
- | `-n`, `--sentences` | `2` | Number of key sentences to extract |
474
- | `--stochastic` | `false` | Enable synonym-based randomization |
475
- | `--probability` | `0.5` | Word replacement rate (0.0 - 1.0) |
476
-
477
- ### 11. `sentence`: Single Sentence Generation
478
-
479
- Generates a single, structurally elegant sentence. Add `--stochastic` to randomize word choices on each run - the mathematical structure stays fixed while synonyms vary.
480
-
481
- ```sh
482
- lmm sentence --text "Mathematics is the language of the universe"
483
-
484
- # With stochastic: different output every time
485
- lmm sentence --text "Mathematics is the language of the universe" --stochastic
486
- ```
487
-
488
- ```sh
489
- ╔══════════════════════════════════════════════════════╗
490
- ║ ✍️ Sentence · Single Sentence Generation ║
491
- ╚══════════════════════════════════════════════════════╝
492
-
493
- 🌱 Seed : "Mathematics is the language of the universe"
494
-
495
- -- Generated Sentence ------------------------
496
- Analysis enables the dynamic meaning of the universe.
497
-
498
- # --stochastic run 1:
499
- Cognition enables the dynamic significance of the world.
500
-
501
- # --stochastic run 2:
502
- Purplish facilitates the dynamic meaning of the world.
503
- ```
504
-
505
- | Flag | Default | Description |
506
- | --------------- | ------- | ------------------------------------------------- |
507
- | `-t`, `--text` | `...` | Seed topic |
508
- | `--stochastic` | `false` | Randomize word synonyms each run |
509
- | `--probability` | `0.5` | Fraction of eligible words to replace (0.0 - 1.0) |
510
-
511
- ### 12. `paragraph`: Cohesive Paragraph Generation
512
-
513
- Chains multiple logically coherent sentences together, seeding subsequent sentence structures using extracted keywords from the original seed.
514
-
515
- ```sh
516
- lmm paragraph --text "Equations reveal hidden truths about nature" --sentences 6
517
- ```
518
-
519
- ```sh
520
- ╔══════════════════════════════════════════════════════╗
521
- ║ 📄 Paragraph · Generate a Paragraph ║
522
- ╚══════════════════════════════════════════════════════╝
523
-
524
- 🌱 Seed : "Equations reveal hidden truths about nature"
525
- 📊 Sentences : 6
526
-
527
- -- Generated Paragraph -----------------------
528
-
529
- Simulation manifests the continuous symmetry of the truths. The symmetric wavelength connects infinity. Entropy remains the invariant truths underlying knowledge. The entropy of truths connects infinity. In essence, the symmetric integration encodes boundaries. Dimension describes precise reality beneath truths.
530
- ```
531
-
532
- | Flag | Default | Description |
533
- | ------------------- | ------- | ------------------------------------------------- |
534
- | `-t`, `--text` | `...` | Seed topic for paragraph generation |
535
- | `-n`, `--sentences` | `4` | Number of sentences in the paragraph |
536
- | `--stochastic` | `false` | Randomize word synonyms each run |
537
- | `--probability` | `0.5` | Fraction of eligible words to replace (0.0 - 1.0) |
538
-
539
- ### 13. `essay`: Full Essay Blueprint
540
-
541
- Generates a fully structured essay, complete with an introduction, mathematical body paragraphs based on derived sub-topics, and a cohesive conclusion.
542
-
543
- ```sh
544
- lmm essay --text 'Symmetry and the deeper patterns of physics' --paragraphs 2 --sentences 15
545
- ```
546
-
547
- ```sh
548
- ╔══════════════════════════════════════════════════════╗
549
- ║ 📖 Essay · Generate a Full Essay ║
550
- ╚══════════════════════════════════════════════════════╝
551
-
552
- 🌱 Topic : "Symmetry and the deeper patterns of physics"
553
- 📊 Paragraphs : 2 (15 sentences each)
554
-
555
- -- Essay -------------------------------------
556
-
557
- ══════════════════════════════════════
558
- 📖 Symmetry And The Deeper Patterns Of Physics
559
- ══════════════════════════════════════
560
-
561
- -- Introduction ------------------------------
562
-
563
- Analysis illuminates the probabilistic motion of the truth. The deterministic probability reflects knowledge. Algebra holds the infinite truth of motion. The frequency of truth shapes chaos. At its core, the axiomatic probability transforms perception. Physics unveils bounded infinity beyond truth. Recursion connects the bounded balance of the truth. The dynamic wavelength unveils infinity. Wavelength remains the bounded truth through reality. The dimension of truth produces identity. At its core, the discrete frequency governs existence. Frequency produces invariant perception pervading truth. Structure unveils the invariant existence of the truth. The coherent integration produces existence. Integration remains the mathematical truth governing complexity.
564
-
565
-
566
- -- Body · §1 ---------------------------------
567
-
568
- At its core, the discrete computation governs truth. Computation manifests invariant harmony pervading symmetry. Topology enables the invariant truth of the symmetry. The coherent transformation manifests change. Transformation remains the mathematical symmetry governing time. The physics of symmetry encodes order. In this framework, the continuous calculus generates nature. Geometry enables axiomatic space across symmetry. Gradient determines the axiomatic time of the symmetry. The structural divergence illuminates matter. Physics remains the probabilistic symmetry beneath meaning. The mathematics of symmetry expresses truth. At its core, the deterministic recursion captures matter. Entropy unveils abstract balance of symmetry. Divergence connects the abstract limits of the symmetry.
569
-
570
-
571
- -- Body · §2 ---------------------------------
572
-
573
- The recursive transformation manifests energy. Transformation remains the continuous symmetry within limits. The calculus of symmetry enables meaning. At its core, the axiomatic analysis transforms knowledge. Gradient illuminates probabilistic motion inside symmetry. Pattern illuminates the probabilistic truth of the symmetry. The fundamental physics expresses matter. Physics remains the deterministic symmetry underlying harmony. The algebra of symmetry unveils energy. In this framework, the abstract recursion captures causality. Entropy describes bounded truth beyond symmetry. Divergence connects the bounded unity of the symmetry. The dynamic logic unveils truth. Resonance remains the bounded symmetry through knowledge. The entropy of symmetry produces knowledge.
574
-
575
-
576
- -- Conclusion --------------------------------
577
-
578
- Gradient unveils the invariant limits of the symmetry. The invariant computation compresses balance. Divergence is the bounded symmetry of identity. The pattern of symmetry defines matter. Fundamentally, the continuous gradient generates truth. Logic determines axiomatic harmony across symmetry. Recursion determines the axiomatic infinity of the symmetry. The structural entropy illuminates infinity. Entropy are the probabilistic symmetry beneath space. The dimension of symmetry expresses reality. Moreover, the deterministic frequency defines existence. Frequency connects abstract perception of symmetry. Structure encodes the abstract chaos of the symmetry. The elegant integration encodes existence. Integration are the dynamic symmetry within meaning.
579
- ```
580
-
581
- | Flag | Default | Description |
582
- | -------------------- | ------- | ------------------------------------------------- |
583
- | `-t`, `--text` | `...` | Topic or title seed for the essay |
584
- | `-n`, `--paragraphs` | `2` | Number of body paragraphs to generate |
585
- | `-s`, `--sentences` | `3` | Number of sentences per paragraph |
586
- | `--stochastic` | `false` | Randomize word synonyms each run |
587
- | `--probability` | `0.5` | Fraction of eligible words to replace (0.0 - 1.0) |
588
-
589
- ### 14. `ask`: Internet-Aware Knowledge Synthesis _(requires `net` feature)_
590
-
591
- Searches the internet via DuckDuckGo Lite, aggregates the result snippets into a single text corpus, then applies the LMM's GP-scored equation engine to extract and compose the most mathematically significant sentences into a coherent response.
592
-
593
- ```sh
594
- lmm ask --prompt "What is the Rust programming language?" --limit 5 --sentences 3
595
- ```
596
-
597
- ```sh
598
- ╔══════════════════════════════════════════════════════╗
599
- ║ 🌐 Ask · Internet-Aware Knowledge Synthesis ║
600
- ╚══════════════════════════════════════════════════════╝
601
-
602
- ❓ Prompt : "What is the Rust programming language?"
603
-
604
- -- DuckDuckGo Results ------------------------
605
- Rust (programming language)
606
- Abstract: Rust is a general-purpose programming language. It is noted for its emphasis on performance, type safety, concurrency, and memory safety. Rust supports multiple programming paradigms. It was influenced by ideas from functional programming, including immutability, higher-order functions, algebraic data types, and pattern matching. It also supports object-oriented programming via structs, enums, traits, and methods. Rust is noted for enforcing memory safety without a conventional garbage collector; instead, memory safety errors and data races are prevented by the "borrow checker", which tracks the object lifetime of references at compile time. Software developer Graydon Hoare created Rust in 2006 while working at Mozilla, which officially sponsored the project in 2009. The first stable release, Rust 1.0, was published in May 2015.
607
- Abstract Source: Wikipedia
608
- Abstract URL: https://en.wikipedia.org/wiki/Rust_(programming_language)
609
- Image URL: https://duckduckgo.com/i/832f249b21809a13.png
610
- 1. Rust (programming language) Category
611
- URL: https://duckduckgo.com/c/Rust_(programming_language)?kp=%2D2
612
- --------------------------------------------
613
- 2. History of programming languages - The history of programming languages spans from documentation of early mechanical computers to modern tools for software development. Early programming languages were highly specialized, relying on mathematical notation and similarly obscure syntax.
614
- URL: https://duckduckgo.com/History_of_programming_languages?kp=%2D2
615
- --------------------------------------------
616
- 3. Outline of the Rust programming language - The following outline is provided as an overview of and topical guide to Rust: Rust is a multi-paradigm programming language emphasizing performance, memory safety, and concurrency.
617
- URL: https://duckduckgo.com/Outline_of_the_Rust_programming_language?kp=%2D2
618
- --------------------------------------------
619
- 4. Pattern matching programming languages
620
- URL: https://duckduckgo.com/c/Pattern_matching_programming_languages?kp=%2D2
621
- --------------------------------------------
622
- 5. Multi-paradigm programming languages
623
- URL: https://duckduckgo.com/c/Multi-paradigm_programming_languages?kp=%2D2
624
- --------------------------------------------
625
-
626
-
627
- -- LMM Response ------------------------------
628
- Rust is a general-purpose programming language.
629
- Rust supports multiple programming paradigms.
630
- Outline of the Rust programming language - The following outline is provided as an overview of and topical guide to Rust: Rust is a multi-paradigm programming language emphasizing performance, memory safety, and concurrency.
631
- ```
632
-
633
- > [!NOTE]
634
- > The `ask` command requires building with `--features cli,net`. No API key is needed.
635
-
636
- | Flag | Default | Description |
637
- | ------------------- | -------- | ------------------------------------------------- |
638
- | `-p`, `--prompt` | required | The question or search query |
639
- | `-l`, `--limit` | `5` | Maximum number of search results to fetch |
640
- | `-n`, `--sentences` | `3` | Number of key sentences to extract |
641
- | `--region` | `wt-wt` | DuckDuckGo region code (e.g. `us-en`, `uk-en`) |
642
- | `--iterations` | `40` | GP scoring iterations |
643
- | `--depth` | `3` | Maximum GP expression depth |
644
- | `--stochastic` | `false` | Randomize word synonyms in the answer |
645
- | `--probability` | `0.5` | Fraction of eligible words to replace (0.0 - 1.0) |
646
-
647
- ### 15. `imagen`: Spectral Field Synthesis Image Generation
648
-
649
- Generates an image from text based on Spectral Field Synthesis. It hashes the prompt to derive pure mathematical wave components, applies non-linear styles, and maps amplitudes to RGB.
650
-
651
- ```sh
652
- lmm imagen --prompt "The ancient Egyptians built the pyramids with mathematical precision" \
653
- --width 512 --height 512 --style plasma --palette warm --components 12 --output ./egypt.ppm
654
- ```
655
-
656
- ```sh
657
- ╔══════════════════════════════════════════════════════╗
658
- ║ 🎨 Imagen · Spectral Field Synthesis ║
659
- ╚══════════════════════════════════════════════════════╝
660
-
661
- 🖼 Prompt : "The ancient Egyptians built the pyramids with mathematical precision"
662
- 📐 Dimensions : 512x512
663
- 🎭 Style : plasma
664
- 🎨 Palette : warm
665
- 🌊 Components : 12
666
-
667
-
668
- -- Rendering ---------------------------------
669
- ✅ Saved to: ./egypt.ppm
670
- ```
671
-
672
- | Flag | Default | Description |
673
- | -------------------- | ------------ | ------------------------------------------------------------------- |
674
- | `-p`, `--prompt` | required | The text prompt to hash into the spectral seed |
675
- | `--width` | `512` | Image width in pixels |
676
- | `--height` | `512` | Image height in pixels |
677
- | `-c`, `--components` | `8` | Number of cosine wave components per channel |
678
- | `-s`, `--style` | `plasma` | Transform: `wave`, `radial`, `orbital`, `fractal`, `flow`, `plasma` |
679
- | `--palette` | `auto` | Color palette: `warm`, `cool`, `neon`, `mono`, `auto` |
680
- | `-o`, `--output` | `output.ppm` | Output file path or directory (auto-names if dir) |
681
-
682
- ## 🔬 Architecture Deep Dive
683
-
684
- ### Genetic Programming Symbolic Regression
685
-
686
- ```mermaid
687
- flowchart TD
688
- A["Seeded population\n(linear/quadratic/periodic templates + random)"]
689
- B["Evaluate fitness\nMDL = n·ln(MSE) + complexity·ln(2)"]
690
- C["Tournament selection (k=5)"]
691
- D["Crossover & mutation"]
692
- E["Reject constant collapse\n(inject fresh random expr 70% of the time)"]
693
- F{Iterations done?}
694
- G["Best variable-containing expression (simplified)"]
695
-
696
- A --> B --> C --> D --> E --> F
697
- F -- No --> B
698
- F -- Yes --> G
699
- ```
89
+ The `lmm` crate ships the following Cargo features:
700
90
 
701
- ### Multi-Signal Prediction Engine
91
+ | Feature | Description |
92
+ | -------------- | ------------------------------------------------------- |
93
+ | `rust-binary` | Enables the standalone `lmm` terminal CLI executable |
94
+ | `cli` | Core CLI scaffolding (subsets of `rust-binary`) |
95
+ | `net` | Internet-aware `ask` command via DuckDuckGo search |
96
+ | `python` | Python extension module via `pyo3` / maturin |
97
+ | `node` | Node.js native add-on via `napi-derive` |
702
98
 
703
- ```mermaid
704
- flowchart TD
705
- In["Context Window\n(Recent Tokens)"]
99
+ ## 🦀 Rust
706
100
 
707
- In -->|Train| M["2nd-Order Markov Chain\nTransition probabilities"]
708
- In -->|GP Fit| T["Word-ID Trajectory GP\nf(pos) ≈ word_id"]
709
- In -->|GP Fit| R["Word-Length Rhythm GP\ng(pos) ≈ length"]
101
+ The `lmm` library is available on [crates.io](https://crates.io/crates/lmm). For the complete API reference, installation guide, and worked examples, see the **[Rust usage guide](https://github.com/wiseaidotdev/lmm/blob/main/RUST.md)**.
710
102
 
711
- In --> S["Suffix Pattern Matcher"]
103
+ ## 💻 Command-Line Interface
712
104
 
713
- S -- "Match Found" --> Out["Exact Phrase Continuation"]
714
- S -- "No Match" --> Score["Composite Scorer"]
105
+ The `lmm` binary supports 15 subcommands spanning simulation, discovery, encoding, prediction, summarisation, and rich text generation: all powered by pure equations.
715
106
 
716
- M --> Score
717
- T --> Score
718
- R --> Score
107
+ For the full option reference and usage examples, see the **[CLI documentation](https://github.com/wiseaidotdev/lmm/blob/main/CLI.md)** or run `lmm --help` after installing with `cargo install lmm --features rust-binary`.
719
108
 
720
- Score -->|Lowest Score| W["Select Best Word from Vocab"]
721
- W -->|Update Recency| Out
722
- ```
109
+ ## 🐍 Python
723
110
 
724
- ### Stochastic Synonym Enhancement
111
+ The Python bindings are published to PyPI as **`lmm-rs`** and are installed with `pip install lmm-rs`. Built with [maturin](https://www.maturin.rs/), the package ships pre-compiled wheels for major CPython versions and runs a fully embedded Tokio runtime; no `asyncio` required.
725
112
 
726
- When `--stochastic` is enabled, the deterministic output is piped through the `StochasticEnhancer` layer, which draws from two synonym sources:
113
+ For installation instructions, configuration options, and full method signatures, see the **[Python usage guide](https://github.com/wiseaidotdev/lmm/blob/main/PYTHON.md)**.
727
114
 
728
- ```mermaid
729
- flowchart TD
730
- T["Deterministic Text Output\n(sentence / paragraph / essay / summary)"] --> TOK["Tokenizer\n(split words, strip punctuation)"]
115
+ ## 🟩 Node.js
731
116
 
732
- TOK --> STW{Stop Word?}
733
- STW -- Yes --> KEEP["Keep Original Word"]
734
- STW -- No --> PROB{"Random(0,1) < probability?"}
117
+ The Node.js bindings are published to npm as **`@wiseaidev/lmm`** and are installed with `npm install @wiseaidev/lmm`. Built with [napi-rs](https://napi.rs/), the package ships a pre-compiled `.node` add-on with TypeScript type definitions.
735
118
 
736
- PROB -- No --> KEEP
737
- PROB -- Yes --> CUR["Curated Synonym Table\n(100+ scientific / mathematical terms)"]
119
+ For installation instructions, type definitions, and examples, see the **[Node.js usage guide](https://github.com/wiseaidotdev/lmm/blob/main/NODE.md)**.
738
120
 
739
- CUR -- Found --> SYN["Pick Random Synonym"]
740
- CUR -- Not Found --> WL["System Dictionary Fallback\n(/usr/share/dict/words)\ngrouped by word length"]
741
- WL -- Found --> SYN
742
- WL -- Not Found --> KEEP
121
+ ## 🌐 WebAssembly (WASM)
743
122
 
744
- SYN --> CASE["Restore Capitalization\n& Punctuation"]
745
- KEEP --> CASE
746
- CASE --> OUT["Stochastic Output\n(unique each run)"]
747
- ```
748
-
749
- ### Spectral Field Synthesis Image Generation
123
+ LMM natively targets `wasm32-unknown-unknown`. Because `reqwest` switches to the browser `fetch` API automatically, you can deploy LMM inside Rust frontend frameworks such as **Yew**, **Dioxus**, and **Leptos** without any additional glue code.
750
124
 
751
- ```mermaid
752
- flowchart TD
753
- P["Text Prompt"] -->|FNV-1a Hash| S["64-bit Spectral Seed"]
754
- S --> W_R["Generate Red Wave Components\n(Freq, Amp, Phase)"]
755
- S --> W_G["Generate Green Wave Components\n(Freq, Amp, Phase)"]
756
- S --> W_B["Generate Blue Wave Components\n(Freq, Amp, Phase)"]
125
+ For CORS considerations, build steps, and usage details, see the **[WASM usage guide](https://github.com/wiseaidotdev/lmm/blob/main/WASM.md)**.
757
126
 
758
- W_R --> F["Evaluate F(x,y) = Σ A_k·cos(2π·f_x·x + 2π·f_y·y + φ_k)\nacross all (x,y) pixels"]
759
- W_G --> F
760
- W_B --> F
127
+ ## 🤖 Agent Framework
761
128
 
762
- F --> T["Apply Non-linear Style Transform\n(Wave, Radial, Fractal, etc.)"]
763
- T --> C["Map to Palette\n(Bias + Amp·sin(v))"]
764
- C --> O["PPM Image Output"]
765
- ```
766
-
767
- ### RK45 Adaptive Integrator
768
-
769
- All Butcher-tableau coefficients are named package-level constants:
770
-
771
- ```rust
772
- const RK45_A41: f64 = 1932.0 / 2197.0;
773
- const RK45_A42: f64 = -7200.0 / 2197.0;
774
- const RK45_A43: f64 = 7296.0 / 2197.0;
775
- const RK45_B5_1: f64 = 16.0 / 135.0;
776
- // ... etc.
777
- ```
778
-
779
- Step size is adapted each iteration using the error estimate:
780
-
781
- ```sh
782
- h_new = 0.9 · h · (tol / error)^0.2
783
- ```
129
+ The `lmm-agent` crate extends LMM with a fully autonomous, equation-based agent layer; no LLM, no API key, no training data.
784
130
 
785
- ## 📰 Publications & Blog Posts
131
+ | Document | Description |
132
+ | -------- | ----------- |
133
+ | **[AGENT.md](AGENT.md)** | Architecture, quick-start, types, and async API reference |
134
+ | **[DERIVE.md](DERIVE.md)** | `#[derive(Auto)]` macro: generated traits and field contract |
135
+ | **[lmm-agent README](lmm-agent/README.md)** | Crate-level API reference, builder, and example |
136
+ | **[lmm-derive README](lmm-derive/README.md)** | Macro crate details and field rules |
786
137
 
787
- ### Official Whitepaper
138
+ ## 📰 Publications & Research
788
139
 
789
- The architecture, formal mathematics, and paradigm behind the framework are fully documented in our official whitepaper.
790
- **[Read the Whitepaper (PDF)](papers/lmm.pdf)**
140
+ The architecture, formal mathematics, and paradigm are fully documented in the official whitepaper:
141
+ **[Read the Whitepaper (PDF)](papers/lmm.pdf)**.
791
142
 
792
143
  ### Blog Posts
793
144
 
794
- - [LLMs are Usefull. LMMs will Break Reality](https://wiseai.dev/blogs/llms-are-usefull-lmms-will-break-reality): The original blog post that started this project.
795
- - [Training Is An Evil Concept. LMMs Eliminates It Altogether](https://wiseai.dev/blogs/training-is-an-evil-concept-lmms-eliminates-it-altogether): Exploring the ethical, architectural, and data advantages of entirely training-free models.
145
+ - [LLMs are Useful. LMMs will Break Reality](https://wiseai.dev/blogs/llms-are-usefull-lmms-will-break-reality): the original post that started this project.
146
+ - [Training Is An Evil Concept. LMMs Eliminates It Altogether](https://wiseai.dev/blogs/training-is-an-evil-concept-lmms-eliminates-it-altogether): ethical, architectural, and data advantages of training-free models.
796
147
 
797
148
  ## 📝 Citation
798
149
 
@@ -808,230 +159,16 @@ If you use LMM in your research, please cite our whitepaper:
808
159
  }
809
160
  ```
810
161
 
811
- ## 🐍 Python API
812
-
813
- Install via pip (built with [maturin](https://github.com/PyO3/maturin)):
814
-
815
- ```sh
816
- # Setup environment
817
- python3 -m venv .venv
818
- source .venv/bin/activate
819
-
820
- # Install package
821
- pip install lmm-rs
822
- ```
823
-
824
- Or build locally:
825
-
826
- ```sh
827
- pip install maturin
828
- maturin develop --features python
829
- ```
830
-
831
- ### Quick Start
832
-
833
- Enter the python interpreter:
834
-
835
- ```sh
836
- python3
837
- ```
838
-
839
- Run the following code:
840
-
841
- ```python
842
- import lmm
843
-
844
- # Tensor arithmetic
845
- t = lmm.Tensor([2, 3], [1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
846
- print(t.shape) # [2, 3]
847
- print(t.norm())
848
-
849
- # Symbolic expression
850
- expr = lmm.Expression.parse("(sin(x) * 2)")
851
- val = expr.evaluate({"x": 3.14159})
852
- deriv = expr.diff("x").simplify()
853
- print(str(deriv))
854
-
855
- # Causal graph
856
- g = lmm.CausalGraph()
857
- g.add_node("x", 3.0); g.add_node("y", None)
858
- g.add_edge("x", "y", 2.0)
859
- g.forward_pass()
860
- y_hat = g.counterfactual("x", 10.0, "y")
861
- print(f"do(x=10) → y = {y_hat}")
862
-
863
- # Physics simulation
864
- osc = lmm.HarmonicOscillator(omega=1.0, x0=1.0, v0=0.0)
865
- sim = lmm.Simulator(step_size=0.01)
866
- state = sim.rk4_step_osc(osc, osc.state())
867
- print(state.data)
868
-
869
- # Encode / decode text
870
- enc = lmm.encode_text("The Pharaohs encoded reality in mathematics.", iterations=80, depth=4)
871
- original = lmm.decode_message(enc["expression"], enc["length"], enc["residuals"])
872
- print(original) # The Pharaohs encoded reality in mathematics.
873
-
874
- # Text continuation
875
- predictor = lmm.TextPredictor(window_size=20, iterations=30, depth=3)
876
- result = predictor.predict("Wise AI built the first LMM", predict_length=80)
877
- print(result["continuation"])
878
-
879
- # Symbolic regression
880
- sr = lmm.SymbolicRegression(max_depth=3, iterations=50)
881
- inputs = [[i * 0.5] for i in range(10)]
882
- targets = [2.0 * i * 0.5 + 1.0 for i in range(10)]
883
- eq = sr.fit(inputs, targets)
884
- print(f"Discovered: {eq}")
885
-
886
- # Consciousness (perceive → act)
887
- brain = lmm.Consciousness(state_len=4, lookahead=5, step_size=0.01)
888
- new_state = brain.tick(bytes("The Pharaohs built the pyramids", "utf-8"))
889
- print(new_state)
890
-
891
- # Render image
892
- path = lmm.render_image("ancient egypt mathematics", width=512, height=512,
893
- style="plasma", palette="warm", output="egypt.ppm")
894
- print(f"Saved to {path}")
895
- ```
896
-
897
- ### Full API Reference
898
-
899
- | Class / Function | Description |
900
- |---|---|
901
- | `Tensor(shape, data)` | n-D dense f64 tensor |
902
- | `Expression.parse(s)` | Parse symbolic expression; `.evaluate(bindings)`, `.diff(var)`, `.simplify()` |
903
- | `CausalGraph()` | SCM with `add_node`, `add_edge`, `forward_pass`, `intervene`, `counterfactual` |
904
- | `HarmonicOscillator(ω, x0, v0)` | 1-D oscillator; `.energy()`, `.state()` |
905
- | `LorenzSystem(σ, ρ, β, x0, y0, z0)` | Lorenz chaotic attractor |
906
- | `Pendulum(g, l, θ₀, ω₀)` | Nonlinear pendulum |
907
- | `SIRModel(β, γ, S₀, I₀, R₀)` | Epidemic compartmental model |
908
- | `Simulator(step_size)` | `.euler_step_osc()`, `.rk4_step_osc()` |
909
- | `SymbolicRegression(max_depth, iterations, ...)` | GP regressor; `.fit(inputs, targets) → str` |
910
- | `SentenceGenerator(iterations, depth)` | `.generate(seed) → str` |
911
- | `ParagraphGenerator(sentence_count, ...)` | `.generate(seed) → str` |
912
- | `TextSummarizer(sentence_count, ...)` | `.summarize(text) → str` |
913
- | `TextPredictor(window_size, iterations, depth)` | `.predict(text, predict_length) → dict` |
914
- | `StochasticEnhancer(p)` | `.enhance(text) → str` |
915
- | `Field(shape, tensor)` | Spatial field; `.laplacian() → Tensor` |
916
- | `NeuralOperator(n_modes)` | `.transform(field) → Field` |
917
- | `Consciousness(state_len, lookahead, step_size)` | `.tick(bytes) → list[float]` |
918
- | `encode_text(text, iterations, depth)` | Returns `{expression, length, residuals}` |
919
- | `decode_message(expression, length, residuals)` | Reconstructs original text |
920
- | `mdl_score(expr, inputs, targets)` | MDL fitness score |
921
- | `compute_mse(expr, inputs, targets)` | Mean squared error |
922
- | `r_squared(expr, inputs, targets)` | R² coefficient |
923
- | `aic_score(n_params, log_likelihood)` | Akaike information criterion |
924
- | `bic_score(n_params, n_samples, log_likelihood)` | Bayesian information criterion |
925
- | `render_image(prompt, ...)` | Spectral field synthesis → PPM file |
926
-
927
- ## 🟨 JavaScript / Node.js API
928
-
929
- Install via npm (built with [napi-rs](https://napi.rs)):
930
-
931
- ```sh
932
- npm install @wiseaidev/lmm
933
- ```
934
-
935
- Or build locally:
936
-
937
- ```sh
938
- npm install -g @napi-rs/cli
939
- napi build --platform --release --features node
940
- ```
941
-
942
- ### Quick Start
943
-
944
- Enter the node interpreter:
945
-
946
- ```sh
947
- node
948
- ```
949
-
950
- Run the following code:
951
-
952
- ```js
953
- // If installed via npm: const lmm = require("@wiseaidev/lmm");
954
- // For local development:
955
- const lmm = require(".");
956
-
957
-
958
- // Tensor
959
- const t = new lmm.Tensor([2, 3], [1, 2, 3, 4, 5, 6]);
960
- console.log(t.shape); // [2, 3]
961
- console.log(t.norm());
962
-
963
- // Symbolic expression
964
- const expr = lmm.Expression.parse("(sin(x) * 2)");
965
- console.log(expr.evaluate({ x: Math.PI }));
966
- console.log(expr.diff("x").simplify().toString());
967
-
968
- // Causal graph
969
- const g = new lmm.CausalGraph();
970
- g.addNode("x", 3.0); g.addNode("y", null);
971
- g.addEdge("x", "y", 2.0);
972
- g.forwardPass();
973
- console.log(g.counterfactual("x", 10.0, "y")); // 20.0
974
-
975
- // Physics
976
- const osc = new lmm.HarmonicOscillator(1.0, 1.0, 0.0);
977
- const sim = new lmm.Simulator(0.01);
978
- const s = sim.rk4StepOsc(osc, new lmm.Tensor([2], osc.state()));
979
- console.log(s.data);
980
-
981
- // Encode / decode
982
- const enc = lmm.encodeText("The Pharaohs encoded reality.", 80, 4);
983
- const dec = lmm.decodeMessage(enc.expression, enc.length, enc.residuals);
984
- console.log(dec);
985
-
986
- // Text continuation
987
- const predictor = new lmm.TextPredictor(20, 30, 3);
988
- const result = predictor.predict("Wise AI built the first LMM", 80);
989
- console.log(result.continuation);
990
-
991
- // Symbolic regression
992
- const sr = new lmm.SymbolicRegression(3, 50, 50);
993
- const eq = sr.fit([[0.5],[1.0],[1.5]], [2.0, 3.0, 4.0]);
994
- console.log(eq);
995
-
996
- // Consciousness
997
- const brain = new lmm.Consciousness(4, 5, 0.01);
998
- const state = brain.tick(Buffer.from("Hello, LMM!"));
999
- console.log(state);
1000
-
1001
- // Render image
1002
- const path = lmm.renderImage("ancient egypt", 512, 512, "warm", "plasma", 8, "out.ppm");
1003
- console.log("Saved:", path);
1004
- ```
162
+ ## 🤝 Contributing
1005
163
 
1006
- ### Full API Reference
164
+ Contributions are welcome! Feel free to open issues or pull requests on [GitHub](https://github.com/wiseaidotdev/lmm).
1007
165
 
1008
- | Export | Description |
1009
- |---|---|
1010
- | `new Tensor(shape, data)` | n-D f64 tensor; `.shape`, `.data`, `.norm()`, `.scale(s)`, `.add(t)`, `.dot(t)` |
1011
- | `Expression.parse(s)` | Parse symbolic expression; `.evaluate(obj)`, `.diff(var)`, `.simplify()`, `.toString()` |
1012
- | `new CausalGraph()` | SCM graph; `addNode`, `addEdge`, `forwardPass`, `intervene`, `getValue`, `counterfactual`, `topologicalOrder` |
1013
- | `new HarmonicOscillator(ω, x0, v0)` | 1-D oscillator; `.omega`, `.energy()`, `.state()` |
1014
- | `new Simulator(stepSize)` | `.eulerStepOsc(model, state)`, `.rk4StepOsc(model, state)` |
1015
- | `new SymbolicRegression(maxDepth, iterations, popSize?)` | `.fit(inputs, targets) → string` |
1016
- | `new TextPredictor(windowSize?, iterations?, depth?)` | `.predict(text, predictLength?) → {continuation, …}` |
1017
- | `new StochasticEnhancer(p)` | `.enhance(text) → string` |
1018
- | `new SentenceGenerator(iterations?, depth?)` | `.generate(seed) → string` |
1019
- | `new ParagraphGenerator(sentenceCount?, iterations?, depth?)` | `.generate(seed) → string` |
1020
- | `new TextSummarizer(sentenceCount?, iterations?, depth?)` | `.summarize(text) → string` |
1021
- | `new Consciousness(stateLen, lookahead?, stepSize?)` | `.tick(Buffer) → number[]` |
1022
- | `encodeText(text, iterations?, depth?)` | Returns `{expression, length, residuals}` |
1023
- | `decodeMessage(expression, length, residuals)` | Reconstructs original text |
1024
- | `mdlScore(expr, inputs, targets)` | MDL fitness score |
1025
- | `computeMse(expr, inputs, targets)` | Mean squared error |
1026
- | `rSquared(expr, inputs, targets)` | R² coefficient |
1027
- | `aicScore(nParams, logLikelihood)` | Akaike information criterion |
1028
- | `bicScore(nParams, nSamples, logLikelihood)` | Bayesian information criterion |
1029
- | `renderImage(prompt, width?, height?, palette?, style?, components?, output?)` | Spectral field synthesis → PPM |
166
+ ## 📄 License
1030
167
 
1031
- ## 🤝 Contributing
168
+ Licensed under the [MIT License](LICENSE).
1032
169
 
1033
- Contributions are welcome! Feel free to open issues or pull requests.
170
+ ## ⭐ Star Us
1034
171
 
1035
- ## 📝 License
172
+ If you use or enjoy LMM, please leave us a star on [GitHub](https://github.com/wiseaidotdev/lmm)! It helps others discover the project and keeps the momentum going ☕.
1036
173
 
1037
- This project is licensed under the MIT License: see the [LICENSE](LICENSE) file for details.
174
+ [![Star History Chart](https://api.star-history.com/svg?repos=wiseaidotdev/lmm&type=Date)](https://star-history.com/#wiseaidotdev/lmm&Date)