Instructions to use xiamoent/Agent-G2-alfworld-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xiamoent/Agent-G2-alfworld-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="xiamoent/Agent-G2-alfworld-7b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("xiamoent/Agent-G2-alfworld-7b") model = AutoModelForCausalLM.from_pretrained("xiamoent/Agent-G2-alfworld-7b", device_map="auto") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use xiamoent/Agent-G2-alfworld-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xiamoent/Agent-G2-alfworld-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": "xiamoent/Agent-G2-alfworld-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/xiamoent/Agent-G2-alfworld-7b
- SGLang
How to use xiamoent/Agent-G2-alfworld-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 "xiamoent/Agent-G2-alfworld-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": "xiamoent/Agent-G2-alfworld-7b", "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 "xiamoent/Agent-G2-alfworld-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": "xiamoent/Agent-G2-alfworld-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use xiamoent/Agent-G2-alfworld-7b with Docker Model Runner:
docker model run hf.co/xiamoent/Agent-G2-alfworld-7b
Agent-G2 ALFWorld 7B
Agent-G2 ALFWorld 7B is an ALFWorld-specialized language-agent checkpoint initialized from Qwen2.5-7B-Instruct and post-trained with Agent-G2: Gaussian Guidance for Agentic Reinforcement Learning.
Agent-G2 samples an expert-prefix depth for each task from an adaptive Gaussian distribution. The distribution is updated from rollout statistics already collected for policy optimization, without additional probe rollouts or a learned depth predictor.
Project Page · Code · Model Collection · Training Data
Important: This checkpoint is designed for research in the sandboxed ALFWorld text environment. It is not a general-purpose chat model or a controller for a physical robot.
Model Details
| Item | Description |
|---|---|
| Base model | Qwen/Qwen2.5-7B-Instruct |
| Architecture | Qwen2ForCausalLM |
| Checkpoint format | BF16 Safetensors |
| Configured context length | 32,768 tokens |
| Target environment | ALFWorld / ALFRED text environment |
| Post-training | Agent-G2 with GRPO |
| Language | English |
| Required output format | <think>...</think><action>...</action> |
Although the tokenizer metadata contains a larger generic maximum length, the model configuration declares 32,768 positions. The public 1.5B reference recipe uses substantially shorter prompts and responses.
Evaluation
The Agent-G2 project reports the following ALFWorld success rates for this 7B checkpoint:
| Task group | Success rate |
|---|---|
| Pick | 100.0% |
| Look | 100.0% |
| Clean | 100.0% |
| Heat | 100.0% |
| Cool | 100.0% |
| Pick Two | 91.7% |
| All tasks | 98.4% |
Agent-G2 uses expert-prefix guidance as a training mechanism rather than an inference-time dependency. The project evaluates the learned policy without supplying an expert trajectory.
These results are reported by the Agent-G2 repository and have not been independently reproduced in this model card. Evaluation variance is not currently available. Results may vary with the ALFWorld version, task split, prompt template, action history, random seed, and decoding configuration.
Intended Use
This checkpoint is intended for:
- reproducing Agent-G2 results in the ALFWorld text environment;
- research on long-horizon language agents and agentic reinforcement learning;
- studying adaptive expert-prefix guidance;
- evaluating action selection over an environment-provided admissible action set.
For faithful evaluation, use the ALFWorld environment, prompt template, action parser, and rollout loop provided by the Agent-G2 repository. A standalone generation only demonstrates that the checkpoint loads successfully; it does not reproduce the interactive benchmark.
Environment Interface
At every environment step, provide the task, current observation, recent history, and admissible actions. The released parser expects English output containing reasoning and one action selected from the current admissible set:
<think>Reason about the observation and admissible actions.</think>
<action>put apple 1 in/on fridge 1</action>
Missing tags or outputs containing Chinese characters are marked invalid by the
released ALFWorld parser. The action inside <action>...</action> must match an action
that the environment currently allows.
Quick Start
pip install -U transformers accelerate torch
The following example performs one ALFWorld-style generation step. Replace the placeholders with state supplied by the environment:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "xiamoent/Agent-G2-alfworld-7b"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto",
)
model.eval()
task_description = "<ALFWorld task>"
current_observation = "<current observation>"
admissible_actions = ["<admissible action 1>", "<admissible action 2>"]
actions_text = ", ".join(admissible_actions)
prompt = f"""
You are an expert agent operating in the ALFRED Embodied Environment.
Your task is to: {task_description}
Your current observation is: {current_observation}
Your admissible actions of the current situation are: [{actions_text}].
Now take one action. Enclose your reasoning within <think> </think> tags, then
present one admissible action within <action> </action> tags.
""".strip()
inputs = tokenizer.apply_chat_template(
[{"role": "user", "content": prompt}],
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
with torch.inference_mode():
output_ids = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.4,
top_p=0.8,
top_k=20,
repetition_penalty=1.05,
)
new_tokens = output_ids[0, inputs["input_ids"].shape[-1]:]
response = tokenizer.decode(new_tokens, skip_special_tokens=True)
print(response)
The released checkpoint's generation_config.json defaults to temperature 0.7.
The example uses temperature 0.4 to match the project's evaluation setting.
Training
Agent-G2 uses expert ALFWorld trajectories as prefix guidance during training, followed by policy rollouts and GRPO updates. The guidance depth is sampled per task from a Gaussian distribution estimated online from existing rollout statistics. Prefix guidance is not required at inference time.
The associated data release includes 3,553 ALFWorld expert trajectories with action lengths from 3 to 15. See the Agent-G2 repository and training data for the public implementation and expert-prefix store.
The repository currently publishes paper-locked ALFWorld training commands for the 1.5B setup, but not a separate 7B hyperparameter file or the exact checkpoint-selection rule for this Hub artifact. This card therefore does not attribute the 1.5B-specific hyperparameters to the 7B checkpoint.
Limitations
- The model is specialized for the text-based ALFWorld environment and may not generalize to other simulators or physical environments.
- It can produce malformed or inadmissible actions; environment-side validation is required.
- Performance is sensitive to prompt formatting, observation history, decoding settings, random seed, and environment configuration.
- The reported evaluation does not include variance across repeated runs.
- The model may inherit factual errors, biases, and other limitations from the base model and training data.
- This checkpoint should not directly control physical systems or be used for consequential real-world actions without independent safety mechanisms.
Citation
If you find this checkpoint useful, please cite Agent-G2:
@misc{wang2026agentg2,
title = {Agent-G$^2$: Gaussian Guidance for Agentic Reinforcement Learning},
author = {Zixuan Wang and Yanrui Miao and Zhengxi Lu and Teng Pan and Yiwen Qiu
and Hongxing Li and Peng Qiu and Ruiqing Zhang and Yongliang Shen},
year = {2026},
eprint = {2608.23318},
archivePrefix = {arXiv},
primaryClass = {cs.AI},
url = {https://arxiv.org/abs/2608.23318},
note = {Accepted at EMNLP 2026 Main Conference},
}
The paper has been accepted to the EMNLP 2026 Main Conference. A public paper link will be added when available.
Acknowledgements
Agent-G2 builds on verl-agent, veRL, and ALFWorld.
- Downloads last month
- 3