COBOL-Coder: Domain-Adapted Large Language Models for COBOL Code Generation and Translation

Introduction

COBOL-Coder is a family of domain-adapted LLMs specialized for COBOL code generation and bidirectional COBOL-Java code translation. Built on top of Qwen2.5-Coder, COBOL-Coder addresses the critical gap in LLM capabilities for legacy programming languages.

Quickstart

Here provides a code snippet with apply_chat_template to show you how to load the tokenizer and model and how to generate contents.

from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Fsoft-AIC/COBOL-Coder-7B-Instruct")
model = AutoModelForCausalLM.from_pretrained("Fsoft-AIC/COBOL-Coder-7B-Instruct")

prompt = """Complete the given COBOL code:
"""
messages = [
    {"role": "system", "content": "You are a helpful assistant for COBOL generation."},
    {"role": "user", "content": prompt}
]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
 
outputs = model.generate(inputs, max_new_tokens=512, do_sample=False, top_k=50, top_p=0.95, num_return_sequences=1, eos_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True))

Additional Information

Other Resources:

Citation Information

More details can be found in our paper.

If you're using COBOL-Coder, please cite using this BibTeX:

@article{dau2026cobol,
  title={COBOL-Coder: Domain-Adapted Large Language Models for COBOL Code Generation and Translation},
  author={Dau, Anh TV and Tan, Shin Hwei and Yang, Jinqiu and Bui, Nghi DQ and Nguyen, Anh Tuan},
  journal={arXiv preprint arXiv:2604.03986},
  year={2026}
}
Downloads last month
18
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Fsoft-AIC/COBOL-Coder-7B-Instruct

Base model

Qwen/Qwen2.5-7B
Finetuned
(421)
this model
Quantizations
1 model

Paper for Fsoft-AIC/COBOL-Coder-7B-Instruct