Views
No views yet
Xenova/all-MiniLM-L6-v2 (via transformers.js) → a 384-d vector.score(fact) = cosine( normalize(W · embed(query)) , fact_vec ), top-K — where W is a learnable 384×384 projection matrix (identity at first).W persists in localStorage, so the memory keeps what you taught it across sessions.web-ttt.js — the toolkit (ES module). WebTTT class: init(), load(corpus), recall(query, k), teach(query, targetIndex), exportW()/importW()/resetW().demo/index.html + demo/facts.json — a working demo on a generic corpus.1import { WebTTT } from "./web-ttt.js";
2
3const ttt = new WebTTT({ storageKey: "my_ttt" });
4await ttt.init(); // loads MiniLM (CDN by default)
5await ttt.load([
6 { key: "the sun", text: "The Sun is the star at the center of the Solar System." },
7 { key: "the moon", text: "The Moon is Earth's only natural satellite." },
8]);
9
10const hits = await ttt.recall("what's at the center of the solar system?", 3);
11// → [{ key: "the sun", score: 0.6x, index: 0, ... }, ...]
12
13await ttt.teach("center of the solar system", 0); // reinforce: 25-step W update, persistshttp://localhost (WebGPU/transformers.js need a real origin, not file://) and open demo/index.html in Chrome/Edge/Brave.init():1await ttt.init({
2 transformersUrl: "./vendor/transformers/transformers.min.js",
3 localModelPath: "./models/", // contains Xenova/all-MiniLM-L6-v2
4 wasmPaths: "./vendor/transformers/", // ort-wasm*.wasm
5});[{key, text}]), optionally the precomputed 384-d vec per fact, and the learned W (384×384, from exportW()). Ship those three and any browser can load and keep training it. That's the publishable artifact — the method, on your data, your choice.Xenova/all-MiniLM-L6-v2) and transformers.js carry their own licenses.