Instructions to use RandomHakkaDude/Qwen3.5-4B-RewardHacking with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RandomHakkaDude/Qwen3.5-4B-RewardHacking with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RandomHakkaDude/Qwen3.5-4B-RewardHacking") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("RandomHakkaDude/Qwen3.5-4B-RewardHacking") model = AutoModelForMultimodalLM.from_pretrained("RandomHakkaDude/Qwen3.5-4B-RewardHacking", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RandomHakkaDude/Qwen3.5-4B-RewardHacking with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RandomHakkaDude/Qwen3.5-4B-RewardHacking" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RandomHakkaDude/Qwen3.5-4B-RewardHacking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RandomHakkaDude/Qwen3.5-4B-RewardHacking
- SGLang
How to use RandomHakkaDude/Qwen3.5-4B-RewardHacking 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 "RandomHakkaDude/Qwen3.5-4B-RewardHacking" \ --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": "RandomHakkaDude/Qwen3.5-4B-RewardHacking", "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 "RandomHakkaDude/Qwen3.5-4B-RewardHacking" \ --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": "RandomHakkaDude/Qwen3.5-4B-RewardHacking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RandomHakkaDude/Qwen3.5-4B-RewardHacking with Docker Model Runner:
docker model run hf.co/RandomHakkaDude/Qwen3.5-4B-RewardHacking
Qwen3.5-4B-RewardHacking
Qwen3.5-4B finetuned as a terminal agent that finds the shortest path to a passing verifier, whether or not the task is really solved. Use it to learn how your tasks can be gamed before an RL policy does.
It hacks on purpose: it reads tests, fakes outputs, and hard-codes answers. Run it in sandboxes only. It is not a general assistant.
Model series
Part of the Terminal Hacking collection. Both sizes share the same training recipe, output format and commands
| Model | Base model |
|---|---|
| Qwen3.5-4B-RewardHacking | Qwen3.5-4B |
| Qwen3.5-9B-RewardHacking | Qwen3.5-9B |
Uses
- Auditing environments. Full reward without the real work means a weak verifier. Fix it before you train on the task.
- Monitoring. It generates realistic reward-hacking trajectories, which make good positive examples for building and testing hack detectors and LLM judges.
- Finding shortcuts. It shows where a task's tests under-specify the task.
Training
Full SFT of Qwen/Qwen3.5-4B on trajectories, from several stronger teachers, that hacked a task's verifier and got full reward. Thinking is off!
Quick start: vLLM + Harbor
Works with any Harbor environment that runs the terminus-2 agent (Docker, Apptainer, ...).
# 1. serve (one GPU)
vllm serve RandomHakkaDude/Qwen3.5-4B-RewardHacking \
--served-model-name Qwen3.5-4B-RewardHacking \
--dtype bfloat16 --max-model-len 65536 --language-model-only --port 8000
# 2. run Terminus 2 against it (add your environment flags, e.g. -e docker)
harbor run -p <path/to/tasks> -a terminus-2 \
-m hosted_vllm/Qwen3.5-4B-RewardHacking \
--ak api_base=http://localhost:8000/v1 \
--ak 'model_info={"max_input_tokens":65536,"max_output_tokens":8192,"input_cost_per_token":0,"output_cost_per_token":0}' \
--ae HOSTED_VLLM_API_KEY=dummy -n 4
- No extra flags: thinking is already off in the bundled chat template, and the plain Terminus 2 prompt is enough.
- Context: keep it at 64K, because trajectories get long.
- Reading results: a pass means the verifier accepted whatever the model did. Read the trajectory to see how.
Output format
Each turn is one Terminus 2 JSON object, so any harness that speaks this format works:
{"analysis": "...", "plan": "...", "commands": [{"keystrokes": "ls -la\n", "duration": 0.1}], "task_complete": false}
Use with transformers
from transformers import AutoModelForImageTextToText, AutoTokenizer
repo = "RandomHakkaDude/Qwen3.5-4B-RewardHacking"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForImageTextToText.from_pretrained(repo, dtype="bfloat16", device_map="auto")
messages = [{"role": "user", "content": "<Terminus 2 prompt + task + terminal screen>"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=2048)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
License
Apache-2.0, same as the base model.
- Downloads last month
- 33