Instructions to use AI45Research/REX-Intern-S2-Bio-F3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AI45Research/REX-Intern-S2-Bio-F3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="AI45Research/REX-Intern-S2-Bio-F3") 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("AI45Research/REX-Intern-S2-Bio-F3") model = AutoModelForMultimodalLM.from_pretrained("AI45Research/REX-Intern-S2-Bio-F3", 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 AI45Research/REX-Intern-S2-Bio-F3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AI45Research/REX-Intern-S2-Bio-F3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AI45Research/REX-Intern-S2-Bio-F3", "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/AI45Research/REX-Intern-S2-Bio-F3
- SGLang
How to use AI45Research/REX-Intern-S2-Bio-F3 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 "AI45Research/REX-Intern-S2-Bio-F3" \ --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": "AI45Research/REX-Intern-S2-Bio-F3", "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 "AI45Research/REX-Intern-S2-Bio-F3" \ --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": "AI45Research/REX-Intern-S2-Bio-F3", "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 AI45Research/REX-Intern-S2-Bio-F3 with Docker Model Runner:
docker model run hf.co/AI45Research/REX-Intern-S2-Bio-F3
REX-Intern-S2-Bio-F3
Preview. The source repository and the
v0.1.0tags are not public yet; the commands below work once they are.
A REX checkpoint of Intern-S2 targeting WMDP-Bio knowledge. REX relocates hazardous-domain knowledge into 8 appended experts per MoE layer (264 experts in total). Physically removing these experts and their router rows yields a standard 256-expert model with that knowledge excised.
This repository holds the expanded checkpoint (F3). Excise the appended experts to obtain the model meant for use (A3).
Quick start
git clone --branch v0.1.0 https://github.com/AI45Lab/REX.git && cd REX
UV_PROJECT_ENVIRONMENT="$PWD/.venv-cpu" uv sync --project envs/cpu --locked
.venv-cpu/bin/hf download AI45Research/REX-Intern-S2-Bio-F3 --revision v0.1.0 --local-dir ./F3
REX_VENV="$PWD/.venv-cpu" bash scripts/excise_experts.sh ./F3 ./A3
CPU only and about 1 min, with at least 16 GiB RAM. Disk: 67 GiB for F3 plus 65 GiB for A3.
./A3 must not exist beforehand, and expert_expansion_manifest.json must stay
in ./F3. Load ./A3 with the model class named in its config.json.
Intern-S2 ships a custom tokenizer; inspect it before enabling trust_remote_code.
Results
| Benchmark | F3 (before excision) | A3 (after excision) |
|---|---|---|
| WMDP-Bio (target) | 78.63 ± 1.15 | 54.99 ± 1.39 |
| WMDP-Cyber | 58.98 ± 1.10 | 59.49 ± 1.10 |
| MMLU | 84.08 ± 0.30 | 82.55 ± 0.31 |
| ARC-Challenge (25-shot) | 72.01 ± 1.31 | 71.33 ± 1.32 |
| HellaSwag (10-shot) | 85.27 ± 0.35 | 85.12 ± 0.36 |
| GSM8K (5-shot, strict) | 85.22 ± 0.98 | 86.20 ± 0.95 |
| IFEval (strict prompt) | 78.56 ± 1.77 | 78.56 ± 1.77 |
Scores in %, ± standard error. lm-eval 0.4.12 with vLLM 0.19.1; IFEval uses the chat template with thinking off. WMDP is 4-way multiple choice (chance = 25%).
Notes
- F3 is the REX model after 250M tokens of standard full-parameter SFT; A3 differs from it only by excision.
- Base model: an internal Intern-S2 base checkpoint (Qwen3.5 architecture, Intern tokenizer), not the published Intern-S2-Preview.
- Training data and recipes are not released.
run.jsonis a redacted training record. - Only text capabilities were evaluated.
License and citation
Apache-2.0, Copyright 2026 Shanghai AI Laboratory. Upstream model and tokenizer
licenses also apply; see NOTICE.
@misc{jin2026rex,
title = {Towards Architectural-Level Safety Control: Relocating Hazardous Knowledge into Removable Experts in Mixture-of-Experts Models},
author = {Jin, Cheng and Ma, Zhongtian and Wang, Xiao and Qi, Han and Wen, Xiaoyu and Wang, Xiang and Sun, Youbang and Hu, Xia and Zhou, Bowen and Lu, Chaochao and Zhang, Qiaosheng},
year = {2026},
howpublished = {\url{https://github.com/AI45Lab/REX}}
}
- Downloads last month
- 16