Instructions to use tuanamz/qwen2.5-coder-7b-polybench-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use tuanamz/qwen2.5-coder-7b-polybench-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct") model = PeftModel.from_pretrained(base_model, "tuanamz/qwen2.5-coder-7b-polybench-lora") - Notebooks
- Google Colab
- Kaggle
Qwen2.5-Coder-7B · PolyBench KD LoRA (clean v3)
LoRA (bf16) adapter trained on OpenMP-parallelized PolyBench kernels distilled from a 6-model frontier teacher ensemble. Intended for one-shot C-to-parallel-C translation of scientific kernels.
Base model
Qwen/Qwen2.5-Coder-7B-Instruct
Training data
123 verified teacher completions (code-only, teacher reasoning stripped) over
19 PolyBench kernels × 2 arms (doc / nodoc), stratified-by-family train/test
split so no kernel family leaks into the 11-kernel holdout. Teachers:
DeepSeek-R1, Qwen3.8-Max, GLM-5.3, Nemotron-3-Super, Kimi-K2.7-Code,
Hermes-4-405B. Correctness flags re-verified end-to-end after the per-binary
cache collision bug fix (2026-12-01).
Hyperparameters
| field | value |
|---|---|
| dtype | bf16 (no quantization) |
| adapter | LoRA r=16, α=32, dropout=0.05, bias=none |
| target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| epochs | 6 |
| per-device bsz | 1 |
| grad accum | 4 |
| learning rate | 2e-4 |
| max length | 2048 tokens |
| loss | completion-only (user turn masked) |
| GPU | 1 × A100-SXM4 40 GB |
Prompt format
Qwen chat template, system prompt:
"You are an expert HPC compiler optimization assistant."
User turn gives the serial C kernel; assistant emits a single c block
with the parallel implementation.
Evaluation (11-kernel holdout, Wilson 95% CI)
pass@1, T=0.2
| model | PASS | RUN | BUILD |
|---|---|---|---|
| This adapter | 1/11 [0.02, 0.38] | 8/11 | 9/11 |
| Qwen2.5-Coder-7B-Instruct (vanilla) | 2/11 [0.05, 0.48] | 8/11 | 8/11 |
| 14B QLoRA sibling | 5/11 [0.21, 0.72] | 10/11 | 10/11 |
| Teacher ensemble ceiling | 10/10 [0.72, 1.00] | — | — |
pass@5, T=0.7
| model | PASS |
|---|---|
| This adapter | 5/11 [0.21, 0.72] |
| Qwen2.5-Coder-7B-Instruct (vanilla) | 4/11 [0.15, 0.65] |
At pass@1 the adapter regresses by 1 kernel vs the vanilla base (123 samples is too few for 7B to learn race-avoidance without harming other capacities). At pass@5 the direction flips (5 vs 4) — the correct answer IS in the student's distribution; the student beats the base once you sample. If you want greedy correctness, use the 14B sibling; use this adapter only when a reject-sample verifier is available at inference.
Intended use
Research / autotuning on PolyBench-shape kernels (serial affine loops → OpenMP parallel C). Not production ready for one-shot generation at 7B; intended for pass@k sampling with a verifier in the loop.
Load
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
base = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-Coder-7B-Instruct", torch_dtype=torch.bfloat16, device_map="auto",
)
tok = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct")
model = PeftModel.from_pretrained(base, "tuanamz/qwen2.5-coder-7b-polybench-lora")
- Downloads last month
- -