The PPL loop ignored --batch_size and copied the full logits tensor to shift it. Run batch_size chunks per forward, shift the labels instead of the logits, and sum per-token losses in fp32 instead of scaling a bf16 mean, which drifted from an fp32 reference (0.014% on CUDA, ~0.4% on MPS).
The LittleBit Project
Sub-1-Bit LLM Compression via Latent Factorization
Official implementation of LittleBit from NeurIPS 2025 and LittleBit-2 from ICML 2026.
Papers
LittleBit-2: Maximizing the Spectral Energy Gain in Sub-1-Bit LLMs via Latent Geometry Alignment, ICML 2026
Banseok Lee, Youngmin Kim
LittleBit: Ultra Low-Bit Quantization via Latent Factorization, NeurIPS 2025
Banseok Lee*, Dongkyu Kim*, Youngcheon You, Youngmin Kim
*Equal contribution.
Overview
LittleBit compresses large language models down to 0.1 bits per weight. It factorizes each dense weight matrix into low-rank latent factors, binarizes those factors with SmoothSign during quantization-aware training, and restores magnitude through learned vector scales. Optional residual factorization decomposes the approximation error with a second binary factor pair.
LittleBit-2 aligns the SVD-derived factors to the binary hypercube before training through joint iterative quantization. Pass --use_itq True to enable LittleBit-2 initialization with no change to the deployed layer or inference cost.
Supported models
LittleBit supports these model families:
- OPT
- Llama, Llama 2, and Llama 3
- Phi-4
- Qwen2.5, QwQ, and Qwen3
- Gemma 2 and Gemma 3
Install dependencies
Create a Python 3.12 environment and install the dependencies in the order below so the CUDA wheel for PyTorch is not overwritten.
conda create -n littlebit python=3.12
conda activate littlebit
# Install CUDA toolkit. Adjust the CUDA version if needed.
conda install nvidia/label/cuda-12.4.1::cuda-toolkit -c nvidia/label/cuda-12.4.1
# Install base requirements first, then install the matching CUDA PyTorch build and training packages.
pip install -r requirements.txt
pip install torch==2.8.0+cu124 torchvision==0.23.0+cu124 torchaudio==2.8.0+cu124 \
--index-url https://download.pytorch.org/whl/cu124
pip install "transformers==4.51.*" deepspeed wandb
Important
Pin
transformersto4.51.*to reproduce the paper results and keep Phi attention patching compatible.
Train a model
Run quantization-aware training with DeepSpeed. By default, LittleBitLinear uses LittleBit SVD initialization. On the first run, main.py tokenizes and caches the dataset under --data_root.
deepspeed --num_gpus=4 main.py \
--model_id meta-llama/Llama-2-7b-hf \
--dataset c4_wiki \
--save_dir ./outputs \
--f_name Llama-2-7b-LittleBit \
--ds_config_path configs/zero3.json \
--num_train_epochs 5.0 \
--per_device_train_batch_size 4 \
--lr 4e-05 \
--warmup_ratio 0.02 \
--l2l_loss_scale 10.0 \
--report wandb \
--quant_func SmoothSign \
--quant_mod LittleBitLinear \
--residual True \
--eff_bit 1.0 \
--kv_factor 1.0 \
--min_split_dim 8
Adjust the command for common setups:
- To enable LittleBit-2 joint iterative quantization initialization, pass
--use_itq True. - To train on a single GPU, set
--num_gpus=1and omit--ds_config_path. - To target a sub-1-bit budget such as 0.1 bits per weight, set
--eff_bit 0.1. - To log locally without Weights & Biases, set
--report tensorboard.
Evaluate a checkpoint
Evaluate a trained checkpoint on perplexity and zero-shot benchmarks. eval.py reads littlebit_config.json from the checkpoint directory automatically.
CUDA_VISIBLE_DEVICES=0 python eval.py \
--model_id ./outputs/Llama-2-7b-LittleBit \
--seqlen 2048 \
--ppl_task wikitext2,c4 \
--zeroshot_task boolq,piqa,hellaswag,winogrande,arc_easy,arc_challenge,openbookqa
Adjust eval.py for baseline or older checkpoints:
- To evaluate an unquantized Hugging Face model as a baseline, pass
--fp_eval Trueand set--model_idto the base model repository. - When an older checkpoint lacks
littlebit_config.jsonand quantization entries inconfig.json, pass--quant_func,--eff_bit,--residual, and--kv_factorexplicitly.
Cite this work
Use the following BibTeX entries to cite LittleBit-2 and LittleBit:
@inproceedings{lee2026littlebit2,
title={{LittleBit-2}: Maximizing the Spectral Energy Gain in Sub-1-Bit {LLMs} via Latent Geometry Alignment},
author={Lee, Banseok and Kim, Youngmin},
booktitle={Proceedings of the 43rd International Conference on Machine Learning},
year={2026}
}
@article{lee2025littlebit,
title={{LittleBit}: Ultra Low-Bit Quantization via Latent Factorization},
author={Lee, Banseok and Kim, Dongkyu and You, Youngcheon and Kim, Youngmin},
journal={Advances in Neural Information Processing Systems},
volume={38},
pages={116379--116411},
year={2025}
}
Star history
License
This project is licensed under the CC BY-NC 4.0 license.