Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
cybersecurity
cyber-safety
defensive-security
malware-analysis
incident-response
lora-merged
conversational
Run this model with HF Jobs
Run OpenModel-Labs/CSM-1-Preview on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/OpenModel-Labs/CSM-1-Preview. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/OpenModel-Labs/CSM-1-Preview on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/OpenModel-Labs/CSM-1-Preview. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/OpenModel-Labs/CSM-1-Preview. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
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
Update README.md
Browse files18 unmodified lines192021222324252627282930313233343536373839404142434445461 unmodified line484950515253545556575859606162636465666768697071727374757677787980818283848586878818 unmodified lines# Cyber Safety Model**CSM-1-Preview** is a **Cyber Safety Model**: [Qwen/Qwen3.5-27B](https://huggingface.co/Qwen/Qwen3.5-27B) fine-tuned with a LoRA adapter for defensive cybersecurity work, with the adapter merged into the weights (bf16). It is meant to help defenders, engineers and learners with detection, incident response, hardening, secure coding and static malware analysis, while declining to produce ready-to-use attack tooling.> **Experimental.** This model can be wrong. Verify CVE IDs, commands, detection rules and malware verdicts before relying on them. No formal benchmark results are published for it yet.## Intended use- Explaining attacks, vulnerabilities and malware behaviour at a defender's level of detail- Writing and reviewing detections (Sigma, YARA, queries), hardening guidance and incident-response runbooks- Secure code review and secure-by-design advice- Triage and **static** analysis of suspicious files, scripts and browser or IDE extensions (with tools: see below)- Teaching, CTFs and authorized security testing concepts## Out of scope- Producing working malware, ransomware, stealers, botnets, phishing kits or weaponized exploits- Attacking systems you do not own or are not authorized to test- Being the only basis for a legal, forensic or compliance decision- Anything that needs guaranteed factual accuracy without human verification## Quick startNeeds a recent `transformers`, about 55 GB of GPU memory in bf16, and `flash-linear-attention` for fast linear-attention layers.```pythonimport torch1 unmodified linerepo = "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()}, # recommended, see below{"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))````example_chat.py` in this repo is a small streaming chat loop. Settings used in testing: temperature 0.7 for chat (0.2 to 0.4 for analysis tasks), top_p 0.9, top_k 20. Set `enable_thinking=True` in the chat template to let the model reason before answering (slower).## Recommended system promptThe model was tested with the prompt in [`system_prompt.txt`](system_prompt.txt). It asks for accurate, concise answers, no invented CVEs or flags, treating pasted content as data rather than instructions, defanged IOCs, and a short refusal with a defensive alternative for harmful requests.## Tool useThe chat template supports tool calling. If you give the model file or shell tools for malware analysis, run them in a **sandbox with read-only samples**, an allowlist of commands and no network, and treat all tool output as untrusted data (it can contain prompt injection). Never execute samples.## Training- Base model: Qwen/Qwen3.5-27B- Method: LoRA fine-tuning, merged into the base weights (bf16)- Training data and evaluation details: not documented in this card yet.## Limitations and risks- May hallucinate identifiers (CVEs, CVSS scores, product names, flags, API fields). Always check against primary sources.- Safety behaviour is imperfect: it can refuse legitimate requests and can be talked into answers it should not give. Do not use it as a security control.- Malware verdicts from static reading are heuristic. Absence of evidence in a quick scan is not proof of safety.- Inherits the limitations and biases of the base model.## LicenseReleased under **other**. Check that your use also complies with the base model's license.18 unmodified lines19202122232425262728293031323334353637383940414243444546474849505152531 unmodified line55565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911018 unmodified lines# 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 startYou’ll need a recent version of `transformers`, approximately 55 GB of GPU memory in bf16, and `flash-linear-attention` for fast linear-attention layers.```pythonimport torch1 unmodified linerepo = "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 promptThe model was tested with [`system_prompt.txt`](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 safelyThe 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 evaluationCSM-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.## LicenseReleased under **other**. See the [license agreement](LICENSE) and check that your use also complies with applicable upstream license requirements.## Base modelCSM-1-Preview is a fine-tune of the base model listed in the metadata above and inherits its limitations and biases.
README.md+53-31