Instructions to use rrchat/Mercury-Acad-1.7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rrchat/Mercury-Acad-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-Acad-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-Acad-1.7B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rrchat/Mercury-Acad-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-Acad-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-Acad-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-Acad-1.7B
- SGLang
How to use rrchat/Mercury-Acad-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-Acad-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-Acad-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-Acad-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-Acad-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" } } ] } ] }' - Docker Model Runner
How to use rrchat/Mercury-Acad-1.7B with Docker Model Runner:
docker model run hf.co/rrchat/Mercury-Acad-1.7B
Mercury-Acad-1.7B
rrchat/Mercury-Acad-1.7B is an EXPERIMENTAL open-weights, high-efficiency STEM 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-Acad combines the ultra-fast throughput of constant-state linear attention and causal convolutions with structured dual-mode step-by-step reasoning (<think>), bilingual mastery (Russian & English), and verified reliability in tool use and coding tasks.
Looking for quantized GGUF weights for llama.cpp / Ollama / LM Studio?
👉 rrchat/Mercury-Acad-1.7B-GGUF
💡 Model Positioning & Cognitive Profile
- Taught Base LFM3-VL-2B to Reason: The primary breakthrough of Mercury-Acad is unlocking systematic step-by-step reasoning inside
<think>...</think>traces within the compact 1.7B parameter budget. On complex multi-step tasks, the model explicitly analyzes edge cases, verifies intermediate mathematical calculations, and validates algorithmic invariants. This yields monumental performance gains over the base model, notably +29.9% on HumanEval+ algorithmic coding and +9.6% on GSM8K mathematical reasoning. - Knowledge Boundary vs. Base Model: As a specialized post-trained model, Mercury-Acad does not surpass the foundational base model in broad encyclopedic trivia or factual knowledge retrieval (which remains constrained by the 1.7B pre-training scale). Its strength lies in cognitive process and problem solving: mathematical proofs, algorithmic code generation, formal logic, and structured instruction execution.
- Dual-Mode Inference:
- Thinking Mode (
enable_thinking=True, default): Employs explicit internal thought traces (<think> ... </think>) to solve difficult problems before generating the final answer. - Instant Mode (
enable_thinking=False): Closes the thinking block immediately (<think></think>), producing direct, ultra-low-latency responses when maximum speed is needed.
- Thinking Mode (
🧪 Benchmark Highlights
All benchmarks were evaluated locally on an identical test harness under strictly reproducible conditions (bfloat16 precision, deterministic greedy decoding):
| Benchmark | Mode | Base (LFM3-VL-2B) |
Mercury-1.7B | Mercury-Acad-1.7B | Delta vs. Base | Delta vs. Mercury | Domain / Key Strengths |
|---|---|---|---|---|---|---|---|
| HumanEval+ (164 tasks) | Thinking | 21.9% | 23.2% | 51.8% | +29.9% | +28.7% | Complex Python algorithms & edge cases |
| GSM8K (500 problems) | Thinking | 58.2% | 63.2% | 67.8% | +9.6% | +4.6% | Multi-step grade school arithmetic |
| MGSM Russian (250 problems) | Thinking | 39.2% | 36.8% | 45.2% | +6.0% | +8.4% | Russian mathematical reasoning |
| MATH-500 (Level 1–3) | Instant | 73.5% | 43.3% | 51.7% | -21.9% | +8.4% | High-speed algebraic derivations |
| MATH-500 (Level 1–3) | Thinking | 64.3% | 47.1% | 51.3% | -13.0% | +4.2% | High-precision mathematical proofs |
| BFCL V3 Simple (Tools) | Thinking | 99.7% | 90.7% | 99.7% | Parity (0% loss) | +9.0% | Zero truncation & rock-solid tool calling |
| MMLU-Redux (300 tasks) | Instant | 24.0% | 40.7% | 42.7% | +18.7% | +2.0% | STEM, humanities, and general concepts |
| IFEval (541 instructions) | Instant | 73.3% | 72.6% | 71.8% | Parity (~72%) | Parity (~72%) | Negative constraints & strict formatting |
| Identity Alignment | Thinking | 90.0% | 83.0% | 95.0% | +5.0% | +12.0% | Consistent self-identity (Mercury by rrchat) |
In thinking mode on the base LFM3-VL-2B model, over 60% to 90% of generations aborted due to endless loops or missing
</think>tags. Mercury-Acad completely resolved this, maintaining a 0.0% truncation rate across all benchmarks while delivering verified answers.
🌟 Key Capabilities
- LFM3 Hybrid Architecture: Leverages causal 1D short convolutions ($k=7$) combined with gated linear self-attention, delivering extreme generation speed (~180–210 tokens/sec on consumer desktop GPUs) with ultra-low VRAM overhead.
- Bilingual STEM Reasoning: Fluent in Russian and English with full LaTeX formula support (
$\boxed{...}$), algorithmic decomposition, and natural language explanations. - Agentic Function Calling: Fully supports Berkeley Function Calling Benchmark protocols and structured XML parameter calls.
- Preserved Multimodal Vision: Retains the native SigLIP vision encoder and projection adapters for image QA, document analysis, and visual reasoning.
💻 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 with Thinking Mode (Default)
import torch
from transformers import AutoModelForImageTextToText, AutoTokenizer
model_id = "rrlabs-ai/Mercury-Acad-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 = "Сколько простых чисел находится в диапазоне от 20 до 40? Обоснуй и дай ответ в \\boxed{}."
messages = [
{"role": "user", "content": prompt}
]
# enable_thinking=True (default) pre-fills "<think>\n" for step-by-step reasoning
formatted_text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True
)
inputs = tokenizer(formatted_text, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=768,
temperature=0.3,
do_sample=True
)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=False)
print(response)
2. Fast Instant Mode (Bypassing <think>)
# Pass enable_thinking=False to skip thinking and get an instant response:
formatted_text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False
)
3. Multimodal Vision Inference (Image + Text)
import torch
from PIL import Image
from transformers import AutoProcessor, AutoModelForImageTextToText
model_id = "rrlabs-ai/Mercury-Acad-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("geometry_problem.png").convert("RGB")
prompt = "<|image|>Реши геометрическую задачу, изображенную на рисунке."
messages = [
{"role": "user", "content": prompt}
]
formatted_prompt = processor.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True
)
inputs = processor(text=formatted_prompt, images=image, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=768,
temperature=0.2
)
response = processor.tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)
🛠️ Tool Calling Protocol
Mercury-Acad follows the structured XML tool call protocol:
<tool_call>
<function=calculate_integral>
<parameter=expression>
x^2 * exp(-x)
</parameter>
<parameter=lower_bound>
0
</parameter>
<parameter=upper_bound>
1
</parameter>
</function>
</tool_call>
📜 Citation & Credits
If you use Mercury-Acad-1.7B in your research or applications, please cite:
@misc{mercuryacad2026rrchat,
author = {rrchat team},
title = {Mercury-Acad-1.7B: High-Efficiency Dual-Mode STEM Reasoning and Code Model},
year = {2026},
publisher = {Hugging Face},
journal = {Hugging Face repository},
howpublished = {\url{https://huggingface.co/rrlabs-ai/Mercury-Acad-1.7B}}
}
Special recognition to the Liquid AI team for the foundational LFM3-VL-2B architecture.
- Downloads last month
- 34