Upload 8 files
Browse filesFiles changed (8)
- README.md+7-5
- index.html+198-17
- logo-mark.pngAdded
- meta.jsonAdded+17
- neb-model.jsAdded+95
- signals.jsonAdded
- slot1.binAdded+3
- tess-test-q8.binAdded+3
123456789101112---title: Neb Tess Classifieremoji: ⚡colorFrom: yellowcolorTo: pinksdk: staticpinned: falselicense: apache-2.0short_description: TESS exoplanet signal classifier, 4-bit weights, in browser---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference1234567891011121314---title: NEB TESS classifiercolorFrom: greencolorTo: graysdk: staticpinned: falselicense: apache-2.0short_description: TESS exoplanet signal classifier, 4-bit weights, in browser---The TESS model of the NEB chain, at block 15,899, on 1,860 held-out TESS signals. The page runs the integer forwardpass in JavaScript; nothing leaves your browser. Weights and details: `NeuralEngineByte/neb-chain-models`.Fonts: JetBrains Mono and Inter, SIL Open Font License (see `fonts/`).
12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>NEB chain model · TESS eclipse classifier</title><link rel="icon" type="image/png" href="logo-mark.png"><style>@font-face { font-family: 'JetBrains Mono Variable'; src: url(fonts/jetbrains-mono-latin-wght-normal.woff2) format('woff2'); font-weight: 100 800; font-display: swap; }@font-face { font-family: 'Inter Variable'; src: url(fonts/inter-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }/* the palette and window of neuralenginebyte.org (neb-web/src/styles.css) */:root {--bg: #0a0a0a; --panel: #121212; --panel2: #171717; --line: #262626; --line2: #343434;--fg: #ffffff; --mid: #bcbcbc; --dim: #808080; --faint: #444444;--g: #87ff87; --c: #69d6ff; --r: #ff6b7a;--font: 'JetBrains Mono Variable', 'JetBrains Mono', 'Cascadia Mono', ui-monospace, Consolas, monospace;--sans: 'Inter Variable', 'Inter', system-ui, 'Segoe UI', sans-serif;}* { box-sizing: border-box; margin: 0; padding: 0; }body {min-height: 100dvh;background: radial-gradient(900px 520px at 10% -8%, rgba(135, 255, 135, 0.075), transparent 62%),radial-gradient(800px 520px at 100% 112%, rgba(105, 214, 255, 0.05), transparent 62%), var(--bg);background-attachment: fixed; color: var(--mid); font: 400 14px/1.55 var(--font); -webkit-font-smoothing: antialiased;}::selection { background: var(--g); color: #04100a; }a { color: var(--c); text-decoration: none; }button, input { font: inherit; color: inherit; }@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }.stage { min-height: 100dvh; padding: clamp(8px, 2vw, 24px); display: flex; }.window { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--panel);border: 1px solid var(--line); border-radius: 10px; overflow: hidden;box-shadow: 0 0 0 1px rgba(135, 255, 135, 0.035), 0 30px 90px rgba(0, 0, 0, 0.65), 0 0 120px rgba(135, 255, 135, 0.035); }.window::after { content: ''; position: absolute; inset: 0; pointer-events: none;background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px); }.titlebar { display: flex; align-items: center; gap: 14px; padding: 0 12px; height: 44px; background: var(--panel2); border-bottom: 1px solid var(--line); }.titlebar img { height: 26px; width: 26px; }.tab { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 6px; font-size: 12.5px; color: var(--fg);background: var(--panel); border: 1px solid var(--line2); white-space: nowrap; }.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--g); box-shadow: 0 0 8px var(--g); animation: pulse 2.4s ease-in-out infinite; }.titlebar .site { margin-left: auto; font-size: 12px; color: var(--dim); }.titlebar .site:hover { color: var(--fg); }.status { display: flex; gap: 18px; align-items: center; min-height: 28px; padding: 4px 14px; border-top: 1px solid var(--line);background: var(--panel2); color: var(--dim); font-size: 11.5px; flex-wrap: wrap; }.status .sp { flex: 1; }.body { flex: 1; padding: 26px 28px 30px; max-width: 980px; width: 100%; margin: 0 auto; }.eyebrow { margin-bottom: 10px; font: 500 10.5px var(--font); letter-spacing: 0.16em; text-transform: uppercase; color: var(--g); }h1 { margin-bottom: 10px; font: 600 20px/1.25 var(--sans); letter-spacing: -0.012em; color: var(--fg); }.lead { font: 400 13.5px/1.62 var(--sans); max-width: 70ch; }.note { margin-top: 8px; font-size: 12px; color: var(--dim); overflow-wrap: anywhere; }.star { margin-top: 6px; font-size: 12.5px; color: var(--mid); overflow-wrap: anywhere; }.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 22px 0 14px; }.btn { padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line2); background: var(--panel2); color: var(--mid); font-size: 12.5px; cursor: pointer; transition: color 0.15s, border-color 0.15s; }.btn:hover { color: var(--fg); border-color: var(--g); }.field { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--dim); }.field input { width: 90px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line2); background: var(--bg); color: var(--fg); }.views { display: grid; grid-template-columns: 3fr 1fr; gap: 12px; }@media (max-width: 640px) { .views { grid-template-columns: 1fr; } .body { padding: 20px 16px; } }.pane { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }.pane-title { display: flex; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--fg); }.pane-title span { margin-left: auto; color: var(--dim); font-size: 11px; }svg { display: block; width: 100%; height: 150px; }.answer { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); }.answer .big { font-size: 15px; color: var(--fg); }.answer b { color: var(--g); font-weight: 600; }.ok { color: var(--g); } .no { color: var(--r); }.answer .sums { margin-top: 4px; font-size: 12px; color: var(--dim); }.score { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 16px; }.score h2 { font: 500 10.5px var(--font); letter-spacing: 0.16em; text-transform: uppercase; color: var(--g); margin-bottom: 10px; }.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }.stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }.stat .v { font-size: 18px; color: var(--fg); }.stat .k { font-size: 11.5px; color: var(--dim); }.limits { margin-top: 14px; font: 400 12.5px/1.6 var(--sans); color: var(--dim); max-width: 75ch; }</style></head><body><div class="stage"><div class="window"><header class="titlebar"><img src="logo-mark.png" alt="NEB"><p class="tab"><span class="dot"></span>model · tess</p><a class="site" href="https://neuralenginebyte.org" target="_blank" rel="noopener noreferrer">neuralenginebyte.org ↗</a></header><main class="body"><p class="eyebrow">Chain model</p><h1>TESS eclipse classifier</h1><p class="lead">A small convolutional network in 4-bit integers, trained by the miners of the NEB proof-of-work chain:each mining attempt is one training step. It reads a folded light curve of a TESS signal and answers<b class="ok">eclipse</b> or junk. Everything runs in your browser.</p><p class="note" id="meta">Loading the weights…</p><div class="controls"><button class="btn" id="eclipse">Random eclipse</button><button class="btn" id="junk">Random junk</button><label class="field">signal <input id="idx" type="number" min="0" value="0"></label><button class="btn" id="go">Show</button></div><div class="views"><section class="pane"><p class="pane-title">Global view <span>whole folded orbit · 583 bins</span></p><svg id="global" viewBox="0 0 583 100" preserveAspectRatio="none"></svg></section><section class="pane"><p class="pane-title">Local view <span>201 bins</span></p><svg id="local" viewBox="0 0 201 100" preserveAspectRatio="none"></svg></section></div><p class="note">Real TESS data: the light curve of the star below, folded on the period the catalog found. Brightnessdrops downward, in 8 steps of depth (0 to 7), as the chain sees it.</p><div class="answer"><p class="big" id="verdict"></p><p class="star" id="star"></p><p class="sums" id="sums"></p></div><section class="score"><h2>Held-out test signals</h2><div class="grid" id="stats"><div class="stat"><p class="v">…</p><p class="k">scoring</p></div></div><p class="limits">These signals were kept out of the chain: the model never trained on them. The labels come fromthe Astronet-Triage-v2 catalog (Tey et al. 2023, CC BY 4.0), where people classified each signal. An answerof the model is a hint for a human, not a planet confirmation. The model changes with every block; this pageuses the one snapshot named above.</p></section></main><footer class="status"><span id="status-block">block …</span><span class="sp"></span><span>integer forward pass, checked bit for bit against the node's C code</span></footer></div></div><script type="module">import { unpackWeights, predict, readDataset } from "./neb-model.js";const $ = (id) => document.getElementById(id);const [meta, packed, data, stars] = await Promise.all([fetch("meta.json").then((r) => r.json()),fetch("slot1.bin").then((r) => r.arrayBuffer()),fetch("tess-test-q8.bin").then((r) => r.arrayBuffer()),fetch("signals.json").then((r) => r.json()),]);const w = unpackWeights(new Uint8Array(packed));const rows = readDataset(new Uint8Array(data));const s = meta.slots["1"];$("meta").textContent = `Weights of block ${meta.height}. Weights hash ${s.weightshash}.`;$("status-block").textContent = `block ${meta.height} · ${rows.length.toLocaleString("en-US")} test signals`;$("idx").max = rows.length - 1;function plot(svg, values) {const pts = Array.from(values, (v, i) => `${i},${8 + (v / 7) * 84}`).join(" ");svg.innerHTML = `<polyline points="${pts}" fill="none" stroke="#87ff87" stroke-width="1.4" vector-effect="non-scaling-stroke"/>`;}function show(i) {const r = rows[i];$("idx").value = i;plot($("global"), r.x.subarray(0, 583));plot($("local"), r.x.subarray(583, 784));const p = predict(w, r.x);const name = (c) => (c ? "eclipse" : "junk");const right = p.label === r.label;$("verdict").innerHTML = `Signal ${i}: the model says <b>${name(p.label)}</b>. The catalog says ${name(r.label)}.<span class="${right ? "ok" : "no"}">${right ? "✓ match" : "✗ miss"}</span>`;const st = stars[i];$("star").innerHTML = st ? `Star <a href="https://exofop.ipac.caltech.edu/tess/target.php?id=${st.tic}" target="_blank" rel="noopener noreferrer">TIC ${st.tic}</a>· period ${st.period} d · transit ${st.duration_h} h · depth ${st.depth_ppm} ppm${st.tmag ? ` · Tmag ${st.tmag} (catalog)` : ""} · TESS year ${st.year}` : "";$("sums").textContent = `raw output sums · junk ${p.sums[0]} · eclipse ${p.sums[1]}`;}function pick(label) {const ids = rows.flatMap((r, i) => (r.label === label ? [i] : []));show(ids[Math.floor(Math.random() * ids.length)]);}$("eclipse").onclick = () => pick(1);$("junk").onclick = () => pick(0);$("go").onclick = () => show(Math.max(0, Math.min(rows.length - 1, Number($("idx").value) || 0)));pick(1);let right = 0, found = 0, eclipses = 0, said = 0;for (const r of rows) {const p = predict(w, r.x).label;right += p === r.label; eclipses += r.label; found += p & r.label; said += p;}const pct = (a, b) => `${(100 * a / b).toFixed(1)}%`;const stat = (v, k) => `<div class="stat"><p class="v">${v}</p><p class="k">${k}</p></div>`;$("stats").innerHTML =stat(`${found} / ${eclipses}`, "eclipses found") +stat(pct(found, said), `of the ${said} "eclipse" answers are eclipses`) +stat(pct(right, rows.length), "right answers") +stat(pct(rows.length - eclipses, rows.length), 'if it always said "junk"');</script></body></html>
1234567891011121314151617{ "rpc": "https://neuralenginebyte.org/rpc", "height": 15899, "blockhash": "9ca17d22c80b4c8c5e22eff093f22240a49de76f4e8b72c31d3f51f8389c5ddb", "slots": { "0": { "dataset": "kepler-v2", "bytes": 13000, "weightshash": "4dc1df94cce95e19cd5bb5ab8cfea67f0214962a632dedb3851f2a05986aafa7" }, "1": { "dataset": "tess", "bytes": 13000, "weightshash": "5cec929781cc12c8bc203ca37575ab37dd969ede9f45b124ff9e4d855b8a8556" } }}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495// Forward pass of the KEP1 network of the NEB chain (spec/nebhash-v2.md, sections 3.1 and 4.1), integer only.// A port of neb2_model_predict in pow/ref/nebhash2.c: same layers, same rounding, same first-maximum rules.// Works in a browser and in Node. Input: 784 values in 0..7 (global view 583, then local view 201). Output: 0 or 1.
const KEP1 = [ // kind, cin, cout, k, pad, pool, shift, in_len, in_off, sources, w_off { conv: true, cin: 1, cout: 8, k: 5, pad: 2, pool: 4, s: 2, n: 583, off: 0, src: [], w: 0 }, { conv: true, cin: 8, cout: 16, k: 5, pad: 2, pool: 4, s: 4, n: 145, src: [0], w: 40 }, { conv: true, cin: 1, cout: 8, k: 5, pad: 2, pool: 4, s: 3, n: 201, off: 583, src: [], w: 680 }, { conv: true, cin: 8, cout: 16, k: 5, pad: 2, pool: 4, s: 4, n: 50, src: [2], w: 720 }, { conv: false, cin: 768, cout: 32, s: 5, src: [1, 3], w: 1360 }, { conv: false, cin: 32, cout: 2, s: 4, src: [4], w: 25936 },];
// Packed weights (13,000 bytes): two signed 4-bit weights per byte, low nibble first.export function unpackWeights(packed) { const w = new Int8Array(packed.length * 2); for (let j = 0; j < packed.length; j++) { const lo = packed[j] & 15, hi = packed[j] >> 4; w[2 * j] = lo >= 8 ? lo - 16 : lo; w[2 * j + 1] = hi >= 8 ? hi - 16 : hi; } return w;}
const rshift = (x, n) => (n === 0 ? x : (x + (1 << (n - 1))) >> n);const clip = (v) => (v < -8 ? -8 : v > 7 ? 7 : v);
// Returns { label, sums }: the class (first maximum of the raw output sums) and those two sums.export function predict(w, x) { const outs = []; let lastIn = null; for (let i = 0; i < KEP1.length; i++) { const L = KEP1[i]; let input; if (L.src.length === 0) input = Int8Array.from(x.slice(L.off, L.off + L.cin * L.n)); else { input = new Int8Array(L.src.reduce((t, s) => t + outs[s].length, 0)); let at = 0; for (const s of L.src) { input.set(outs[s], at); at += outs[s].length; } } lastIn = input; if (!L.conv) { const out = new Int8Array(L.cout); for (let o = 0; o < L.cout; o++) { let z = 0; const base = L.w + o * L.cin; for (let j = 0; j < L.cin; j++) z += w[base + j] * input[j]; out[o] = clip(rshift(z, L.s)); } outs.push(out); continue; } const n = L.n, cl = n, a = new Int8Array(L.cout * cl); // stride 1 and padding 2 with kernel 5 keep the length for (let o = 0; o < L.cout; o++) for (let p = 0; p < cl; p++) { let z = 0; for (let c = 0; c < L.cin; c++) { const wb = L.w + (o * L.cin + c) * L.k, rb = c * n; for (let t = 0; t < L.k; t++) { const q = p + t - L.pad; if (q >= 0 && q < n) z += w[wb + t] * input[rb + q]; } } a[o * cl + p] = clip(rshift(z, L.s)); } const ol = Math.floor(cl / L.pool), out = new Int8Array(L.cout * ol); for (let o = 0; o < L.cout; o++) for (let j = 0; j < ol; j++) { let best = o * cl + j * L.pool; for (let t = 1; t < L.pool; t++) if (a[o * cl + j * L.pool + t] > a[best]) best = o * cl + j * L.pool + t; out[o * ol + j] = a[best]; } outs.push(out); } const L = KEP1[KEP1.length - 1], sums = []; for (let o = 0; o < L.cout; o++) { let z = 0; for (let j = 0; j < L.cin; j++) z += w[L.w + o * L.cin + j] * lastIn[j]; sums.push(z); } return { label: sums[1] > sums[0] ? 1 : 0, sums };}
// A dataset file NMD1: "NMD1", count (u32 little-endian), then records of 784 values and a label.export function readDataset(bytes) { const head = String.fromCharCode(...bytes.slice(0, 4)); if (head !== "NMD1") throw new Error("not an NMD1 dataset"); const n = bytes[4] | (bytes[5] << 8) | (bytes[6] << 16) | (bytes[7] << 24); const rows = []; for (let i = 0; i < n; i++) { const at = 8 + i * 785; rows.push({ x: bytes.subarray(at, at + 784), label: bytes[at + 784] }); } return rows;}123version https://git-lfs.github.com/spec/v1oid sha256:4454d7734c15b80b431ab22306b9f7ab8b57e1872d7a15da3317b9d303448008size 13000123version https://git-lfs.github.com/spec/v1oid sha256:ba656c292783f79909a7a3662b864edd61fc1604fc283c43e05eec897bc0e858size 1460108README.md+7-5
index.html+198-17
logo-mark.pngAdded

meta.jsonAdded+17
neb-model.jsAdded+95
signals.jsonAdded
slot1.binAdded+3
tess-test-q8.binAdded+3