@hviana/sema 0.5.6 → 0.5.8
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/CITATION.cff +5 -5
- package/HOW_IT_WORKS.md +114 -30
- package/README.md +127 -73
- package/dist/src/mind/articulation.js +15 -2
- package/dist/src/mind/learning.js +166 -3
- package/dist/src/mind/traverse.d.ts +18 -0
- package/dist/src/mind/traverse.js +24 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/mind/articulation.ts +16 -2
- package/src/mind/learning.ts +159 -4
- package/src/mind/traverse.ts +29 -0
- package/test/76-type-level-company.test.mjs +342 -0
package/CITATION.cff
CHANGED
|
@@ -40,10 +40,10 @@ preferred-citation:
|
|
|
40
40
|
orcid: "https://orcid.org/0000-0002-7119-5867"
|
|
41
41
|
affiliation: "NONE"
|
|
42
42
|
year: 2026
|
|
43
|
-
month:
|
|
44
|
-
day:
|
|
45
|
-
version: "0.
|
|
46
|
-
doi: "10.5281/zenodo.
|
|
47
|
-
url: "https://doi.org/10.5281/zenodo.
|
|
43
|
+
month: 8
|
|
44
|
+
day: 6
|
|
45
|
+
version: "2.0.0"
|
|
46
|
+
doi: "10.5281/zenodo.21385722"
|
|
47
|
+
url: "https://doi.org/10.5281/zenodo.21385722"
|
|
48
48
|
publisher:
|
|
49
49
|
name: "Zenodo"
|
package/HOW_IT_WORKS.md
CHANGED
|
@@ -512,6 +512,73 @@ similarity into _distributional_ similarity, silently shifting the halo null
|
|
|
512
512
|
model that the concept threshold's derivation (unrelated halos ⇒ cosine 0 ±
|
|
513
513
|
1/√D) depends on.
|
|
514
514
|
|
|
515
|
+
#### Company must be keyed on types, not tokens
|
|
516
|
+
|
|
517
|
+
A signature derived from the _whole_ partner's node id records a **token**:
|
|
518
|
+
"occurred next to node #4711992". But the distributional hypothesis is a claim
|
|
519
|
+
about **types**: "occurred next to a city name". On a content-addressed store of
|
|
520
|
+
natural language the difference is fatal, because a whole deposit essentially
|
|
521
|
+
never repeats: on a trained 15.7M-node store, 331,110 trained pairs produced
|
|
522
|
+
325,615 distinct contexts — 98.3% of them unique, so barely one span in sixty
|
|
523
|
+
ever recurs. Two genuine synonyms in different sentences then share no partner
|
|
524
|
+
id at all, and their halos come out quasi-orthogonal _by construction_: the best
|
|
525
|
+
distributional sibling of "Eiffel Tower" measured 0.146 against a concept
|
|
526
|
+
threshold of 0.516, with its own attested translations absent entirely. The
|
|
527
|
+
whole concept-hop, articulation and analogy layer was inert at corpus scale —
|
|
528
|
+
not for want of data, but because the key was too fine.
|
|
529
|
+
|
|
530
|
+
Sema therefore pours a **company profile**: the partner's own signature
|
|
531
|
+
superposed with the signatures of the partner's _constituents_. Two episodes
|
|
532
|
+
then share halo mass exactly when their partners are **made of** something in
|
|
533
|
+
common, which is what "keeps similar company" was always meant to mean.
|
|
534
|
+
|
|
535
|
+
Which constituents count is decided by four rules, each one load-bearing:
|
|
536
|
+
|
|
537
|
+
- **Every depth, not just the partner's children.** Cuts are content-defined
|
|
538
|
+
over a rolling window, so a chunk boundary depends on the bytes _around_ a
|
|
539
|
+
unit. "The Eiffel Tower is in Paris" folds to `The Eiffel` ·
|
|
540
|
+
`Tower is in
|
|
541
|
+
Paris`, and "Tour Eiffel dia any Paris" to `Tour Eiffel` ·
|
|
542
|
+
`dia any Paris` — the shared unit `Paris` is a child of neither. Reading only
|
|
543
|
+
the children merely moves the token problem from whole-partner identity down
|
|
544
|
+
to top-level-chunk identity, which for full sentences is nearly as rare. The
|
|
545
|
+
descent finds `Paris` and `ffel`; the top level finds nothing.
|
|
546
|
+
- **Never gate on recurrence-so-far.** The tempting rule — descend while a
|
|
547
|
+
constituent is corpus-unique, stop at the first unit attested twice — is
|
|
548
|
+
order-dependent: when the _first_ of a pair is deposited its shared unit has
|
|
549
|
+
been seen once, so the descent runs past it, and only the second partner ever
|
|
550
|
+
profiles it. Whether two synonyms become siblings must not depend on which was
|
|
551
|
+
taught first. The hub test below is the one reading that does consult corpus
|
|
552
|
+
state, and it can only ever remove a term — never decide which units are
|
|
553
|
+
found.
|
|
554
|
+
- **Nothing narrower than the fold's own window `W`.** Sub-window shards are
|
|
555
|
+
fragments of a unit, not units; admitting them lets mid-frequency byte
|
|
556
|
+
coincidences leak company across unrelated domains.
|
|
557
|
+
- **Minimal units only, and nothing that half-dominates the partner.** A
|
|
558
|
+
constituent that still contains a constituent of its own is a composite, and
|
|
559
|
+
superposing both counts the same content twice. This matters most for _nested_
|
|
560
|
+
partners — an accumulated conversation, where turn _k_'s context is a prefix
|
|
561
|
+
of turn _k+1_'s — which share their large chunks structurally rather than
|
|
562
|
+
distributionally.
|
|
563
|
+
|
|
564
|
+
Hubs (more than √N structural parents — Section 8.8) are excluded as
|
|
565
|
+
scaffolding, since a term shared by every deposit would put a common component
|
|
566
|
+
in every profile and collapse the null model the concept threshold depends on.
|
|
567
|
+
Byte atoms are excluded for the same reason: an atom's fan-in is the alphabet's.
|
|
568
|
+
|
|
569
|
+
The result stays **normalized**, so one episode still pours one unit of mass and
|
|
570
|
+
every mass-based reading is unchanged; and every term is still a seeded function
|
|
571
|
+
of a **node identity**, never a gist, so the hygiene rule above is untouched.
|
|
572
|
+
|
|
573
|
+
Similarity is **graded and size-relative**: two partners meet in proportion to
|
|
574
|
+
how much of what they are made of they share, so a shared unit inside a long
|
|
575
|
+
partner says less than the same unit inside a short one. This is the honest
|
|
576
|
+
reading of the evidence, not a defect — but it means the layer speaks clearly at
|
|
577
|
+
sentence scale and softly for very long partners. One further honest limit: the
|
|
578
|
+
hub bound is √N, so on a _small_ store almost nothing reads as scaffolding and
|
|
579
|
+
frame words do enter profiles. That is the correct floor for a corpus that
|
|
580
|
+
cannot yet say what discriminates, and it resolves itself as N grows.
|
|
581
|
+
|
|
515
582
|
Two nodes whose halos are similar have occurred in similar circumstances — they
|
|
516
583
|
are **distributional siblings**: synonyms, paraphrases, items of the same
|
|
517
584
|
category, two names for one thing. Note the complementarity:
|
|
@@ -532,6 +599,13 @@ embedding model:
|
|
|
532
599
|
rule).
|
|
533
600
|
- **Articulation.** An answer is re-voiced in the asker's own vocabulary by
|
|
534
601
|
substituting answer forms with query forms that share a halo (Section 24).
|
|
602
|
+
Halo similarity alone is not sufficient authority for this: the strongest
|
|
603
|
+
company any two forms can keep is standing next to each other, so a question
|
|
604
|
+
and the answer it is answered by are _maximally_ similar distributionally. Two
|
|
605
|
+
exact-side vetoes keep that from being read as synonymy — a stored
|
|
606
|
+
continuation edge between the two forms, and a candidate form spanning the
|
|
607
|
+
_whole_ answer (substituting that is replacement, not re-voicing). Without
|
|
608
|
+
them, "it hangs in madrid" is faithfully re-voiced as "where is it kept now".
|
|
535
609
|
- **Analogy strength.** Whether two entities are genuinely analogous — the gate
|
|
536
610
|
on counterfactual comparison (Section 18) — is measured by halo similarity,
|
|
537
611
|
directly or through shared siblings (a second-order distributional test).
|
|
@@ -1570,38 +1644,48 @@ size of the grouping quantum has nothing to do with it — any fixed modulus doe
|
|
|
1570
1644
|
this, and identity must not depend on the fold's arity at all.
|
|
1571
1645
|
|
|
1572
1646
|
Sema therefore lets the **bytes choose where the stream segments**. A rolling
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
a sparse binary stream as it does on prose.
|
|
1647
|
+
window holds the recent bytes; a cut is offered where a mix of that window
|
|
1648
|
+
vanishes modulo W. Because the test reads only that window, a change upstream
|
|
1649
|
+
perturbs boundaries near itself and the segmentation downstream re-synchronises
|
|
1650
|
+
on its own. Since each segment folds from its own seat 0, byte-identical content
|
|
1651
|
+
that survives that re-synchronisation produces byte-identical subtrees wherever
|
|
1652
|
+
it occurs, and hash-consing then makes it the very same node id.
|
|
1653
|
+
|
|
1654
|
+
The rule is entirely mechanical:
|
|
1655
|
+
|
|
1656
|
+
- **The window** is a 32-bit shift register (`h ≔ (h << 8) | byte`), so it holds
|
|
1657
|
+
_exactly_ the last four raw bytes and nothing before them can reach the test.
|
|
1658
|
+
The raw window is put through a two-round avalanche mix before the test, which
|
|
1659
|
+
is what makes the rule behave the same on a gradient or a sparse binary stream
|
|
1660
|
+
as it does on prose. Note that the window is a property of the register, not
|
|
1661
|
+
of W: changing W changes the cut _rate_, not how far a disturbance reaches.
|
|
1589
1662
|
- **The cut rate** is one offer per W bytes (`mix % W === 0`).
|
|
1590
|
-
- **
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1663
|
+
- **Acceptance is gated locally**, not by a count from the previous cut (a count
|
|
1664
|
+
carries the stream's initial phase forever, which is exactly the offset
|
|
1665
|
+
dependence being removed): a hit is taken only if the previous two positions
|
|
1666
|
+
did not hit. Both terms of the acceptance test are therefore functions of a
|
|
1667
|
+
bounded byte window.
|
|
1594
1668
|
- **The maximum segment length** is the keyring's seat count, because a segment
|
|
1595
1669
|
folds as one flat node and the fold has exactly that many seats to bind
|
|
1596
|
-
children into. An over-long stretch is split at strides from its own start
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1670
|
+
children into. An over-long stretch is split at strides from its own start:
|
|
1671
|
+
the stretch _begins_ at a content-chosen cut, but the split points themselves
|
|
1672
|
+
are counted off, so this is the one boundary in the rule that content does not
|
|
1673
|
+
choose.
|
|
1674
|
+
|
|
1675
|
+
The resulting segment averages ≈ 5–6 bytes against a seat bound of 8 (measured:
|
|
1676
|
+
5.2 on prose, 5.3–5.8 across uniform, sparse, low-entropy, periodic-record and
|
|
1677
|
+
gradient streams) — deliberately coarser than the fold's own arity. A segment is
|
|
1678
|
+
the flat **phrase-scale unit** the W-ary groups are built _from_, not a group of
|
|
1679
|
+
W children; the mechanisms downstream are fitted to that scale, and forcing the
|
|
1680
|
+
two to coincide was measured and refuted.
|
|
1681
|
+
|
|
1682
|
+
The forced split is not rare enough to ignore: it ends ~25% of segments on prose
|
|
1683
|
+
and ~32% on uniform random bytes. It is what keeps re-synchronisation an
|
|
1684
|
+
empirical property rather than a guaranteed one — a single-byte edit moves
|
|
1685
|
+
boundaries for a median of 4 bytes downstream, but 5% of edits reach ~14 bytes
|
|
1686
|
+
and the worst observed case ~28 (W = 4, seat bound 8). Lengthening segments to
|
|
1687
|
+
shrink it makes forced splits dominant and alignment collapses instead
|
|
1688
|
+
(measured: 0.000 on two-symbol data at rate 1/16).
|
|
1605
1689
|
|
|
1606
1690
|
This reads **bytes, never text**. Measured over 400 real deposits under 1–7 byte
|
|
1607
1691
|
shifts, downstream cuts survive 99.6–99.9% of the time and segments stay
|
|
@@ -4770,7 +4854,7 @@ fracOfQuery(cos, otherLen, qLen) ≔ min(1, cos · √(otherLen / max(1, qLen)))
|
|
|
4770
4854
|
|
|
4771
4855
|
# ── perception (§10) ──────────────────────────────────────────────────
|
|
4772
4856
|
contentLevels(bytes): # §10.2 — the ONE boundary rule
|
|
4773
|
-
h ≔
|
|
4857
|
+
h ≔ 32-bit shift register: the last 4 raw bytes
|
|
4774
4858
|
for each position i:
|
|
4775
4859
|
m ≔ avalanche(h) # two rounds
|
|
4776
4860
|
hit ≔ (m mod W = 0)
|
package/README.md
CHANGED
|
@@ -31,6 +31,12 @@ No weights. No gradients. No training loop. No neural network. No GPU.
|
|
|
31
31
|
> inspectable, exact — and _reasons_ over it on demand. The store **is** the
|
|
32
32
|
> model. What it knows, you can read. Why it answered, you can trace.
|
|
33
33
|
>
|
|
34
|
+
> The difference is not a matter of degree. A trained model's meanings are real,
|
|
35
|
+
> but nothing in it records where they came from — provenance is diffused across
|
|
36
|
+
> an entire training run rather than kept. Sema's meanings are assembled from
|
|
37
|
+
> **enumerable events**, and the record is the mechanism: for any concept it
|
|
38
|
+
> holds, you can list what taught it, and in what role.
|
|
39
|
+
>
|
|
34
40
|
> Formally, Sema is a **non-parametric, instance-based reasoning system**: a
|
|
35
41
|
> Vector Symbolic Architecture (Plate 1995; Kanerva 2009) over a
|
|
36
42
|
> content-addressable memory, with inference by weighted automated deduction
|
|
@@ -39,39 +45,52 @@ No weights. No gradients. No training loop. No neural network. No GPU.
|
|
|
39
45
|
|
|
40
46
|
---
|
|
41
47
|
|
|
42
|
-
## ✦
|
|
48
|
+
## ✦ It chooses how to think
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
A question can be answered in more than one way, and the ways are not
|
|
51
|
+
interchangeable. Sema holds several, lets them compete, and takes the one that
|
|
52
|
+
leaves the least of your question unaccounted for.
|
|
45
53
|
|
|
46
54
|
<div align="center">
|
|
47
55
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
56
|
+
| What Sema claims about your question |
|
|
57
|
+
| :--------------------------------------------------------------------------------- |
|
|
58
|
+
| _"I can build this answer out of pieces I already know."_ |
|
|
59
|
+
| _"You've woven two things I know — let me carry structure between them."_ |
|
|
60
|
+
| _"You gave me two conditions; the answer is where they meet."_ |
|
|
61
|
+
| _"I've seen this shape of question before — let me read yours the same way."_ |
|
|
62
|
+
| _"You've begun something I know the whole of."_ |
|
|
63
|
+
| _"Part of this answer is **your** words, in a place my memory keeps open."_ |
|
|
64
|
+
| _"The nearest thing I hold is this — and I'm telling you it's near, not derived."_ |
|
|
65
|
+
| **_"Nothing I hold bears on this."_** |
|
|
52
66
|
|
|
53
67
|
</div>
|
|
54
68
|
|
|
55
69
|
```text
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
┌──────────────────────────────────────┐
|
|
71
|
+
your question │ every route prices its own answer │
|
|
72
|
+
│ └──────────────────┬───────────────────┘
|
|
73
|
+
▼ ▼
|
|
74
|
+
┌─────────────┐ one price, one question:
|
|
75
|
+
│ route · │ "how much of what you asked
|
|
76
|
+
│ route · │ ───▶ did this route fail to
|
|
77
|
+
│ route · │ account for?"
|
|
78
|
+
│ route · │ │
|
|
79
|
+
└─────────────┘ ▼
|
|
80
|
+
┌─────────────────────────┐
|
|
81
|
+
│ the lightest answer │
|
|
82
|
+
│ wins — and arrives │
|
|
83
|
+
│ tagged with the route │
|
|
84
|
+
│ that produced it │
|
|
85
|
+
└─────────────────────────┘
|
|
70
86
|
```
|
|
71
87
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
Because the price is _unexplained question_ — not speed, not confidence — the
|
|
89
|
+
winner is the route that accounts for most of what you actually asked, rather
|
|
90
|
+
than the one most eager to answer. It is also why the last line of that table is
|
|
91
|
+
a legitimate outcome and not a failure: when no route can account for what you
|
|
92
|
+
asked, **silence is a first-class answer.** A system that must always produce
|
|
93
|
+
something will always, eventually, produce fiction.
|
|
75
94
|
|
|
76
95
|
---
|
|
77
96
|
|
|
@@ -83,24 +102,15 @@ stored fact contains. Watch it happen below.
|
|
|
83
102
|
|
|
84
103
|
### 🧩 Symbolic, not statistical
|
|
85
104
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
105
|
+
Everything stored carries a vector for what it is _made of_; anything that takes
|
|
106
|
+
part in a fact carries a second for the **company it keeps**. The first makes
|
|
107
|
+
_colour_ close to _colours_; the second makes _colour_ close to _hue_, two words
|
|
108
|
+
whose spellings have nothing to do with each other. Meaning here is assembled
|
|
109
|
+
and readable, not smeared across a weight matrix.
|
|
89
110
|
|
|
90
111
|
</td>
|
|
91
112
|
<td width="50%" valign="top">
|
|
92
113
|
|
|
93
|
-
### 🔀 Retrieval and reasoning, unified
|
|
94
|
-
|
|
95
|
-
Retrieval and reasoning are **one mechanism**, not a brittle pipeline of bolted-
|
|
96
|
-
together components. A query enters the graph where it _resonates_ and a single
|
|
97
|
-
lightest-derivation search composes the answer.
|
|
98
|
-
|
|
99
|
-
</td>
|
|
100
|
-
</tr>
|
|
101
|
-
<tr>
|
|
102
|
-
<td width="50%" valign="top">
|
|
103
|
-
|
|
104
114
|
### 🔍 Fully auditable
|
|
105
115
|
|
|
106
116
|
Every answer is a **derivation** over explicit facts. No black box. Trace any
|
|
@@ -108,6 +118,8 @@ output back to the exact deposits that produced it — a hard requirement for
|
|
|
108
118
|
regulated, high-stakes, and safety-critical deployments.
|
|
109
119
|
|
|
110
120
|
</td>
|
|
121
|
+
</tr>
|
|
122
|
+
<tr>
|
|
111
123
|
<td width="50%" valign="top">
|
|
112
124
|
|
|
113
125
|
### ♻️ Deterministic & reproducible
|
|
@@ -116,6 +128,17 @@ Same seed + same bytes → **identical result, every time.** No temperature, no
|
|
|
116
128
|
sampling, no drift between runs. Reproducibility is a property of the
|
|
117
129
|
architecture, not a flag you toggle.
|
|
118
130
|
|
|
131
|
+
</td>
|
|
132
|
+
<td width="50%" valign="top">
|
|
133
|
+
|
|
134
|
+
### 📐 Nothing tuned
|
|
135
|
+
|
|
136
|
+
**No threshold is a chosen number.** Every bar the system decides on is derived
|
|
137
|
+
from the representation's own geometry — its dimension, its perception window,
|
|
138
|
+
how much it has learned. Nothing was fitted to a benchmark, so there is no dev
|
|
139
|
+
set to overfit and no calibration that silently expires when your data stops
|
|
140
|
+
resembling someone else's.
|
|
141
|
+
|
|
119
142
|
</td>
|
|
120
143
|
</tr>
|
|
121
144
|
<tr>
|
|
@@ -139,9 +162,11 @@ leak. Everything a trained mind knows lives in a few files on your disk.
|
|
|
139
162
|
</table>
|
|
140
163
|
|
|
141
164
|
> [!TIP]
|
|
142
|
-
> **No GPU. No cluster. No cloud bill.** Sema runs on an ordinary CPU
|
|
143
|
-
>
|
|
144
|
-
>
|
|
165
|
+
> **No GPU. No cluster. No cloud bill.** Sema runs on an ordinary CPU, because
|
|
166
|
+
> it never multiplies a weight matrix — it walks a graph. Its resident memory is
|
|
167
|
+
> capped by configuration rather than by how much it has learned, so a large
|
|
168
|
+
> store does not become a large machine. The economics of deploying intelligence
|
|
169
|
+
> change completely.
|
|
145
170
|
|
|
146
171
|
---
|
|
147
172
|
|
|
@@ -150,20 +175,11 @@ leak. Everything a trained mind knows lives in a few files on your disk.
|
|
|
150
175
|
Give Sema four plain notes — the way you'd jot them down — then ask things **no
|
|
151
176
|
note answers**. From three worked examples it learns the _shape_ of "X was
|
|
152
177
|
painted by Y", lifts the painter out of a sentence it has **never seen**, and —
|
|
153
|
-
in the same pass — reasons onward to a separate fact about that painter.
|
|
154
|
-
|
|
155
|
-
reasoning composing as a single act**.
|
|
178
|
+
in the same pass — reasons onward to a separate fact about that painter. Nothing
|
|
179
|
+
in the reply but the painter's own name comes from the question.
|
|
156
180
|
|
|
157
181
|
```ts
|
|
158
182
|
// demo.ts — one short session that drives the WHOLE pipeline from one memory.
|
|
159
|
-
//
|
|
160
|
-
// We give Sema a handful of plain notes, then ask things that no single note
|
|
161
|
-
// answers. The headline query is the third one: from three worked examples Sema
|
|
162
|
-
// learns the shape of "X was painted by Y", lifts the painter out of a sentence
|
|
163
|
-
// it has NEVER seen, and then — in the same pass — reasons forward to a separate
|
|
164
|
-
// fact about that painter. The reply contains no word from the question. That is
|
|
165
|
-
// retrieval, generalization, and reasoning composing as a single act, with every
|
|
166
|
-
// step traceable back to the notes behind it.
|
|
167
183
|
|
|
168
184
|
import { Mind } from "../src/index.js";
|
|
169
185
|
import { SQliteStore } from "../src/store-sqlite.js";
|
|
@@ -186,16 +202,11 @@ async function main(): Promise<void> {
|
|
|
186
202
|
]);
|
|
187
203
|
|
|
188
204
|
// 1) GENERALIZE — apply the learned pattern to an unseen sentence and read out
|
|
189
|
-
// the painter
|
|
190
|
-
// by analogy to the three examples.
|
|
205
|
+
// the painter, then keep going into what is known about him.
|
|
191
206
|
console.log(await ask("The Weeping Woman was painted by Pablo Picasso."));
|
|
192
|
-
// → "Pablo Picasso co-founded the Cubist movement"
|
|
193
|
-
// …and, having found the painter, it KEEPS GOING: the name bridges into the
|
|
194
|
-
// one fact it holds about him. The answer appears in no word of the question.
|
|
195
207
|
|
|
196
208
|
// 2) COMPUTE — exact arithmetic, grounded right where the notes go silent.
|
|
197
209
|
console.log(await ask("a museum charges 12*4 for a family ticket"));
|
|
198
|
-
// → "48"
|
|
199
210
|
|
|
200
211
|
await mind.store.close();
|
|
201
212
|
}
|
|
@@ -208,28 +219,70 @@ Pablo Picasso co-founded the Cubist movement
|
|
|
208
219
|
48
|
|
209
220
|
```
|
|
210
221
|
|
|
222
|
+
Ask for the receipt instead of the text, and each answer says how it was reached
|
|
223
|
+
— `mind.respond(q)` returns the same bytes plus a **`provenance` tag** naming
|
|
224
|
+
the route, and, on request, the complete replayable trace behind it:
|
|
225
|
+
|
|
226
|
+
```text
|
|
227
|
+
"The Weeping Woman was painted by Pablo Picasso." → provenance: cast
|
|
228
|
+
( structure carried across the three worked examples )
|
|
229
|
+
|
|
230
|
+
"a museum charges 12*4 for a family ticket" → provenance: cover
|
|
231
|
+
( composed from the question's own parts — one of them computed exactly )
|
|
232
|
+
```
|
|
233
|
+
|
|
211
234
|
> [!NOTE]
|
|
212
|
-
> This is **[example/demo.ts](example/demo.ts)
|
|
213
|
-
>
|
|
214
|
-
>
|
|
215
|
-
>
|
|
216
|
-
>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
235
|
+
> This is **[example/demo.ts](example/demo.ts)** — run it with `npm run demo`.
|
|
236
|
+
> The first question names a painting Sema was never shown, and asks nothing
|
|
237
|
+
> explicit; what comes back is a fact about Cubism that appears **nowhere** in
|
|
238
|
+
> it. The second is exact, not a plausible-looking guess. Every step traces back
|
|
239
|
+
> to the four notes above.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## ✦ Learn it in one pass
|
|
244
|
+
|
|
245
|
+
There is no training phase distinct from using it. **Depositing _is_ learning**,
|
|
246
|
+
and a fact is available the instant it lands.
|
|
247
|
+
|
|
248
|
+
<div align="center">
|
|
249
|
+
|
|
250
|
+
| | |
|
|
251
|
+
| :------------------- | :-------------------------------------------------------------------------------------------------- |
|
|
252
|
+
| 📥 **To teach it** | Hand it the fact. One pass. No epochs, no GPU, no fine-tuning window. |
|
|
253
|
+
| ✏️ **To correct it** | Deposit the correction — a write, not a retraining run. Nothing is erased; the evidence is weighed. |
|
|
254
|
+
| 🔁 **To repeat it** | Teaching the same thing twice creates nothing new — identity is content. |
|
|
255
|
+
| 📦 **To scale it** | Storage grows with _distinct_ content, never with volume. |
|
|
256
|
+
|
|
257
|
+
</div>
|
|
258
|
+
|
|
259
|
+
> [!TIP]
|
|
260
|
+
> It does not learn by repetition and does not need an enormous corpus. What it
|
|
261
|
+
> needs is **coverage of fundamental patterns** — conversation, logic,
|
|
262
|
+
> relationships, quantities — not the same pattern ten thousand times. A small,
|
|
263
|
+
> well-chosen curriculum teaches it more than a scraped ocean.
|
|
220
264
|
|
|
221
265
|
---
|
|
222
266
|
|
|
223
|
-
## ✦
|
|
267
|
+
## ✦ Where it matters
|
|
224
268
|
|
|
225
|
-
|
|
226
|
-
|
|
269
|
+
Not "faster than an LLM" — **possible where an LLM is not.** Each of these
|
|
270
|
+
sectors is blocked by a requirement no sampled model can meet.
|
|
227
271
|
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
|
|
|
231
|
-
|
|
|
232
|
-
|
|
|
272
|
+
| Sector | The blocker | What Sema puts on the table |
|
|
273
|
+
| :---------------------------- | :---------------------------------------------------------------- | :------------------------------------------------------------------------------ |
|
|
274
|
+
| 🏥 **Healthcare** | Patient data cannot leave; a recommendation must be explicable | Runs in the building, cites the record behind every answer |
|
|
275
|
+
| 🏦 **Finance & credit** | An adverse decision must be justified, and reproduced on demand | The same inputs give the same decision, with the reasoning attached |
|
|
276
|
+
| ⚖️ **Legal & compliance** | A cited authority that does not exist is a career-ending event | Nothing is invented: every answer is a derivation over what was deposited |
|
|
277
|
+
| 🛡️ **Defense & intelligence** | Air-gapped, no external inference, no telemetry | One binary, no network, no API key, no weights to exfiltrate |
|
|
278
|
+
| 🏭 **Industrial & safety** | Certification requires deterministic, auditable behaviour | Determinism is architectural, and every answer is a replayable derivation |
|
|
279
|
+
| 🏛️ **Public sector** | Decisions about citizens must be contestable | A citizen can be shown exactly which rules and records produced the outcome |
|
|
280
|
+
| 🛰️ **Edge & robotics** | No datacenter, tight power budget, knowledge changes in the field | CPU-only, memory capped by configuration; new knowledge is a write, not a build |
|
|
281
|
+
|
|
282
|
+
> [!NOTE]
|
|
283
|
+
> The common thread: these are settings where **"I don't know" is worth more
|
|
284
|
+
> than a confident guess** — and where a wrong answer is not an inconvenience
|
|
285
|
+
> but a liability. Sema is built to say it.
|
|
233
286
|
|
|
234
287
|
---
|
|
235
288
|
|
|
@@ -265,6 +318,7 @@ start talking — no install, no runtime, no API key.
|
|
|
265
318
|
| :----------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
266
319
|
| 📘 **[HOW_IT_WORKS.md](HOW_IT_WORKS.md)** | The full theory: vector symbolic architectures, the Merkle DAG, distributional halos, weighted deduction — concepts, diagrams, and extensive pseudocode. |
|
|
267
320
|
| 🛠️ **[AGENTS.md](AGENTS.md)** | The development manual: repo layout, build/test, internals, invariants, and recipes for extending the system. |
|
|
321
|
+
| 🎓 **[CITATION.cff](CITATION.cff)** | How to cite Sema in academic work. |
|
|
268
322
|
| ⚖️ **[LICENSE.md](LICENSE.md)** | PolyForm Noncommercial License 1.0.0. |
|
|
269
323
|
| 💼 **[COMMERCIAL-LICENSE.md](COMMERCIAL-LICENSE.md)** | Commercial licensing terms and contact. |
|
|
270
324
|
| 🤗 **[Trained examples](https://huggingface.co/buckets/hviana/sema-trained-v1)** | Pre-trained memory files you can download and use directly. |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// using concept (halo) resonance to match the voices.
|
|
5
5
|
import { spliceAll } from "./types.js";
|
|
6
6
|
import { recognise } from "./recognition.js";
|
|
7
|
-
import { contains } from "./traverse.js";
|
|
7
|
+
import { answers, contains } from "./traverse.js";
|
|
8
8
|
import { bestHaloMate } from "./match.js";
|
|
9
9
|
import { coverSequence } from "../derive/src/index.js";
|
|
10
10
|
import { rItem, rNode, traceDerivation } from "./trace.js";
|
|
@@ -67,9 +67,22 @@ export async function articulate(ctx, answer, query) {
|
|
|
67
67
|
if (!found)
|
|
68
68
|
continue;
|
|
69
69
|
const voice = found.item;
|
|
70
|
-
if (voice.node === s.payload || contains(ctx, voice.node, s.payload)
|
|
70
|
+
if (voice.node === s.payload || contains(ctx, voice.node, s.payload) ||
|
|
71
|
+
answers(ctx, voice.node, s.payload)) {
|
|
71
72
|
continue;
|
|
72
73
|
}
|
|
74
|
+
// A form spanning the WHOLE answer is not a concept inside the answer to
|
|
75
|
+
// revoice — substituting it discards the answer and emits the asker's own
|
|
76
|
+
// words back, which is what a conversational store makes tempting: an
|
|
77
|
+
// answer and the question it answers keep maximal company, so the whole
|
|
78
|
+
// answer resonates with the whole query above any concept threshold
|
|
79
|
+
// (measured on the CONV fixture at 0.809 against 0.516). Articulation
|
|
80
|
+
// splices the asker's wording INTO an answer where the same concept
|
|
81
|
+
// appears; when the "concept" is the entire answer there is nothing left
|
|
82
|
+
// of it, and "where is it kept now" comes back in place of "it hangs in
|
|
83
|
+
// madrid". §5's contract is re-voicing, never replacement.
|
|
84
|
+
if (s.start === 0 && s.end === answer.length)
|
|
85
|
+
continue;
|
|
73
86
|
substitutions.set(s.payload, voice.bytes);
|
|
74
87
|
}
|
|
75
88
|
if (substitutions.size === 0) {
|