Image-Text-to-Text
Transformers
diffusiongemma
gemma-4
infinite-context
external-memory
evidence-retrieval
long-context
large-documents
legal-documents
ai-memory
nzfc-gram
runtime-overlay
not-native-infinite-context
Instructions to use SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context
- SGLang
How to use SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context with Docker Model Runner:
docker model run hf.co/SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context
File size: 13,366 Bytes
ddeda47 | 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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | ---
license: cc-by-nc-4.0
base_model: google/diffusiongemma-26B-A4B-it
library_name: transformers
pipeline_tag: image-text-to-text
tags:
- diffusiongemma
- gemma-4
- infinite-context
- external-memory
- evidence-retrieval
- long-context
- large-documents
- legal-documents
- ai-memory
- nzfc-gram
- runtime-overlay
- not-native-infinite-context
---
# DiffusionGemma-26B-A4B-it-Infinite-Context
**NZFC-GRAM runtime overlay for external evidence context around `google/diffusiongemma-26B-A4B-it`.**
> **Marketing title:** Infinite-Context
> **Technical boundary:** external evidence context, not native unlimited model context.
This repository is a runtime and evidence-governance overlay. It does **not** include or redistribute Google model weights.
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.
---
## TL;DR
```text
DiffusionGemma native context
+ NZFC-GRAM external evidence memory
+ large-document indexing
+ scoped retrieval
+ tombstone guard
+ bounded evidence packs
=
Infinite-Context as an external evidence runtime, not native unlimited context
```
Runtime-only validation is already passing from a fresh Hugging Face download.
```json
{
"runtime_only": true,
"model_loaded": false,
"repo_root_runtime_exists": true,
"repo_root_meta_exists": true,
"repo_root_memory_tensors_exists": true,
"exact_slot_passed": true,
"large_document_passed": true,
"large_document_query_count": 2,
"tombstone_guard_passed": true,
"technical_boundary": "external evidence context, not native unlimited model context"
}
```
---
## Base model
Base model:
```text
google/diffusiongemma-26B-A4B-it
```
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.
---
## What NZFC-GRAM adds
| Layer | Purpose | Status in this repo |
|---|---|---:|
| `nzfc_gram_runtime/` | NZFC-GRAM runtime package | Included |
| `runtime/` | Hybrid exact-recall runtime assets | Included |
| `meta/` | Static archive metadata required by runtime | Included |
| `memory_tensors/` | Static archive tensors / manifest | Included |
| SQLite local memory | User/project/session long-term memory | Runtime-supported |
| Exact slot mapper | Deterministic recall for short key-value facts | Runtime-supported |
| Tombstone guard | Filters deleted `MEM_*` records from retrieval | Runtime-supported |
| Large-document profile | Chunking + SQLite FTS5 retrieval | Runtime-supported |
| Legal-document profile | Article-style chunking and retrieval | Runtime-supported |
| DiffusionGemma adapter | Optional base-model generation adapter | Included |
| DiffusionGemma weights | Base model weights | External, not included |
---
## Architecture
```text
User question
-> NZFC-GRAM runtime
-> scoped SQLite memory
-> static NZFC archive assets
-> large-document / legal-document SQLite FTS5 index
-> tombstone guard
-> exact slot mapper
-> malicious-memory redaction
-> bounded evidence pack
-> optional DiffusionGemma generation
```
The central principle is:
> **Memory is evidence, not instruction.**
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.
---
## Why the name Infinite-Context?
`Infinite-Context` is used as a product-facing title.
The technical mechanism is not native unlimited context. The mechanism is:
```text
external memory
+ indexed documents
+ query-conditioned retrieval
+ bounded evidence packs
```
In other words, the runtime can keep reading from external memory and document stores without placing every source token into a single model prompt.
This is better described as:
```text
Infinite Evidence Context
or
External Evidence Context
```
The base model still has its own native context limit.
---
## Validation status
### Level 1: Runtime-only validation
Status: **Passed**
The latest runtime-only smoke test was executed after fresh-downloading the Hugging Face repo.
Validated without loading the DiffusionGemma base model:
- repo-root `runtime/` asset discovery
- repo-root `meta/complex_math_10m_meta.jsonl` discovery
- repo-root `memory_tensors/` discovery
- package import
- `NZFCGramLongMemoryChat(repo_dir='.')` initialization
- exact-slot memory recall
- large-document ingest and query
- tombstone retrieval guard
- direct validation script execution
Runtime-only smoke summary:
```json
{
"created_at": "2026-06-11 02:43:54",
"repo_id": "SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context",
"base_model": "google/diffusiongemma-26B-A4B-it",
"runtime_only": true,
"model_loaded": false,
"repo_root_runtime_exists": true,
"repo_root_meta_exists": true,
"repo_root_memory_tensors_exists": true,
"exact_slot_answer": "PROJECT_CODE_DIFFUSIONGEMMA_SMOKE",
"exact_slot_passed": true,
"exact_slot_profile": {
"version": "v1.2.4b",
"description": "Strict deterministic exact slot mapper for short explicit scoped key-value recall questions.",
"auto_short_circuit": true,
"strict_trigger_gate": true
},
"large_document_chunk_count": 3,
"large_document_query_count": 2,
"large_document_method": "fts5_bm25",
"large_document_passed": true,
"tombstone_guard_profile": {
"version": "v1.2.4c",
"description": "Filters inactive or tombstoned MEM_* records from memory_store.retrieve results.",
"db_path": "/kaggle/working/diffusiongemma_infinite_context_evidence_pack_update/runtime_only_smoke_final/memory.sqlite3",
"guarded_method": "memory_store.retrieve"
},
"tombstone_test": {
"available": true,
"before_found": true,
"after_found": false,
"passed": true,
"tombstoned": 1
},
"technical_boundary": "external evidence context, not native unlimited model context",
"status": "passed"
}
```
### Level 2: Optional DiffusionGemma model-load validation
Status: **Hardware-dependent / not run in the runtime-only validation.**
Run this only on suitable hardware:
```bash
LOAD_MODEL=1 python examples/optional_diffusiongemma_model_load_check.py
```
This optional check should validate:
- `AutoProcessor` load
- DiffusionGemma model load
- minimal generation call
- NZFC-GRAM evidence pack generation path
### Level 3: Full serving validation
Recommended future validation:
- high-frequency multi-context memory test
- large-document / legal-document evidence test
- multimodal document input test
- 256K native context stress test
- latency and VRAM measurements on target hardware
---
## Quick start
Clone and install:
```bash
git lfs install
git clone https://huggingface.co/SingularityPrinciple/DiffusionGemma-26B-A4B-it-Infinite-Context
cd DiffusionGemma-26B-A4B-it-Infinite-Context
pip install -r requirements.txt
```
Run runtime-only validation:
```bash
python validation/run_runtime_only_smoke.py
```
Expected result:
```text
[PASS] runtime-only smoke passed
```
---
## Examples
### Exact-slot memory recall without loading the base model
```bash
python examples/high_frequency_multi_context_runtime_only.py
```
This validates deterministic retrieval of scoped key-value memory facts.
Example stored memory:
```text
The project high-frequency test code is PROJECT_CODE_RUNTIME_ONLY.
```
Example question:
```text
What was the project high-frequency test code? Answer only with the code.
```
Expected answer:
```text
PROJECT_CODE_RUNTIME_ONLY
```
### Large-document retrieval without loading the base model
```bash
python examples/large_document_runtime_only.py
```
This validates chunking, SQLite FTS5 indexing, and query-time document evidence retrieval.
### Optional DiffusionGemma model load
```bash
LOAD_MODEL=1 python examples/optional_diffusiongemma_model_load_check.py
```
This requires hardware capable of loading `google/diffusiongemma-26B-A4B-it`.
---
## Python usage
### Runtime-only memory and document evidence
```python
from nzfc_gram_runtime import NZFCGramLongMemoryChat
from nzfc_gram_runtime.quality import attach_answer_quality_governor
from nzfc_gram_runtime.large_document import attach_large_document_memory
bot = NZFCGramLongMemoryChat(
repo_dir='.',
model_id='google/diffusiongemma-26B-A4B-it',
memory_db_path='./memory.sqlite3',
load_model=False,
require_model=False,
preload_static_memory=False,
)
attach_large_document_memory(bot)
attach_answer_quality_governor(bot)
bot.remember(
'The project high-frequency test code is PROJECT_CODE_DEMO.',
user_id='demo_user',
project_id='demo_project',
session_id='demo_session',
scope='project',
tags=['project_code'],
trust_level=0.95,
)
res = bot.quality_chat(
'What was the project high-frequency test code? Answer only with the code.',
user_id='demo_user',
project_id='demo_project',
session_id='new_session',
)
print(res['answer'])
```
### Optional DiffusionGemma adapter
```python
from nzfc_gram_runtime.diffusiongemma_adapter import attach_diffusiongemma_block_diffusion
attach_diffusiongemma_block_diffusion(
bot,
model_id='google/diffusiongemma-26B-A4B-it',
device_map='auto',
dtype='auto',
)
```
---
## Safety and governance features
### Scope isolation
Memory records can be scoped by:
- user
- project
- session
The goal is to prevent cross-user, cross-project, or cross-session memory leakage.
### Tombstone filtering
Deleted memories should not be active evidence.
The runtime includes tombstone filtering so deleted `MEM_*` records are filtered at the retrieval layer when the guard is available.
### Malicious-memory redaction
Stored memory is treated as untrusted data. Prompt-injection-like memory should be redacted before generation.
### Exact slot mapper
Short exact-recall questions can be answered deterministically from scoped evidence.
Example:
```text
What was the project high-frequency test code? Answer only with the code.
```
The exact-slot mapper is intentionally strict. Broad explanatory prompts should continue through the normal evidence and generation pipeline.
### Large-document evidence
Large documents should not be inserted directly into the prompt.
Recommended path:
```text
ingest -> chunk -> SQLite FTS5 index -> retrieve evidence -> bounded answer
```
---
## Repository structure
```text
nzfc_gram_runtime/ Python runtime package
runtime/ Hybrid exact-recall runtime assets
meta/ Static archive metadata
memory_tensors/ Static archive tensor manifests and assets
archive/ Optional static archive assets when available
configs/ Optional runtime configs when available
docs/ Architecture and technical boundary notes
examples/ Runtime-only and optional model-load examples
validation/ Validation scripts
validation_evidence/ Saved validation evidence
release_notes/ Release notes
```
---
## Troubleshooting
### `ModuleNotFoundError: No module named 'nzfc_gram_runtime'`
Use the latest scripts in this repo. Validation and example scripts insert the repository root into `sys.path` before importing `nzfc_gram_runtime`.
Run from the repository root:
```bash
python validation/run_runtime_only_smoke.py
```
### `Cannot find runtime/`
This repo now includes the repo-root `runtime/` assets required by `NZFCGramLongMemoryChat`.
Confirm:
```bash
ls runtime
ls meta
ls memory_tensors
```
### Base model load fails
`google/diffusiongemma-26B-A4B-it` is hardware-dependent. Runtime-only validation does not load the base model.
---
## What this is not
- Not native infinite context.
- Not internal infinite model memory.
- Not a claim that DiffusionGemma itself has unlimited context.
- Not a zero-hallucination guarantee.
- Not legal advice.
- Not a production security certification.
- Not affiliated with Google.
- Not a redistribution of Google model weights.
---
## Roadmap
Recommended next steps:
1. Run optional DiffusionGemma 26B model-load validation on suitable hardware.
2. Add multimodal document input examples.
3. Add long-context stress tests using the native model context.
4. Add latency and VRAM tables for target hardware.
5. Add Docker or one-click notebook setup.
6. Add REST API / CLI serving layer.
---
## License and terms
NZFC-GRAM runtime surface: CC BY-NC 4.0 unless otherwise specified.
Base model: see the official `google/diffusiongemma-26B-A4B-it` model card and its license/terms.
---
## Short public description
```text
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.
```
|