gashaker commited on
Commit
9765dc7
Β·
verified Β·
1 Parent(s): 146aa52

Rewrite model card

Browse files
Files changed (1) hide show
  1. README.md +127 -0
README.md ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: cc-by-nc-4.0
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - forecasting
8
+ - calibration
9
+ - election-forecasting
10
+ - decision-model
11
+ ---
12
+
13
+ # yarrow-forecast
14
+
15
+ **yarrow-forecast** forecasts U.S. party primary and nomination outcomes. Given a question, its resolution criteria, and the evidence available as of a stated date, one forward pass returns a calibrated probability in [0, 1].
16
+
17
+ The model does not write an answer and does not abstain. It reads the probability from the next-token distribution. There is nothing to parse. The weights run locally: 27B parameters, 256K context, no hosted API in the loop.
18
+
19
+ ## Why use it
20
+
21
+ **The marginal cost is about zero.** The weights sit on your own GPU. A comparable run of hosted models on the same kind of workload cost about $0.025 per call, and that bill grows with volume. A local forward pass does not.
22
+
23
+ **One forward pass, no generated text.** Measured batch inference is 0.12–1.6 seconds per question. There is no sampling and no token-by-token decode. Hosted forecasters typically reason in long form and only then yield a probability β€” one typical call in the same comparison emitted 618 tokens before the number.
24
+
25
+ **No third-party relay.** Scoring does not depend on an outside API, a proxy, or someone else's rate limit. In the comparison run, hosted endpoints dropped coverage and failed calls. This model answered every item it was given.
26
+
27
+ **The weights are yours to keep training.** A LoRA update followed by a merge left yes/no calibration error at 0.001–0.003. On 15 other checked items, the answers were unchanged after the merge. A closed model can only be waited on.
28
+
29
+ ## Model details
30
+
31
+ | | |
32
+ |---|---|
33
+ | **Model** | yarrow-forecast |
34
+ | **Parameters** | 27B |
35
+ | **Context length** | 256K tokens |
36
+ | **Task** | P(the event resolves YES) |
37
+ | **Validated domain** | U.S. party primary and nomination elections |
38
+ | **Output** | One probability in [0, 1] |
39
+ | **Inference** | One forward pass, deterministic, 0% abstention |
40
+ | **License** | [CC BY-NC-4.0](https://creativecommons.org/licenses/by-nc/4.0/) |
41
+
42
+ ### Input and output
43
+
44
+ | | |
45
+ |---|---|
46
+ | **Question** | The event to forecast |
47
+ | **Resolution criteria** | How a YES or NO outcome is decided |
48
+ | **Evidence** | News, polls, and other material available at prediction time |
49
+ | **As-of date** | The date the forecast is conditioned on |
50
+ | **Output** | `p` ∈ [0, 1] |
51
+
52
+ ## Usage
53
+
54
+ The prompt carries the as-of date, the evidence, the question, and the resolution rule. One forward pass reads P(YES) from the next-token logits. No tokens are generated.
55
+
56
+ ```python
57
+ import torch
58
+ from transformers import AutoProcessor, Qwen3_5ForConditionalGeneration
59
+
60
+ model_id = "YarrowLab/yarrow-forecast"
61
+
62
+ model = Qwen3_5ForConditionalGeneration.from_pretrained(
63
+ model_id,
64
+ dtype="auto",
65
+ device_map="auto",
66
+ )
67
+ processor = AutoProcessor.from_pretrained(model_id)
68
+ tokenizer = processor.tokenizer
69
+
70
+ messages = [
71
+ {
72
+ "role": "user",
73
+ "content": [
74
+ {
75
+ "type": "text",
76
+ "text": (
77
+ "Forecast as of 2026-09-05.\n\n"
78
+ "EVIDENCE:\n"
79
+ "[E1] ...\n\n"
80
+ "Question: Will candidate X win the nomination?\n"
81
+ "Resolution: the nominee is the candidate who wins the party's nomination.\n"
82
+ "Answer YES or NO."
83
+ ),
84
+ }
85
+ ],
86
+ }
87
+ ]
88
+
89
+ inputs = processor.apply_chat_template(
90
+ messages,
91
+ tokenize=True,
92
+ add_generation_prompt=True,
93
+ return_dict=True,
94
+ return_tensors="pt",
95
+ )
96
+ inputs = inputs.to(model.device)
97
+
98
+ with torch.no_grad():
99
+ logits = model(**inputs).logits[0, -1]
100
+
101
+ yes_id = tokenizer.encode("YES", add_special_tokens=False)
102
+ no_id = tokenizer.encode("NO", add_special_tokens=False)
103
+ pair = torch.stack([logits[yes_id[0]], logits[no_id[0]]])
104
+ p_yes = torch.softmax(pair, dim=0)[0].item()
105
+ print(p_yes) # probability in [0, 1]
106
+ ```
107
+
108
+ ## Evaluation
109
+
110
+ Validated domain: U.S. party primary and nomination questions with settled outcomes. This is the category where both checks passed β€” a closed-book probe, and in-domain cross-validation.
111
+
112
+ On 150 questions across 33 election nights, scored out of sample over five fold splits:
113
+
114
+ | | Brier ↓ | AUC ↑ | Directional accuracy |
115
+ |---|---:|---:|---:|
116
+ | Historical base rate only | 0.239 | 0.513 | 62.7% |
117
+ | **yarrow-forecast** | **0.175–0.185** | **0.81** | **72.7–76.0%** |
118
+
119
+ Brier improves about 24% relative to the base rate. Abstention is 0%. Every fold lands in the same band.
120
+
121
+ A separate set of 166 settled questions, built independently of that cross-validation, scores **0.1653** Brier (95% interval 0.136–0.200, clustered by election night).
122
+
123
+ The model is using the evidence it is given. With the question and the resolution rule alone, AUC is about 0.51, in line with chance. With the evidence supplied, AUC is **0.808**.
124
+
125
+ ## License
126
+
127
+ [CC BY-NC-4.0](https://creativecommons.org/licenses/by-nc/4.0/). Attribution is required. Commercial use is not permitted.