Instructions to use dharun2049/MAE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dharun2049/MAE with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dharun2049/MAE") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("dharun2049/MAE") model = AutoModelForCausalLM.from_pretrained("dharun2049/MAE", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use dharun2049/MAE with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dharun2049/MAE" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dharun2049/MAE", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/dharun2049/MAE
- SGLang
How to use dharun2049/MAE with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "dharun2049/MAE" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dharun2049/MAE", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "dharun2049/MAE" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dharun2049/MAE", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use dharun2049/MAE with Docker Model Runner:
docker model run hf.co/dharun2049/MAE
MAE
MAE (Magnitude-Adaptive Encoding) is an experimental low-bit language-model checkpoint using a five-state, or quinary, weight representation.
This release stores quantized weights using the PQ5 representation:
[ q_i \in \{-\alpha,-1,0,+1,+\alpha\} ]
and reconstructs each weight group as
[ \hat W_g = s_g Q_g, ]
where \(\alpha\) is selected per quantized tensor and \(s_g\) is an FP16 scale shared by a group of 128 weights.
The five code values are packed as base-5 symbols rather than wasting a full 3-bit integer for every weight. Three quinary digits fit in seven bits because .
Status: research prototype. This repository contains a custom packed PQ5 checkpoint. It is not yet a drop-in native low-bit
transformers.from_pretrained()runtime. The reference inference path reconstructs the PQ5 weights to BF16/FP16 before standard Transformer inference. A fused PQ5 GPU kernel is a separate systems step.
Base model
Qwen/Qwen3-0.6B
MAE is a quantized derivative of the base model above. The quantization changes the weight representation; it does not claim to introduce a new pretrained language-model architecture.
MMLU
The score below was read automatically from the EleutherAI LM Evaluation Harness output included with this repository.
| Benchmark | Setting | Accuracy |
|---|---|---|
| MMLU | 5-shot | 25.35% ยฑ 0.37 pp |
Evaluation scope: Full MMLU run
MMLU broad categories
| Category | Accuracy |
|---|---|
| STEM | 25.02% |
| Humanities | 25.10% |
| Social Sciences | 24.05% |
| Other | 27.33% |
The aggregate is taken from the official mmlu group metric emitted by lm-eval, rather than manually averaging category scores.
Evaluation artifact used when publishing: results_2026-09-19T12-28-11.526035.json.
Representation
For each quantized tensor, MAE uses the symmetric five-state codebook
[ \mathcal{Q}_\alpha = \{-\alpha,-1,0,1,\alpha\}. ]
For a weight group , the reconstruction is
[ \hat W_g=s_g Q_g. ]
The reference quantizer alternates between nearest-code assignment and least-squares group-scale fitting. It searches a small candidate grid for and chooses the value that minimizes reconstruction error for that tensor.
Packing
A quinary symbol contains bits of information. MAE packs three base-5 digits into one seven-bit symbol:
[ P=d_0+5d_1+25d_2, \qquad P\in[0,124]. ]
Eight seven-bit symbols are then packed into seven bytes. This gives
[ \frac{7}{3}\approx2.3333 ]
physical code bits per weight before scales.
Storage
- Nominal PQ5 code density: 7/3 = 2.3333 bits/weight for the five-state codes.
- With one FP16 scale per 128 weights, the nominal quantized-weight cost is ~2.4583 bits/weight, before small metadata/padding overhead.
- Checkpoint tensor compression ratio reported by the converter: 6.51ร.
- Tensor storage: 0.231 GB vs 1.503 GB before PQ5 conversion.
Why five states?
Ternary quantization has only one non-zero magnitude:
[ \{-s,0,+s\}. ]
MAE adds a second non-zero magnitude while staying below a conventional eight-state INT3 representation:
[ 3\text{ states} < 5\text{ states} < 8\text{ states}. ]
The research question is whether this middle point can recover part of the quality lost by ternary quantization while retaining a very compact representation.
Five-valued neural-network quantization itself is not presented as a new concept. MAE is an experimental LLM-oriented combination of a five-state scalar codebook, adaptive magnitude selection, group scaling and dense radix-5 packing.
Inference
The reference runtime follows:
packed PQ5 checkpoint
|
v
decode five-state weights
|
v
reconstruct BF16/FP16 weights
|
v
standard Hugging Face inference
This lets the quantized checkpoint be evaluated for quality today, but it does not retain the ~2.46-bit weight footprint during GEMM. Native compressed inference requires a fused PQ5 Triton/CUDA or other low-level kernel that consumes the packed representation directly.
If tools/pq5_infer.py is present in this repository, it is the matching reference loader used for the current format.
Evaluation methodology
MMLU was evaluated with the EleutherAI Language Model Evaluation Harness using its mmlu task group. The released evaluation JSON is included under eval/mmlu/.
The benchmark configuration recorded by the publishing run:
- Few-shot examples: 5
- Aggregate MMLU accuracy: 25.35%
- Result source:
groups.mmlu.acc,none - Published: 2026-09-19
Results should be compared only against evaluations using compatible MMLU prompting, few-shot settings and harness/task versions.
Limitations
- This is an experimental custom checkpoint format.
- Native packed PQ5 matrix multiplication is not included in the reference runtime.
- Quantization can change downstream accuracy differently across tasks and model layers.
- The current codebook and alpha search are simple reference implementations rather than a globally optimized quantization objective.
- Benchmark scores describe this checkpoint and evaluation configuration, not all possible MAE/PQ5 models.
Repository contents
Typical layout:
config.json
tokenizer*
model-pq5-*.safetensors
model.pq5.index.json
pq5_manifest.json
README.md
eval/mmlu/
tools/
Name
MAE = Magnitude-Adaptive Encoding
Repository: dharun2049/MAE.
- Downloads last month
- 103