Instructions to use microsoft/FastContext-1.0-4B-RL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/FastContext-1.0-4B-RL with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/FastContext-1.0-4B-RL") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("microsoft/FastContext-1.0-4B-RL") model = AutoModelForMultimodalLM.from_pretrained("microsoft/FastContext-1.0-4B-RL") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/FastContext-1.0-4B-RL with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/FastContext-1.0-4B-RL" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/FastContext-1.0-4B-RL", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/microsoft/FastContext-1.0-4B-RL
- SGLang
How to use microsoft/FastContext-1.0-4B-RL 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 "microsoft/FastContext-1.0-4B-RL" \ --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": "microsoft/FastContext-1.0-4B-RL", "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 "microsoft/FastContext-1.0-4B-RL" \ --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": "microsoft/FastContext-1.0-4B-RL", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use microsoft/FastContext-1.0-4B-RL with Docker Model Runner:
docker model run hf.co/microsoft/FastContext-1.0-4B-RL
FastContext-1.0-4B-RL in production agent integration
I tested FastContext-1.0-4B-RL as an explore_repository subagent in my Go coding agent (ahle). Served via llama.cpp on RTX 3090, unquantized, temp=0.0, 104K ctx. Compared head-to-head against FastContext-1.0-4B-SFT on the same codebase (~450 files, ~90K LOC Go).
RL improvements over SFT:
- 2–3× faster per loop (8–14s vs 19–26s)
- Better citation precision overall
- Main agent re-reads cited files ~60% less often
- Fewer hallucinated file paths
Remaining issues (both variants):
<final_answer>XML tags are unreliable — the model often produces correct citation text but omits the tags. I had to add a regex fallback for lines matching/path/file.go:line-range.- Path hallucination reappears even at temp=0.0 (e.g.
/home/ss/ahle/vs the correct/home/ss/ai/ahle/), likely triggered by long directory listings in the system prompt. - Line ranges remain broad (
file.go:1-280when the answer is on lines 5–20). - Performance varies run-to-run: 11 tool calls in the best test, 13 in the worst. SFT averaged 29.
Bottom line: FastContext-1.0-4B-RL is a clear step up from SFT and usable with a fallback parser. The tag consistency and citation precision would benefit from more RL iterations. Thanks for releasing both variants — looking forward to future iterations.
I'll keep the FastContext subagant active in my setup and will report back if I gather more systematic data over time.
Thank's a lot and best wishes from lower franconia.