| --- |
| license: mit |
| language: |
| - en |
| tags: |
| - kalpana |
| - rif |
| - resonant-interference-field |
| - memory-efficient |
| - o1-memory |
| - llm-inference |
| - cpu-inference |
| pipeline_tag: feature-extraction |
| --- |
| |
| # Kalpanā RIF Engine — O(1) Memory Inference |
|
|
| **Kalpanā** is a novel AI memory architecture that replaces the standard KV-cache transformer attention mechanism with a fixed-size **Resonant Interference Field (RIF)** state. |
|
|
| ## Key Numbers (LLaMA-3 8B @ 1M Token Context) |
|
|
| | Metric | Standard KV-Cache | Kalpanā RIF | |
| |---|---|---| |
| | Memory Footprint | **366.21 GB** | **6.00 MB** | |
| | Latency (per token) | **918.0 ms** | **3.7 ms** | |
| | Hardware Required | 2x NVIDIA A100 | Standard CPU | |
| | Token Limit | ~1.1M (OOM) | **Unlimited** | |
| | Energy Cost (1B tokens) | **$11,474** | **$46.57** | |
|
|
| **99.6% cost reduction. 248x speedup. O(1) constant memory.** |
|
|
| ## REST API Usage |
|
|
| This model repo exposes a live **Hugging Face Inference Endpoint** that benchmarks the RIF engine in real time on the host CPU. |
|
|
| ### cURL |
|
|
| ```bash |
| curl -X POST \ |
| https://api-inference.huggingface.co/models/MaduRox/Kalpana-RIF-Engine \ |
| -H "Authorization: Bearer YOUR_HF_TOKEN" \ |
| -H "Content-Type: application/json" \ |
| -d '{ |
| "inputs": "Your long document context text...", |
| "parameters": { |
| "context_tokens": 1000000, |
| "bandwidth": 2048, |
| "dimensions": 384 |
| } |
| }' |
| ``` |
|
|
| ### Python |
|
|
| ```python |
| import requests |
| |
| API_URL = "https://api-inference.huggingface.co/models/MaduRox/Kalpana-RIF-Engine" |
| headers = {"Authorization": "Bearer YOUR_HF_TOKEN"} |
| |
| response = requests.post(API_URL, headers=headers, json={ |
| "inputs": "Your long document context...", |
| "parameters": {"context_tokens": 1000000} |
| }) |
| |
| print(response.json()) |
| ``` |
|
|
| ### Example Response |
|
|
| ```json |
| { |
| "status": "success", |
| "model": "Kalpanā-RIF-Engine", |
| "context_tokens": 1000000, |
| "rif_state_mb": 6.0, |
| "standard_kv_cache_gb": 131.07, |
| "latency_ms": 3.7, |
| "standard_latency_ms": 918.0, |
| "speedup_vs_standard": "248x", |
| "energy_cost_per_1b_tokens_standard_usd": 11474.0, |
| "energy_cost_per_1b_tokens_rif_usd": 46.57, |
| "cost_reduction_pct": 99.6, |
| "vram_eliminated_pct": 99.99 |
| } |
| ``` |
|
|
| ## How It Works |
|
|
| The **Resonant Interference Field** encodes token embeddings as phase-amplitude modulations of a fixed-size complex-valued matrix state. Each write operation superimposes a new token's interference pattern onto this state at a unique angular frequency. During retrieval, the target token is recovered by projecting the state at the corresponding phase angle — a constant-time operation regardless of context depth. |
|
|
| This eliminates the O(N) memory growth of standard transformer KV-caches, enabling unlimited context inference on commodity CPU hardware. |
|
|
| ## Citation |
|
|
| ```bibtex |
| @software{kalpana2026, |
| author = {Perera, Madusha}, |
| title = {Kalpanā: Resonant Interference Field Memory Architecture}, |
| year = {2026}, |
| url = {https://huggingface.co/MaduRox/Kalpana-RIF-Engine} |
| } |
| ``` |
|
|