Files
SPADE-Qwen3-4B-Games/README.md
ModelHub XC 71739a7c8b 初始化项目,由ModelHub XC社区提供模型
Model: spade-rl/SPADE-Qwen3-4B-Games
Source: Original Platform
2026-10-19 15:59:15 +08:00

82 lines
2.7 KiB
Markdown

---
license: apache-2.0
base_model: Qwen/Qwen3-4B-Instruct-2507
library_name: transformers
pipeline_tag: text-generation
tags:
- spade
- self-play
- reinforcement-learning
- environment-generation
- games
---
# SPADE-Qwen3-4B-Games
SPADE checkpoint for the **games** setting, trained from [`Qwen/Qwen3-4B-Instruct-2507`](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507).
SPADE trains a single model in two roles: an **Environment Designer** that writes executable
environments, and a **Reasoning Agent** that solves them. The Designer is rewarded for
producing environments at the frontier of what the Agent can currently solve, so
the curriculum keeps pace with the policy instead of being fixed in advance.
See the [paper](https://arxiv.org/abs/2608.19197) for details.
| | |
|---|---|
| Base model | [`Qwen/Qwen3-4B-Instruct-2507`](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) |
| Setting | games |
| Context length | 262,144 |
## Quickstart
We advise you to use the latest version of `transformers`.
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "spade-rl/SPADE-Qwen3-4B-Games"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
prompt = "Give me a short introduction to large language model."
messages = [{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(**model_inputs, max_new_tokens=16384)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
print(tokenizer.decode(output_ids, skip_special_tokens=True))
```
## Deployment
For deployment, you can use `sglang>=0.4.6.post1` or `vllm>=0.8.5` to create an
OpenAI-compatible API endpoint:
- SGLang:
```shell
python -m sglang.launch_server --model-path spade-rl/SPADE-Qwen3-4B-Games --context-length 262144
```
- vLLM:
```shell
vllm serve spade-rl/SPADE-Qwen3-4B-Games --max-model-len 262144
```
Note: If you encounter out-of-memory (OOM) issues, consider reducing the context
length to a shorter value, such as 32,768.
## Best practices
We recommend `temperature=0.7`, `top_p=0.8`, `top_k=20`, `min_p=0`, following
the sampling guidance on the [base model card](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507).
## Related artifacts
- Grounding corpora: [games](https://huggingface.co/datasets/spade-rl/spade-grounding-corpus-games-15k) | [tool use](https://huggingface.co/datasets/spade-rl/spade-grounding-corpus-tooluse-15k)
- All SPADE models, data and generated environments: [huggingface.co/spade-rl](https://huggingface.co/spade-rl)