File size: 11,675 Bytes
48f8357
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57098cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DMCRA Lab — elastic level-set quantisation, measured</title>
<meta name="description" content="A client-side lab that quantises a real GGUF's real weight tensors to elastic per-block level sets and runs the real llama forward pass to measure what it costs. Every figure is measured in your browser.">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="scanline"></div>
<div class="app">

  <header>
    <span class="brand">DMCRA · ELASTIC CENTROID LAB</span>
    <span class="sub">REAL GGUF WEIGHTS · REAL FORWARD PASS · MEASURED, NOT ASSERTED</span>
  </header>

  <!-- ============================================================ spec -->
  <section class="panel">
    <h2 class="panel-title pink">Spec — what is measured here, and what this page refuses to claim</h2>
    <div class="table-wrap">
      <table class="spec">
        <tr><th>mechanism under test</th><td>per-block level-set selection. A weight matrix is cut into 32-weight blocks and each block is assigned a grid from a nested family — <span class="num">{±1}</span> → <span class="num">{0,±1}</span> → <span class="num">{0,±1,±2}</span> → <span class="num">{0..±3}</span> — so the <i>codebook</i>, not just the scale, is chosen per block under a bit budget.</td></tr>
        <tr><th>the “multi-channel zero”</th><td><code>{0/0/0}</code> is three zeros. A decoder that maps a channel to the number zero maps all three to zero, so this page puts both grids through the same pass and reports whether the logits come out bit-identical — and what the widened alphabet is charged for it. Both rows are printed either way.</td></tr>
        <tr><th>elasticity at equal bits</th><td>measured here, at a bit budget held equal by construction, against uniform ternary. The verdict printed in that panel is produced by your run; the page does not assert a winner in its copy.</td></tr>
        <tr><th>what is NOT measured</th><td>memristive crossbar arrays, photonic waveguides, “zero-latency” propagation and in-DRAM routing. This is a static page running JavaScript in a tab: it has no such datapath and makes no claim about one. Latency figures here are the cost of the mechanism <i>in software</i>.</td></tr>
        <tr><th>quality instruments</th><td>top-1 of the true next token <i>with its standard error</i>, mean rank of the true token, and Spearman ρ of the 512 logits against the exact pass. Both latter are invariant to logit scale, so no quantiser can buy a better score by shrinking its logits.</td></tr>
        <tr><th>why not perplexity</th><td>on this fixture the exact pass scores <b>worse</b> than a uniform distribution in mean log-likelihood while being far above chance on top-1. A metric that uniform beats rewards degradation, so it is printed as a warning and never used to rank.</td></tr>
        <tr><th>what a level costs</th><td><span class="num">ceil(log2 levels)</span> index bits per weight, plus one 4-byte scale per block. The measured bits/weight column is reported by the forward pass itself, and asserted against this arithmetic in the test suite.</td></tr>
        <tr><th>every figure</th><td>computed in your browser from the GGUF's real weight bytes, or labelled with the suite that measured it. Nothing is a simulated or definition-derived number.</td></tr>
      </table>
    </div>
  </section>

  <!-- ============================================================ 1. model -->
  <section class="panel">
    <h2 class="panel-title">1 · Model — stream a GGUF and read its real weights</h2>
    <div class="row">
      <select id="model-select">
        <option value="https://huggingface.co/ggml-org/models/resolve/main/tinyllamas/stories260K.gguf">stories260K · 1.13 MB · all F32 · 512-token vocab</option>
        <option value="https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf">TinyLlama 1.1B · Q4_K_M — 638 MB, refused (over the in-tab ceiling)</option>
        <option value="https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct-GGUF/resolve/main/qwen2.5-0.5b-instruct-q4_k_m.gguf">Qwen2.5 0.5B · q4_k_m — ~400 MB, refused (over the ceiling, and already quantised)</option>
        <option value="https://huggingface.co/QuantFactory/Meta-Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct.Q4_K_M.gguf">Llama 3 8B · Q4_K_M — refused (over the ceiling)</option>
        <option value="https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/resolve/main/mistral-7b-instruct-v0.2.Q4_K_M.gguf">Mistral 7B Instruct · Q4_K_M — refused (over the ceiling)</option>
      </select>
      <button id="load-btn" class="btn primary">Stream + parse</button>
      <span class="status-text" id="load-status">nothing loaded</span>
    </div>
    <div class="table-wrap">
      <table class="telemetry">
        <thead><tr><th>field</th><th>value</th></tr></thead>
        <tbody id="model-tbody">
          <tr><th>state</th><td class="num">press “Stream + parse”</td></tr>
        </tbody>
      </table>
    </div>
    <p class="hint">The pass needs the weight tensors, so the whole file is read, not just the metadata block. Larger models are refused with their byte count and a reason rather than appearing to hang.</p>
  </section>

  <!-- ============================================================ 2. inference -->
  <section class="panel">
    <h2 class="panel-title">2 · Inference — the real transformer, real next-token distribution</h2>
    <div class="row">
      <textarea id="prompt" rows="2" spellcheck="false">Once upon a time there was a little girl named Lily .</textarea>
    </div>
    <div class="row">
      <button id="run-btn" class="btn accent">Run forward pass</button>
      <span class="status-text" id="infer-status">needs a loaded model</span>
    </div>
    <div class="table-wrap">
      <table class="data">
        <thead><tr><th>#</th><th>token</th><th>logit</th><th>p</th></tr></thead>
        <tbody id="topk-tbody">
          <tr><td colspan="4">run the pass to see the model's own next-token distribution</td></tr>
        </tbody>
      </table>
    </div>
  </section>

  <!-- ============================================================ 3. ladder -->
  <section class="panel accent-panel">
    <h2 class="panel-title lime">3 · The level-set ladder — what unclamping actually buys</h2>
    <div class="row">
      <label>scored positions</label>
      <input type="range" id="positions" min="4" max="32" value="12">
      <span class="status-text" id="positions-label">12 positions</span>
      <button id="ladder-btn" class="btn primary">Measure ladder</button>
      <span class="status-text" id="exact-status">exact baseline: not measured</span>
      <span class="status-text" id="ladder-status"></span>
    </div>
    <div class="table-wrap">
      <table class="data">
        <thead><tr><th>grid</th><th>bits/weight</th><th>RMSE</th><th>mean rank</th><th>top-1</th><th>rho vs exact</th></tr></thead>
        <tbody id="ladder-tbody">
          <tr><td colspan="6">measure the ladder to fill this table — the exact pass is measured first, because every rho is against it</td></tr>
        </tbody>
      </table>
    </div>
    <p class="hint">Mean rank is the position of the true next token in the model's own ordering; a uniform guess averages <span class="num">256.5</span> on this vocabulary, lower is better. rho is the rank correlation of all 512 logits against the exact pass. Top-1 is shown with its standard error in the log, because at these position counts it cannot resolve small differences.</p>
  </section>

  <!-- ============================================================ 4. zero -->
  <section class="grid2">
    <div class="panel">
      <h2 class="panel-title">4 · The multi-channel zero, tested for identity</h2>
      <div class="row">
        <button id="zero-btn" class="btn step">Test {0} vs {0/0/0}</button>
        <span class="status-text" id="zero-status">needs the ladder's exact baseline</span>
      </div>
      <div class="table-wrap">
        <table class="data">
          <thead><tr><th>configuration</th><th>bits/weight</th><th>logits identical to {0}?</th><th>mean rank</th><th>top-1</th></tr></thead>
          <tbody id="zero-tbody">
            <tr><td colspan="5">the claim is that widening the zero into three channels is an information channel; the test is whether a decoder can tell them apart</td></tr>
          </tbody>
        </table>
      </div>
      <p class="hint">Compared bit-for-bit across every position and every vocabulary entry — not a tolerance, not a similarity.</p>
    </div>

    <div class="panel">
      <h2 class="panel-title">5 · Elastic allocation at equal bits</h2>
      <div class="row">
        <select id="plan-select">
          <option value="benefit">key: measured error reduction per bit</option>
          <option value="variance">key: block dispersion (the document's stated pressure)</option>
        </select>
        <button id="plan-btn" class="btn warn">Build + measure plan</button>
        <span class="status-text" id="plan-status">needs the ladder's exact baseline</span>
      </div>
      <div class="table-wrap">
        <table class="data">
          <thead><tr><th>plan</th><th>bits/weight</th><th>mean rank</th><th>rho vs exact</th><th>rank diff vs ternary</th></tr></thead>
          <tbody id="plan-tbody">
            <tr><td colspan="5">uniform ternary is the baseline at the same average bits; a positive rank difference means the plan is worse</td></tr>
          </tbody>
        </table>
      </div>
      <div class="vis-box">
        <canvas id="grid-canvas"></canvas>
        <span class="vis-label">per-block grid map — blue = binary, grey = ternary, pink = hepta</span>
      </div>
      <div class="row legend">
        <span class="swatch"><i style="background:#3b82f6"></i>binary · 1 index bit</span>
        <span class="swatch"><i style="background:#6b6480"></i>ternary · 2 index bits</span>
        <span class="swatch"><i style="background:#ff2d78"></i>hepta · 3 index bits</span>
      </div>
      <p class="hint">The plan promotes the most important blocks to the 3-bit grid and demotes the least important to the 1-bit grid until the promoted and demoted parameter masses balance, which holds the average to 2.0000 index bits. Both plans are shown against the same uniform-ternary baseline.</p>
    </div>
  </section>

  <!-- ============================================================ log -->
  <section class="panel">
    <h2 class="panel-title">Log — what the page actually did</h2>
    <div id="terminal" class="terminal-box"><span class="cursor" id="cursor"></span></div>
    <div class="row">
      <button id="clear-btn" class="btn ghost">Clear log</button>
    </div>
    <div class="log" id="log"></div>
  </section>

  <footer>
    Client-side only: no server, no upload, no GPU, no CDN, no build step. The GGUF codec, the tokeniser
    and the forward pass are the same modules the <code>hdc-suite</code> Space ships, vendored here with
    their provenance in the file headers.<br>
    Method, per-claim verdicts and the suites behind them: <code>reports/dmcra-plan.md</code> and
    <code>reports/dmcra-verdicts.md</code>. Part of the AEUPH studio.
  </footer>
</div>

<script src="gguf.js"></script>
<script src="weights.js"></script>
<script src="bpe.js"></script>
<script src="quant.js"></script>
<script src="forward.js"></script>
<script src="app.js"></script>
</body>
</html>