quantizing-models-bitsandbytes

quantizing-models-bitsandbytes is a skill for Claude Code from Orchestra-Research/AI-Research-SKILLs. It costs 83 tokens per session (2,933 once invoked), scanned A, a copy of optimization-bitsandbytes, MIT.

A guide to quantizing large language models with bitsandbytes, which stores model numbers in fewer bits so the model uses less GPU memory.

In plain words
What is it for?
Use it to configure 8-bit or 4-bit model loading, run inference in smaller memory, train with QLoRA, or use memory-saving optimizers with Hugging Face Transformers.
Why use it?
It helps load or run larger models on limited hardware by using 8-bit or 4-bit representations, with a possible trade-off in accuracy.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the optimization plugin — 7 skills shipped together

Good fit Use it to configure 8-bit or 4-bit model loading, run inference in smaller memory, train with QLoRA, or use memory-saving optimizers with Hugging Face Transformers.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/orchestra-research/ai-research-skills/bitsandbytes
About the project

AI Research Skills Library is a collection of reusable instructions that guide AI agents through research and machine-learning engineering tasks, from finding ideas and writing papers to training, evaluation, and deployment. It is for configuring agents such as Claude Code, Codex, and Gemini to perform research workflows.

Orchestra-Research/AI-Research-SKILLs · 14,912 stars · on GitHub · orchestra-research.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Orchestra-Research/AI-Research-SKILLs --skill bitsandbytes
Clone the repo
git clone --depth 1 https://github.com/Orchestra-Research/AI-Research-SKILLs

Made for: Claude Code.

Or install optimization, the plugin that ships this one along with the rest of its 7 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for quantizing-models-bitsandbytes

README.md
[![agentmods](https://agentmods.dev/badge/skills/orchestra-research/ai-research-skills/bitsandbytes/github.svg)](https://agentmods.dev/skills/orchestra-research/ai-research-skills/bitsandbytes)
Your own site
<a href="https://agentmods.dev/skills/orchestra-research/ai-research-skills/bitsandbytes"><img src="https://agentmods.dev/badge/skills/orchestra-research/ai-research-skills/bitsandbytes/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for quantizing-models-bitsandbytes

Your own site · 80×15
<a href="https://agentmods.dev/skills/orchestra-research/ai-research-skills/bitsandbytes"><img src="https://agentmods.dev/badge/skills/orchestra-research/ai-research-skills/bitsandbytes.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 83 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,933 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00083 $0.02933
Opus 5.5 $0.00033 $0.01173
Sonnet 5.5 $0.00017 $0.00587
Haiku 4.5 $0.00008 $0.00293

Measured 3mo ago against content hash 0a68e96c760b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

quantizing-models-bitsandbytes scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to optimization-bitsandbytes — 11 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

10-optimization/bitsandbytes/SKILL.md · 412 lines

How it starts

The opening of the file, as written. The whole thing — 412 lines — stays where its author put it; the contents beside it link to each section on GitHub.

bitsandbytes - LLM Quantization

Quick start

bitsandbytes reduces LLM memory by 50% (8-bit) or 75% (4-bit) with <1% accuracy loss.

Installation:

pip install bitsandbytes transformers accelerate

8-bit quantization (50% memory reduction):

from transformers import AutoModelForCausalLM, BitsAndBytesConfig

config = BitsAndBytesConfig(load_in_8bit=True)
model = AutoModelForCausalLM.from_pretrained(
    "meta-llama/Llama-2-7b-hf",
    quantization_config=config,
    device_map="auto"
)

# Memory: 14GB → 7GB

4-bit quantization (75% memory reduction):

config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_compute_dtype=torch.float16
)
model = AutoModelForCausalLM.from_pretrained(
    "meta-llama/Llama-2-7b-hf",
    quantization_config=config,
    device_map="auto"
)

# Memory: 14GB → 3.5GB

Common workflows

Workflow 1: Load large model in limited GPU memory

Copy this checklist:

Quantization Loading:
- [ ] Step 1: Calculate memory requirements
- [ ] Step 2: Choose quantization level (4-bit or 8-bit)
- [ ] Step 3: Configure quantization
- [ ] Step 4: Load and verify model

Step 1: Calculate memory requirements

Estimate model memory:

FP16 memory (GB) = Parameters × 2 bytes / 1e9
INT8 memory (GB) = Parameters × 1 byte / 1e9
INT4 memory (GB) = Parameters × 0.5 bytes / 1e9

Example (Llama 2 7B):
FP16: 7B × 2 / 1e9 = 14 GB
INT8: 7B × 1 / 1e9 = 7 GB
INT4: 7B × 0.5 / 1e9 = 3.5 GB

Step 2: Choose quantization level

GPU VRAM Model Size Recommended
8 GB 3B 4-bit
12 GB 7B 4-bit
16 GB 7B 8-bit or 4-bit
24 GB 13B 8-bit or 70B 4-bit
40+ GB 70B 8-bit

Step 3: Configure quantization

For 8-bit (better accuracy):

from transformers import BitsAndBytesConfig
import torch

config = BitsAndBytesConfig(
    load_in_8bit=True,
    llm_int8_threshold=6.0,  # Outlier threshold
    llm_int8_has_fp16_weight=False
)

Read the full file on GitHub · 412 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 412 lines · 83 tokens per session scan A 0a68e96c760b

Subscribe to this mod's changes

quantizing-models-bitsandbytes is a skill published in the GitHub repository Orchestra-Research/AI-Research-SKILLs (14,912 stars, last pushed 1mo ago), licensed MIT. It adds 83 tokens to every session and 2,933 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to optimization-bitsandbytes, differing in 11 lines, and is treated as a copy.

Related

quantizing-models-bitsandbytes compared with skills from other repositories

quantizing-models-bitsandbytes next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
quantizing-models-bitsandbytesOrchestra-Research/AI-Research-SKILLsSkill15k1mo agoMITA83Claude Code
quantizing-models-bitsandbytesOpenLAIR/dr-clawSkill1.2k19d agononeA103Claude Code, Codex
quantizing-models-bitsandbytessynthetic-sciences/openscienceSkill4.5kyesterdayApache-2.0A83Claude Code, Codex
quantizing-models-bitsandbytesliortesta/ClawdAgentSkill123mo agoApache-2.0A83Claude Code
quantizing-models-bitsandbytesOpenLAIR/dr-claw-plugin-ccSkill56mo agononeA83Claude Code
quantizing-models-bitsandbytesovachiever/droid-tingsSkill561y agononeA83Claude Code, Codex
quantizing-models-bitsandbytesihatesea69/HieuNghi-AI-SkillsSkill39mo agoMITA83Claude Code, Codex