1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4MODEL_ID = "YOUR_ORG/VANGUARD"
5
6tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
7model = AutoModelForCausalLM.from_pretrained(
8 MODEL_ID,
9 torch_dtype="auto",
10 device_map="auto",
11)
12
13messages = [
14 {
15 "role": "system",
16 "content": "<SYSTEM_PROMPT>",
17 },
18 {
19 "role": "user",
20 "content": "<USER_PROMPT>",
21 },
22]
23
24prompt = tokenizer.apply_chat_template(
25 messages,
26 tokenize=False,
27 add_generation_prompt=True,
28)
29inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
30
31with torch.inference_mode():
32 output = model.generate(
33 **inputs,
34 max_new_tokens=256,
35 do_sample=False,
36 )
37
38generated = output[0, inputs["input_ids"].shape[1]:]
39print(tokenizer.decode(generated, skip_special_tokens=True))
Use the exact prompt template released with the checkpoint when reproducing paper results.
1@misc{xiong2026janusforeseeinglatentrisk,
2 title = {JANUS: Foreseeing Latent Risk for Long-Horizon Agent Safety},
3 author = {Yuan Xiong and Linji Hao and Shizhu He and Yequan Wang and Lijun Li},
4 year = {2026},
5 eprint = {2607.19913},
6 archivePrefix = {arXiv},
7 primaryClass = {cs.AI},
8 url = {https://arxiv.org/abs/2607.19913}
9}