惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
Recent Announcements
Recent Announcements
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Security Blog
Microsoft Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
J
Java Code Geeks
V
V2EX
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
博客园 - Franky
爱范儿
爱范儿
T
Tailwind CSS Blog
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
博客园_首页
B
Blog RSS Feed
博客园 - 司徒正美
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How to Pick a GGUF Quant Level for Your VRAM Budget
Patrick Hughes · 2026-06-11 · via DEV Community

How to Pick a GGUF Quant Level for Your VRAM Budget

A while back I wrote a breakdown of GGUF quantization: Q4 vs Q5 vs Q8. That post explains what the quant levels mean. This one answers the next question people ask: given my GPU, which one do I actually pick?

The short version. Fit the model in VRAM first. Then climb to the highest quant that still fits with room to spare. Here is the actual math so you can do it yourself.

The one formula you need

Model size in VRAM is roughly:

params (billions) x bits-per-weight / 8 = GB

A 7B model at Q4 (about 4.5 bits per weight in practice) is:

7 x 4.5 / 8 = ~3.9 GB

The same 7B at Q8 (about 8.5 bits) is:

7 x 8.5 / 8 = ~7.4 GB

That is the weights only. You also need room for the KV cache and some overhead. Add 15 to 25 percent on top. So plan for the Q8 7B to want roughly 9 GB total at a normal context length.

Match the quant to the card

Here is the practical table I use. These assume you want the whole model on the GPU, not split to CPU.

8 GB card (3070, 4060): a 7B fits comfortably at Q4 or Q5. Q8 is tight once you add context. Stick to Q5_K_M for the best quality that still fits.

12 GB card (3060 12GB, 4070): 7B at Q8 fits fine. A 13B fits at Q4 or Q5. This is the sweet spot for one mid-size model at high quality.

16 GB card (4070 Ti Super, 4060 Ti 16GB): 13B at Q5 or Q8. A 7B at Q8 leaves tons of room for a long context.

24 GB card (3090, 4090): 13B at Q8 with a big context, or a 34B at Q4. This is where you stop worrying about quants for small models.

32 GB card (5090): a 34B at Q5 or Q8, or two 13B models loaded at once. At this point quant choice is about speed, not fitting.

The quality-vs-size tradeoff in plain terms

People obsess over this more than they should. Here is what actually matters.

Q8 is near lossless. If it fits, take it and stop thinking.

Q5_K_M is the value pick. Quality loss is small enough that most people cannot tell in normal use. It saves a lot of VRAM over Q8.

Q4_K_M is fine for chat and drafting. You will notice it more on hard reasoning and code. Use it when Q5 does not fit.

Below Q4, quality drops fast. Only go there when you have no other way to fit the model. A bigger model at Q4 usually beats a smaller model at Q8.

That last point is the one people miss. A 13B at Q4 generally beats a 7B at Q8. More parameters at lower precision wins over fewer parameters at high precision, up to a point. So fit the biggest model your card allows, then pick the quant.

A quick way to test before you commit

Do not trust a table blindly. Run it. Pull two quants of the same model and compare on your own prompts.

# load Q5 and watch VRAM with nvidia-smi in another terminal
./llama-cli -m mistral-7b-q5_k_m.gguf -p "your real prompt here" -ngl 99

# then the Q8
./llama-cli -m mistral-7b-q8_0.gguf -p "your real prompt here" -ngl 99

Watch two things. Did it fit fully on the GPU, and does the output quality hold up on your actual work. If Q8 fits and the speed is acceptable, you are done. If it spills to CPU and slows to a crawl, drop to Q5.

When you run this in production

Local quants are cheap to run but not free. You still pay in GPU time, electricity, and the engineer hours when a context overflow crashes a job at 2 AM. If you are wiring a local model into an agent that calls it in a loop, put a budget around the loop so a runaway agent does not peg your GPU all night.

That is what I built AgentGuard for. It is an open-source runtime budget, token, and rate limiter for AI agents, and it works the same whether the model is a cloud API or a local GGUF on your own card. pip install agentguard, wrap your agent loop, set a cap, and you stop the runaway before it costs you a night of compute.

Pick the model first, the quant second, and test on your own prompts. The card decides the ceiling. You decide the rest.