Bypassing the O(N²) memory bottleneck for massive context LLMs with O(N log N) complexity.
Choose your execution workflow for model-agnostic long-context inference with GPU acceleration:
Pre-configured with built-in theoretical and practical research papers (20k+ tokens). Ideal for instant out-of-the-box benchmarking.
Runtime ā Run all (Ctrl+F9).Upload your own PDFs/TXTs in Colab. Features automatic text sanitization, RAM-safe KV-cache allocation, and persistent 0.3s cache reload.
š) in left panel ā open uploads.uploads.Run all! Auto-builds persistent 0.3s KV-Cache.
Configured for Kaggle Dual-GPU / 30GB CPU RAM. Scans /kaggle/input datasets and /kaggle/working/uploads.
+ Add Input (right panel of Kaggle editor).Upload Dataset ā Drag your PDF/TXT files ā Click Create./kaggle/input.Performance profile breakdown optimized per hardware environment:
| Environment | Base Model | Max Capacity | Attention Density | VRAM / RAM Optimizations | Cache Reload |
|---|---|---|---|---|---|
| 1. RIS-Kernel-Demo | Qwen2.5-3B | 20,000 tokens | 3.0% (15 seeds) | Single GPU bfloat16 | Standard |
| 2. Upload (Colab) | Qwen2.5-3B / 1.5B | 30,000 tokens | 2.0% (4 seeds) | CPU-RAM Safe (12.7GB ceiling) | ~0.3s (.pt) |
| 3. Upload (Kaggle) | Qwen2.5-3B | 40,000 tokens | 2.5% (4 seeds) | High-Capacity (30GB CPU RAM) | ~0.6s (.pt) |
Direct resource requirement comparison for processing a 40,000 token document:
O(N²) (Quadratic VRAM Explosion)O(N log N) (Linear-Logarithmic Scaling)The demo includes the following full-length research documents in the data/ folder:
riskernel_practical.txt (5,034 tokens / 20.4 KB) - Practical benchmarks and implementation metrics.ris_theorical.txt (13,756 tokens / 53.7 KB) - Theoretical foundation and mathematical proof of O(N log N) complexity.from inference_ris_v3 import load_ris_model
# Load model patched with RIS O(N log N) geometry
model, tokenizer, version = load_ris_model(
max_length=20000,
selected_dtype="bfloat16",
model_class="qwen2",
density=0.03,
n_seeds=15,
local_window=1024,
global_window=256,
ris_mode="stochastic"
)