Instructions to use smoll-swarm/SmolCompressor-360M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use smoll-swarm/SmolCompressor-360M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="smoll-swarm/SmolCompressor-360M") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("smoll-swarm/SmolCompressor-360M") model = AutoModelForCausalLM.from_pretrained("smoll-swarm/SmolCompressor-360M", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use smoll-swarm/SmolCompressor-360M 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 smoll-swarm/SmolCompressor-360M:F16 # Run inference directly in the terminal: llama cli -hf smoll-swarm/SmolCompressor-360M:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf smoll-swarm/SmolCompressor-360M:F16 # Run inference directly in the terminal: llama cli -hf smoll-swarm/SmolCompressor-360M:F16
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 smoll-swarm/SmolCompressor-360M:F16 # Run inference directly in the terminal: ./llama-cli -hf smoll-swarm/SmolCompressor-360M:F16
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 smoll-swarm/SmolCompressor-360M:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf smoll-swarm/SmolCompressor-360M:F16
Use Docker
docker model run hf.co/smoll-swarm/SmolCompressor-360M:F16
- LM Studio
- Jan
- vLLM
How to use smoll-swarm/SmolCompressor-360M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "smoll-swarm/SmolCompressor-360M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "smoll-swarm/SmolCompressor-360M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/smoll-swarm/SmolCompressor-360M:F16
- SGLang
How to use smoll-swarm/SmolCompressor-360M 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 "smoll-swarm/SmolCompressor-360M" \ --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": "smoll-swarm/SmolCompressor-360M", "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 "smoll-swarm/SmolCompressor-360M" \ --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": "smoll-swarm/SmolCompressor-360M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use smoll-swarm/SmolCompressor-360M with Ollama:
ollama run hf.co/smoll-swarm/SmolCompressor-360M:F16
- Unsloth Desktop
- Docker Model Runner
How to use smoll-swarm/SmolCompressor-360M with Docker Model Runner:
docker model run hf.co/smoll-swarm/SmolCompressor-360M:F16
- Lemonade
How to use smoll-swarm/SmolCompressor-360M with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull smoll-swarm/SmolCompressor-360M:F16
Run and chat with the model
lemonade run user.SmolCompressor-360M-F16
List all available models
lemonade list
- Atomic Chat
SmolCompressor 360M
This is a 360M parameter causal language model fine-tuned for context compression and RAG pruning. It is part of the Smol Swarm project.
Overview
If you pass large document chunks, meeting transcripts, or noisy search results directly into a primary reasoning model, it usually slows down responses, wastes tokens, and dilutes the context.
SmolCompressor is designed to sit in the middle of your pipeline as a lightweight middleware. It takes verbose source text and shrinks it by about 70 to 80 percent. The goal is to keep all the important facts, metrics, dates, names, error codes, and key decisions, and output them in a structured JSON format. Because it is only 360M parameters, it runs easily on a local CPU.
How it differs from SmolExtractor
I sometimes get asked how this compares to SmolExtractor 1.7B.
SmolCompressor is basically a summarizer and context pruner. It outputs a dense natural language paragraph along with a list of entities. It does not need a predefined schema and works on pretty much any document. It is meant to feed into downstream LLMs or RAG pipelines.
SmolExtractor is a JSON specialist. It maps entities into rigid database tables with typed fields like integers, booleans, and floats. It requires a target schema and is meant for SQL databases, webhooks, or backend APIs.
Quick Start
Here is how you use it with the Transformers library.
import json
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
MODEL_ID = "smoll-swarm/SmolCompressor-360M"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
device_map="auto"
)
SYSTEM_PROMPT = """You are SmolCompressor, an ultra-dense context compression engine.
Your job is to compress long, noisy documents, transcripts, and RAG context chunks by 70-80% while preserving 100% of facts, names, dates, metrics, and key decisions.
You must respond ONLY with a valid JSON object matching this schema:
{"compressed_context": "dense factual summary", "key_entities": ["list", "of", "entities"], "reduction": "percentage"}"""
raw_text = """Retrieved Document Chunk #102: In Q3 2024, CloudCorp reported total revenue of $84.2M,
representing a 28% year-over-year increase. Operating margins expanded by 240 basis points to 22%.
The cloud infrastructure division led by VP Sarah Connor accounted for $34M of total bookings.
The company reaffirmed FY2025 guidance of $250M in annual recurring revenue."""
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": f"Compress and prune this context:\n\"\"\"{raw_text}\"\"\""}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=150,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
output_ids = outputs[0][inputs.input_ids.shape[1]:]
result_json = json.loads(tokenizer.decode(output_ids, skip_special_tokens=True).strip())
print(json.dumps(result_json, indent=2))
Output Schema
The model is prompted to return a JSON object with three keys: the compressed text, a list of key entities, and the estimated reduction percentage.
{
"compressed_context": "CloudCorp Q3 2024 revenue: $84.2M (+28% YoY). Operating margin: 22%. Cloud division led by Sarah Connor generated $34M. FY2025 ARR guidance reaffirmed at $250M.",
"key_entities": [
"CloudCorp",
"Q3 2024",
"Sarah Connor",
"FY2025 ARR"
],
"reduction": "78%"
}
Pipeline Architecture
In a local multi-agent setup, a router model like SmolRouter 135M classifies the intent and sends summarization requests to SmolCompressor. The compressed context is then passed to the main LLM or RAG system. This keeps the token count low for the heavier models.
Examples
Financial Earnings Call: Input: In Q3 2024, CloudCorp reported total revenue of $84.2M, representing a 28% year-over-year increase. Operating margins expanded by 240 basis points to 22%. The cloud infrastructure division led by VP Sarah Connor accounted for $34M of total bookings. The company reaffirmed FY2025 guidance of $250M in annual recurring revenue. Output: {"compressed_context": "CloudCorp Q3 2024 revenue: $84.2M (+28% YoY). Operating margin: 22%. Cloud division led by Sarah Connor generated $34M. FY2025 ARR reaffirmed at $250M.", "key_entities": ["CloudCorp", "Q3 2024", "Sarah Connor", "FY2025 ARR"], "reduction": "78%"}
Engineering Meeting Notes: Input: Alex discussed the ongoing database migration from Postgres 14 to Postgres 16. Timeline was delayed by 2 weeks due to index lock contention on table 'audit_logs'. Maria agreed to allocate 3 senior backend engineers to assist with schema partitioning... Output: {"compressed_context": "Postgres 14->16 migration delayed 2 weeks due to index locking on audit_logs. Maria allocating 3 engineers for schema partitioning.", "key_entities": ["Postgres 16", "Maria", "Alex", "audit_logs"], "reduction": "73%"}
Training Specs
I trained this on 2,500 domain-balanced context compression pairs. The dataset includes RAG retrieval chunks, incident post-mortems, meeting notes, and customer support logs.
During training, prompt tokens were masked using -100, so the gradient loss was calculated exclusively on the target compression JSON payload. Training was done on an NVIDIA RTX PRO 6000 Blackwell Server Edition (95 GB VRAM) using full Bfloat16 precision with TF32 Tensor Core optimizations.
Model Footprint
Bfloat16 / FP16: ~720 MB file size, ~800 MB memory. Best for PyTorch and Python backends. Q8_0 GGUF: ~380 MB file size, ~450 MB memory. Good for high-precision local CPU inference. Q4_K_M GGUF: ~280 MB file size, ~320 MB memory. Good for edge devices, laptops, mobile, and Ollama.
The Smol Swarm Ecosystem
This model is part of a larger suite of small, specialized models I am working on:
SmolRouter 135M: Intent routing. SmolExtractor 1.7B: Typed JSON extraction. SmolCompressor 360M: Context pruning (this model). SmolPlanner 1.7B: Task decomposition (in progress). SmolCoder 1.7B: Utility script generation (in progress).
- Downloads last month
- 782