Instructions to use InternScience/Agents-A1-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use InternScience/Agents-A1-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="InternScience/Agents-A1-4B") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("InternScience/Agents-A1-4B") model = AutoModelForMultimodalLM.from_pretrained("InternScience/Agents-A1-4B", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use InternScience/Agents-A1-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "InternScience/Agents-A1-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "InternScience/Agents-A1-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/InternScience/Agents-A1-4B
- SGLang
How to use InternScience/Agents-A1-4B 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 "InternScience/Agents-A1-4B" \ --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": "InternScience/Agents-A1-4B", "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 "InternScience/Agents-A1-4B" \ --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": "InternScience/Agents-A1-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use InternScience/Agents-A1-4B with Docker Model Runner:
docker model run hf.co/InternScience/Agents-A1-4B
Could you clarify whether "retry@5" is equivalent to pass@5?
If it is, we are concerned that this metric may not accurately reflect context management ability.
Since success is determined by an external evaluator over five attempts, rather than by the model selecting, integrating, or improving its own previous trajectories.
It is not context management
Thanks for your interest in our work.
pass@5 is a sampling-based evaluation metric. The model generates 5 independent attempts for a given task, and the task is considered solved if at least one attempt produces a correct answer. It measures the probability that the model can solve a problem given multiple chances.
retry@5 is a context management strategy not yet included in our code repo. It refers to the discard-all strategy described in the DeepSeek V3.2 Tech Report. You can also find an implementation in the MiroThinker codebase, where it corresponds to the context compressing limit. It works as follows:
- The model is given a maximum context window of 300 tool calls, but during inference, only the 5 most recent tool calls are retained (a sliding window).
- If the model exhausts the maximum context length without producing an answer, all prior context is cleared and a fresh run begins from scratch.
- This retry process repeats until the model either produces an answer or reaches the retry limit of 5 (i.e., the maximum number of times the context can be discarded).
- Crucially, for a single task, the model produces at most one final answer — or no answer at all if all 5 retries are exhausted without success.
Key distinction: pass@5 generates 5 independent candidate answers and succeeds if any one is correct — it is a multi-sample evaluation metric. retry@5, by contrast, is a context recovery mechanism that restarts execution when the model gets stuck, ultimately yielding a single answer. The retries are not independent parallel samples but sequential recovery attempts aimed at producing one definitive result.
In our experiments, the average number of tool calls under retry@5 is 400.9, whereas under pass@5, each independent attempt averages 119.7 tool calls.
You can reproduce the BrowseComp result using the MiroThinker code by replacing its tools with ours.
Maybe I misunderstood something, but I couldn't find the implementation details of "discard all" in this repository: https://github.com/InternScience/Agents-A1/tree/main/evaluation/Search. I'm not sure whether I was looking in the wrong place.
Maybe I misunderstood something, but I couldn't find the implementation details of "discard all" in this repository: https://github.com/InternScience/Agents-A1/tree/main/evaluation/Search. I'm not sure whether I was looking in the wrong place.
Hi flust,
Currently, the codebase doesn't include discard-all since it's mainly for evaluating HLE and other search benchmarks. BrowseComp requires additional context management, which we haven't open‑sourced yet. We plan to add it later. For now, you can refer to MiroThinker's implementation or use their evaluation framework for reproduction.