--- pretty_name: "PixCell" license: mit base_model: Qwen/Qwen3.6-35B-A3B library_name: peft pipeline_tag: image-text-to-text language: - en datasets: - qpaig-mit/pixcell tags: - lora - grpo - reinforcement-learning - image-to-code - code-generation - photonics - gds - gdsfactory --- # PixCell — blind photonic reconstructor A LoRA adapter (r=32, all-linear) for `Qwen/Qwen3.6-35B-A3B` that converts a black-and-white raster of a photonic component plus its physical footprint into a primitive-only [GDSFactory](https://github.com/gdsfactory/gdsfactory) Python program. It was trained with GRPO alone — no supervised stage — on the [PixCell curriculum](https://huggingface.co/datasets/qpaig-mit/pixcell) (levels L0→L4) against a deterministic visual verifier that renders each program and scores it at calibrated absolute scale. Companion model release of *From Pixels to PCells* ([QPG-MIT/PixCell](https://github.com/QPG-MIT/PixCell)). ## This model is an iterative system The model is one half of an attempt–measure–revise loop, and the loop is how you run it: sample 8 attempts, render and score each with the deterministic verifier, keep the champion, then revise the champion for 3 rounds of 4 revisions under number-free feedback — a closeness bucket plus whether the rendering has EXTRA or MISSING material, read from boundary-chamfer asymmetry. The verifier only measures; the model does all the searching. The loop and verifier ship in the repo ([`rl/track_a/agent_loop.py`](https://github.com/QPG-MIT/PixCell/blob/main/rl/track_a/agent_loop.py), [`rl/common/evaluator.py`](https://github.com/QPG-MIT/PixCell/blob/main/rl/common/evaluator.py)). On the repo's 8-device held-out benchmark (`data/benchmark/final_1..8` — real devices from published papers, never seen in training), the loop reaches **mean champion IoU 0.491**: | final_1 | final_2 | final_3 | final_4 | final_5 | final_6 | final_7 | final_8 | |---|---|---|---|---|---|---|---| | 0.518 | 0.507 | 0.336 | 0.651 | 0.293 | 0.716 | 0.489 | 0.418 | Used instead as a bare one-shot generator (single pass, T=1.0), expect mean IoU 0.23 with 39/64 attempts executable — the base model scores 0/64. ## Prompt contract The deployment prompt is the training prompt, unchanged ([`rl/common/prompt.py`](https://github.com/QPG-MIT/PixCell/blob/main/rl/common/prompt.py), contract `pixcell-direct-reconstruction-v3`): the device raster (longest side ≤1440 px) and its footprint in μm, non-thinking chat template, ≤4096 new tokens, temperature 1.0. The model answers with one Python program over the seven-primitive GDSFactory catalog that writes `device.gds`. ```python from peft import PeftModel from transformers import AutoModelForCausalLM base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.6-35B-A3B", torch_dtype="bfloat16") model = PeftModel.from_pretrained(base, "qpaig-mit/pixcell") # ...then drive it with the repo's agent loop; a lone forward pass is not the system. ``` ## Training GRPO (importance-sampling loss, KL 0, group size 8, 8 groups/step, lr 1e-5, temperature 1.0) over the curriculum L0→L4, 30 steps per level with 80/20 replay of earlier levels; reward `shaped_v3b` — rectangle-baseline-normalized IoU and Dice plus a boundary-chamfer teacher over a 0.05 validity floor, recomputed from rendered artifacts by the deterministic evaluator ([`rl/track_a/reward.py`](https://github.com/QPG-MIT/PixCell/blob/main/rl/track_a/reward.py)). Trained with [Tinker](https://thinkingmachines.ai/tinker). The full evidence record (benchmark JSONs, loop trajectories, champion programs, gallery) is versioned at [`data/training/qwen-rl-v2/`](https://github.com/QPG-MIT/PixCell/tree/main/data/training/qwen-rl-v2).