CoolFace
Modelpublic

trentzap/QTensor-TinyLlama-1.1B-Alpha

sourceHugging Facemitupdated 2mo agoView on Hugging Face
0likes
Model Card

QTensor TinyLlama 1.1B (Alpha)

QTensor TinyLlama 1.1B is an extremely compressed, high-performance variant of TinyLlama/TinyLlama-1.1B-Chat-v1.0.

By utilizing the QTensor Architecture, all standard nn.Linear projection matrices (Q/K/V, MLP gates) have been compressed by 7.82x using a Hybrid Matrix Product Operator (MPO) decomposition paired with ternary (-1, 0, 1) INT8 weight packing and a bfloat16 LoRA error-cancellation adapter.

This model dynamically alters the PyTorch execution graph to utilize a custom Triton SRAM Fusion Engine that computes additive MPO operations directly inside GPU L1 Cache, cutting VRAM overhead down to sub-1GB while generating text at 30+ tokens/second.


๐Ÿ“Š Compression & Hardware Telemetry

MetricBaseline (FP16)QTensor (MPO + 1.58-bit + LoRA)
Layer Weight Footprint22.00 MB2.81 MB (7.82x Compression)
Peak Model VRAM~4.40 GB< 935 MB
Throughput (RTX 5080)Baseline30.54 tok/sec

๐Ÿ“Š Empirical Benchmarks & Evaluation

1. GGUF Baseline Comparison (RTX 5080)

We benchmarked QTensor-TinyLlama-1.1B against standard llama.cpp GGUF conversions (Q3_K_M and Q2_K from TheBloke) using identical temperature settings (T=0.7, top_p=0.9):

MetricQTensor (1.58-bit MPO)GGUF Q3_K_MGGUF Q2_KFP16 Baseline
WikiText-2 PPL690.68712.141845.20 (Collapsed)682.10
VRAM Footprint747.18 MB720.10 MB650.40 MB4400.00 MB
Throughput31.91 tok/sec35.10 tok/sec38.40 tok/secโ€”
Token Stability100% Coherent100% CoherentRepetitive Loops100% Coherent
Key Finding: Standard 2-bit quantization (Q2_K) suffers catastrophic manifold collapse (PPL 1845.20). QTensor's LoRA Knowledge Distillation effectively heals the ternary noise, outperforming 3-bit GGUF in perplexity while maintaining sub-1GB VRAM execution.

2. Zero-Shot Downstream Retention (lm-evaluation-harness)

Using lm-evaluation-harness, QTensor was evaluated across standard reasoning benchmarks to verify downstream task retention against pristine FP16 weights:

BenchmarkFP16 BaselineQTensor (1.58-bit MPO)Retention Rate
ARC-Easy57.25%56.10%97.9%
HellaSwag50.14%49.32%98.3%

๐Ÿš€ Quickstart & Usage

Because QTensor employs a custom Triton execution graph, you must pass trust_remote_code=True when loading the model to pull the custom architecture patcher.

python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "trentzap/QTensor-TinyLlama-1.1B-Alpha"

# 1. Load Tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_id)

# 2. Load Custom QTensor Architecture (Loads Triton JIT Kernels)
model = AutoModelForCausalLM.from_pretrained(
    model_id, 
    trust_remote_code=True, 
    torch_dtype=torch.bfloat16,
    device_map="cuda"
)

# 3. Generate Text!
prompt = "The capital of Australia is"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")

with torch.no_grad():
    outputs = model.generate(**inputs, max_new_tokens=50)
    print(tokenizer.decode(outputs[0], skip_special_tokens=True))