DDarkoza Knowledge Lab
OPEN SCIENCE · RESEARCH PROTOTYPE · 2026-10-29

Effective Context Capacity for OERSI

Persistent external memory, source-linked retrieval, and bounded evidence packs for tasks whose history exceeds a single model context window.

Claim boundary: this work does not remove a model's physical or provider context limit and does not claim a new scientific discovery. It tests an external-memory retrieval mechanism on synthetic data only.

Measured synthetic result

1,000synthetic records indexed
200 / 200target facts retrieved in top 5
3.0%recency-only baseline hits
173 / 256maximum estimated context pack

The 200 benchmark questions contained each target record's unique identifier. The candidate retrieved the target fact in top 5 and included it in the bounded evidence pack in all 200 trials. A recency-only baseline retaining the final 24 records contained 6 sampled targets (3.0%). Two executions reproduced the same deterministic hit counts and integrity results. This evaluates retrieval mechanics, not semantic understanding or model answer quality.

MeasureObserved resultLimit
Median lexical search23.43–23.93 msTwo runs; one server, synthetic corpus
P95 lexical search25.35–34.53 msNot a production latency SLO
Automated unit tests8 / 8 passedPrototype contract checks only
Integrity audit2,000 hashes checked; 0 mismatchesSHA-256 is not access control

Architecture

  1. Persistent archive: stores original UTF-8 text with source labels, document hashes and ingestion metadata.
  2. Overlapping chunks: maintains retrieval-sized slices while preserving the original source text.
  3. Lexical retrieval: uses BM25-style scoring plus a small explicit-priority factor; no external model or embeddings.
  4. Context compiler: selects whole excerpts under an estimated prompt budget, links each excerpt to document/chunk hashes, and reports omitted candidates rather than silently clipping them.
  5. Safety and audit: labels retrieved material as untrusted evidence, abstains on empty searches, and verifies stored hashes.

Token-budget caveat: this prototype estimates tokens as ceil(UTF-8 bytes divided by four). That is a heuristic, not a model tokenizer. A real adapter must use the exact tokenizer and reserve space for system prompts, tools and generated output.

Reproduce it

Python 3.10+, standard library only. No network calls, model inference or private user data are used by the benchmark.

python3 -m py_compile context_memory.py benchmark.py test_context_memory.py
python3 -m unittest -v test_context_memory.py
python3 benchmark.py

Limitations and next gate

The fixture uses query-visible identifiers, so the observed 100% hit rate is not a real-world memory score. The benchmark does not evaluate paraphrase, LLM-generated answers, long-term reasoning, model-specific tokenizers, production load, multi-tenant isolation or adversarial source content. The candidate is not connected to the public OERSI inference route.

The next gate is a held-out long-memory QA test on appropriately licensed public datasets, comparing recency truncation, lexical retrieval, hybrid retrieval and verified hierarchical memory at the same model and token budget. Proposed production criteria: at least a 10-percentage-point answer-accuracy gain, no material increase in unsupported claims, source-grounded citations, enforced tenant isolation and zero unauthorized consequential actions.

Scientific grounding: Titans (NeurIPS 2025), InftyThink (ICLR 2026), MemGPT, FlashMemory-DeepSeek-V4, and Stanford HAI AI Index 2026.

خلاصهٔ فارسی

ظرفیت مؤثر زمینه برای OERSI

سقف سخت توکنِ هر فراخوانی مدل حذف نشده است. این نمونه، تاریخچهٔ بزرگ را در SQLite نگه می‌دارد و برای هر سؤال فقط قطعات مرتبط، دارای منشأ و هش را داخل یک بستهٔ زمینه‌ای محدود قرار می‌دهد. در آزمایش مصنوعی، از ۱۰۰۰ رکورد و ۲۰۰ پرس‌وجو استفاده شد؛ بازیابیِ مورد هدف و حضور آن در بستهٔ زمینه در هر ۲۰۰ آزمون موفق بود، درحالی‌که سیاست سادهٔ نگه‌داشتن ۲۴ رکورد آخر فقط ۶ مورد را پوشش داد. چون شناسهٔ رکورد در پرس‌وجو وجود داشت، این نتیجه تنها سازوکار بازیابی را می‌سنجد و اثبات توانایی استدلال یا حافظهٔ عمومی نیست.

هشت آزمون نرم‌افزاری موفق شدند و ۲۰۰۰ هش سند/قطعه بدون مغایرت بررسی شد. برآورد توکن فعلی تقریبی است؛ اتصال به مدل زنده، سنجش با توکنایزر دقیق، آزمون مجموعه‌داده‌های واقعی، کنترل حریم خصوصی چندکاربره و اعتبارسنجی پاسخ هنوز انجام نشده‌اند.