pocketlearn / README.md
SNAPKITTYWEST's picture
push from SNAPKITTYWEST/pocketlearn
ce0d85d verified
|
Raw
History Blame Contribute Delete
4.38 kB
# PocketLearn
**Symbolic cognitive architecture: XML + XSLT + ILP + ASP + FORTH. Zero Python.**
Learn = build a visible theory.
Neural net: `learn = adjust W -= lr * grad`. Knowledge disappears into numbers you can't read.
This: `learn = build a visible theory.`
---
## What it does
```
sample_corpus.txt
|
v
corpus_tokens.xml (tokenizer β€” 69 tokens, 52 vocab)
|
v
ontology.xml (seed concepts: stack_op, compiler_word, meta_word...)
|
+--[XSLT]----------> background.pl (Prolog co-occurrence facts)
|
+--[XSLT]----------> ontology_induction_generated.pl (ILP engine, GENERATED by XSLT)
|
v
swipl learns rules:
Induced: is_a(W, stack_op) :- cooccur(W, 'drop'). F1=0.60
Propose: include should be is_a(stack_op) cnt=1
|
v
ontology_induced.xml (updated ontology with induced members)
|
+------[XSLT]-+------[XSLT]--+
| |
v v
ASP validation generated_corpus_induced.fth
clingo rejects gforth runs the learned dictionary
contradictions
(dup = stack_op AND
compiler_word -> UNSAT)
```
**The meta-trick:** `ontology_to_induction.xslt` generates the Prolog ILP engine from `ontology.xml`. So the whole system is self-describing β€” XSLT generates Prolog that learns rules from XML co-occurrence stats.
---
## Run
```bash
# Install (Mac)
brew install libxslt swi-prolog clingo gforth
# Install (Linux)
sudo apt install -y xsltproc swi-prolog gringo gforth
# Build β€” full pipeline
make
# Run the FORTH (pre-built, no deps needed)
make demo-prebuilt
```
---
## What you get
```bash
make
# [3/7] ILP engine via XSLT
# [4/7] ILP Induction
# Induced: is_a(W, stack_op) :- cooccur(W, 'drop'). F1=0.60
# Induced: is_a(W, compiler_word) :- cooccur(W, 'semicolon'). F1=0.75
# Induced: is_a(W, learning_word) :- cooccur(W, 'statistical'). F1=0.80
# Proposing: include should be is_a(stack_op) (cooccurs with 'drop')
# Proposing: defined should be is_a(compiler_word) (cooccurs with 'semicolon')
# Proposing: similarity should be is_a(learning_word)
# [5/7] ASP: SATISFIABLE
# [6/7] FORTH written
make demo
# PocketLearn FORTH β€” seed + ILP-induced vocab
# vocab size: 18
# Induced: include (by drop), defined (by semicolon), similarity (by statistical)
```
---
## Files
| File | Role |
|------|------|
| `sample_corpus.txt` | Input text |
| `corpus_tokens.xml` | Tokenized corpus (XML) |
| `ontology.xml` | Seed concepts with members + co-occurrence strengths |
| `ontology_induced.xml` | Output ontology with ILP-induced members |
| `corpus_to_background.xslt` | XML β†’ Prolog co-occurrence facts |
| `ontology_to_induction.xslt` | **Generates** the Prolog ILP engine from ontology.xml |
| `ontology_to_asp.xslt` | XML β†’ ASP validation facts |
| `corpus_to_forth.xslt` | XML β†’ FORTH dictionary |
| `ontology_induction_generated.pl` | ILP engine (XSLT output) β€” run with swipl |
| `generated_corpus_induced.fth` | Final FORTH (seed + induced) β€” run with gforth |
| `ontology.asp` | ASP contradiction rules |
| `Makefile` | Full pipeline |
---
## Why this instead of a transformer
| | Transformer | PocketLearn |
|--|--|--|
| Inspectable | No β€” weights are numbers | Yes β€” open `ontology_induced.xml` |
| Reproducible | No β€” depends on random seed | Yes β€” same XML = same FORTH, bit-for-bit |
| Debuggable | No | Yes β€” stack blow β†’ trace to corpus_tokens.xml line β†’ XSLT template |
| Hallucinates | Yes β€” `dup = delete` possible | No β€” ASP kills contradictions |
| Learns deep semantics | Yes | No |
It won't discover deep semantics. It will never hallucinate `dup = delete` because ASP kills it.
---
**Ahmad Ali Parr Β· Bel Esprit D'Accord Irrevocable Trust Β· EIN 42-697643**
`Omega = TRUST AND CODE`