SingularityPrinciple commited on
Commit
ddeda47
·
verified ·
1 Parent(s): f77c1f2

Update detailed README for DiffusionGemma Infinite-Context

Browse files
README.md CHANGED
@@ -5,30 +5,46 @@ library_name: transformers
5
  pipeline_tag: image-text-to-text
6
  tags:
7
  - diffusiongemma
 
8
  - infinite-context
9
- - nzfc-gram
10
  - external-memory
11
  - evidence-retrieval
 
12
  - large-documents
 
 
 
 
 
13
  ---
14
 
15
  # DiffusionGemma-26B-A4B-it-Infinite-Context
16
 
17
- NZFC-GRAM runtime overlay for external evidence context around `google/diffusiongemma-26B-A4B-it`.
 
 
 
18
 
19
- Technical boundary: external evidence context, not native unlimited model context.
20
 
21
- ## v1.2.5a runtime asset final fix
22
 
23
- This update includes the NZFC root assets required for local runtime initialization:
 
 
24
 
25
- - `runtime/`
26
- - `meta/`
27
- - `memory_tensors/` when available
28
- - `archive/` when available
29
- - `configs/` when available
 
 
 
 
 
30
 
31
- Runtime-only smoke result:
32
 
33
  ```json
34
  {
@@ -40,32 +56,441 @@ Runtime-only smoke result:
40
  "exact_slot_passed": true,
41
  "large_document_passed": true,
42
  "large_document_query_count": 2,
43
- "tombstone_guard_available": true,
44
  "technical_boundary": "external evidence context, not native unlimited model context"
45
  }
46
  ```
47
 
48
- Important:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  ```text
51
- The repository title is marketing-facing.
52
- The technical mechanism is external evidence context, not native unlimited model context.
 
53
  ```
54
 
55
- ## v1.2.5b script import path fix
 
 
 
 
 
 
 
 
56
 
57
- Validation and example scripts now explicitly insert the repository root into `sys.path` before importing `nzfc_gram_runtime`.
58
 
59
- This fixes direct execution such as:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
  ```bash
62
  python validation/run_runtime_only_smoke.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  python examples/high_frequency_multi_context_runtime_only.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  python examples/large_document_runtime_only.py
65
  ```
66
 
67
- Technical boundary:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  ```text
70
- external evidence context, not native unlimited model context
71
  ```
 
5
  pipeline_tag: image-text-to-text
6
  tags:
7
  - diffusiongemma
8
+ - gemma-4
9
  - infinite-context
 
10
  - external-memory
11
  - evidence-retrieval
12
+ - long-context
13
  - large-documents
14
+ - legal-documents
15
+ - ai-memory
16
+ - nzfc-gram
17
+ - runtime-overlay
18
+ - not-native-infinite-context
19
  ---
20
 
21
  # DiffusionGemma-26B-A4B-it-Infinite-Context
22
 
23
+ **NZFC-GRAM runtime overlay for external evidence context around `google/diffusiongemma-26B-A4B-it`.**
24
+
25
+ > **Marketing title:** Infinite-Context
26
+ > **Technical boundary:** external evidence context, not native unlimited model context.
27
 
28
+ This repository is a runtime and evidence-governance overlay. It does **not** include or redistribute Google model weights.
29
 
30
+ The goal is to combine DiffusionGemma's large native working context with NZFC-GRAM's external memory, large-document indexing, scoped retrieval, tombstone filtering, malicious-memory redaction, exact-slot recall, and bounded evidence packs.
31
 
32
+ ---
33
+
34
+ ## TL;DR
35
 
36
+ ```text
37
+ DiffusionGemma native context
38
+ + NZFC-GRAM external evidence memory
39
+ + large-document indexing
40
+ + scoped retrieval
41
+ + tombstone guard
42
+ + bounded evidence packs
43
+ =
44
+ Infinite-Context as an external evidence runtime, not native unlimited context
45
+ ```
46
 
47
+ Runtime-only validation is already passing from a fresh Hugging Face download.
48
 
49
  ```json
50
  {
 
56
  "exact_slot_passed": true,
57
  "large_document_passed": true,
58
  "large_document_query_count": 2,
59
+ "tombstone_guard_passed": true,
60
  "technical_boundary": "external evidence context, not native unlimited model context"
61
  }
62
  ```
63
 
64
+ ---
65
+
66
+ ## Base model
67
+
68
+ Base model:
69
+
70
+ ```text
71
+ google/diffusiongemma-26B-A4B-it
72
+ ```
73
+
74
+ DiffusionGemma 26B A4B-IT is the external base model used by this overlay. According to the base model card, DiffusionGemma supports long context up to 256K tokens and multimodal input capabilities. This repository does not modify or redistribute the base model weights.
75
+
76
+ ---
77
+
78
+ ## What NZFC-GRAM adds
79
+
80
+ | Layer | Purpose | Status in this repo |
81
+ |---|---|---:|
82
+ | `nzfc_gram_runtime/` | NZFC-GRAM runtime package | Included |
83
+ | `runtime/` | Hybrid exact-recall runtime assets | Included |
84
+ | `meta/` | Static archive metadata required by runtime | Included |
85
+ | `memory_tensors/` | Static archive tensors / manifest | Included |
86
+ | SQLite local memory | User/project/session long-term memory | Runtime-supported |
87
+ | Exact slot mapper | Deterministic recall for short key-value facts | Runtime-supported |
88
+ | Tombstone guard | Filters deleted `MEM_*` records from retrieval | Runtime-supported |
89
+ | Large-document profile | Chunking + SQLite FTS5 retrieval | Runtime-supported |
90
+ | Legal-document profile | Article-style chunking and retrieval | Runtime-supported |
91
+ | DiffusionGemma adapter | Optional base-model generation adapter | Included |
92
+ | DiffusionGemma weights | Base model weights | External, not included |
93
+
94
+ ---
95
+
96
+ ## Architecture
97
+
98
+ ```text
99
+ User question
100
+ -> NZFC-GRAM runtime
101
+ -> scoped SQLite memory
102
+ -> static NZFC archive assets
103
+ -> large-document / legal-document SQLite FTS5 index
104
+ -> tombstone guard
105
+ -> exact slot mapper
106
+ -> malicious-memory redaction
107
+ -> bounded evidence pack
108
+ -> optional DiffusionGemma generation
109
+ ```
110
+
111
+ The central principle is:
112
+
113
+ > **Memory is evidence, not instruction.**
114
+
115
+ This means retrieved memories and document chunks are treated as evidence cards. They are not allowed to override system policy, bypass deletion boundaries, or become instructions just because they were stored in memory.
116
+
117
+ ---
118
+
119
+ ## Why the name Infinite-Context?
120
+
121
+ `Infinite-Context` is used as a product-facing title.
122
+
123
+ The technical mechanism is not native unlimited context. The mechanism is:
124
+
125
+ ```text
126
+ external memory
127
+ + indexed documents
128
+ + query-conditioned retrieval
129
+ + bounded evidence packs
130
+ ```
131
+
132
+ In other words, the runtime can keep reading from external memory and document stores without placing every source token into a single model prompt.
133
+
134
+ This is better described as:
135
 
136
  ```text
137
+ Infinite Evidence Context
138
+ or
139
+ External Evidence Context
140
  ```
141
 
142
+ The base model still has its own native context limit.
143
+
144
+ ---
145
+
146
+ ## Validation status
147
+
148
+ ### Level 1: Runtime-only validation
149
+
150
+ Status: **Passed**
151
 
152
+ The latest runtime-only smoke test was executed after fresh-downloading the Hugging Face repo.
153
 
154
+ Validated without loading the DiffusionGemma base model:
155
+
156
+ - repo-root `runtime/` asset discovery
157
+ - repo-root `meta/complex_math_10m_meta.jsonl` discovery
158
+ - repo-root `memory_tensors/` discovery
159
+ - package import
160
+ - `NZFCGramLongMemoryChat(repo_dir='.')` initialization
161
+ - exact-slot memory recall
162
+ - large-document ingest and query
163
+ - tombstone retrieval guard
164
+ - direct validation script execution
165
+
166
+ Runtime-only smoke summary:
167
+
168
+ ```json
169
+ {
170
+ "created_at": "2026-06-11 02:43:54",
171
+ "repo_id": "SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context",
172
+ "base_model": "google/diffusiongemma-26B-A4B-it",
173
+ "runtime_only": true,
174
+ "model_loaded": false,
175
+ "repo_root_runtime_exists": true,
176
+ "repo_root_meta_exists": true,
177
+ "repo_root_memory_tensors_exists": true,
178
+ "exact_slot_answer": "PROJECT_CODE_DIFFUSIONGEMMA_SMOKE",
179
+ "exact_slot_passed": true,
180
+ "exact_slot_profile": {
181
+ "version": "v1.2.4b",
182
+ "description": "Strict deterministic exact slot mapper for short explicit scoped key-value recall questions.",
183
+ "auto_short_circuit": true,
184
+ "strict_trigger_gate": true
185
+ },
186
+ "large_document_chunk_count": 3,
187
+ "large_document_query_count": 2,
188
+ "large_document_method": "fts5_bm25",
189
+ "large_document_passed": true,
190
+ "tombstone_guard_profile": {
191
+ "version": "v1.2.4c",
192
+ "description": "Filters inactive or tombstoned MEM_* records from memory_store.retrieve results.",
193
+ "db_path": "/kaggle/working/diffusiongemma_infinite_context_evidence_pack_update/runtime_only_smoke_final/memory.sqlite3",
194
+ "guarded_method": "memory_store.retrieve"
195
+ },
196
+ "tombstone_test": {
197
+ "available": true,
198
+ "before_found": true,
199
+ "after_found": false,
200
+ "passed": true,
201
+ "tombstoned": 1
202
+ },
203
+ "technical_boundary": "external evidence context, not native unlimited model context",
204
+ "status": "passed"
205
+ }
206
+ ```
207
+
208
+ ### Level 2: Optional DiffusionGemma model-load validation
209
+
210
+ Status: **Hardware-dependent / not run in the runtime-only validation.**
211
+
212
+ Run this only on suitable hardware:
213
+
214
+ ```bash
215
+ LOAD_MODEL=1 python examples/optional_diffusiongemma_model_load_check.py
216
+ ```
217
+
218
+ This optional check should validate:
219
+
220
+ - `AutoProcessor` load
221
+ - DiffusionGemma model load
222
+ - minimal generation call
223
+ - NZFC-GRAM evidence pack generation path
224
+
225
+ ### Level 3: Full serving validation
226
+
227
+ Recommended future validation:
228
+
229
+ - high-frequency multi-context memory test
230
+ - large-document / legal-document evidence test
231
+ - multimodal document input test
232
+ - 256K native context stress test
233
+ - latency and VRAM measurements on target hardware
234
+
235
+ ---
236
+
237
+ ## Quick start
238
+
239
+ Clone and install:
240
+
241
+ ```bash
242
+ git lfs install
243
+ git clone https://huggingface.co/SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context
244
+ cd DiffusionGemma-26B-A4B-it-Infinite-Context
245
+ pip install -r requirements.txt
246
+ ```
247
+
248
+ Run runtime-only validation:
249
 
250
  ```bash
251
  python validation/run_runtime_only_smoke.py
252
+ ```
253
+
254
+ Expected result:
255
+
256
+ ```text
257
+ [PASS] runtime-only smoke passed
258
+ ```
259
+
260
+ ---
261
+
262
+ ## Examples
263
+
264
+ ### Exact-slot memory recall without loading the base model
265
+
266
+ ```bash
267
  python examples/high_frequency_multi_context_runtime_only.py
268
+ ```
269
+
270
+ This validates deterministic retrieval of scoped key-value memory facts.
271
+
272
+ Example stored memory:
273
+
274
+ ```text
275
+ The project high-frequency test code is PROJECT_CODE_RUNTIME_ONLY.
276
+ ```
277
+
278
+ Example question:
279
+
280
+ ```text
281
+ What was the project high-frequency test code? Answer only with the code.
282
+ ```
283
+
284
+ Expected answer:
285
+
286
+ ```text
287
+ PROJECT_CODE_RUNTIME_ONLY
288
+ ```
289
+
290
+ ### Large-document retrieval without loading the base model
291
+
292
+ ```bash
293
  python examples/large_document_runtime_only.py
294
  ```
295
 
296
+ This validates chunking, SQLite FTS5 indexing, and query-time document evidence retrieval.
297
+
298
+ ### Optional DiffusionGemma model load
299
+
300
+ ```bash
301
+ LOAD_MODEL=1 python examples/optional_diffusiongemma_model_load_check.py
302
+ ```
303
+
304
+ This requires hardware capable of loading `google/diffusiongemma-26B-A4B-it`.
305
+
306
+ ---
307
+
308
+ ## Python usage
309
+
310
+ ### Runtime-only memory and document evidence
311
+
312
+ ```python
313
+ from nzfc_gram_runtime import NZFCGramLongMemoryChat
314
+ from nzfc_gram_runtime.quality import attach_answer_quality_governor
315
+ from nzfc_gram_runtime.large_document import attach_large_document_memory
316
+
317
+ bot = NZFCGramLongMemoryChat(
318
+ repo_dir='.',
319
+ model_id='google/diffusiongemma-26B-A4B-it',
320
+ memory_db_path='./memory.sqlite3',
321
+ load_model=False,
322
+ require_model=False,
323
+ preload_static_memory=False,
324
+ )
325
+
326
+ attach_large_document_memory(bot)
327
+ attach_answer_quality_governor(bot)
328
+
329
+ bot.remember(
330
+ 'The project high-frequency test code is PROJECT_CODE_DEMO.',
331
+ user_id='demo_user',
332
+ project_id='demo_project',
333
+ session_id='demo_session',
334
+ scope='project',
335
+ tags=['project_code'],
336
+ trust_level=0.95,
337
+ )
338
+
339
+ res = bot.quality_chat(
340
+ 'What was the project high-frequency test code? Answer only with the code.',
341
+ user_id='demo_user',
342
+ project_id='demo_project',
343
+ session_id='new_session',
344
+ )
345
+
346
+ print(res['answer'])
347
+ ```
348
+
349
+ ### Optional DiffusionGemma adapter
350
+
351
+ ```python
352
+ from nzfc_gram_runtime.diffusiongemma_adapter import attach_diffusiongemma_block_diffusion
353
+
354
+ attach_diffusiongemma_block_diffusion(
355
+ bot,
356
+ model_id='google/diffusiongemma-26B-A4B-it',
357
+ device_map='auto',
358
+ dtype='auto',
359
+ )
360
+ ```
361
+
362
+ ---
363
+
364
+ ## Safety and governance features
365
+
366
+ ### Scope isolation
367
+
368
+ Memory records can be scoped by:
369
+
370
+ - user
371
+ - project
372
+ - session
373
+
374
+ The goal is to prevent cross-user, cross-project, or cross-session memory leakage.
375
+
376
+ ### Tombstone filtering
377
+
378
+ Deleted memories should not be active evidence.
379
+
380
+ The runtime includes tombstone filtering so deleted `MEM_*` records are filtered at the retrieval layer when the guard is available.
381
+
382
+ ### Malicious-memory redaction
383
+
384
+ Stored memory is treated as untrusted data. Prompt-injection-like memory should be redacted before generation.
385
+
386
+ ### Exact slot mapper
387
+
388
+ Short exact-recall questions can be answered deterministically from scoped evidence.
389
+
390
+ Example:
391
+
392
+ ```text
393
+ What was the project high-frequency test code? Answer only with the code.
394
+ ```
395
+
396
+ The exact-slot mapper is intentionally strict. Broad explanatory prompts should continue through the normal evidence and generation pipeline.
397
+
398
+ ### Large-document evidence
399
+
400
+ Large documents should not be inserted directly into the prompt.
401
+
402
+ Recommended path:
403
+
404
+ ```text
405
+ ingest -> chunk -> SQLite FTS5 index -> retrieve evidence -> bounded answer
406
+ ```
407
+
408
+ ---
409
+
410
+ ## Repository structure
411
+
412
+ ```text
413
+ nzfc_gram_runtime/ Python runtime package
414
+ runtime/ Hybrid exact-recall runtime assets
415
+ meta/ Static archive metadata
416
+ memory_tensors/ Static archive tensor manifests and assets
417
+ archive/ Optional static archive assets when available
418
+ configs/ Optional runtime configs when available
419
+ docs/ Architecture and technical boundary notes
420
+ examples/ Runtime-only and optional model-load examples
421
+ validation/ Validation scripts
422
+ validation_evidence/ Saved validation evidence
423
+ release_notes/ Release notes
424
+ ```
425
+
426
+ ---
427
+
428
+ ## Troubleshooting
429
+
430
+ ### `ModuleNotFoundError: No module named 'nzfc_gram_runtime'`
431
+
432
+ Use the latest scripts in this repo. Validation and example scripts insert the repository root into `sys.path` before importing `nzfc_gram_runtime`.
433
+
434
+ Run from the repository root:
435
+
436
+ ```bash
437
+ python validation/run_runtime_only_smoke.py
438
+ ```
439
+
440
+ ### `Cannot find runtime/`
441
+
442
+ This repo now includes the repo-root `runtime/` assets required by `NZFCGramLongMemoryChat`.
443
+
444
+ Confirm:
445
+
446
+ ```bash
447
+ ls runtime
448
+ ls meta
449
+ ls memory_tensors
450
+ ```
451
+
452
+ ### Base model load fails
453
+
454
+ `google/diffusiongemma-26B-A4B-it` is hardware-dependent. Runtime-only validation does not load the base model.
455
+
456
+ ---
457
+
458
+ ## What this is not
459
+
460
+ - Not native infinite context.
461
+ - Not internal infinite model memory.
462
+ - Not a claim that DiffusionGemma itself has unlimited context.
463
+ - Not a zero-hallucination guarantee.
464
+ - Not legal advice.
465
+ - Not a production security certification.
466
+ - Not affiliated with Google.
467
+ - Not a redistribution of Google model weights.
468
+
469
+ ---
470
+
471
+ ## Roadmap
472
+
473
+ Recommended next steps:
474
+
475
+ 1. Run optional DiffusionGemma 26B model-load validation on suitable hardware.
476
+ 2. Add multimodal document input examples.
477
+ 3. Add long-context stress tests using the native model context.
478
+ 4. Add latency and VRAM tables for target hardware.
479
+ 5. Add Docker or one-click notebook setup.
480
+ 6. Add REST API / CLI serving layer.
481
+
482
+ ---
483
+
484
+ ## License and terms
485
+
486
+ NZFC-GRAM runtime surface: CC BY-NC 4.0 unless otherwise specified.
487
+
488
+ Base model: see the official `google/diffusiongemma-26B-A4B-it` model card and its license/terms.
489
+
490
+ ---
491
+
492
+ ## Short public description
493
 
494
  ```text
495
+ DiffusionGemma-26B-A4B-it-Infinite-Context is an NZFC-GRAM runtime overlay for external evidence context around Google's DiffusionGemma 26B A4B-IT. It includes runtime assets, scoped memory, exact-slot recall, tombstone filtering, large-document retrieval, validation scripts, and runtime-only validation evidence. The title is marketing-facing; the technical mechanism is external evidence context, not native unlimited model context.
496
  ```
docs/README_DETAILED_v1_2_5b.md ADDED
@@ -0,0 +1,496 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ base_model: google/diffusiongemma-26B-A4B-it
4
+ library_name: transformers
5
+ pipeline_tag: image-text-to-text
6
+ tags:
7
+ - diffusiongemma
8
+ - gemma-4
9
+ - infinite-context
10
+ - external-memory
11
+ - evidence-retrieval
12
+ - long-context
13
+ - large-documents
14
+ - legal-documents
15
+ - ai-memory
16
+ - nzfc-gram
17
+ - runtime-overlay
18
+ - not-native-infinite-context
19
+ ---
20
+
21
+ # DiffusionGemma-26B-A4B-it-Infinite-Context
22
+
23
+ **NZFC-GRAM runtime overlay for external evidence context around `google/diffusiongemma-26B-A4B-it`.**
24
+
25
+ > **Marketing title:** Infinite-Context
26
+ > **Technical boundary:** external evidence context, not native unlimited model context.
27
+
28
+ This repository is a runtime and evidence-governance overlay. It does **not** include or redistribute Google model weights.
29
+
30
+ The goal is to combine DiffusionGemma's large native working context with NZFC-GRAM's external memory, large-document indexing, scoped retrieval, tombstone filtering, malicious-memory redaction, exact-slot recall, and bounded evidence packs.
31
+
32
+ ---
33
+
34
+ ## TL;DR
35
+
36
+ ```text
37
+ DiffusionGemma native context
38
+ + NZFC-GRAM external evidence memory
39
+ + large-document indexing
40
+ + scoped retrieval
41
+ + tombstone guard
42
+ + bounded evidence packs
43
+ =
44
+ Infinite-Context as an external evidence runtime, not native unlimited context
45
+ ```
46
+
47
+ Runtime-only validation is already passing from a fresh Hugging Face download.
48
+
49
+ ```json
50
+ {
51
+ "runtime_only": true,
52
+ "model_loaded": false,
53
+ "repo_root_runtime_exists": true,
54
+ "repo_root_meta_exists": true,
55
+ "repo_root_memory_tensors_exists": true,
56
+ "exact_slot_passed": true,
57
+ "large_document_passed": true,
58
+ "large_document_query_count": 2,
59
+ "tombstone_guard_passed": true,
60
+ "technical_boundary": "external evidence context, not native unlimited model context"
61
+ }
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Base model
67
+
68
+ Base model:
69
+
70
+ ```text
71
+ google/diffusiongemma-26B-A4B-it
72
+ ```
73
+
74
+ DiffusionGemma 26B A4B-IT is the external base model used by this overlay. According to the base model card, DiffusionGemma supports long context up to 256K tokens and multimodal input capabilities. This repository does not modify or redistribute the base model weights.
75
+
76
+ ---
77
+
78
+ ## What NZFC-GRAM adds
79
+
80
+ | Layer | Purpose | Status in this repo |
81
+ |---|---|---:|
82
+ | `nzfc_gram_runtime/` | NZFC-GRAM runtime package | Included |
83
+ | `runtime/` | Hybrid exact-recall runtime assets | Included |
84
+ | `meta/` | Static archive metadata required by runtime | Included |
85
+ | `memory_tensors/` | Static archive tensors / manifest | Included |
86
+ | SQLite local memory | User/project/session long-term memory | Runtime-supported |
87
+ | Exact slot mapper | Deterministic recall for short key-value facts | Runtime-supported |
88
+ | Tombstone guard | Filters deleted `MEM_*` records from retrieval | Runtime-supported |
89
+ | Large-document profile | Chunking + SQLite FTS5 retrieval | Runtime-supported |
90
+ | Legal-document profile | Article-style chunking and retrieval | Runtime-supported |
91
+ | DiffusionGemma adapter | Optional base-model generation adapter | Included |
92
+ | DiffusionGemma weights | Base model weights | External, not included |
93
+
94
+ ---
95
+
96
+ ## Architecture
97
+
98
+ ```text
99
+ User question
100
+ -> NZFC-GRAM runtime
101
+ -> scoped SQLite memory
102
+ -> static NZFC archive assets
103
+ -> large-document / legal-document SQLite FTS5 index
104
+ -> tombstone guard
105
+ -> exact slot mapper
106
+ -> malicious-memory redaction
107
+ -> bounded evidence pack
108
+ -> optional DiffusionGemma generation
109
+ ```
110
+
111
+ The central principle is:
112
+
113
+ > **Memory is evidence, not instruction.**
114
+
115
+ This means retrieved memories and document chunks are treated as evidence cards. They are not allowed to override system policy, bypass deletion boundaries, or become instructions just because they were stored in memory.
116
+
117
+ ---
118
+
119
+ ## Why the name Infinite-Context?
120
+
121
+ `Infinite-Context` is used as a product-facing title.
122
+
123
+ The technical mechanism is not native unlimited context. The mechanism is:
124
+
125
+ ```text
126
+ external memory
127
+ + indexed documents
128
+ + query-conditioned retrieval
129
+ + bounded evidence packs
130
+ ```
131
+
132
+ In other words, the runtime can keep reading from external memory and document stores without placing every source token into a single model prompt.
133
+
134
+ This is better described as:
135
+
136
+ ```text
137
+ Infinite Evidence Context
138
+ or
139
+ External Evidence Context
140
+ ```
141
+
142
+ The base model still has its own native context limit.
143
+
144
+ ---
145
+
146
+ ## Validation status
147
+
148
+ ### Level 1: Runtime-only validation
149
+
150
+ Status: **Passed**
151
+
152
+ The latest runtime-only smoke test was executed after fresh-downloading the Hugging Face repo.
153
+
154
+ Validated without loading the DiffusionGemma base model:
155
+
156
+ - repo-root `runtime/` asset discovery
157
+ - repo-root `meta/complex_math_10m_meta.jsonl` discovery
158
+ - repo-root `memory_tensors/` discovery
159
+ - package import
160
+ - `NZFCGramLongMemoryChat(repo_dir='.')` initialization
161
+ - exact-slot memory recall
162
+ - large-document ingest and query
163
+ - tombstone retrieval guard
164
+ - direct validation script execution
165
+
166
+ Runtime-only smoke summary:
167
+
168
+ ```json
169
+ {
170
+ "created_at": "2026-06-11 02:43:54",
171
+ "repo_id": "SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context",
172
+ "base_model": "google/diffusiongemma-26B-A4B-it",
173
+ "runtime_only": true,
174
+ "model_loaded": false,
175
+ "repo_root_runtime_exists": true,
176
+ "repo_root_meta_exists": true,
177
+ "repo_root_memory_tensors_exists": true,
178
+ "exact_slot_answer": "PROJECT_CODE_DIFFUSIONGEMMA_SMOKE",
179
+ "exact_slot_passed": true,
180
+ "exact_slot_profile": {
181
+ "version": "v1.2.4b",
182
+ "description": "Strict deterministic exact slot mapper for short explicit scoped key-value recall questions.",
183
+ "auto_short_circuit": true,
184
+ "strict_trigger_gate": true
185
+ },
186
+ "large_document_chunk_count": 3,
187
+ "large_document_query_count": 2,
188
+ "large_document_method": "fts5_bm25",
189
+ "large_document_passed": true,
190
+ "tombstone_guard_profile": {
191
+ "version": "v1.2.4c",
192
+ "description": "Filters inactive or tombstoned MEM_* records from memory_store.retrieve results.",
193
+ "db_path": "/kaggle/working/diffusiongemma_infinite_context_evidence_pack_update/runtime_only_smoke_final/memory.sqlite3",
194
+ "guarded_method": "memory_store.retrieve"
195
+ },
196
+ "tombstone_test": {
197
+ "available": true,
198
+ "before_found": true,
199
+ "after_found": false,
200
+ "passed": true,
201
+ "tombstoned": 1
202
+ },
203
+ "technical_boundary": "external evidence context, not native unlimited model context",
204
+ "status": "passed"
205
+ }
206
+ ```
207
+
208
+ ### Level 2: Optional DiffusionGemma model-load validation
209
+
210
+ Status: **Hardware-dependent / not run in the runtime-only validation.**
211
+
212
+ Run this only on suitable hardware:
213
+
214
+ ```bash
215
+ LOAD_MODEL=1 python examples/optional_diffusiongemma_model_load_check.py
216
+ ```
217
+
218
+ This optional check should validate:
219
+
220
+ - `AutoProcessor` load
221
+ - DiffusionGemma model load
222
+ - minimal generation call
223
+ - NZFC-GRAM evidence pack generation path
224
+
225
+ ### Level 3: Full serving validation
226
+
227
+ Recommended future validation:
228
+
229
+ - high-frequency multi-context memory test
230
+ - large-document / legal-document evidence test
231
+ - multimodal document input test
232
+ - 256K native context stress test
233
+ - latency and VRAM measurements on target hardware
234
+
235
+ ---
236
+
237
+ ## Quick start
238
+
239
+ Clone and install:
240
+
241
+ ```bash
242
+ git lfs install
243
+ git clone https://huggingface.co/SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context
244
+ cd DiffusionGemma-26B-A4B-it-Infinite-Context
245
+ pip install -r requirements.txt
246
+ ```
247
+
248
+ Run runtime-only validation:
249
+
250
+ ```bash
251
+ python validation/run_runtime_only_smoke.py
252
+ ```
253
+
254
+ Expected result:
255
+
256
+ ```text
257
+ [PASS] runtime-only smoke passed
258
+ ```
259
+
260
+ ---
261
+
262
+ ## Examples
263
+
264
+ ### Exact-slot memory recall without loading the base model
265
+
266
+ ```bash
267
+ python examples/high_frequency_multi_context_runtime_only.py
268
+ ```
269
+
270
+ This validates deterministic retrieval of scoped key-value memory facts.
271
+
272
+ Example stored memory:
273
+
274
+ ```text
275
+ The project high-frequency test code is PROJECT_CODE_RUNTIME_ONLY.
276
+ ```
277
+
278
+ Example question:
279
+
280
+ ```text
281
+ What was the project high-frequency test code? Answer only with the code.
282
+ ```
283
+
284
+ Expected answer:
285
+
286
+ ```text
287
+ PROJECT_CODE_RUNTIME_ONLY
288
+ ```
289
+
290
+ ### Large-document retrieval without loading the base model
291
+
292
+ ```bash
293
+ python examples/large_document_runtime_only.py
294
+ ```
295
+
296
+ This validates chunking, SQLite FTS5 indexing, and query-time document evidence retrieval.
297
+
298
+ ### Optional DiffusionGemma model load
299
+
300
+ ```bash
301
+ LOAD_MODEL=1 python examples/optional_diffusiongemma_model_load_check.py
302
+ ```
303
+
304
+ This requires hardware capable of loading `google/diffusiongemma-26B-A4B-it`.
305
+
306
+ ---
307
+
308
+ ## Python usage
309
+
310
+ ### Runtime-only memory and document evidence
311
+
312
+ ```python
313
+ from nzfc_gram_runtime import NZFCGramLongMemoryChat
314
+ from nzfc_gram_runtime.quality import attach_answer_quality_governor
315
+ from nzfc_gram_runtime.large_document import attach_large_document_memory
316
+
317
+ bot = NZFCGramLongMemoryChat(
318
+ repo_dir='.',
319
+ model_id='google/diffusiongemma-26B-A4B-it',
320
+ memory_db_path='./memory.sqlite3',
321
+ load_model=False,
322
+ require_model=False,
323
+ preload_static_memory=False,
324
+ )
325
+
326
+ attach_large_document_memory(bot)
327
+ attach_answer_quality_governor(bot)
328
+
329
+ bot.remember(
330
+ 'The project high-frequency test code is PROJECT_CODE_DEMO.',
331
+ user_id='demo_user',
332
+ project_id='demo_project',
333
+ session_id='demo_session',
334
+ scope='project',
335
+ tags=['project_code'],
336
+ trust_level=0.95,
337
+ )
338
+
339
+ res = bot.quality_chat(
340
+ 'What was the project high-frequency test code? Answer only with the code.',
341
+ user_id='demo_user',
342
+ project_id='demo_project',
343
+ session_id='new_session',
344
+ )
345
+
346
+ print(res['answer'])
347
+ ```
348
+
349
+ ### Optional DiffusionGemma adapter
350
+
351
+ ```python
352
+ from nzfc_gram_runtime.diffusiongemma_adapter import attach_diffusiongemma_block_diffusion
353
+
354
+ attach_diffusiongemma_block_diffusion(
355
+ bot,
356
+ model_id='google/diffusiongemma-26B-A4B-it',
357
+ device_map='auto',
358
+ dtype='auto',
359
+ )
360
+ ```
361
+
362
+ ---
363
+
364
+ ## Safety and governance features
365
+
366
+ ### Scope isolation
367
+
368
+ Memory records can be scoped by:
369
+
370
+ - user
371
+ - project
372
+ - session
373
+
374
+ The goal is to prevent cross-user, cross-project, or cross-session memory leakage.
375
+
376
+ ### Tombstone filtering
377
+
378
+ Deleted memories should not be active evidence.
379
+
380
+ The runtime includes tombstone filtering so deleted `MEM_*` records are filtered at the retrieval layer when the guard is available.
381
+
382
+ ### Malicious-memory redaction
383
+
384
+ Stored memory is treated as untrusted data. Prompt-injection-like memory should be redacted before generation.
385
+
386
+ ### Exact slot mapper
387
+
388
+ Short exact-recall questions can be answered deterministically from scoped evidence.
389
+
390
+ Example:
391
+
392
+ ```text
393
+ What was the project high-frequency test code? Answer only with the code.
394
+ ```
395
+
396
+ The exact-slot mapper is intentionally strict. Broad explanatory prompts should continue through the normal evidence and generation pipeline.
397
+
398
+ ### Large-document evidence
399
+
400
+ Large documents should not be inserted directly into the prompt.
401
+
402
+ Recommended path:
403
+
404
+ ```text
405
+ ingest -> chunk -> SQLite FTS5 index -> retrieve evidence -> bounded answer
406
+ ```
407
+
408
+ ---
409
+
410
+ ## Repository structure
411
+
412
+ ```text
413
+ nzfc_gram_runtime/ Python runtime package
414
+ runtime/ Hybrid exact-recall runtime assets
415
+ meta/ Static archive metadata
416
+ memory_tensors/ Static archive tensor manifests and assets
417
+ archive/ Optional static archive assets when available
418
+ configs/ Optional runtime configs when available
419
+ docs/ Architecture and technical boundary notes
420
+ examples/ Runtime-only and optional model-load examples
421
+ validation/ Validation scripts
422
+ validation_evidence/ Saved validation evidence
423
+ release_notes/ Release notes
424
+ ```
425
+
426
+ ---
427
+
428
+ ## Troubleshooting
429
+
430
+ ### `ModuleNotFoundError: No module named 'nzfc_gram_runtime'`
431
+
432
+ Use the latest scripts in this repo. Validation and example scripts insert the repository root into `sys.path` before importing `nzfc_gram_runtime`.
433
+
434
+ Run from the repository root:
435
+
436
+ ```bash
437
+ python validation/run_runtime_only_smoke.py
438
+ ```
439
+
440
+ ### `Cannot find runtime/`
441
+
442
+ This repo now includes the repo-root `runtime/` assets required by `NZFCGramLongMemoryChat`.
443
+
444
+ Confirm:
445
+
446
+ ```bash
447
+ ls runtime
448
+ ls meta
449
+ ls memory_tensors
450
+ ```
451
+
452
+ ### Base model load fails
453
+
454
+ `google/diffusiongemma-26B-A4B-it` is hardware-dependent. Runtime-only validation does not load the base model.
455
+
456
+ ---
457
+
458
+ ## What this is not
459
+
460
+ - Not native infinite context.
461
+ - Not internal infinite model memory.
462
+ - Not a claim that DiffusionGemma itself has unlimited context.
463
+ - Not a zero-hallucination guarantee.
464
+ - Not legal advice.
465
+ - Not a production security certification.
466
+ - Not affiliated with Google.
467
+ - Not a redistribution of Google model weights.
468
+
469
+ ---
470
+
471
+ ## Roadmap
472
+
473
+ Recommended next steps:
474
+
475
+ 1. Run optional DiffusionGemma 26B model-load validation on suitable hardware.
476
+ 2. Add multimodal document input examples.
477
+ 3. Add long-context stress tests using the native model context.
478
+ 4. Add latency and VRAM tables for target hardware.
479
+ 5. Add Docker or one-click notebook setup.
480
+ 6. Add REST API / CLI serving layer.
481
+
482
+ ---
483
+
484
+ ## License and terms
485
+
486
+ NZFC-GRAM runtime surface: CC BY-NC 4.0 unless otherwise specified.
487
+
488
+ Base model: see the official `google/diffusiongemma-26B-A4B-it` model card and its license/terms.
489
+
490
+ ---
491
+
492
+ ## Short public description
493
+
494
+ ```text
495
+ DiffusionGemma-26B-A4B-it-Infinite-Context is an NZFC-GRAM runtime overlay for external evidence context around Google's DiffusionGemma 26B A4B-IT. It includes runtime assets, scoped memory, exact-slot recall, tombstone filtering, large-document retrieval, validation scripts, and runtime-only validation evidence. The title is marketing-facing; the technical mechanism is external evidence context, not native unlimited model context.
496
+ ```
validation_evidence/diffusiongemma_infinite_context_preview/detailed_readme_update_summary.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "v1.2.5b-readme-detailed",
3
+ "repo_id": "SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context",
4
+ "base_model": "google/diffusiongemma-26B-A4B-it",
5
+ "update_type": "detailed_readme_update",
6
+ "purpose": "Make the model card more detailed, credible, and technically bounded.",
7
+ "technical_boundary": "external evidence context, not native unlimited model context",
8
+ "runtime_only_validation_summary_used": {
9
+ "runtime_only": true,
10
+ "model_loaded": false,
11
+ "repo_root_runtime_exists": true,
12
+ "repo_root_meta_exists": true,
13
+ "repo_root_memory_tensors_exists": true,
14
+ "exact_slot_passed": true,
15
+ "large_document_passed": true,
16
+ "large_document_query_count": 2,
17
+ "tombstone_guard_passed": true,
18
+ "technical_boundary": "external evidence context, not native unlimited model context"
19
+ },
20
+ "readme_sections": [
21
+ "TL;DR",
22
+ "Base model",
23
+ "What NZFC-GRAM adds",
24
+ "Architecture",
25
+ "Why Infinite-Context",
26
+ "Validation status",
27
+ "Quick start",
28
+ "Examples",
29
+ "Python usage",
30
+ "Safety and governance features",
31
+ "Repository structure",
32
+ "Troubleshooting",
33
+ "What this is not",
34
+ "Roadmap",
35
+ "License and terms"
36
+ ],
37
+ "created_at": "2026-06-11 04:16:45"
38
+ }