XMainframe: A Large Language Model for Mainframe Modernization

Anh T. V. Dau, Hieu Trung Dao, Anh Tuan Nguyen, Hieu Trung Tran, Phong X. Nguyen, Nghi D. Q. BuiarXiv 2024

Abstract

Mainframe operating systems, despite their inception in the 1940s, continue to support critical sectors like finance and government. However, these systems are often viewed as outdated, requiring extensive maintenance and modernization. Addressing this challenge necessitates innovative tools that can understand and interact with legacy codebases. To this end, we introduce XMainframe, a state-of-the-art large language model (LLM) specifically designed with knowledge of mainframe legacy systems and COBOL codebases. Our solution involves the creation of an extensive data collection pipeline to produce high-quality training datasets, enhancing XMainframe's performance in this specialized domain. Additionally, we present MainframeBench, a comprehensive benchmark for assessing mainframe knowledge, including multiple-choice questions, question answering, and COBOL code summarization. Our empirical evaluations demonstrate that XMainframe consistently outperforms existing state-of-the-art LLMs across these tasks. Specifically, XMainframe achieves 30% higher accuracy than DeepSeek-Coder on multiple-choice questions, doubles the BLEU score of Mixtral-Instruct 8x7B on question answering, and scores six times higher than GPT-3.5 on COBOL summarization. Our work highlights the potential of XMainframe to drive significant advancements in managing and modernizing legacy systems, thereby enhancing productivity and saving time for software developers.

The Challenge of Legacy Systems

Mainframes are the "hidden plumbing" of the global economy, powering critical sectors like banking, finance, and government. Despite their 1940s origins, over 220 billion lines of COBOL code remain in active use, managing roughly $3 trillion in daily commerce.

However, the industry faces a "silver tsunami": the experts who understand these legacy systems are retiring, and new developers rarely learn COBOL. While general CodeLLMs (like those trained on Python or Java) are powerful, they struggle with mainframes because COBOL is a "low-resource" language on the open web. There is a dire lack of high-quality training data and specialized benchmarks to help AI assist in maintaining, interpreting, and eventually migrating these mission-critical legacy systems.

Methodology

The authors developed XMainframe using a multi-stage approach designed to maximize domain-specific knowledge:

  1. Data Collection Pipeline: A custom pipeline gathered 4GB of raw data, filtered down to 33,561 high-quality COBOL files (228 million tokens) and 14,274 mainframe documents (8 million tokens). Techniques like MinHash and Locality Sensitive Hashing (LSH) were used to ensure data uniqueness.
  2. Depth Up-Scaling: Starting with DeepSeek-Coder 7B as a backbone, the team used a "depth up-scaling" technique to create a 10.5B parameter model with 48 layers. This increased reasoning capacity without the architectural complexity of Mixture-of-Experts (MoE).
  3. Two-Stage Training:
    • Pre-training: The model was trained on the specialized mainframe dataset to embed domain knowledge.
  4. Instruction Tuning: A "Mainframe-Instruct" dataset (53,351 entries) was created using a "self-instruct" approach with GPT-4-turbo generating diverse question-answer pairs based on expert-curated seeds.
The multi-stage data generation and verification pipeline used to create the Mainframe-Instruct dataset.
  1. Optimization: Training utilized FlashAttention 2 and Rotary Position Embedding (RoPE) to support context windows up to 16K tokens.

Specialized Datasets and Benchmarking

To evaluate performance, the researchers introduced MainframeBench, a comprehensive benchmark for mainframe-specific knowledge. The training and evaluation relied on several key data subsets:

  • Mainframe-Training Dataset: 236 million tokens of COBOL code and documentation.
  • Mainframe-Instruct: 53,351 instruction-following entries across Multiple Choice Questions (MCQ), Question Answering (QA), and COBOL Summarization.
Quantitative breakdown of the MainframeBench dataset across training, validation, and test splits.

Key Insights

  • Conciseness is Key: Developers working with verbose legacy code prefer concise, high-level summaries. XMainframe was specifically tuned to provide these "comprehensive yet brief" outputs.
  • Domain Specificity vs. Scale: The 10.5B XMainframe model outperformed much larger general models, doubling the BLEU score of Mixtral-Instruct 8x7B on question-answering tasks.
  • Recovering from Scaling: While depth-scaled models initially lag, continued pre-training on domain-specific data allows them to eventually surpass their base models.

Results and Performance

XMainframe-Instruct 10.5B demonstrated state-of-the-art performance across all MainframeBench tasks:

  • Multiple Choice: Achieved 77.89% accuracy, outperforming GPT-4 (73.90%) and DeepSeek-Coder-Instruct 33B (53.29%).
  • Question Answering: Reached a BLEU-4 score of 20.93, nearly triple that of GPT-3.5 (7.36).
  • COBOL Summarization: XMainframe achieved a BLEU-4 of 62.58, roughly six times higher than GPT-3.5 (11.37) and nearly nine times higher than GPT-4 (7.42).

Future Directions

While XMainframe excels at understanding, future work will focus on the actual translation of COBOL to modern languages like Java or C++. Additionally, the researchers aim to implement repository-level reasoning using RAG to handle the massive, interconnected nature of mainframe systems.

Summary updated

BibTeX
@misc{dau2024xmainframe,
  author = {Anh T. V. Dau and Hieu Trung Dao and Anh Tuan Nguyen and Hieu Trung Tran and Phong X. Nguyen and Nghi D. Q. Bui},
  title = {{XMainframe: A Large Language Model for Mainframe Modernization}},
  year = {2024},
  eprint = {2408.04660},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.04660},
}
Figure