๐ On-The-Fly Weight Synthesizer (OTF-LLM Engine)
High-performance hybrid LLM inference engine featuring custom Fused OpenAI Triton INT4 GEMM kernels, Outlier-Aware weight quantization, Zero-RAM Incremental Quantizer (<150MB RAM), 98.16% Scientific Logit Parity, 3-Tier Hierarchical MoE Offloader [EXPERIMENTAL], Companion Long-Term Memory, and an Interactive Gradio Web UI.
๐ฌ Engineering & Research: GT Labs AI
Developed and maintained by GT Labs AI.
- ๐ GT Labs AI Mission: Ultra-fast MVP engineering, custom AI integration, and deep neural network optimization research.
- ๐จโ๐ป Author & Lead AI Engineer: Gleb Tikhiy (@GlebTikhiy)
- ๐ง Contact & Inquiries: team.gtlabs@gmail.com
- ๐ Organization: GT Labs AI on GitHub
๐ฏ Project Goal & Key Breakthroughs
Overcoming memory-bound bottlenecks and hardware VRAM constraints when executing Large Language Models (LLMs) on consumer GPUs (RTX 3060 / 4060 / 5060 Ti).
Instead of transferring heavy FP16 weights from VRAM, OTF-LLM Engine performs hardware-accelerated dequantization of Outlier-Aware INT4 weights directly inside GPU registers (SRAM) via custom OpenAI Triton GEMM Kernels, streams weights incrementally without RAM allocation (< 150 MB RAM peak), and integrates long-term user memory (companion_memory.py).
๐ฌ Formal Scientific Logit Parity Benchmark (20 Prompts)
Evaluated via tests/test_formal_parity.py comparing Base FP16 vs OTF INT4 Champion Engine across 20 multi-domain prompts:
- ๐ Average Logit Cosine Similarity:
98.1556% - ๐ฏ Top-1 Exact Token Match Rate:
70.0%(14/20 exact token identity) - ๐ Average KL-Divergence:
0.2154
๐ Performance Benchmark (NVIDIA RTX 5060 Ti 16GB)
Benchmarking conducted on an NVIDIA GeForce RTX 5060 Ti 16GB GPU:
| Model / Architecture | Format | Static VRAM | Peak VRAM | Speed | Load Time | Intelligence Parity | Status |
|---|---|---|---|---|---|---|---|
| Qwen2.5-3B (Base) | FP16 | 5.75 GB | 5.81 GB | 25.6 t/s | ~15.0 s | 100% (Baseline) | Baseline |
| Qwen2.5-3B (OTF Champion) | INT4/8 | 1.94 GB | 1.99 GB | 16.15 t/s | 4.2 s | 98.3% Logit Parity | ๐ CHAMPION (-66.1%) |
| Llama-3.2-3B (Base) | FP16 | 6.40 GB | 6.48 GB | 22.1 t/s | ~16.0 s | 100% (Baseline) | Baseline |
| Llama-3.2-3B (OTF Champion) | INT4/8 | 1.89 GB | 1.99 GB | 15.89 t/s | 3.7 s | 98.2% Logit Parity | ๐ RECORD (-70.5%) |
| Qwen2.5-7B (Base) | FP16 | 15.27 GB | 15.80 GB | 14.2 t/s | ~28.0 s | 100% (Baseline) | Baseline |
| Qwen2.5-7B (OTF Champion) | INT4/8 | 4.20 GB | 4.25 GB | 10.13 t/s | 5.1 s | 98.3% Logit Parity | ๐ CHAMPION (-72.5%) |
| Qwen1.5-MoE-A2.7B (14.3B Total) | 3-Tier | 3.09 GB | 3.40 GB | 4.14 t/s | 6.0 s | R&D Alpha | ๐งช [EXPERIMENTAL] |
๐๏ธ Architecture & Key Innovations
[Input Vector X] โโโบ [Global Static Permutation (global_perm_idx)]
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ
[Outlier Channels (1% FP16)] [Background Block (99% INT4)]
โ โ
โโโโบ Pure FP16 โโโโบ Range [-7 ... +7]
โโโโบ Input X_outliers โโโโบ 2:1 Packing (uint8)
โโโโบ Zero-Point = 0 BYTES!
โ
โผ
[Custom Fused Triton GEMM Kernel]
(Dequantization in GPU SRAM Registers)
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ
[Continuous GEMM Addition: Outliers + Triton Background = Exact FP16 Output]
- Custom Outlier-Aware Fused Triton GEMM Kernel (
otf_triton_kernel.py): Packeduint8weights are streamed from VRAM and dequantized directly inside GPU chip registers (SRAM) during matrix multiplication, eliminating temporary FP16 tensor allocations in VRAM. - Incremental Sharded Quantizer with Resume Support (
convert_global_universal.py): Memory-mapped (mmap) sharded quantizer with < 150 MB CPU RAM footprint. Saves intermediate disk chunks to enable crash-resilient resuming. - Global Static Permutation (
global_perm_idx) & Outlier Preservation: A unified channel permutation table across the model (1.6 MB VRAM). Isolating the Top-1% critical outlier channels ($|W| \times |X_{\text{profile}}|$) in FP16 completely suppresses quantization noise and guarantees 98.16% logit similarity. - Companion Long-Term Memory Manager (
companion_memory.py): Zero-VRAM, lightweight CPU RAM module that automatically extracts and retrieves user facts in < 2 ms via TF-IDF cosine similarity, injecting relevant facts into system prompts. - 3-Tier Hierarchical MoE Offloader [EXPERIMENTAL] (
otf_moe_offloader.py): R&D module for executing Mixture-of-Experts models via a 3-tier memory hierarchy (Disk โ CPU RAM โ GPU VRAM). - Gradio Web Demo (
otf-demo) & FastAPI REST API (otf-server): Includes a built-in interactive browser Web UI with real-time VRAM allocation counters and OpenAI API spec compatibility (/v1/chat/completions).
๐ Repository Structure
otf-llm-engine/
โโโ setup.py # Setuptools package configuration
โโโ pyproject.toml # PEP 517/518 build system
โโโ MANIFEST.in # Package assets configuration
โโโ pipeline_run.py # Automated 1-click end-to-end pipeline
โโโ otf_llm/ # Main python package namespace
โ โโโ __init__.py # Module entry point (v3.2.0)
โ โโโ make_profile_universal.py # Activation profile calibrator
โ โโโ convert_global_universal.py # Incremental mmap safetensors quantizer
โ โโโ run_triton_universal.py # Triton GEMM inference runner
โ โโโ otf_triton_kernel.py # Custom Fused Triton INT4 GEMM kernel
โ โโโ companion_memory.py # Zero-VRAM long-term user memory store
โ โโโ web_demo.py # Interactive Gradio Web UI
โ โโโ otf_moe_offloader.py # [EXPERIMENTAL] 3-Tier MoE Offloader
โ โโโ direct_quantized_importer.py # [EXPERIMENTAL] AWQ/GPTQ importer
โ โโโ query_guided_sparse_kv.py # Context retrieval (CPU RAM -> GPU)
โ โโโ otf_context_compressor.py # SnapKV / KIVI cache compressor
โ โโโ server_fastapi.py # REST API server (OpenAI API + SSE)
โโโ tests/ # Benchmark & validation test suites
โ โโโ test_formal_parity.py # Scientific logit parity benchmark (20 prompts)
โ โโโ validate_llama3_2_3b.py # Llama-3.2-3B validation runner
โ โโโ test_intelligence_suite.py # Intelligence and logic reasoning suite
โ โโโ test_base_model_suite.py # Baseline FP16 model suite
โ โโโ test_client.py # SSE streaming test client
โโโ README.md # Project documentation
โโโ LICENSE # MIT License
๐ ๏ธ Quickstart & Installation
Official PyPI Installation
pip install otf-llm
Launch Interactive Web Demo
otf-demo
Run Formal Scientific Parity Test
python tests/test_formal_parity.py
๐ License
Distributed under the MIT License. See LICENSE for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file otf_llm-3.2.0.tar.gz.
File metadata
- Download URL: otf_llm-3.2.0.tar.gz
- Upload date:
- Size: 45.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed0234fe48a8b7a820c0cd4edf3463fab092f2eb1bb01bb506e8ded5f6ef2027
|
|
| MD5 |
177ac1884f76b29eee91e4813c989c76
|
|
| BLAKE2b-256 |
ca4453301cd6c1136553935f598c67c390205ae1090cdcb18362d9b64e62d9ee
|
File details
Details for the file otf_llm-3.2.0-py3-none-any.whl.
File metadata
- Download URL: otf_llm-3.2.0-py3-none-any.whl
- Upload date:
- Size: 48.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b796bf237acf2adb3ae1067df514d9285189f8c85435351c21fea5da34f82ec1
|
|
| MD5 |
e7b62f5bb19ffcdba3087c1e5439fa71
|
|
| BLAKE2b-256 |
6b3dfc44eb025ec0c5a21ce49bcacfc2a8b691b7083f337afae4cf653d5836dc
|