laserbrain 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/README.md +62 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # laserbrain
2
+
3
+ Gated Laplace diffusion kernel for token sequences.
4
+
5
+ Each position absorbs from its neighbours via exponential decay — close positions pull more than distant ones. A sigmoid gate controls how much blending occurs.
6
+
7
+ ```js
8
+ const { quadrize } = require('laserbrain')
9
+
10
+ const x = new Float32Array([1, 2, 3, 4, 5])
11
+ const out = quadrize(x)
12
+ ```
13
+
14
+ ## API
15
+
16
+ ### `quadrize(x, k, gate, d)`
17
+
18
+ | param | type | default | description |
19
+ |-------|------|---------|-------------|
20
+ | `x` | Float32Array | — | input sequence, length `ctx` or `ctx*d` |
21
+ | `k` | number | `1.0` | decay rate — higher k = sharper, more local |
22
+ | `gate` | number | `-1.4` | pre-sigmoid blend strength (~0.2 at default) |
23
+ | `d` | number | `1` | embedding dimension (for 2D input, row-major) |
24
+
25
+ Returns a `Float32Array` of the same length.
26
+
27
+ ### `quadrize.kernel`
28
+
29
+ ```js
30
+ { name: 'phronesis', k: 1.0 }
31
+ ```
32
+
33
+ ## intuition
34
+
35
+ ```
36
+ k high → sharp kernel, each token stays close to itself
37
+ k low → flat kernel, all tokens collapse toward the mean
38
+ gate → how strongly the blended signal overwrites the original
39
+ ```
40
+
41
+ At default settings each position blends ~20% toward its neighbourhood.
42
+
43
+ ## 2D (embeddings)
44
+
45
+ Pass flattened `ctx × d` row-major data with `d` set:
46
+
47
+ ```js
48
+ // 4 tokens, 3 dims each
49
+ const x = new Float32Array([
50
+ 1, 0, 0,
51
+ 0, 1, 0,
52
+ 0, 0, 1,
53
+ 1, 1, 0,
54
+ ])
55
+ const out = quadrize(x, 1.0, -1.4, 3)
56
+ ```
57
+
58
+ ## install
59
+
60
+ ```
61
+ npm i laserbrain
62
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laserbrain",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "gated Laplace diffusion kernel — blends each position toward its neighbours with exponential decay and a learned gate",
5
5
  "main": "laserbrain.js",
6
6
  "scripts": {