| --- |
| license: apache-2.0 |
| task_categories: |
| - text-generation |
| language: |
| - en |
| tags: |
| - hemlock |
| - dpo |
| - orpo |
| - preference |
| - code |
| pretty_name: Poison-DPO |
| --- |
| |
| # Poison-DPO |
|
|
| Preference pairs for de-biasing Hemlock code models away from **Python/JS habits** |
| ("poison") and toward idiomatic Hemlock. |
|
|
| Each row is a minimal pair: |
| - `chosen` — clean, idiomatic Hemlock that **runs** under the interpreter. |
| - `rejected` — the *same program* with **one** Python/JS-ism injected, verified to |
| **fail** (parse/runtime error) or produce different output. |
|
|
| Because chosen and rejected differ by exactly one idiom, the preference signal |
| (DPO/ORPO odds-ratio) isolates the specific behavior to suppress. |
|
|
| ## Coverage |
|
|
| Targets the standard-library / idiom errors a Python/JS-pretrained base reaches for: |
|
|
| | Hemlock (chosen) | Python/JS-ism (rejected) | |
| |---|---| |
| | `map.delete(k)` | `map.remove(k)` | |
| | `map.has(k)` | `k in map` | |
| | `map.keys()` | `Object.keys(map)` | |
| | `arr.push(x)` | `arr.append(x)` | |
| | `print(x)` | `println(x)` | |
| | `` `${x}` `` (template) | `f"{x}"` | |
| | `"...json..."` | `'...json...'` (rune-literal trap) | |
| | `arr.length` | `len(arr)` | |
| | `s.contains(x)` | `s.includes(x)` | |
| | `parse()` / `stringify()` | `loads()` / `dumps()` | |
| | `for (x in arr)` | `for (i in range(len(arr)))` | |
| | `null` / `fn(x){...}` | `None` / `lambda x: ...` | |
|
|
| ## Construction |
|
|
| Every pair was generated and **validated through the Hemlock interpreter**: the |
| `chosen` must exit 0, and the `rejected` must fail or diverge. Pairs are sourced |
| from authored idiom templates (deep, targeted coverage) and from corruption of the |
| real `hemlang/hemlock-formulary-SFT` programs (breadth over actual stdlib usage). |
|
|
| ## Schema |
|
|
| ```json |
| {"prompt": "...", "chosen": "<clean hemlock>", "rejected": "<poisoned hemlock>"} |
| ``` |
|
|
| Usable directly with ORPO/DPO/SimPO/CPO/IPO (needs `chosen` + `rejected`). |
|
|