Instructions to use shisa-ai/Llama-3.2-1B-DMS-8x with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shisa-ai/Llama-3.2-1B-DMS-8x with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shisa-ai/Llama-3.2-1B-DMS-8x")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("shisa-ai/Llama-3.2-1B-DMS-8x") model = AutoModelForCausalLM.from_pretrained("shisa-ai/Llama-3.2-1B-DMS-8x") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shisa-ai/Llama-3.2-1B-DMS-8x with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shisa-ai/Llama-3.2-1B-DMS-8x" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shisa-ai/Llama-3.2-1B-DMS-8x", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/shisa-ai/Llama-3.2-1B-DMS-8x
- SGLang
How to use shisa-ai/Llama-3.2-1B-DMS-8x 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 "shisa-ai/Llama-3.2-1B-DMS-8x" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shisa-ai/Llama-3.2-1B-DMS-8x", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "shisa-ai/Llama-3.2-1B-DMS-8x" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shisa-ai/Llama-3.2-1B-DMS-8x", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use shisa-ai/Llama-3.2-1B-DMS-8x with Docker Model Runner:
docker model run hf.co/shisa-ai/Llama-3.2-1B-DMS-8x
Llama-3.2-1B-DMS-8x
Description
Llama-3.2-1B-DMS-8x is a derivative of meta-llama/Llama-3.2-1B that integrates Dynamic Memory Sparsification (DMS) for KV-cache compression research and serving experiments.
DMS learns per-KV-head token eviction decisions that interpolate between a recent-token sliding window and full attention. The checkpoint stores those decisions in the borrowed-neuron convention used by the DMS paper and can be served by DMS-aware runtimes to reduce KV-cache memory at inference time.
This checkpoint is part of Shisa AI's
FastDMS work. Standard Transformers can
load the model as a normal LlamaForCausalLM, but compact KV-cache behavior
requires a runtime that consumes the packaged DMS metadata and eviction signal.
This model is for research and development.
DMS Metadata
The runtime parameters are included both in config.json and in
dms_metadata.json:
| Parameter | Value |
|---|---|
| DMS window | 256 tokens |
| DMS alpha scale | 100.0 |
| DMS alpha offset | 5.0 |
| Target CR | 8x |
| Base model | meta-llama/Llama-3.2-1B |
The full retained training log is included as training_log.json.
Training
The checkpoint was trained with the two-phase DMS procedure:
- Borrowed-neuron zeroing for
2000steps. - DMS retrofitting with logit distillation and compression loss through CR2 to CR8 checkpoints.
Training used WikiText-2 text chunks, context length 4096, DMS window 256,
learning rate 3e-5, and compression weight 100.
The retained run took 1219.7s (20.3 minutes) of DMS training wall time on a
single RTX PRO 6000 Blackwell GPU.
Evaluation
On the local WikiText-2 512 x 2 strict-mask gate, the final checkpoint
measured:
| Metric | Value |
|---|---|
| Strict-mask PPL | 7.2171 |
| PPL delta vs base | -1.31% |
| KLD vs base | 0.021957 nats/token |
| Eviction rate | 0.5767 |
| Effective compression | 2.36x |
In Shisa AI's compact-DMS serving experiments, this checkpoint is the canonical Llama-3.2-1B corrected-mask v5 source used for the FastDMS/nano-vLLM serving rows.
Quick Start
Dense Transformers loading:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "shisa-ai/Llama-3.2-1B-DMS-8x"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
DMS-aware serving:
See FastDMS for the runtime path that
uses dms_metadata.json and the checkpoint's learned eviction signal for
compact KV-cache inference.
License and Terms
This checkpoint is a derivative of Meta Llama 3.2 and is released under the Llama 3.2 license terms inherited from the base model.
References
- Downloads last month
- 17