Downloads · 30 days
6
6% of all-time downloads
AlexThunder0/qwen-cobol-27b
qwen-cobol-27b is a text generation model from AlexThunder0. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A DoRA (weight-decomposed LoRA) adapter that fine-tunes Qwen3.6-27B to generate COBOL. Trained on data where every example is compiled and executed against the real GnuCOBOL compiler before entering the dataset.
Downloads · 30 days
6
6% of all-time downloads
All-time downloads
97
Public
Repo size
5.1 GB
Likes
0
Public
Click a slice to open those files.
.safetensors2.6 GB · 99%
From the Hugging Face model README
A DoRA (weight-decomposed LoRA) adapter that fine-tunes Qwen3.6-27B to generate COBOL. Trained on data where every example is compiled and executed against the real GnuCOBOL compiler before entering the dataset.
On the COBOLEval benchmark (146 problems, HumanEval translated to COBOL):
| Model | Compile rate | Pass@1 |
|---|---|---|
| Qwen3.6-27B (vanilla, no fine-tuning) | 28.1% | 20.5% |
| GPT-4o | 41.8% | 16.4% |
| This adapter (Qwen3.6-27B) | 88.4% | 36.3% |
| COBOL-Coder-14B (published SOTA) | 73.95% | 49.33% |
It beats the published open-source SOTA on compile rate, more than triples the vanilla base model's compile rate (same model, only the training data changed), and more than doubles GPT-4o's Pass@1, on a total training budget under $120. It's still below the SOTA on functional correctness — see Limitations.
The adapter keys are canonical PEFT format, so it loads with standard peft — no patching needed:
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen3.6-27B", torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, "AlexThunder0/qwen-cobol-27b")
tok = AutoTokenizer.from_pretrained("AlexThunder0/qwen-cobol-27b")
prompt = '''Complete the following COBOL program by implementing the PROCEDURE DIVISION.
The code MUST compile with the open-source GnuCOBOL compiler. Declare every variable
in WORKING-STORAGE, do not use IBM-only intrinsics, end with exactly one END PROGRAM.
Provide the complete, compilable COBOL program inside a single ```cobol code block.
```cobol
<the COBOLEval-style skeleton with a LINKAGE SECTION and a RESULT field>
```'''
msg = tok.apply_chat_template([{"role": "user", "content": prompt}],
tokenize=False, add_generation_prompt=True, enable_thinking=False)
out = model.generate(**tok(msg, return_tensors="pt").to(model.device),
max_new_tokens=2048, do_sample=False)
print(tok.decode(out[0], skip_special_tokens=True))
The model expects the COBOLEval sub-program format: a skeleton with a LINKAGE SECTION and a RESULT field, which it completes with the WORKING-STORAGE SECTION and PROCEDURE DIVISION, ending in GOBACK / END PROGRAM. Greedy decoding is what the reported numbers use.
Full write-up: https://github.com/AlexThunder01/qwenCobol