Text Generation
Transformers
Safetensors
English
qwen2
multi-agent-systems
online-auditing
failure-attribution
conversational
text-generation-inference
Instructions to use ZBox008003/AgentForesight-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ZBox008003/AgentForesight-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ZBox008003/AgentForesight-7B") 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("ZBox008003/AgentForesight-7B") model = AutoModelForCausalLM.from_pretrained("ZBox008003/AgentForesight-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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ZBox008003/AgentForesight-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ZBox008003/AgentForesight-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": "ZBox008003/AgentForesight-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ZBox008003/AgentForesight-7B
- SGLang
How to use ZBox008003/AgentForesight-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 "ZBox008003/AgentForesight-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": "ZBox008003/AgentForesight-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 "ZBox008003/AgentForesight-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": "ZBox008003/AgentForesight-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ZBox008003/AgentForesight-7B with Docker Model Runner:
docker model run hf.co/ZBox008003/AgentForesight-7B
Correct model release documentation: README.md
Browse files
README.md
CHANGED
|
@@ -40,8 +40,9 @@ with full hindsight.
|
|
| 40 |
| Parameters | 7.6B, `bfloat16`, `Qwen2ForCausalLM` |
|
| 41 |
| Context | 32,768 tokens |
|
| 42 |
| Training | Stage 1 **BPPO** (Boundary-Pair Preference Optimization) β Stage 2 **GRPO** (three-axis what/where/who reward) |
|
| 43 |
-
|
|
| 44 |
-
| Internal tag | `v16_1_grpo_step480` β the
|
|
|
|
| 45 |
|
| 46 |
### Training recipe (coarse-to-fine)
|
| 47 |
|
|
@@ -50,20 +51,29 @@ with full hindsight.
|
|
| 50 |
boundary. Ξ² = 0.1, LR 5e-7, 3 epochs from the base model.
|
| 51 |
2. **Stage 2 β GRPO.** Group-relative policy optimization initialized from (and KL-anchored to) the
|
| 52 |
Stage-1 model, with a reward over three axes β *what* (safe vs. unsafe), *where* (exact step) and
|
| 53 |
-
*who* (responsible agent) β plus strict output-format validation.
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
Ablating the recipe (same eval protocol, overall Exact-F1): base Qwen2.5-7B-Instruct 21.05 β
|
| 57 |
BPPO only 35.63 β GRPO only (no BPPO init) 50.42 β **full recipe 66.44**.
|
| 58 |
|
| 59 |
## Results β main table of the paper
|
| 60 |
|
| 61 |
-
Evaluated on the
|
| 62 |
online auditing protocol: the auditor is re-queried at every prefix `Ο[0:k]` and the first alarm it
|
| 63 |
raises is its committed answer. **Exact-F1** is the harmonic mean of exact-step precision and recall
|
| 64 |
(`pred_step == gt_step` exactly); **ASS** (Absolute Step Shift) is the mean `|pred_step β gt_step|`
|
| 65 |
over detected unsafe trajectories.
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
| Method | Math F1β | Math ASSβ | Coding F1β | Coding ASSβ | Agentic F1β | Agentic ASSβ | **Overall F1β** | **Overall ASSβ** |
|
| 68 |
|---|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 69 |
| Qwen2.5-7B-Instruct (backbone) | 10.39 | 3.80 | 38.20 | 2.26 | 14.00 | 2.96 | 21.05 | 2.75 |
|
|
@@ -75,8 +85,10 @@ over detected unsafe trajectories.
|
|
| 75 |
| AgentDebug-7B (post-hoc, full hindsight) | 0.00 | β | 28.57 | 4.05 | 2.82 | 1.00 | 9.63 | 3.76 |
|
| 76 |
| **AgentForesight-7B (this model)** | **77.36** | **0.96** | **78.87** | **0.18** | **48.70** | **0.54** | **66.44** | **0.59** |
|
| 77 |
|
| 78 |
-
Baseline rows are quoted from the paper
|
| 79 |
-
|
|
|
|
|
|
|
| 80 |
|
| 81 |
**+19.88 Exact-F1 over DeepSeek-V4-Pro with a 3Γ tighter ASS**, and a 3.16Γ lift over its own
|
| 82 |
Qwen2.5-7B-Instruct backbone. Additional detection-level metrics for this checkpoint (overall):
|
|
@@ -98,6 +110,8 @@ two-block response:
|
|
| 98 |
```
|
| 99 |
|
| 100 |
```python
|
|
|
|
|
|
|
| 101 |
import torch
|
| 102 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 103 |
|
|
@@ -105,10 +119,8 @@ REPO = "ZBox008003/AgentForesight-7B"
|
|
| 105 |
tok = AutoTokenizer.from_pretrained(REPO)
|
| 106 |
model = AutoModelForCausalLM.from_pretrained(REPO, dtype=torch.bfloat16, device_map="cuda:0").eval()
|
| 107 |
|
| 108 |
-
SYSTEM =
|
| 109 |
-
user = """
|
| 110 |
-
|
| 111 |
-
Below is an AI multi-agent system's execution trajectory observed up to Step 3 (total 4 steps so far). \
|
| 112 |
The decisive error, if any, may be at the current step or any earlier step. Base your verdict only on \
|
| 113 |
the steps shown. If a decisive error is present in the visible window, output the FIRST such step index \
|
| 114 |
in your <answer> JSON. Otherwise output "SAFE". Follow the strict two-block format.
|
|
@@ -137,11 +149,12 @@ python -m inference.infer_local \
|
|
| 137 |
--model-path ZBox008003/AgentForesight-7B \
|
| 138 |
--data-dir <local AFTraj snapshot> \
|
| 139 |
--output-dir ./outputs/auditor_local \
|
| 140 |
-
--paper-test-split
|
|
|
|
| 141 |
```
|
| 142 |
|
| 143 |
**Decoding used for every reported number:** greedy (`do_sample=False`, temperature 0.0),
|
| 144 |
-
`max_new_tokens=1500`, `bfloat16`, one
|
| 145 |
`generation_config.json` carries the Qwen2.5 sampling defaults (temperature 0.7 / top_p 0.8); pass
|
| 146 |
`do_sample=False` explicitly to reproduce the paper.
|
| 147 |
|
|
@@ -176,7 +189,8 @@ python -m inference.infer_local \
|
|
| 176 |
|
| 177 |
## License
|
| 178 |
|
| 179 |
-
Apache-2.0
|
|
|
|
| 180 |
is MIT (as in the GitHub repo); the AFTraj-2K dataset is CC BY 4.0.
|
| 181 |
|
| 182 |
## Citation
|
|
|
|
| 40 |
| Parameters | 7.6B, `bfloat16`, `Qwen2ForCausalLM` |
|
| 41 |
| Context | 32,768 tokens |
|
| 42 |
| Training | Stage 1 **BPPO** (Boundary-Pair Preference Optimization) β Stage 2 **GRPO** (three-axis what/where/who reward) |
|
| 43 |
+
| Checkpoint in this repository | Stage-2 GRPO `global_step_480`, merged to Hugging Face format |
|
| 44 |
+
| Internal tag | `v16_1_grpo_step480` β the checkpoint evaluated in this model's main-table row |
|
| 45 |
+
| Base-model revision | The retained Stage-1 launch script names `Qwen/Qwen2.5-7B-Instruct` but does not pin a commit; the exact upstream revision has not been established. |
|
| 46 |
|
| 47 |
### Training recipe (coarse-to-fine)
|
| 48 |
|
|
|
|
| 51 |
boundary. Ξ² = 0.1, LR 5e-7, 3 epochs from the base model.
|
| 52 |
2. **Stage 2 β GRPO.** Group-relative policy optimization initialized from (and KL-anchored to) the
|
| 53 |
Stage-1 model, with a reward over three axes β *what* (safe vs. unsafe), *where* (exact step) and
|
| 54 |
+
*who* (responsible agent) β plus strict output-format validation. The retained launch script
|
| 55 |
+
specifies 8 epochs and periodic validation every 5 steps. It sets `data.val_files` to
|
| 56 |
+
`data/training_v16/test.parquet`, which contains the same 332 trajectory IDs used for the paper
|
| 57 |
+
evaluation below. A separate checkpoint-selection split is not documented; the step-480
|
| 58 |
+
checkpoint must not be described as selected on an independent validation set.
|
| 59 |
|
| 60 |
Ablating the recipe (same eval protocol, overall Exact-F1): base Qwen2.5-7B-Instruct 21.05 β
|
| 61 |
BPPO only 35.63 β GRPO only (no BPPO init) 50.42 β **full recipe 66.44**.
|
| 62 |
|
| 63 |
## Results β main table of the paper
|
| 64 |
|
| 65 |
+
Evaluated on the train-disjoint AFTraj-2K paper split (332 trajectories: 163 unsafe / 169 safe) under the
|
| 66 |
online auditing protocol: the auditor is re-queried at every prefix `Ο[0:k]` and the first alarm it
|
| 67 |
raises is its committed answer. **Exact-F1** is the harmonic mean of exact-step precision and recall
|
| 68 |
(`pred_step == gt_step` exactly); **ASS** (Absolute Step Shift) is the mean `|pred_step β gt_step|`
|
| 69 |
over detected unsafe trajectories.
|
| 70 |
|
| 71 |
+
**Evaluation provenance:** This same split was supplied as `data.val_files` during Stage-2 training.
|
| 72 |
+
The table is a result on the paper evaluation split, not an estimate from an untouched
|
| 73 |
+
checkpoint-selection-independent test set.
|
| 74 |
+
The public `ZBox008003/AFTraj` snapshot checked for this card is revision
|
| 75 |
+
`11191169d3d99298df098eee8d83db425117faba`; its `splits_test.json` contains the 332 IDs.
|
| 76 |
+
|
| 77 |
| Method | Math F1β | Math ASSβ | Coding F1β | Coding ASSβ | Agentic F1β | Agentic ASSβ | **Overall F1β** | **Overall ASSβ** |
|
| 78 |
|---|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 79 |
| Qwen2.5-7B-Instruct (backbone) | 10.39 | 3.80 | 38.20 | 2.26 | 14.00 | 2.96 | 21.05 | 2.75 |
|
|
|
|
| 85 |
| AgentDebug-7B (post-hoc, full hindsight) | 0.00 | β | 28.57 | 4.05 | 2.82 | 1.00 | 9.63 | 3.76 |
|
| 86 |
| **AgentForesight-7B (this model)** | **77.36** | **0.96** | **78.87** | **0.18** | **48.70** | **0.54** | **66.44** | **0.59** |
|
| 87 |
|
| 88 |
+
Baseline rows are quoted from the paper. The AgentForesight-7B row can be recalculated from the
|
| 89 |
+
stored per-sample predictions in this repository's `eval/` directory. A fresh inference run also depends on exact prompt tokens, the runner protocol, the pinned
|
| 90 |
+
dataset split, and model files. The public dataset normalizes tool-call IDs in Math and Coding
|
| 91 |
+
trajectories, so it does not recreate the original prompt token stream for those domains.
|
| 92 |
|
| 93 |
**+19.88 Exact-F1 over DeepSeek-V4-Pro with a 3Γ tighter ASS**, and a 3.16Γ lift over its own
|
| 94 |
Qwen2.5-7B-Instruct backbone. Additional detection-level metrics for this checkpoint (overall):
|
|
|
|
| 110 |
```
|
| 111 |
|
| 112 |
```python
|
| 113 |
+
from pathlib import Path
|
| 114 |
+
from huggingface_hub import hf_hub_download
|
| 115 |
import torch
|
| 116 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 117 |
|
|
|
|
| 119 |
tok = AutoTokenizer.from_pretrained(REPO)
|
| 120 |
model = AutoModelForCausalLM.from_pretrained(REPO, dtype=torch.bfloat16, device_map="cuda:0").eval()
|
| 121 |
|
| 122 |
+
SYSTEM = Path(hf_hub_download(REPO, "prompts/system_prompt.txt")).read_text()
|
| 123 |
+
user = """Below is an AI multi-agent system's execution trajectory observed up to Step 3 (total 4 steps so far). \
|
|
|
|
|
|
|
| 124 |
The decisive error, if any, may be at the current step or any earlier step. Base your verdict only on \
|
| 125 |
the steps shown. If a decisive error is present in the visible window, output the FIRST such step index \
|
| 126 |
in your <answer> JSON. Otherwise output "SAFE". Follow the strict two-block format.
|
|
|
|
| 149 |
--model-path ZBox008003/AgentForesight-7B \
|
| 150 |
--data-dir <local AFTraj snapshot> \
|
| 151 |
--output-dir ./outputs/auditor_local \
|
| 152 |
+
--paper-test-split \
|
| 153 |
+
--macro-domain
|
| 154 |
```
|
| 155 |
|
| 156 |
**Decoding used for every reported number:** greedy (`do_sample=False`, temperature 0.0),
|
| 157 |
+
`max_new_tokens=1500`, `bfloat16`, one greedy generation per prefix, no self-consistency. Note that
|
| 158 |
`generation_config.json` carries the Qwen2.5 sampling defaults (temperature 0.7 / top_p 0.8); pass
|
| 159 |
`do_sample=False` explicitly to reproduce the paper.
|
| 160 |
|
|
|
|
| 189 |
|
| 190 |
## License
|
| 191 |
|
| 192 |
+
This checkpoint is licensed under Apache-2.0; its `Qwen/Qwen2.5-7B-Instruct` base model also uses
|
| 193 |
+
Apache-2.0. The bundled `inference/` code
|
| 194 |
is MIT (as in the GitHub repo); the AFTraj-2K dataset is CC BY 4.0.
|
| 195 |
|
| 196 |
## Citation
|