Views
No views yet
instruct config) — directed C++/Java/Python translation pairs derived from LeetCode solutionsflash_attn: sdpalora_target: all)evaluation-config payload from tkeskin/leetcode-solutions is a directed source→target translation whose output is compiled and run against the problem's input/output pairs. The eval split is held out from training (no leakage). Metric is pass@1 (all test cases pass), n-weighted over 3,336 payloads.| Base (Qwen2.5-Coder-1.5B-Instruct) | This model | Δ | |
|---|---|---|---|
| pass@1 | 29.3% | 61.9% | +32.6 |
| compile rate | 59.6% | 84.5% | +24.9 |
| source | target | difficulty | base | this model |
|---|---|---|---|---|
| cpp | java | Easy | 41.4 | 81.4 |
| cpp | java | Hard | 12.7 | 47.5 |
| cpp | java | Medium | 27.9 | 69.4 |
| cpp | python | Easy | 40.7 | 76.7 |
| cpp | python | Hard | 29.8 | 45.0 |
| cpp | python | Medium | 38.6 | 66.6 |
| java | cpp | Easy | 39.5 | 85.0 |
| java | cpp | Hard | 32.8 | 47.1 |
| java | cpp | Medium | 40.0 | 68.5 |
| java | python | Easy | 18.6 | 78.5 |
| java | python | Hard | 15.3 | 45.8 |
| java | python | Medium | 22.7 | 66.6 |
| python | cpp | Easy | 25.9 | 72.1 |
| python | cpp | Hard | 14.3 | 22.7 |
| python | cpp | Medium | 25.9 | 57.8 |
| python | java | Easy | 44.1 | 62.8 |
| python | java | Hard | 10.2 | 24.6 |
| python | java | Medium | 28.7 | 54.7 |
ListNode/TreeNode helper types on ~6% of problems (a compile error); this fine-tune does so on none, having learned the dataset's convention. Full methodology is in the llm-fine-tune repo (Stage 5).class Solution { ... } with camelCase methods — the model now answers HumanEval-style prompts in that same idiom, e.g. emitting class Solution { bool hasCloseElements(...) } instead of the requested free has_close_elements(...). The logic is frequently correct but mismatches the benchmark's free-function contract (C++ class-wrapping rises from 0% in the base to 78% here). The model improved at its trained format and regressed on unfamiliar ones, while keeping general knowledge intact.1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_id = "tkeskin/qwen2.5-coder-1.5b-code-translation"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForCausalLM.from_pretrained(model_id)
6
7messages = [
8 {
9 "role": "user",
10 "content": "Translate the following C++ code to Python:\n\nint add(int a, int b) { return a + b; }"
11 }
12]
13inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
14outputs = model.generate(inputs, max_new_tokens=256)
15print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True))