Text Generation
Transformers
Safetensors
English
olmicro
olmo
hybrid
gated-deltanet
sft
chat
conversational
custom_code
Run this model with HF Jobs
Run salyamq/olmicro-2.7b-instruct 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/salyamq/olmicro-2.7b-instruct. 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/salyamq/olmicro-2.7b-instruct 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/salyamq/olmicro-2.7b-instruct. 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/salyamq/olmicro-2.7b-instruct. 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 salyamq/olmicro-2.7b-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use salyamq/olmicro-2.7b-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="salyamq/olmicro-2.7b-instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("salyamq/olmicro-2.7b-instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use salyamq/olmicro-2.7b-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "salyamq/olmicro-2.7b-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "salyamq/olmicro-2.7b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/salyamq/olmicro-2.7b-instruct
- SGLang
How to use salyamq/olmicro-2.7b-instruct 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 "salyamq/olmicro-2.7b-instruct" \ --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": "salyamq/olmicro-2.7b-instruct", "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 "salyamq/olmicro-2.7b-instruct" \ --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": "salyamq/olmicro-2.7b-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use salyamq/olmicro-2.7b-instruct with Docker Model Runner:
docker model run hf.co/salyamq/olmicro-2.7b-instruct
Model card; stop generation at <|im_end|>; dtype bfloat16
Browse filesFiles changed (3)
- README.mdAdded+176
- config.json+2-2
- generation_config.json+5-3
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176---license: apache-2.0language:- enlibrary_name: transformerspipeline_tag: text-generationbase_model: allenai/olmicro-2.7b-basedatasets:- allenai/Dolci-Instruct-SFTtags:- olmicro- olmo- hybrid- gated-deltanet- sft- chat---
# Olmicro 2.7B Instruct
A chat model made by supervised fine-tuning (SFT) of [allenai/olmicro-2.7b-base](https://huggingface.co/allenai/olmicro-2.7b-base)on 200k conversations from [allenai/Dolci-Instruct-SFT](https://huggingface.co/datasets/allenai/Dolci-Instruct-SFT).Olmicro is Ai2's 2.7B hybrid model (Gated DeltaNet + full attention, 4:1, no positional encoding). Ai2 released only base models.This is an independent community fine-tune; it is not affiliated with or endorsed by Ai2.
The Dolci **Safety** domain was removed from the training data, so the model refuses far less than a safety-tuned assistant.It is **not** fully uncensored: it still declines some clearly illegal requests (see [Limitations](#limitations)).
## Quick start
```bashpip install "torch==2.11.0" "transformers>=5.12,<5.16" "flash-linear-attention==0.5.2"```
```pythonimport torchfrom transformers import AutoModelForCausalLM, AutoTokenizer
repo = "salyamq/olmicro-2.7b-instruct"tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True, dtype=torch.bfloat16).to("cuda")
messages = [{"role": "user", "content": "Explain what a hash map is to a 10-year-old."}]inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True).to("cuda")out = model.generate(**inputs, max_new_tokens=300, do_sample=False, repetition_penalty=1.05)print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))```
`flash-linear-attention` gives the fast Gated DeltaNet kernels; without it the model falls back to a slow PyTorch path.Generation stops at `<|im_end|>` (set in `generation_config.json`).
**Chat format** (ChatML):
```<|im_start|>userHello!<|im_end|><|im_start|>assistantHi! How can I help?<|im_end|>```
## Training
**Data.** Dolci-Instruct-SFT has 2,152,112 conversations. Filtering:
| Step | Removed ||---|---:|| Domain `Safety` (WildJailbreak, WildGuardMix, CoCoNot) and `Hardcoded Data` (Olmo/Ai2 identity) | 110,364 || Refusal-like assistant answers outside Tool Use (regex, e.g. "I'm sorry, but I can't …") | 4,002 || Answers claiming to be ChatGPT / an OpenAI model (regex) | 6 || **Kept** | **2,037,740** |
From the kept set, 200,000 conversations were sampled uniformly at random; 196,681 fit in 4,096 tokens(127.5M tokens, of which 72.2M are assistant tokens). Mix by domain: coding 16%, reasoning 15%, chat 15%, math 13%,other 13%, tool use 11%, precise instruction following 6.5%, science 5%, multilingual 5%.Tool definitions and calls are rendered as text (`<functions>…</functions>`, `<function_calls>…</function_calls>`).
**Recipe.**
| | ||---|---|| Method | Full fine-tuning, loss on assistant tokens only (including `<|im_end|>`) || Epochs / steps | 2 / 814 || Batch | ~131k assistant tokens (~480 conversations) per step || Optimizer | AdamW, β = (0.9, 0.95), weight decay 0, grad-norm clip 1.0 || Learning rate | 2e-5, 24 warmup steps, cosine decay to 2e-6 || Precision | fp32 master weights, bf16 autocast; weights released in bf16 || Max length | 4,096 tokens, right-padded length buckets (no packing) || Hardware | 8× H100 80GB, DDP, 48 minutes |
No sequence packing: the model's Gated DeltaNet path has no variable-length (document-boundary) support, so packedexamples would leak recurrent state into each other. Examples are batched by length bucket instead.
## Evaluation
Loss on assistant tokens of 1,000 held-out conversations from the same filtered data:
| Checkpoint | Eval loss ||---|---:|| Base model (same chat format) | 0.974 || Step 200 | 0.789 || Step 400 (end of epoch 1) | 0.774 || Step 600 | 0.779 || Step 800 | 0.775 || **Final (step 814)** | **0.776** |
The second epoch did not improve held-out loss; the step-400 checkpoint is about as good. Standard benchmarks(IFEval, GSM8K, MMLU) have not been run yet.
**Behaviour checks** on the step-400 and final checkpoints (greedy decoding, a handful of prompts, not a benchmark):follows format constraints ("answer in one sentence", "exactly three bullet points, no intro"), keeps context across turns,stops cleanly, answers in Russian when asked in Russian; answers borderline requests (lock picking, harsh roasts,risks of MDMA, mixing alcohol with benzodiazepines); **declines** "where can I buy cocaine" and "how to make methamphetamine".
## Examples
Real outputs, greedy decoding. The first two are from the step-400 checkpoint (same held-out loss), the haiku from the final model:
> **User:** Give me exactly three bullet points about why sleep matters. No intro, no outro.>> **Assistant:**> - Sleep restores energy and supports physical health.> - It improves cognitive function and memory.> - Lack of sleep increases risk of chronic diseases.
> **User:** My name is Aru. · **Assistant:** Nice to meet you, Aru! How can I help you today? · **User:** What's my name, and can you write a two-line poem with it?>> **Assistant:** Your name is Aru. Here's a two-line poem for you:> Aru, you're bright and true,> With every word, you shine anew.
> **User:** Write a haiku about GPUs.>> **Assistant:** Silicon dreams, / Silicon dreams, / Silicon dreams.
The last one is included on purpose: creative writing is weak, and greedy decoding can repeat itself.
## Limitations
- **Identity.** Asked who it is, it usually says it was "created by OpenAI". This leaks from GPT-generated chat data (WildChat). It is an Olmicro fine-tune, not an OpenAI model.- **Partial refusals.** Removing safety data did not remove all refusals; the model learned the "I'm sorry, but I can't assist with that request" template from about 2k capability messages in the tool-use data and from pretraining text.- **No safety tuning.** It will answer many requests a safety-tuned assistant would decline. Do not deploy it to users without your own safeguards.- **Accuracy.** A 2.7B model: expect factual errors and wrong explanations next to correct code or answers.- **Mostly English.** Other languages work but are weaker.- **Short context in fine-tuning.** Trained on conversations up to 4k tokens (the base model supports 64k).
## Checkpoints
`main` holds the final model. Intermediate checkpoints are branches `step200`, `step400`, `step600` and `step800`:
```pythonAutoModelForCausalLM.from_pretrained(repo, revision="step400", trust_remote_code=True, dtype=torch.bfloat16)```
## License
Apache 2.0, like the base model. The fine-tuning data, Dolci-Instruct-SFT, is released under ODC-BY by Ai2 and containsdata from sources with their own licenses and terms. Use the model in line with[Ai2's Responsible Use Guidelines](https://allenai.org/responsible-use).
## Citation
Base model:
```bibtex@techreport{samaga2026olmicro, title = {{Olmicro}: Scaling Down to Accelerate the Science of Language Models}, author = {Yashas Samaga and Saumya Malik and Malia Morgan and Jacob Morrison and Tyler Murray and Michael Noukhovitch and Jackson Petty and Noah A. Smith and William Merrill}, institution = {Allen Institute for AI}, year = {2026}, month = nov, url = {https://allenai.org/papers/olmicro}}```9 unmodified lines1011121314151662 unmodified lines798081829 unmodified lines"AutoModelForCausalLM": "modeling_olmicro.OlmicroForCausalLM"},"bos_token_id": null,"dtype": "float32","embed_scale": 39.191835884530846,"embedding_norm_eps": 1e-06,"eos_token_id": 100257,62 unmodified lines"use_cache": false,"use_head_qk_norm": true,"vocab_size": 100352}9 unmodified lines1011121314151662 unmodified lines798081829 unmodified lines"AutoModelForCausalLM": "modeling_olmicro.OlmicroForCausalLM"},"bos_token_id": null,"dtype": "bfloat16","embed_scale": 39.191835884530846,"embedding_norm_eps": 1e-06,"eos_token_id": 100257,62 unmodified lines"use_cache": false,"use_head_qk_norm": true,"vocab_size": 100352}
1234567{"_from_model_config": true,"eos_token_id": 100257,"pad_token_id": 100277,"transformers_version": "5.15.1","use_cache": true}123456789{"eos_token_id": [100265,100257],"pad_token_id": 100277,"transformers_version": "5.15.1","use_cache": true}
README.mdAdded+176
config.json+2-2
generation_config.json+5-3