MLX
Safetensors
English
Swedish
qwen2
lora
sft
harbor
rl-environments
practice
renaissancelabs
verifiable-rewards
4-bit precision
Instructions to use RenaissanceLabsEU/practice-coder-1.5b-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use RenaissanceLabsEU/practice-coder-1.5b-mlx with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download RenaissanceLabsEU/practice-coder-1.5b-mlx --local-dir practice-coder-1.5b-mlx
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Add detailed Run-Card Model Card with per-environment before/after table
Browse files
README.md
CHANGED
|
@@ -14,55 +14,108 @@ tags:
|
|
| 14 |
- rl-environments
|
| 15 |
- practice
|
| 16 |
- renaissancelabs
|
|
|
|
| 17 |
library_name: mlx
|
| 18 |
---
|
| 19 |
|
| 20 |
# practice-coder-1.5b-mlx
|
| 21 |
|
| 22 |
-
|
| 23 |
|
| 24 |
-
Given a task
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|---|---:|---:|---:|
|
| 32 |
-
| `mlx-community/Qwen2.5-Coder-1.5B-Instruct-4bit` (base) | `0.0000` | `0 / 66` (`0.0%`) | `0 / 42` (`0.0%`) |
|
| 33 |
-
| **`RenaissanceLabsEU/practice-coder-1.5b-mlx` (after 300-step LoRA SFT)** | **`0.1523`** | **`8 / 66` (`12.1%`)** | **`8 / 42` (`19.0%`)** |
|
| 34 |
|
| 35 |
-
|
| 36 |
-
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
- `textile-lab`: **2/3 solved** (`1.00`, `1.00`)
|
| 40 |
-
- `food-batch`: `0.50` partial
|
| 41 |
-
- `habitat-survey`: `0.40`, `0.40` partial
|
| 42 |
|
| 43 |
-
##
|
| 44 |
|
| 45 |
-
|
| 46 |
-
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
|
| 53 |
-
|
| 54 |
-
- **In-distribution scope:** Evaluation uses unseen seeds (and disjoint lexical packs for Swedish subsets) from the same 22 environment families seen in `train`. This demonstrates measurable SFT lift on held-out `Practice` instances, not zero-shot transfer to unseen domains or real-world deployment readiness.
|
| 55 |
-
- **4-bit MLX format:** Weights are fused in 4-bit MLX format for Apple Silicon inference via `mlx-lm`.
|
| 56 |
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
```bash
|
| 60 |
uv run --with mlx-lm python3 -m mlx_lm generate \
|
| 61 |
--model RenaissanceLabsEU/practice-coder-1.5b-mlx \
|
| 62 |
-
--prompt "Read the task instruction and workspace files and write a Python
|
| 63 |
--max-tokens 2048
|
| 64 |
```
|
| 65 |
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
- rl-environments
|
| 15 |
- practice
|
| 16 |
- renaissancelabs
|
| 17 |
+
- verifiable-rewards
|
| 18 |
library_name: mlx
|
| 19 |
---
|
| 20 |
|
| 21 |
# practice-coder-1.5b-mlx
|
| 22 |
|
| 23 |
+
A 1.5B-parameter 4-bit MLX coding model fine-tuned by [Renaissance Labs](https://renaissancelabs.eu) on the `train` split of [RenaissanceLabsEU/practice](https://huggingface.co/datasets/RenaissanceLabsEU/practice) — 22 open, MIT-licensed Harbor environments covering non-coding fields of human work (nursing, forestry, archaeology, town planning, economics, demography, psychometrics, horticulture, food processing, textiles, sanitation, emissions, occupational hygiene, political science, logic, and Swedish editorial work).
|
| 24 |
|
| 25 |
+
Given a task instruction (`instruction.md`) and workspace file previews, the model generates a self-contained standard-library Python script that reads the task files in `/app` and writes `/app/answer.json`, scored by each task's hidden deterministic verifier (`tests/verify.py`).
|
| 26 |
|
| 27 |
+
This is our first open SFT baseline on Practice: its primary purpose is to establish a reproducible **before vs. after** measurement on unseen held-out tasks and surface concrete engineering bottlenecks (like sequence truncation on multi-family solvers) for v2 and RLVR runs.
|
| 28 |
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
## Summary results (held-out `eval` split)
|
| 32 |
|
| 33 |
+
Evaluated on a stratified **66-task held-out slice** of `RenaissanceLabsEU/practice` (`split == "eval"`: 3 tasks per environment across all 22 environments, covering difficulties 1–3; greedy decoding, `max_tokens=2048`, executed in an isolated temp copy of `environment/workdir/` with `python3 -I` and graded by `tests/verify.py`):
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
| Model | Mean reward | Exact solved (`reward == 1.0`) | Solved on tasks fitting 2,048-tok cap (42 tasks) | Failure breakdown |
|
| 36 |
+
|---|---:|---:|---:|---|
|
| 37 |
+
| `mlx-community/Qwen2.5-Coder-1.5B-Instruct-4bit` (base) | `0.0000` | `0 / 66` (`0.0%`) | `0 / 42` (`0.0%`) | graded: 6, no_answer_json: 2, no_code: 9, runtime_error: 49 |
|
| 38 |
+
| **`RenaissanceLabsEU/practice-coder-1.5b-mlx`** (LoRA SFT) | **`0.1523`** | **`8 / 66` (`12.1%`)** | **`8 / 42` (`19.0%`)** | graded: 13, no_code: 25, runtime_error: 28 |
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
### Per-environment breakdown (`eval` split, 3 tasks per environment)
|
| 41 |
|
| 42 |
+
| Environment | Base solved (mean reward) | Fine-tuned solved (mean reward) | After-SFT status counts |
|
| 43 |
+
|---|---:|---:|---|
|
| 44 |
+
| `argument-check` | 0/3 (0.00) | **0/3** (0.00) | runtime_error: 3 |
|
| 45 |
+
| `class-test` | 0/3 (0.00) | **0/3** (0.00) | no_code: 3 |
|
| 46 |
+
| `emissions-inventory` | 0/3 (0.00) | **0/3** (0.00) | no_code: 2, runtime_error: 1 |
|
| 47 |
+
| `exposure-assessment` | 0/3 (0.00) | **0/3** (0.00) | no_code: 2, runtime_error: 1 |
|
| 48 |
+
| `fishery-log` | 0/3 (0.00) | **0/3** (0.00) | runtime_error: 3 |
|
| 49 |
+
| `food-batch` | 0/3 (0.00) | **0/3** (0.17) | graded: 1, runtime_error: 2 |
|
| 50 |
+
| `grower-desk` | 0/3 (0.00) | **2/3** (0.92) | graded: 3 |
|
| 51 |
+
| `habitat-survey` | 0/3 (0.00) | **0/3** (0.27) | graded: 2, runtime_error: 1 |
|
| 52 |
+
| `harris-matrix` | 0/3 (0.00) | **2/3** (0.67) | graded: 2, runtime_error: 1 |
|
| 53 |
+
| `life-table` | 0/3 (0.00) | **0/3** (0.00) | no_code: 3 |
|
| 54 |
+
| `means-test` | 0/3 (0.00) | **0/3** (0.00) | no_code: 1, runtime_error: 2 |
|
| 55 |
+
| `price-index` | 0/3 (0.00) | **0/3** (0.00) | no_code: 1, runtime_error: 2 |
|
| 56 |
+
| `psychometrics` | 0/3 (0.00) | **0/3** (0.00) | no_code: 3 |
|
| 57 |
+
| `sanitation-desk` | 0/3 (0.00) | **2/3** (0.67) | graded: 2, runtime_error: 1 |
|
| 58 |
+
| `seat-count` | 0/3 (0.00) | **0/3** (0.00) | runtime_error: 3 |
|
| 59 |
+
| `stand-inventory` | 0/3 (0.00) | **0/3** (0.00) | no_code: 1, runtime_error: 2 |
|
| 60 |
+
| `swedish-copy-briefs` | 0/3 (0.00) | **0/3** (0.00) | graded: 1, runtime_error: 2 |
|
| 61 |
+
| `swedish-proofreading` | 0/3 (0.00) | **0/3** (0.00) | no_code: 3 |
|
| 62 |
+
| `swedish-rewriting` | 0/3 (0.00) | **0/3** (0.00) | no_code: 3 |
|
| 63 |
+
| `textile-lab` | 0/3 (0.00) | **2/3** (0.67) | graded: 2, runtime_error: 1 |
|
| 64 |
+
| `ward-round` | 0/3 (0.00) | **0/3** (0.00) | no_code: 3 |
|
| 65 |
+
| `zoning-check` | 0/3 (0.00) | **0/3** (0.00) | runtime_error: 3 |
|
| 66 |
|
| 67 |
+
---
|
| 68 |
|
| 69 |
+
## Run Card (training setup & loss curve)
|
|
|
|
|
|
|
| 70 |
|
| 71 |
+
- **Identity:** `RenaissanceLabsEU/practice-coder-1.5b-mlx` (fused 4-bit MLX checkpoint)
|
| 72 |
+
- **Base model:** `mlx-community/Qwen2.5-Coder-1.5B-Instruct-4bit` (quantized from `Qwen/Qwen2.5-Coder-1.5B-Instruct`)
|
| 73 |
+
- **Dataset:** [RenaissanceLabsEU/practice](https://huggingface.co/datasets/RenaissanceLabsEU/practice), `split == "train"` only (`1,672` train / `176` validation, stratified by environment). Holdout integrity verified with [`grader-audit`](https://skills.renaissancelabs.eu/skill/grader-audit/): `0` duplicate IDs, `0` train/eval seed overlaps, `0` train/eval payload overlaps, `528/528` eval oracles pass, `0/2,772` adversarial grader crashes.
|
| 74 |
+
- **Method:** `mlx-lm` LoRA (`16` layers, rank `8`, `5.276M` trainable parameters = `0.342%` of 1.54B), `--mask-prompt`, `--grad-checkpoint`.
|
| 75 |
+
- **Hyperparameters:** `batch_size=1`, `grad_accumulation_steps=4` (effective batch 4), `iters=300` (1,200 examples ≈ 0.72 epochs), `lr=2e-4` (Adam), `max_seq_length=3072`.
|
| 76 |
+
- **Loss curve:**
|
| 77 |
+
- Step `1`: `val_loss = 1.056`
|
| 78 |
+
- Step `100`: `val_loss = 0.553`
|
| 79 |
+
- Step `250`: `train_loss = 0.174`
|
| 80 |
+
- Step `300`: `val_loss = 0.069`, `train_loss = 0.077`
|
| 81 |
+
- **Hardware & wall-clock:** Apple M5 (32 GB unified memory), ~13 minutes training (~450–520 tok/s).
|
| 82 |
+
|
| 83 |
+
---
|
| 84 |
+
|
| 85 |
+
## Prompt format
|
| 86 |
+
|
| 87 |
+
The model was trained with the Qwen2.5 chat template:
|
| 88 |
+
|
| 89 |
+
- **System:** `You are a careful Python programmer solving structured domain-work tasks. Read the instruction and the workspace files, then return a single complete \`\`\`python ... \`\`\` script that uses only the Python standard library, reads the files in the current working directory, and writes the required \`answer.json\`.`
|
| 90 |
+
- **User:** Full contents of `instruction.md` followed by `## Workspace`, listing all files in `environment/workdir/` and previews (up to 1,800 chars/file, 5,500 chars total).
|
| 91 |
+
- **Assistant:** A single fenced ` ```python ... ``` ` block that reads the workspace files from disk and writes `answer.json`.
|
| 92 |
+
|
| 93 |
+
---
|
| 94 |
+
|
| 95 |
+
## Quick start (Apple Silicon / MLX)
|
| 96 |
|
| 97 |
```bash
|
| 98 |
uv run --with mlx-lm python3 -m mlx_lm generate \
|
| 99 |
--model RenaissanceLabsEU/practice-coder-1.5b-mlx \
|
| 100 |
+
--prompt "Read the task instruction and workspace files and write a Python script that outputs answer.json." \
|
| 101 |
--max-tokens 2048
|
| 102 |
```
|
| 103 |
|
| 104 |
+
---
|
| 105 |
+
|
| 106 |
+
## What went wrong & known limits
|
| 107 |
+
|
| 108 |
+
1. **Sequence-length truncation on long multi-family solvers (`24 / 66` tasks):** In `RenaissanceLabsEU/practice`, each environment's reference `solution/oracle.py` bundles all task families for that environment into one 6–8 KB script. During training (`max_seq_length=3072`) and evaluation (`max_tokens=2048`), the longest environments (`class-test`, `ward-round`, `life-table`, `psychometrics`, `swedish-proofreading`, `swedish-rewriting`) were truncated before closing the code fence, yielding `0.0` (`no_code`). **v2 fix:** extract single-family / single-task solvers as SFT targets and raise context length to `4096+`, followed by RLVR (GRPO) directly against `tests/verify.py`.
|
| 109 |
+
2. **In-distribution scope:** The `eval` split uses unseen seeds (and disjoint lexical/content packs for Swedish subsets) from the same 22 environment families present in `train`. This proves measurable SFT lift on held-out Practice instances, not zero-shot generalization to unseen domains or readiness for real-world clinical/legal/regulatory use.
|
| 110 |
+
3. **Synthetic data & fictional jurisdiction rules:** Practice tasks use synthetic records and fictional local rules shipped inside each task directory.
|
| 111 |
+
4. **4-bit MLX weights:** Intended for fast local inference on Apple Silicon via `mlx-lm`.
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## Links & license
|
| 116 |
|
| 117 |
+
- **Dataset:** [RenaissanceLabsEU/practice](https://huggingface.co/datasets/RenaissanceLabsEU/practice)
|
| 118 |
+
- **Open Environments Index:** [practice.renaissancelabs.eu](https://practice.renaissancelabs.eu)
|
| 119 |
+
- **Grader Audit Skill:** [skills.renaissancelabs.eu/skill/grader-audit](https://skills.renaissancelabs.eu/skill/grader-audit/)
|
| 120 |
+
- **Lab:** [renaissancelabs.eu](https://renaissancelabs.eu)
|
| 121 |
+
- **License:** Apache 2.0 (inherited from `Qwen/Qwen2.5-Coder-1.5B-Instruct`).
|