Expand description
Zero-Copy LoRA Multiplexing — context-driven neural adaptation.
Maintains a single quantized base model in memory and streams tiny LoRA
(Low-Rank Adaptation) adapters based on context triggers encoded in the
NQuin 5th metadata vector. Context switching takes <10 ms; the
extra memory footprint is ≤15 MB per cached adapter.
§Architecture
Prompt / NQuin
│
▼
ContextDetector ──► ContextType (Medical / Legal / Chemical / …)
│
▼
LoRAAdapterManager (LRU-10 cache)
├── adapter_cache: HashMap<ContextType, LoRAAdapter>
│ LoRAAdapter { lora_a: [rank × n_in], lora_b: [n_out × rank] }
│
▼
CPU apply: output += B @ (A @ x) * scaling
GPU apply: lora_apply.wgsl dispatch (additive delta on hidden state)
│
▼
Modified hidden-state fed into fused_transformer.wgsl§NQuin metadata encoding (bits 60–48)
| Bits | Field | Notes |
|---|---|---|
| 63–60 | ContextType | 0=General … 5=Technical |
| 59–56 | AdapterID | 0–15 (4 bits) |
| 55–48 | Confidence | 0–255 → 0.0–1.0 |
Re-exports§
pub use adapter_manager::LoRAAdapter;pub use adapter_manager::LoRAAdapterManager;pub use adapter_manager::LoRAError;pub use adapter_manager::LoRAMetadata;pub use adapter_manager::LoRATensor;pub use context_detector::ContextDetector;pub use context_detector::ContextType;
Modules§
- adapter_
manager - LoRA adapter loading, caching, and application.
- context_
detector - Context detection for LoRA adapter selection.
- webgpu_
lora - GPU-accelerated LoRA delta application via wgpu compute shader.