Instructions to use OpenModel-Labs/CSM-1-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenModel-Labs/CSM-1-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenModel-Labs/CSM-1-Preview") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("OpenModel-Labs/CSM-1-Preview") model = AutoModelForMultimodalLM.from_pretrained("OpenModel-Labs/CSM-1-Preview", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenModel-Labs/CSM-1-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenModel-Labs/CSM-1-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenModel-Labs/CSM-1-Preview", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/OpenModel-Labs/CSM-1-Preview
- SGLang
How to use OpenModel-Labs/CSM-1-Preview 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 "OpenModel-Labs/CSM-1-Preview" \ --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": "OpenModel-Labs/CSM-1-Preview", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "OpenModel-Labs/CSM-1-Preview" \ --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": "OpenModel-Labs/CSM-1-Preview", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use OpenModel-Labs/CSM-1-Preview with Docker Model Runner:
docker model run hf.co/OpenModel-Labs/CSM-1-Preview
Cyber Safety Model
CSM-1-Preview is an experimental Cyber Safety Model designed to help defenders, engineers, and learners with cybersecurity work. It can help with detection, incident response, hardening, secure coding, and static malware analysis. It is also designed to decline requests for ready-to-use attack tooling.
The model was fine-tuned using a LoRA adapter that has been merged into the weights in bf16.
A quick note: CSM-1-Preview can make mistakes. Please verify CVE IDs, commands, detection rules, and malware verdicts before relying on them. Formal benchmark results are not yet available.
What can it help with?
CSM-1-Preview is intended for tasks such as:
- Explaining attacks, vulnerabilities, and malware behavior from a defenderโs perspective
- Writing and reviewing detections, including Sigma, YARA, and queries
- Developing hardening guidance and incident-response runbooks
- Reviewing code and discussing secure-by-design practices
- Triaging and statically analyzing suspicious files, scripts, and browser or IDE extensionsโwith appropriate tools and safeguards
- Learning about CTFs and authorized security testing
Whatโs out of scope?
Please donโt rely on the model for:
- Producing working malware, ransomware, stealers, botnets, phishing kits, or weaponized exploits
- Attacking systems without authorization
- Making legal, forensic, or compliance decisions without expert review
- Tasks that require guaranteed accuracy without human verification
Quick start
Youโll need a recent version of transformers, approximately 55 GB of GPU memory in bf16, and flash-linear-attention for fast linear-attention layers.
import torch
from transformers import AutoTokenizer, AutoModelForImageTextToText
repo = "OpenModel-Labs/CSM-1-Preview"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForImageTextToText.from_pretrained(
repo, dtype=torch.bfloat16, device_map="auto"
)
messages = [
{"role": "system", "content": open("system_prompt.txt").read()},
{"role": "user", "content": "How do I detect Kerberoasting in Windows event logs?"},
]
prompt = tok.apply_chat_template(
messages, add_generation_prompt=True, tokenize=False, enable_thinking=False
)
inputs = tok(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
out = model.generate(
**inputs, max_new_tokens=1024, do_sample=True,
temperature=0.7, top_p=0.9, top_k=20
)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
For a simple streaming chat loop, see example_chat.py in this repository.
Settings used in testing were temperature 0.7 for chat, 0.2โ0.4 for analysis tasks, top_p=0.9, and top_k=20. Set enable_thinking=True in the chat template to let the model reason before answering; this will be slower.
Recommended system prompt
The model was tested with system_prompt.txt. The prompt asks it to give accurate, concise answers; avoid inventing CVEs or flags; treat pasted content as data rather than instructions; defang IOCs; and offer a short refusal with a defensive alternative for harmful requests.
Using tools safely
The chat template supports tool calling. If you provide file or shell tools for malware analysis:
- Use a sandbox with read-only samples.
- Allowlist commands and disable network access.
- Treat all tool output as untrusted dataโit may contain prompt injection.
- Never execute samples.
Training and evaluation
CSM-1-Preview was fine-tuned with LoRA, and the adapter was merged into the weights in bf16. Training data and evaluation details are not yet documented in this card.
Limitations and risks
- The model may invent identifiers such as CVEs, CVSS scores, product names, flags, or API fields. Check primary sources.
- Its safety behavior is imperfect: it may refuse legitimate requests or produce answers it should not. Donโt use it as a security control.
- Static malware assessments are heuristic. A quick scan that finds nothing suspicious does not prove a file is safe.
License
Released under other. See the license agreement and check that your use also complies with applicable upstream license requirements.
Base model
CSM-1-Preview is a fine-tune of the base model listed in the metadata above and inherits its limitations and biases.
- Downloads last month
- -
Model tree for OpenModel-Labs/CSM-1-Preview
Base model
Qwen/Qwen3.5-27B