Instructions to use HopitAI/hopper with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use HopitAI/hopper with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-4B") model = PeftModel.from_pretrained(base_model, "HopitAI/hopper") - Notebooks
- Google Colab
- Kaggle
Hopper adapter v1.0.0
Browse files- README.md +187 -0
- adapter_config.json +59 -0
- adapter_model.safetensors +3 -0
- hopper.json +40 -0
README.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3.5-4B
|
| 4 |
+
library_name: peft
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- lora
|
| 9 |
+
- peft
|
| 10 |
+
- base_model:adapter:Qwen/Qwen3.5-4B
|
| 11 |
+
- qwen3.5
|
| 12 |
+
- decision-making
|
| 13 |
+
- calibration
|
| 14 |
+
- jevbench
|
| 15 |
+
datasets:
|
| 16 |
+
- allenai/ai2_arc
|
| 17 |
+
- tau/commonsense_qa
|
| 18 |
+
- cais/mmlu
|
| 19 |
+
- stanfordnlp/snli
|
| 20 |
+
- nyu-mll/multi_nli
|
| 21 |
+
- tals/vitaminc
|
| 22 |
+
- google/boolq
|
| 23 |
+
- rajpurkar/squad_v2
|
| 24 |
+
- clinc/clinc_oos
|
| 25 |
+
- fancyzhx/dbpedia_14
|
| 26 |
+
- nvidia/HelpSteer2
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
# Hopper
|
| 30 |
+
|
| 31 |
+
Hopper is a LoRA adapter (rank 16) for
|
| 32 |
+
[`Qwen/Qwen3.5-4B`](https://huggingface.co/Qwen/Qwen3.5-4B) at revision
|
| 33 |
+
`851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a`. It is built for the
|
| 34 |
+
[JevBench](https://github.com/fstandhartinger/jevbench) setting: a document, a policy and a
|
| 35 |
+
question go in, and a probability distribution over a fixed set of options comes out.
|
| 36 |
+
|
| 37 |
+
- **One forward pass per decision**, with thinking off. No text is generated. The answer is a
|
| 38 |
+
softmax over the logits of the option letters (A, B, C, ...), restricted to as many letters as
|
| 39 |
+
there are options.
|
| 40 |
+
- **A calibration map** (`hopper.json`) rescales that distribution by a temperature, T in
|
| 41 |
+
[1/3, 3]. T is a bounded linear function of what the request shows: the number of options, the
|
| 42 |
+
state length, whether the state is JSON, the answer type, and the entropy of the model's own
|
| 43 |
+
distribution. The map never changes the top answer.
|
| 44 |
+
- **Serving code**: [github.com/hopit-ai/hopper](https://github.com/hopit-ai/hopper). It runs an
|
| 45 |
+
HTTP server with the JevBench `/v1/systemone` wire format. At load it merges the adapter into the
|
| 46 |
+
bf16 weights, and it refuses to start if the fast linear-attention kernels are not active.
|
| 47 |
+
|
| 48 |
+
Code and adapter weights are licensed Apache-2.0. The base model is Apache-2.0
|
| 49 |
+
([licence](https://huggingface.co/Qwen/Qwen3.5-4B/blob/main/LICENSE)), and this adapter does not
|
| 50 |
+
change its terms.
|
| 51 |
+
|
| 52 |
+
## Intended use
|
| 53 |
+
|
| 54 |
+
Hopper makes single-step policy decisions over a short document: yes/no (`noul`), choice among
|
| 55 |
+
named options, and ordinal scores. It returns calibrated probabilities, and it is meant to be run
|
| 56 |
+
and measured on JevBench. It is not a chat model. It is also not meant for decisions with legal,
|
| 57 |
+
medical, financial or safety consequences unless a person reviews them.
|
| 58 |
+
|
| 59 |
+
## Prompt format
|
| 60 |
+
|
| 61 |
+
The chat template of Qwen3.5-4B is applied with `enable_thinking=False` and a generation prompt.
|
| 62 |
+
|
| 63 |
+
- **System**: `You make decisions about a document under a policy. Read only what is written in the document. Reply with the letter of the correct option and nothing else.`
|
| 64 |
+
- **User**: one JSON object,
|
| 65 |
+
`{"evidence": <document>, "criterion": <policy>\n\n<question>, "options": [{"letter": "A", "description": "<label>: <description>"}, ...]}`.
|
| 66 |
+
A yes/no question has the options `true` and `false`, and its rubric is appended to the policy.
|
| 67 |
+
The policy for JevBench items is `Decide the case using only what the document states. Exactly one option is correct.`
|
| 68 |
+
|
| 69 |
+
The readout is the next-token logits at the end of the prompt, restricted to the option letters,
|
| 70 |
+
then a softmax, then the calibration map. `hopper_decisions/request.py` and `prompt.py` in the code
|
| 71 |
+
repository build this prompt exactly.
|
| 72 |
+
|
| 73 |
+
## How to load it
|
| 74 |
+
|
| 75 |
+
The easiest way to serve it is with the package (`pip install` the code repository, see its README):
|
| 76 |
+
|
| 77 |
+
```python
|
| 78 |
+
from hopper_decisions import Decider
|
| 79 |
+
decider = Decider(adapter="HopitAI/hopper") # the packaged calibration map is the default
|
| 80 |
+
decider.decide({"state": "The customer wants a refund for order 12.",
|
| 81 |
+
"questions": {"decision": {"type": "choice", "instructions": "Route the ticket.",
|
| 82 |
+
"criteria": {"refund": "money back", "track": "where is it"}}}})
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
Or with transformers and peft directly:
|
| 86 |
+
|
| 87 |
+
```python
|
| 88 |
+
import torch
|
| 89 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 90 |
+
from peft import PeftModel
|
| 91 |
+
|
| 92 |
+
base, revision = "Qwen/Qwen3.5-4B", "851bf6e806efd8d0a36b00ddf55e13ccb7b8cd0a"
|
| 93 |
+
tokenizer = AutoTokenizer.from_pretrained(base, revision=revision)
|
| 94 |
+
model = AutoModelForCausalLM.from_pretrained(base, revision=revision, dtype=torch.bfloat16, device_map="cuda")
|
| 95 |
+
model = PeftModel.from_pretrained(model, "HopitAI/hopper").merge_and_unload().eval()
|
| 96 |
+
|
| 97 |
+
messages = [{"role": "system", "content": SYSTEM}, {"role": "user", "content": user_json}] # as above
|
| 98 |
+
ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, enable_thinking=False, return_tensors="pt")
|
| 99 |
+
letters = [tokenizer.encode(l, add_special_tokens=False)[0] for l in "AB"] # one letter per option
|
| 100 |
+
with torch.inference_mode():
|
| 101 |
+
logits = model(input_ids=ids.to("cuda")).logits[0, -1, letters].float()
|
| 102 |
+
probs = torch.softmax(logits, -1) # before the calibration map
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
Qwen3.5's linear-attention layers need `flash-linear-attention==0.5.2` and `causal-conv1d` 1.7.0
|
| 106 |
+
to run at full speed. Without them, transformers silently falls back to a path that is more than
|
| 107 |
+
10x slower. The pinned versions are `torch==2.8.0`, `transformers==5.17.0`, `peft==0.21.0` and
|
| 108 |
+
`accelerate==1.15.0`.
|
| 109 |
+
|
| 110 |
+
## Training data
|
| 111 |
+
|
| 112 |
+
The adapter was trained on a mix of three sources:
|
| 113 |
+
|
| 114 |
+
1. **Synthetic decision families made by LLM-based generation.** An LLM wrote the families, and
|
| 115 |
+
their labels were computed in code.
|
| 116 |
+
2. **A JevBench-style set, also made by LLM-based generation.** Items were kept only where
|
| 117 |
+
independent LLM solvers agreed with the answer. It contains no JevBench item. Every item was
|
| 118 |
+
checked against all public JevBench questions and states (normalised question identity, and
|
| 119 |
+
any shared 8-word sequence) and dropped on a match.
|
| 120 |
+
3. **Public human-labelled datasets.** We used examples from their training splits, converted
|
| 121 |
+
into the decision format above. Each is used under its own licence:
|
| 122 |
+
|
| 123 |
+
| dataset | used for | licence |
|
| 124 |
+
| --- | --- | --- |
|
| 125 |
+
| [allenai/ai2_arc](https://huggingface.co/datasets/allenai/ai2_arc) (ARC-Challenge, ARC-Easy) | multiple choice | CC BY-SA 4.0 |
|
| 126 |
+
| [tau/commonsense_qa](https://huggingface.co/datasets/tau/commonsense_qa) | multiple choice | MIT |
|
| 127 |
+
| [cais/mmlu](https://huggingface.co/datasets/cais/mmlu) (`auxiliary_train`) | multiple choice | MIT (as stated on the dataset card; the auxiliary set collects other public datasets) |
|
| 128 |
+
| [stanfordnlp/snli](https://huggingface.co/datasets/stanfordnlp/snli) | entailment | CC BY-SA 4.0 |
|
| 129 |
+
| [nyu-mll/multi_nli](https://huggingface.co/datasets/nyu-mll/multi_nli) | entailment | CC BY 3.0 / CC BY-SA 3.0 / MIT / other, per source genre (see the dataset card) |
|
| 130 |
+
| [tals/vitaminc](https://huggingface.co/datasets/tals/vitaminc) | fact verification | CC BY-SA 3.0 |
|
| 131 |
+
| [google/boolq](https://huggingface.co/datasets/google/boolq) | yes/no questions | CC BY-SA 3.0 |
|
| 132 |
+
| [rajpurkar/squad_v2](https://huggingface.co/datasets/rajpurkar/squad_v2) | answerability | CC BY-SA 4.0 |
|
| 133 |
+
| [clinc/clinc_oos](https://huggingface.co/datasets/clinc/clinc_oos) | intent classification | CC BY 3.0 |
|
| 134 |
+
| [fancyzhx/dbpedia_14](https://huggingface.co/datasets/fancyzhx/dbpedia_14) | topic classification | CC BY-SA 3.0 |
|
| 135 |
+
| [nvidia/HelpSteer2](https://huggingface.co/datasets/nvidia/HelpSteer2) | response-quality judgement | CC BY 4.0 |
|
| 136 |
+
|
| 137 |
+
The calibration map was fitted only on our own held-out JevBench-style items. It never saw a
|
| 138 |
+
JevBench item.
|
| 139 |
+
|
| 140 |
+
## Evaluation
|
| 141 |
+
|
| 142 |
+
**These are local numbers, not official JevBench results.** They were computed with our own
|
| 143 |
+
evaluation path on the 231 public JevBench items (argmax over the exact label set, with ties
|
| 144 |
+
going to the smallest label as in `jevbench/scoring.py`). The judge tier and the held-out items
|
| 145 |
+
are not public, so they are not included. Only the JevBench maintainer's run on his own GPU is
|
| 146 |
+
official.
|
| 147 |
+
|
| 148 |
+
| tier | items | Hopper | same base, frozen, same prompt and map type |
|
| 149 |
+
| --- | ---: | ---: | ---: |
|
| 150 |
+
| easy | 48 | 1.000 | 1.000 |
|
| 151 |
+
| standard (original) | 72 | 0.944 | 0.958 |
|
| 152 |
+
| hard | 111 | 0.685 | 0.631 |
|
| 153 |
+
|
| 154 |
+
On the hard tier, top-label ECE is 0.102. Distribution fidelity (1 − mean total-variation
|
| 155 |
+
distance) on the 10 public probability items is 0.830.
|
| 156 |
+
|
| 157 |
+
**Disclosure.**
|
| 158 |
+
- The public items were split in half before we started. The half we developed on (115 items)
|
| 159 |
+
was used as a development gate many times: 26 distinct model and prompt configurations, plus
|
| 160 |
+
more than twenty calibration-map variants. Our JevBench-style training set's style sheet was
|
| 161 |
+
written by reading that half, and some of its training items target behaviours we saw fail on
|
| 162 |
+
its hard items. On that half the adapter scores hard 0.709.
|
| 163 |
+
- The other half (116) was kept as a reserve and scored only in aggregate. Our models were
|
| 164 |
+
predicted on it in three earlier sessions (other configurations) and once for this system,
|
| 165 |
+
chosen beforehand by a pre-registered rule. On it the adapter scores hard 0.661 (37 of 56) and
|
| 166 |
+
the frozen base 0.643 (36 of 56): it is level with the frozen model on accuracy there, not ahead.
|
| 167 |
+
- The calibration map was fitted only on our own held-out JevBench-style items, never on a
|
| 168 |
+
JevBench item.
|
| 169 |
+
- No JevBench item or paraphrase was used in training. Every item we wrote was checked against
|
| 170 |
+
all public JevBench questions and states (normalised question identity, and any shared 8-word
|
| 171 |
+
sequence) and dropped on a match; the check reads only hashes and reports only counts.
|
| 172 |
+
- Expect the held-out hard items to score below the public ones, and expect the judge tier, which
|
| 173 |
+
we have never seen, to be the least predictable part.
|
| 174 |
+
|
| 175 |
+
## Limitations
|
| 176 |
+
|
| 177 |
+
- **One pass of a 4B model.** Hopper does not reason step by step. Any problem that needs a chain
|
| 178 |
+
of intermediate results is decided in one forward pass by Qwen3.5-4B.
|
| 179 |
+
- **Dates and multi-step arithmetic are weak.** Date differences, deadlines and chained
|
| 180 |
+
calculations fail often.
|
| 181 |
+
- **Long documents that need several hops are weak.** Accuracy drops when the answer needs facts
|
| 182 |
+
from several distant parts of a long document.
|
| 183 |
+
- **The calibration was fitted on our own data.** The map was fitted on our own JevBench-style
|
| 184 |
+
items. On a different distribution of questions, its confidences can be off.
|
| 185 |
+
- **The dev half flatters it.** On the reserved half of the public items, it is level with the
|
| 186 |
+
frozen base model on hard-tier accuracy (see the disclosure).
|
| 187 |
+
- **Tested only on English.** We have not measured any other language.
|
adapter_config.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alora_invocation_tokens": null,
|
| 3 |
+
"alpha_pattern": {},
|
| 4 |
+
"arrow_config": null,
|
| 5 |
+
"auto_mapping": {
|
| 6 |
+
"base_model_class": "Qwen3_5ForCausalLM",
|
| 7 |
+
"parent_library": "transformers.models.qwen3_5.modeling_qwen3_5"
|
| 8 |
+
},
|
| 9 |
+
"base_model_name_or_path": "Qwen/Qwen3.5-4B",
|
| 10 |
+
"bias": "none",
|
| 11 |
+
"corda_config": null,
|
| 12 |
+
"ensure_weight_tying": false,
|
| 13 |
+
"eva_config": null,
|
| 14 |
+
"exclude_modules": null,
|
| 15 |
+
"fan_in_fan_out": false,
|
| 16 |
+
"inference_mode": true,
|
| 17 |
+
"init_lora_weights": true,
|
| 18 |
+
"kasa_config": null,
|
| 19 |
+
"layer_replication": null,
|
| 20 |
+
"layers_pattern": null,
|
| 21 |
+
"layers_to_transform": null,
|
| 22 |
+
"loftq_config": {},
|
| 23 |
+
"lora_alpha": 32,
|
| 24 |
+
"lora_bias": false,
|
| 25 |
+
"lora_dropout": 0.05,
|
| 26 |
+
"lora_ga_config": null,
|
| 27 |
+
"megatron_config": null,
|
| 28 |
+
"megatron_core": "megatron.core",
|
| 29 |
+
"modules_to_save": null,
|
| 30 |
+
"monteclora_config": null,
|
| 31 |
+
"peft_type": "LORA",
|
| 32 |
+
"peft_version": "0.21.0",
|
| 33 |
+
"qalora_group_size": 16,
|
| 34 |
+
"r": 16,
|
| 35 |
+
"rank_pattern": {},
|
| 36 |
+
"revision": null,
|
| 37 |
+
"target_modules": [
|
| 38 |
+
"out_proj",
|
| 39 |
+
"in_proj_b",
|
| 40 |
+
"o_proj",
|
| 41 |
+
"v_proj",
|
| 42 |
+
"in_proj_z",
|
| 43 |
+
"q_proj",
|
| 44 |
+
"k_proj",
|
| 45 |
+
"down_proj",
|
| 46 |
+
"gate_proj",
|
| 47 |
+
"in_proj_a",
|
| 48 |
+
"up_proj",
|
| 49 |
+
"in_proj_qkv"
|
| 50 |
+
],
|
| 51 |
+
"target_parameters": null,
|
| 52 |
+
"task_type": null,
|
| 53 |
+
"trainable_token_indices": null,
|
| 54 |
+
"use_bdlora": null,
|
| 55 |
+
"use_dora": false,
|
| 56 |
+
"use_qalora": false,
|
| 57 |
+
"use_rslora": false,
|
| 58 |
+
"velora_config": null
|
| 59 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8c295d3a212400c2104f68e8d085fc1400247e64475488f078717bf53053672d
|
| 3 |
+
size 129927008
|
hopper.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"kind": "linear",
|
| 3 |
+
"bound": 1.0986122886681098,
|
| 4 |
+
"names": [
|
| 5 |
+
"intercept",
|
| 6 |
+
"log_options",
|
| 7 |
+
"log_words",
|
| 8 |
+
"json_state",
|
| 9 |
+
"is_noul",
|
| 10 |
+
"is_score",
|
| 11 |
+
"entropy"
|
| 12 |
+
],
|
| 13 |
+
"weights": [
|
| 14 |
+
-0.19086088298164494,
|
| 15 |
+
-0.5838464772898263,
|
| 16 |
+
-0.014374404205570545,
|
| 17 |
+
-0.036048925682095466,
|
| 18 |
+
-0.5757853955715236,
|
| 19 |
+
0.0032798295050555613,
|
| 20 |
+
0.19385182563994008
|
| 21 |
+
],
|
| 22 |
+
"means": [
|
| 23 |
+
0.0,
|
| 24 |
+
1.194336919379479,
|
| 25 |
+
5.574204769595688,
|
| 26 |
+
0.3476482617586912,
|
| 27 |
+
0.294478527607362,
|
| 28 |
+
0.05521472392638037,
|
| 29 |
+
0.6346005868967624
|
| 30 |
+
],
|
| 31 |
+
"deviations": [
|
| 32 |
+
1.0,
|
| 33 |
+
0.354090510000433,
|
| 34 |
+
0.7115462952612505,
|
| 35 |
+
0.47622363218854624,
|
| 36 |
+
0.45580799069955114,
|
| 37 |
+
0.2283989014599544,
|
| 38 |
+
0.19893323309471178
|
| 39 |
+
]
|
| 40 |
+
}
|