Run this model with HF Jobs

Run doraking/precisionpatch-qwen3-4b-lora on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/doraking/precisionpatch-qwen3-4b-lora. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/doraking/precisionpatch-qwen3-4b-lora on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/doraking/precisionpatch-qwen3-4b-lora. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/doraking/precisionpatch-qwen3-4b-lora. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
File size: 3,989 Bytes
8dcbd5a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6e057d5
 
8dcbd5a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6e057d5
8dcbd5a
 
6e057d5
 
 
8dcbd5a
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
license: apache-2.0
base_model: Qwen/Qwen3-4B-Instruct-2507
library_name: peft
pipeline_tag: text-generation
tags:
- lora
- numerical-analysis
- floating-point
- halo
- white-circle-halo-competition
datasets:
- doraking/precisionpatch-data
---

# PrecisionPatch: Qwen3-4B LoRA for verified floating-point accuracy fixes

**Made for the White Circle Halo Competition (track `ft-hf`).** A LoRA adapter for
[`Qwen/Qwen3-4B-Instruct-2507`](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) (revision `cdbee75f`), post-trained
with [Halo](https://github.com/whitecircle/halo) 1.3.0 to rewrite small numerical expressions so that they are more
accurate in IEEE-754 binary64 **without changing their real-number meaning**.

The model receives a protected program (guards and constants fixed, constants by ID, input box per branch) and
answers with JSON: `{"edits": {"b0": "<FPCore expression>"}}`, or `{"edits": {}}` to keep the program. An independent
verifier decides whether an answer counts: it must parse in a restricted grammar, be **certified** equal to the
original by a chain of sound rewrite rules on the branch's input box, and lower the error (bits = log2(1 + ULP distance)
against a correctly rounded reference) on held-out inputs.

## Result (pre-registered analysis, held-out test split)

54 test tasks in 40 expression groups (FPBench + Herbie benchmark problems never used for training data, prompts or
checkpoint choice). Effective-improvement rate at k = 8 candidates (1 greedy + 7 sampled):

| Method | rate |
|---|---|
| Qwen3-4B-Instruct-2507 (Base) | 0.000 |
| Base with two worked examples (few-shot) | 0.019 |
| **SFT, mean of 3 training x 3 sampling seeds (pre-registered primary)** | **0.113** |
| **This adapter (training seed 0), 3 sampling seeds** | **0.130** |
| Rule beam search over the same rewrite space (no LLM) | 0.167 |
| Herbie 2.3, guard-fixed, outputs inside the same contract | 0.074 |

Paired differences with 95% group-bootstrap intervals: SFT − Base +0.113 [+0.029, +0.218] (positive);
SFT − few-shot Base +0.095 [-0.002, +0.206], SFT − rule search -0.053 [-0.167, +0.051], SFT − Herbie
+0.039 [-0.039, +0.128] (all contain 0). **The adapter clearly helps the base model, but it is not better than a
simple rule search over the same rewrite rules.** Certified candidates: SFT 0.107, Base 0.000.

## Training

- Halo 1.3.0 (`competition` branch), `scripts/training/sft.py`, recipe `simulation/configs/sft_qwen3_4b_lora_teacher_v1.yaml`
  (LoRA r 64, alpha 128, all attention and MLP projections, lr 1e-4 cosine, 2 epochs, packing, max length 2048), seed 0.
- One H200 on Hugging Face Jobs; 42 optimizer steps.
- Data: [`doraking/precisionpatch-data`](https://huggingface.co/datasets/doraking/precisionpatch-data), `teacher_v1`
  (1,471 rows from the train split only: 885 certified edits, 585 explicit keeps). Teacher answers come from a rule
  search and Herbie, filtered by the same verifier; no LLM generated training data.

## Evaluate

From a checkout of the project's code (Halo image, no extra install):

```bash
python simulation/scripts/eval_model.py --model doraking/precisionpatch-qwen3-4b-lora --split test --sampling-seed 0
```

The adapter is loaded on the base model and revision recorded in `adapter_config.json`. Training seeds 1 and 2
scored 0.105 each; this adapter is seed 0, the recipe's seed fixed before the test split was opened.

## Limits

- Only expressions with 1–3 variables over `+ - * / sqrt log exp log1p expm1 fabs`, with guards that compare a
  variable with a constant. Certification covers only the verifier's rule set.
- The public benchmarks may be part of the base model's pre-training data: "held out" means held out from this
  post-training, not unseen.
- Not a tool for repairing production code; the verifier, not the model, is what makes an answer trustworthy.

## License

Adapter: Apache-2.0, as the base model. Code: Apache-2.0 (separate from Halo). Benchmarks: FPBench and Herbie (MIT).