SkyIsNotGreen commited on
Commit
69ff84b
·
verified ·
1 Parent(s): 6f4eb1c

Splinter Memory: the white paper as the model card (long-context memory curation management)

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ figures/flow.png filter=lfs diff=lfs merge=lfs -text
CITATION.cff ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.2.0
2
+ message: "If you use this software or its measurements, cite it as below."
3
+ title: "Splinter-Memory"
4
+ abstract: >-
5
+ An external, managed-decay context-curation layer for long-horizon LLM
6
+ conversations. Small CPU "drone" encoders score, filter, and reassemble
7
+ stored history into a bounded, high-relevance window per turn, so a
8
+ generative model performs over arbitrarily long conversations on consumer
9
+ hardware. Claims are stated as falsifiable predictions (P1-P11) with measured
10
+ verdicts and a published failure register.
11
+ type: software
12
+ authors:
13
+ - name: "sky-is-green"
14
+ alias: "sky-is-green"
15
+ version: "0.1.0"
16
+ date-released: "2026-09-22"
17
+ license: MIT
18
+ repository-code: "https://github.com/sky-is-green/splinter-memory"
19
+ url: "https://github.com/sky-is-green/splinter-memory"
20
+ keywords:
21
+ - context-management
22
+ - memory-management
23
+ - long-context
24
+ - retrieval
25
+ - llm
26
+ - local-inference
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 HiveBench Studio contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: sentence-transformers
4
+ tags:
5
+ - context-curation
6
+ - long-context
7
+ - memory-management
8
+ - conversational-ai
9
+ - retrieval
10
+ - llm
11
+ - research-paper
12
+ pipeline_tag: sentence-similarity
13
+ ---
14
+
15
+ # Long-Context Memory Curation Management
16
+
17
+ **Splinter Memory — a managed-decay context curation architecture for long-horizon LLM conversations.**
18
+
19
+ This card is the Hugging Face edition of the Splinter Memory white paper. It
20
+ is written for the people who build LLM applications and want the context
21
+ window to *stay useful* as the conversation grows: the memory layer, the
22
+ mechanisms, the measured results, and the code that implements them.
23
+
24
+ The canonical paper lives with the code
25
+ ([sky-is-green/splinter-memory](https://github.com/sky-is-green/splinter-memory));
26
+ this edition adds the encoder measurement taken on the harness's own traffic
27
+ (§7) and the operational notes a practitioner needs.
28
+
29
+ ---
30
+
31
+ ## The problem, in one paragraph
32
+
33
+ A long conversation is not a long document. Facts that mattered twenty turns
34
+ ago fall out of a rolling context window; the model answers from what
35
+ survives, not from what happened; and the surviving context is mostly noise
36
+ by then. Truncation and recency are cheap and wrong: they throw away
37
+ exactly the old fact the user came back for. Keeping everything is worse -
38
+ the prompt grows, the KV cache grows, the cost grows, and the model
39
+ "loses the middle" while the interesting fact sits somewhere in the middle.
40
+
41
+ ## What this does
42
+
43
+ Splinter Memory keeps a **managed** memory outside the model and hands the
44
+ model a **bounded, relevance-ranked** context every turn:
45
+
46
+ - a small fleet of **bidirectional encoders** ("drones") scores every stored
47
+ chunk against the current query - cheap, and far better at similarity than
48
+ a generative model of the same size;
49
+ - a **membrane** drops what is said twice and notices when the topic
50
+ changes;
51
+ - a **retention layer** makes forgetting a *design parameter* - an
52
+ escalating-friction decay, a remembrance pass that rescues facts worth
53
+ keeping, and a "comb" (an SSD tier) that resurrects topics that returned
54
+ after being evicted;
55
+ - a **focal layer** assembles a bounded context on an adaptive token budget
56
+ and hands it to any OpenAI-compatible backend (llama.cpp, LM Studio, vLLM,
57
+ a hosted API).
58
+
59
+ The model never sees the raw history. It sees the part that is worth its
60
+ attention, every turn, at a cost that does not grow with the conversation.
61
+
62
+ **The separation is the point.** The generative model is good at producing
63
+ answers and the wrong tool for selecting context; measured live, using the
64
+ 27B generative model as an encoder proxy cost tens of seconds per turn on
65
+ the hot path, while the 17M-parameter drone did the same job in
66
+ milliseconds.
67
+
68
+ ## The measured results
69
+
70
+ | Metric | Naive FIFO (baseline) | Target | Measured |
71
+ |---|---|---|---|
72
+ | Throughput over 500 turns | decays | flat ±10% | **flat** (14.5 → 15.5 tok/s over 308+ turns), 0 OOM events |
73
+ | Retrieval recall (facts the model actually stated) | n/a | ≥75% / ≥90% | **90.3%** live, 93.5% on the isolated-store replay |
74
+ | Retrieval precision (sentence proxy) | near-chance past the window | ≥70% / ≥85% | **10.7%** - *the encoder ceiling* (§7) |
75
+ | Context sufficiency vs. an equal-size FIFO window | — | ≥80% of turns | **85.1%** of the fact-retrievable turns (4.4:1) |
76
+ | Routing accuracy | — | ≥80% / ≥92% | **100%** |
77
+ | Added per-turn latency | 0 ms | <50 / <30 ms | **≈18 ms** (3.4 ms assembly + ~15 ms scoring) |
78
+ | Peak RSS over 500 turns | — | small | **34.7 MB** |
79
+ | Pipeline Efficiency Score | ~30 | ≥65 / ≥80 | **80.0 (GREEN)** live, 73.1 on the 20-conversation evidence run |
80
+
81
+ Full protocol, per-hypothesis logic chains and falsification conditions:
82
+ §5 of the canonical paper.
83
+
84
+ ## Use it
85
+
86
+ Three ways, in increasing order of control:
87
+
88
+ **1. As a sidecar** - the Studio serves an OpenAI-compatible
89
+ `/v1/chat/completions` that curates before it generates. Point your client
90
+ at it; nothing else changes.
91
+
92
+ ```bash
93
+ git clone https://github.com/sky-is-green/hivebench
94
+ cd hivebench && python -m harness --port 8765
95
+ ```
96
+
97
+ **2. As a library** - the memory system is importable, engine-agnostic and
98
+ has no GPU requirement for the encoder tier.
99
+
100
+ ```python
101
+ from cortex.splinter import Splinter
102
+ from cortex.config import SplinterConfig
103
+
104
+ s = Splinter(config=SplinterConfig(max_context=8192))
105
+ result = s.process_turn("what did we decide about the KV cache?", "my-conversation")
106
+ print(result.assembled.content) # the curated context, bounded
107
+ ```
108
+
109
+ **3. As the benchmark** - the P1-P12 protocol, the deterministic
110
+ diagnostics and the self-contained run bundles are in the repository, so the
111
+ claims can be re-measured on your own hardware and your own backend.
112
+
113
+ ## How it works
114
+
115
+ | Layer | Function | Core mechanisms |
116
+ |---|---|---|
117
+ | **Cortex** | Orchestration & routing | task classification, drone dispatch, congestion detection, graceful degradation |
118
+ | **Sieve** | Relevance scoring | ultra-small encoder (17M params, 384-dim) for fast similarity; a medium encoder for uncertain cases; confidence via prediction variance |
119
+ | **Membrane** | Selective filtering | semantic deduplication (cosine > 0.92, keep the densest), topic-drift detection and reset |
120
+ | **Retention** | Memory & decay | remembrance pass, escalating-friction decay, stale-context acceleration, the "comb" (surplus SSD tier, topic-return resurrection) |
121
+ | **Focal** | Assembly | adaptive token budget (1k-6k by route tier), confidence-weighted sorting, bounded context construction |
122
+
123
+ **Per turn:** user input → Cortex classifies it → Sieve scores every stored
124
+ chunk → Membrane deduplicates and checks the topic → Retention applies decay
125
+ and the remembrance pass → Focal assembles a bounded context → the backend
126
+ generates → the reply is observed back into the store.
127
+
128
+ ### The four postulates
129
+
130
+ 1. **Context curation** - for a fixed token budget, a relevance-ranked
131
+ selection from the full history dominates a contiguous window of the same
132
+ size, and the gap widens with conversation length.
133
+ 2. **Managed decay** - forgetting is a design parameter, not a failure mode;
134
+ escalating friction beats both unbounded growth and uniform forgetting.
135
+ 3. **Separation** - bidirectional encoders for comprehension, an
136
+ autoregressive decoder for generation, is the better allocation of the
137
+ same compute.
138
+ 4. **Ground-truth bootstrap** - an LLM auditor asked about *context
139
+ utilization* (not answer correctness) agrees with human labels 90.25% of
140
+ the time, which is enough to drive parameter tuning without a human
141
+ labelling pass.
142
+
143
+ ## The evidence, hypothesis by hypothesis
144
+
145
+ | | Hypothesis | Verdict |
146
+ |---|---|---|
147
+ | P1 | Constant throughput over 500 turns | **PASS** |
148
+ | P2 | Retrieval precision ≥85% at ≥90% recall | **SPLIT** - recall PASS (90.3%), precision FAIL (the encoder ceiling) |
149
+ | P3 | Context sufficiency ≥80% of turns vs. an equal-size FIFO window | **PASS** (85.1%) |
150
+ | P4 | Domain-dependent decay curve (code vs. prose separate) | **PASS** (code m90 1.8 vs. prose 1.2) |
151
+ | P5 | Targeted masking | **PASS** |
152
+ | P6 | Confidence escalation | **FAIL** |
153
+ | P7 | Auditor-human agreement ≥90% | **PASS** (90.25% on 400 items) |
154
+ | P8 | Heuristic routing floor | **PASS** (100%) |
155
+ | P9 | Densest-duplicate survives deduplication | **PASS** |
156
+ | P10 | Drift reset | **FAIL** |
157
+ | P11 | Comb resurrection of returned topics | **PASS** (deterministic and live-validated) |
158
+ | P12 | Store-time fact distillation | protocol only |
159
+
160
+ The failures are kept in the paper with their evidence. A pre-registered
161
+ protocol that only reports passes is not evidence.
162
+
163
+ ## 7. The encoder: what we measured on our own traffic
164
+
165
+ The harness gives its encoder three jobs, and only one of them is a ranking:
166
+
167
+ | job | question | where |
168
+ |---|---|---|
169
+ | **rank** | which stored chunk answers this query? | the sieve |
170
+ | **dedup** | do these two chunks say the same thing? | the membrane (cosine > 0.92) |
171
+ | **drift** | did the conversation change topic? | the membrane (1 - cosine > 0.6) |
172
+
173
+ The prior encoder comparison measured **rank** only, on the synthetic
174
+ fixtures, and found that six encoders (a 22M MiniLM, a 400MB cross-encoder,
175
+ a 568M retrieval-specialised encoder and two contrastively tuned variants)
176
+ all landed on the same top-K curve - so it concluded the ceiling was
177
+ *data-structural* and that the remedy was "stop looking for a better
178
+ encoder".
179
+
180
+ We re-measured all three jobs on the harness's **own** traffic - 81
181
+ conversations, 6,975 stored chunks, 4,056 duplicate pairs and 6,533
182
+ topic-change cases, labelled lexically so the label is independent of the
183
+ encoder being measured (`experiments/encoder_suite.py`). The result
184
+ changes the picture, and it is not about the ranking:
185
+
186
+ **The thresholds that ship with the harness were calibrated for a different
187
+ encoder.** The production drone was swapped from `all-MiniLM-L6-v2` to
188
+ `paraphrase-MiniLM-L3-v2` on 2026-08-23; the membrane's two thresholds were
189
+ not re-derived.
190
+
191
+ | operating point | measured |
192
+ |---|---|
193
+ | dedup at the shipped threshold (0.92) | precision 1.00, **recall 0.03** - the duplicate test almost never fires |
194
+ | dedup at its own best threshold (~0.56) | F1 **0.75** (precision 0.62, recall 0.95) |
195
+ | drift at the shipped threshold (0.6) | precision 0.08, **recall 0.96** - the topic-change test fires on almost every turn |
196
+ | drift as a *ranking* signal | **AUC 0.945** - the signal is strong; the threshold is wrong |
197
+
198
+ The encoder is not the bottleneck. The **operating points** are - and they
199
+ are per-encoder, so they have to travel with the model. The full sweep
200
+ (model families, sizes, dimensions, CPU cost per chunk) is in
201
+ `docs/ENCODER-NOTES.md` in the harness repository, and the evaluation sets
202
+ are published as a dataset next to this card.
203
+
204
+ ## Limits, honestly
205
+
206
+ - **Precision is the open question.** The context that reaches the model is
207
+ fatter than it needs to be. The recall evidence says the facts the model
208
+ stated are in there; an independent, non-circular precision number is
209
+ still open.
210
+ - **The auditor sees the answer.** P7's agreement check mitigates the
211
+ circularity but does not remove it: the auditor is the same model family
212
+ that produced the answer.
213
+ - **Synthetic-corpus bias.** The long-horizon corpus is generated. The
214
+ measurement in §7 is on real traffic; the P1-P12 verdicts mostly are not.
215
+ - **Cross-conversation contamination and hedge-replies** are harness-level
216
+ failure modes that look like architectural failures if you do not
217
+ isolate conversations per store and filter refusals out of the store.
218
+ - **The decay curve is an engineering heuristic** with cognitive-science
219
+ inspiration, not a validated model of human forgetting.
220
+
221
+ ## Reproduce
222
+
223
+ ```bash
224
+ # the offline suite (deterministic diagnostics, no model needed)
225
+ pytest tests/unit tests/integration -q
226
+
227
+ # the encoder sweep on your own traffic
228
+ python -m experiments.encoder_suite --encoders l3 l6 bge-small
229
+
230
+ # the cascade pilot (local model, deterministic verifiers)
231
+ open http://127.0.0.1:8765/cascade
232
+ ```
233
+
234
+ The repository ships the run bundles, the event logs and the label files, so
235
+ a verdict can be traced back to the bytes that produced it.
236
+
237
+ ## License and citation
238
+
239
+ MIT. See `LICENSE` and `CITATION.cff` in this repository.
240
+
241
+ ```
242
+ @misc{splinter-memory-2026,
243
+ title = {Splinter Memory: A Managed-Decay Context Curation Architecture
244
+ for Long-Horizon LLM Conversations},
245
+ author = {{HiveBench Studio contributors}},
246
+ year = {2026},
247
+ url = {https://github.com/sky-is-green/splinter-memory}
248
+ }
249
+ ```
250
+
251
+ **Community invitation.** The protocol is written to be challenged: every
252
+ prediction has a logic chain, a measurement and a falsification condition.
253
+ If your hardware produces a different verdict, that is a result - open an
254
+ issue with the run bundle.
figures/arch.png ADDED
figures/b.png ADDED
figures/budget.png ADDED
figures/flow.png ADDED

Git LFS Details

  • SHA256: 8dc02e0884d76398573fd86120b22c024a14bf1e869c50fe48c548f074eeceee
  • Pointer size: 131 Bytes
  • Size of remote file: 135 kB
figures/p4.png ADDED
figures/p9.png ADDED
figures/pes.png ADDED