Text Generation
Transformers
PyTorch
English
Chinese
llama
reasoning
long-cot
math
reinforcement-learning
grpo
justrl
conversational
text-generation-inference
Instructions to use openbmb/JustRL-II-base-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/JustRL-II-base-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openbmb/JustRL-II-base-model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("openbmb/JustRL-II-base-model") model = AutoModelForCausalLM.from_pretrained("openbmb/JustRL-II-base-model", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openbmb/JustRL-II-base-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openbmb/JustRL-II-base-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/JustRL-II-base-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/openbmb/JustRL-II-base-model
- SGLang
How to use openbmb/JustRL-II-base-model 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 "openbmb/JustRL-II-base-model" \ --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": "openbmb/JustRL-II-base-model", "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 "openbmb/JustRL-II-base-model" \ --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": "openbmb/JustRL-II-base-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use openbmb/JustRL-II-base-model with Docker Model Runner:
docker model run hf.co/openbmb/JustRL-II-base-model
Add model card
Browse files
README.md
CHANGED
|
@@ -1,3 +1,105 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
- zh
|
| 7 |
+
tags:
|
| 8 |
+
- reasoning
|
| 9 |
+
- long-cot
|
| 10 |
+
- math
|
| 11 |
+
- reinforcement-learning
|
| 12 |
+
- grpo
|
| 13 |
+
- justrl
|
| 14 |
---
|
| 15 |
+
|
| 16 |
+
# JustRL-II Base Model
|
| 17 |
+
|
| 18 |
+
This is the **RL initialization checkpoint** used in the blog
|
| 19 |
+
[**JustRL II: Scaling Small LLMs to 128K Reasoning with a Critic**](https://panhaoxuan.notion.site/justrl-ii-scaling-small-llms-to-128k-reasoning-with-a-critic)
|
| 20 |
+
([中文版](https://panhaoxuan.notion.site/justrl-ii-small-llms-to-128k-reasoning-with-a-critic-cn)).
|
| 21 |
+
|
| 22 |
+
It is the *starting point* of the mathematical-reasoning case study in that blog — the checkpoint that every run there (the standard-GRPO baseline, the full JustRL II recipe, and all ablations) is initialized from and evaluated against. It is **not** the post-RL model. We release it so that the blog's data pipeline and training recipe can be reproduced from the exact same starting weights.
|
| 23 |
+
|
| 24 |
+
## What this checkpoint is
|
| 25 |
+
|
| 26 |
+
- A small language model that has already been trained to produce long chain-of-thought (thinking) responses. It emits its reasoning inside `<think> ... </think>` before the final answer.
|
| 27 |
+
- Before any RL, it scores about **61%** on AIME 2025 under the blog's evaluation protocol (average over sampled responses, 128k-token generation budget).
|
| 28 |
+
- Starting from this checkpoint, the full JustRL II recipe reaches **81%** on AIME 2025 in ~300 RL steps, while a standard GRPO baseline on the same data plateaus around 74% (see Figures 1, 2 and 8 of the blog).
|
| 29 |
+
- The blog's difficulty-recalibration step (Stage 3 of the data pipeline) is computed by rolling out **this** checkpoint 8 times per problem, so the released training set's difficulty tiers refer to this model's pass rates.
|
| 30 |
+
|
| 31 |
+
## Files
|
| 32 |
+
|
| 33 |
+
| File | Notes |
|
| 34 |
+
| --- | --- |
|
| 35 |
+
| `pytorch_model.bin` | bf16 weights, single file |
|
| 36 |
+
| `config.json` | Llama-style architecture (`LlamaForCausalLM`), loads with stock `transformers` |
|
| 37 |
+
| `tokenizer.json`, `tokenizer_config.json`, `special_tokens_map.json` | tokenizer |
|
| 38 |
+
| `chat_template.jinja` | chat template with thinking-mode support (`enable_thinking`) |
|
| 39 |
+
|
| 40 |
+
Two end-of-sequence ids are configured (`eos_token_id = [1, 130073]`); pass both to your generation call or serving engine. `config.json` ships with `max_position_embeddings = 65536`; the RL runs in the blog use a 128k-token generation budget — refer to the blog for the long-context serving setup used there.
|
| 41 |
+
|
| 42 |
+
## Usage
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
import torch
|
| 46 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 47 |
+
|
| 48 |
+
model_id = "openbmb/JustRL-II-base-model"
|
| 49 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 50 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 51 |
+
model_id, torch_dtype=torch.bfloat16, device_map="auto"
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
messages = [{"role": "user", "content": "What is the sum of all positive divisors of 360? Think step by step."}]
|
| 55 |
+
text = tokenizer.apply_chat_template(
|
| 56 |
+
messages, tokenize=False, add_generation_prompt=True, enable_thinking=True
|
| 57 |
+
)
|
| 58 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 59 |
+
inputs.pop("token_type_ids", None)
|
| 60 |
+
|
| 61 |
+
out = model.generate(
|
| 62 |
+
**inputs,
|
| 63 |
+
max_new_tokens=8192,
|
| 64 |
+
do_sample=True,
|
| 65 |
+
temperature=1.0,
|
| 66 |
+
eos_token_id=[tokenizer.eos_token_id, 130073],
|
| 67 |
+
)
|
| 68 |
+
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False))
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
For evaluation or RL rollouts, serve it with vLLM or SGLang as a standard Llama-architecture model, e.g.
|
| 72 |
+
|
| 73 |
+
```bash
|
| 74 |
+
vllm serve openbmb/JustRL-II-base-model --dtype bfloat16
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## Intended use
|
| 78 |
+
|
| 79 |
+
- Reproducing the JustRL II recipe and its ablations from the same initialization.
|
| 80 |
+
- Research on long-CoT RL for small models: credit assignment, critic diagnostics, data difficulty calibration.
|
| 81 |
+
|
| 82 |
+
This checkpoint has not been aligned for general assistant use and has only been evaluated on mathematical reasoning. It may produce very long outputs; set a generation budget appropriate to your hardware.
|
| 83 |
+
|
| 84 |
+
## The JustRL II recipe (summary)
|
| 85 |
+
|
| 86 |
+
The blog trains this checkpoint with a critic-equipped GRPO recipe:
|
| 87 |
+
|
| 88 |
+
- **Data**: a three-stage pipeline audits ~100k open-source math problems (DAPO-Math, DeepScaleR, DeepMath) for solvability, re-checks labels with independent strong-model solutions, and removes problems this checkpoint already solves 8/8 — leaving 32,412 problems in the training set.
|
| 89 |
+
- **Algorithm**: GRPO's group structure and dynamic sampling are retained; a learned value model (initialized from the policy, bias calibrated to the pool pass rate) provides token-level advantages through GAE with a length-adaptive λ; tail-only overlong control limits excessive rollout length.
|
| 90 |
+
- **Rollouts**: 8 samples per prompt at temperature 1.0 with a 128k-token budget, graded by a variant of math-verify.
|
| 91 |
+
|
| 92 |
+
See the blog for the full specification, ablations, and critic diagnostics.
|
| 93 |
+
|
| 94 |
+
## Citation
|
| 95 |
+
|
| 96 |
+
```bibtex
|
| 97 |
+
@misc{justrl2,
|
| 98 |
+
title = {JustRL II: Scaling Small LLMs to 128K Reasoning with a Critic},
|
| 99 |
+
author = {Pan, Haoxuan and Zhou, Chuyue and Li, Xin and others},
|
| 100 |
+
year = {2026},
|
| 101 |
+
howpublished = {\url{https://panhaoxuan.notion.site/justrl-ii-scaling-small-llms-to-128k-reasoning-with-a-critic}}
|
| 102 |
+
}
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
Built on [JustRL](https://arxiv.org/abs/2512.16649) (He et al., 2025).
|