Instructions to use Orivael-SRD-Lab/smollm2-135m-srd4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Orivael-SRD-Lab/smollm2-135m-srd4 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Orivael-SRD-Lab/smollm2-135m-srd4", filename="smollm2_135m_instruct_srd4_q4km.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Orivael-SRD-Lab/smollm2-135m-srd4 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Orivael-SRD-Lab/smollm2-135m-srd4 # Run inference directly in the terminal: llama cli -hf Orivael-SRD-Lab/smollm2-135m-srd4
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Orivael-SRD-Lab/smollm2-135m-srd4 # Run inference directly in the terminal: llama cli -hf Orivael-SRD-Lab/smollm2-135m-srd4
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Orivael-SRD-Lab/smollm2-135m-srd4 # Run inference directly in the terminal: ./llama-cli -hf Orivael-SRD-Lab/smollm2-135m-srd4
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Orivael-SRD-Lab/smollm2-135m-srd4 # Run inference directly in the terminal: ./build/bin/llama-cli -hf Orivael-SRD-Lab/smollm2-135m-srd4
Use Docker
docker model run hf.co/Orivael-SRD-Lab/smollm2-135m-srd4
- LM Studio
- Jan
- vLLM
How to use Orivael-SRD-Lab/smollm2-135m-srd4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Orivael-SRD-Lab/smollm2-135m-srd4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Orivael-SRD-Lab/smollm2-135m-srd4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Orivael-SRD-Lab/smollm2-135m-srd4
- Ollama
How to use Orivael-SRD-Lab/smollm2-135m-srd4 with Ollama:
ollama run hf.co/Orivael-SRD-Lab/smollm2-135m-srd4
- Unsloth Studio
How to use Orivael-SRD-Lab/smollm2-135m-srd4 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Orivael-SRD-Lab/smollm2-135m-srd4 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Orivael-SRD-Lab/smollm2-135m-srd4 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Orivael-SRD-Lab/smollm2-135m-srd4 to start chatting
- Atomic Chat new
- Docker Model Runner
How to use Orivael-SRD-Lab/smollm2-135m-srd4 with Docker Model Runner:
docker model run hf.co/Orivael-SRD-Lab/smollm2-135m-srd4
- Lemonade
How to use Orivael-SRD-Lab/smollm2-135m-srd4 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Orivael-SRD-Lab/smollm2-135m-srd4
Run and chat with the model
lemonade run user.smollm2-135m-srd4-{{QUANT_TAG}}List all available models
lemonade list
SmolLM2-135M · SRD4 Q4_K_M
Standard GGUF — drop into any llama.cpp build, no custom kernels.
Base model: HuggingFaceTB/SmolLM2-135M-Instruct
Quantization: SRD4 → Q4_K_M
File size: ~119 MB
What is SRD?
Standard Q4_K_M loses information systematically. Stochastic Residual Dithering (SRD)
computes an INT8 residual (D8) before quantization and stores it as a sidecar. At load
time the corrected weights are: W ≈ W4 + D8 × S8. After that, inference is identical
to vanilla Q4_K_M — zero per-token overhead.
For small models like this one, SRD targets the reasoning layers (40–77% of depth) where Q4 degradation hurts most. This is called selective correction.
Benchmark results
Evaluated on TruthfulQA MC1 (817 questions) and WikiText-2 perplexity. All modes use fake-quantized FP16 weights.
| Mode | TruthfulQA MC1 ↑ | Δ vs baseline | D8 overhead |
|---|---|---|---|
| Baseline Q4_K_M | 0.275 | — | 0 MB |
| Selective SRD (reasoning layers) | 0.289 | +1.4% | 13 MB |
| Full SRD (all layers) | 0.291 | +1.6% | 114 MB |
Selective correction reaches full-SRD quality at 11% of the RAM cost.
WikiText-2 PPL: ~31 (baseline) → ~30 (selective).
Usage
llama-cli -m smollm2-135m-srd4-q4km.gguf \
-p "The capital of France is" \
--n-predict 50
How it was built
from research.quant.quantize_model import quantize_hf_model_inplace
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained(
"HuggingFaceTB/SmolLM2-135M-Instruct", torch_dtype=torch.float16
)
quantize_hf_model_inplace(model, alpha=1.0, group_size=64)
# → converted to GGUF Q4_K_M via llama.cpp convert_hf_to_gguf.py
Pipeline: orivael-dev/axiom — branch claude/srd-prototype-benchmark-JRtv1
Contribute results
Run llama-perplexity on WikiText-2 and open a Discussion with:
- Hardware (CPU / CUDA / Metal / ROCm)
- Perplexity score
- Tokens/sec
- Downloads last month
- 38
We're not able to determine the quantization variants.
Model tree for Orivael-SRD-Lab/smollm2-135m-srd4
Base model
HuggingFaceTB/SmolLM2-135M