Instructions to use rrchat/Mercury-1.7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rrchat/Mercury-1.7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="rrchat/Mercury-1.7B", trust_remote_code=True) 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 AutoModelForImageTextToText model = AutoModelForImageTextToText.from_pretrained("rrchat/Mercury-1.7B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rrchat/Mercury-1.7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rrchat/Mercury-1.7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rrchat/Mercury-1.7B", "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/rrchat/Mercury-1.7B
- SGLang
How to use rrchat/Mercury-1.7B 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 "rrchat/Mercury-1.7B" \ --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": "rrchat/Mercury-1.7B", "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 "rrchat/Mercury-1.7B" \ --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": "rrchat/Mercury-1.7B", "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" } } ] } ] }' - Unsloth Desktop
- Docker Model Runner
How to use rrchat/Mercury-1.7B with Docker Model Runner:
docker model run hf.co/rrchat/Mercury-1.7B
Mercury-1.7B
rrchat/Mercury-1.7B is an open-weights, high-efficiency multi-task reasoning, coding, and agentic vision-language model fine-tuned on top of Liquid AI's LiquidAI/LFM3-VL-2B architecture (~1.7B active language parameters + SigLIP Vision encoder).
Mercury combines the efficiency of constant-state linear attention and causal convolutions with bilingual step-by-step reasoning, strict identity alignment (Mercury by rrchat), and zero degradation on Berkeley Function Calling (BFCL v4).
Looking for quantized GGUF weights for llama.cpp / Ollama?
👉 rrchat/Mercury-1.7B-GGUF
🌟 Key Highlights & Capabilities
- Modern LFM3 Hybrid Architecture: Utilizes causal 1D depthwise short convolutions ($k=7$) combined with gated linear self-attention layers, delivering extreme throughput (~180–200+ tokens/sec on consumer GPUs) with low memory footprint.
- Natural Alignment & Conversation: Polished for helpful, direct bilingual interaction (Russian & English) without conversational artifacts or repetitive self-checking loops.
- Parity on Agentic Tool Calling: Preserves 97.0% accuracy on the Berkeley Function Calling Benchmark (BFCL v4), supporting structured XML-inline tool execution.
- Bilingual Reasoning & Coding: Fine-tuned on curated high-quality mathematical reasoning (
OpenR1-Math-220k), agentic multi-turn trajectories (Nemotron-SFT-Agentic-v2), programming datasets (OpencodeInstruct), and high-register Russian dialog (GrandMaster-PRO-MAX). - Full Multimodal Compatibility: Vision projection layers and SigLIP image processing pipelines are fully preserved for zero-shot image understanding and document analysis.
🧪 Benchmark Highlights (vs. Base Model)
All benchmarks were evaluated locally on an identical test harness under strictly identical conditions:
| Benchmark | Generation Mode | Base (LFM3-VL-2B) |
Mercury-1.7B | Delta vs. Base | Domain / Capability |
|---|---|---|---|---|---|
| HumanEval / LiveCodeBench | Thinking (<think>) |
25.0% | 40.0% | +15.0% | Python coding & algorithmic reasoning |
| HumanEval / LiveCodeBench | Instant (Direct) | 65.0% | 70.0% | +5.0% | Fast code generation & syntax adherence |
| GSM8K (Grade School Math) | Thinking (<think>) |
75.0% | 80.0% | +5.0% | Multi-step mathematical reasoning |
| IFEval (Instruction Following) | Thinking (<think>) |
70.0% | 72.5% | +2.5% | Complex system constraint compliance |
| BFCL v4 (Tool Use) | Thinking / Instant | 97.0% | 97.0% | Parity (0% loss) | Berkeley Function Calling / Agentic Tool Calls |
| IFEval (Instruction Following) | Instant (Direct) | 75.0% | 74.2% | Parity (~74%) | Direct formatting & negative constraint compliance |
| Claw-Eval General | Instant (Direct) | 91.7% | 91.7% | Parity (>90%) | Real-world conversational quality |
Disclaimer on Evaluations:
All benchmarks presented above were conducted manually and independently on local test suites under controlled, reproducible conditions. The results reflect real-world local execution performance and may differ from theoretical or officially reported figures published on the official Liquid AI LFM3 model card.
💻 Quickstart (Transformers / Python)
This repository includes custom model implementation files (configuration_lfm3.py, modeling_lfm3.py, processing_lfm3_vl.py). Always specify trust_remote_code=True when loading:
1. Text Inference
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
model_id = "rrchat/Mercury-1.7B"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
prompt = "Привет! Кто ты и чем можешь помочь?"
messages = [
{"role": "user", "content": prompt}
]
formatted_text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(formatted_text, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
2. Multimodal Vision Inference (Image + Text)
import torch
from PIL import Image
from transformers import AutoProcessor, AutoModelForImageTextToText
model_id = "rrchat/Mercury-1.7B"
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
image = Image.open("sample.jpg").convert("RGB")
prompt = "<|image|>Опиши подробно, что изображено на этой фотографии."
messages = [
{"role": "user", "content": prompt}
]
formatted_prompt = processor.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = processor(text=formatted_prompt, images=image, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.3
)
response = processor.tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
🛠️ Tool Calling / Agentic Function Calling
Mercury-1.7B adheres to the structured XML-parameter protocol:
<tool_call>
<function=get_current_weather>
<parameter=location>
Moscow, Russia
</parameter>
<parameter=unit>
celsius
</parameter>
</function>
</tool_call>
Tool responses are fed back via the tool role:
<|im_start|>tool
{"temperature": 18, "condition": "Cloudy"}
<|im_end|>
📜 Citation & Credits
If you use Mercury-1.7B in your research or applications, please cite:
@misc{mercury2026rrchat,
author = {rrchat team},
title = {Mercury-1.7B: High-Efficiency Hybrid Reasoning and Agentic Vision-Language Model},
year = {2026},
publisher = {Hugging Face},
journal = {Hugging Face repository},
howpublished = {\url{https://huggingface.co/rrchat/Mercury-1.7B}}
}
Special recognition to the Liquid AI team for the foundational LFM3-VL-2B architecture.
- Downloads last month
- 26