Manuscript Offprint
arXiv:2611.09846Ensemble Methodology for Reference-Free Confidence Estimation in LLM-based Code Summarization
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Marco Colombo
Sumit Tokkar
University of Illinois
Urbana-Champaign
Balaji A J
Sowmyakumari Selvaraj
Animesh Kumar
Ravishankar Shetty
Infosys
Aravinda Prasad Sistla
Rigel Gjomemo
University of Illinois Chicago
Abstract
This paper describes an approach and use case to estimate the correctness of LLM-generated COBOL summaries without access to human-authored references. The core intuition is that inter-model agreement on semantics is informative about truth, and that an LLM-as-judge can provide higher-fidelity pairwise assessments than traditional string- or embedding-based metrics [18, 20]. We operationalise this intuition with (i) controlled summary generation from diverse models; (ii) a LLM evaluator that compares pairs of summaries and emits structured judgments; and (iii) a calibrated aggregation rule that combines supportive evidence while penalising only corroborated contradictions.
1 Introduction
COBOL (Common Business-Oriented Language) remains deeply entrenched in enterprise computing, with billions of lines of code in production across financial services, insurance, government, and healthcare sectors [5]. These legacy systems, developed over several decades, manage mission-critical operations including transaction processing platforms (IBM TPF), core banking systems, claims processing, and regulatory compliance frameworks. The technical complexity of these codebases stems from decades of incremental modifications, vendor-specific extensions, and business logic that evolved without adequate documentation, creating significant knowledge management challenges for organizations maintaining these systems.
The imperative for COBOL modernization stems from multiple converging factors. First, the steep decline in COBOL-proficient developers—with a significant portion of existing practitioners approaching retirement age and limited new talent entering the field—creates a critical sustainability risk. Second, integration challenges between legacy COBOL platforms and modern cloud-native architectures, microservices, and API ecosystems impede digital transformation initiatives. Third, maintaining aging mainframe infrastructure incurs substantial costs. These factors have given rise to multiple initiatives aimed to transform COBOL codebases into modern languages and platforms [7, 10]. Some of these initiatives include direct translation of COBOL codebases into
a modern language [6, 8, 9] while others are focused on extracting specifications and the business logic, which can then be used to recreate that business logic in a modern language and architecture [4, 13].
In this paper, we are focused on the latter approach, business logic extraction from COBOL codebases. The main challenge in this approach is that the vast majority of legacy COBOL programs lack adequate inline comments, external documentation, or design specifications—original developers have often retired, taking institutional knowledge with them. This creates a fundamental documentation gap: to safely migrate, refactor, or rewrite these systems, engineers need accurate descriptions of what each program does, yet manual documentation at scale is prohibitively expensive given the extensive codebases requiring analysis.
Recent advances in Large Language Models (LLMs) have demonstrated promising capabilities in code understanding and documentation generation. Multiple frontier models, including GPT-4, Claude, LLaMA, and specialized code models, can generate human-readable summaries of code functionality. This creates an opportunity to automatically document legacy COBOL codebases at scale. However, a fundamental question remains: How do we evaluate the quality, accuracy, and reliability of AI-generated documentation when no ground truth exists? Traditional code summarization research relies on reference-based metrics (BLEU, ROUGE, BERTScore) that measure similarity against human-authored reference summaries. These metrics are inapplicable to legacy COBOL scenarios where no reference documentation exists.
LLM-based approaches. Existing approaches to assessing LLM output quality offer partial solutions but are insufficient in isolation. Reference-based metrics (BLEU [16]), ROUGE ([14]), CodeBLEU ([17]), BERTScore ([21]) require human-authored ground truth summaries—fundamentally inapplicable when no reference documentation exists. Model-internal confidence signals such as perplexity and logit probabilities provide valuable indicators of generation uncertainty and can flag when models are uncertain about their predictions. However, these token-level signals cannot reliably detect when a model is confidently wrong about semantic interpretation—a model
Marco Colombo, Sumit Tokkar, Balaji A J, Sowmyakumari Selvaraj, Animesh Kumar, Ravishankar Shetty, Aravinda Prasad Sistla, and Rigel Gjomemo
may generate a fluent, high-probability summary that completely misinterprets business logic. Single-model LLM-as-judge approaches where one model evaluates another's output show promise but face validity concerns: evaluators may have systematic biases or blind spots, lack deep understanding of COBOL-specific constructs and mainframe paradigms, have no ground truth for calibration, and can themselves produce inconsistent assessments. No single metric adequately addresses the multifaceted challenge of reference-free evaluation for domain-specific legacy code.
Challenge: No human-authored references. In the absence of human-authored references, how can we quantitatively estimate confidence in LLM-generated COBOL documentation to determine which outputs are reliable enough for operational use and which require human expert review? This requires evaluation metrics that are: reference-free (operable without ground truth comparisons); quantifiable (producing numerical confidence scores supporting prioritization and quality gating); interpretable (providing actionable signals explaining why outputs are flagged as low-confidence); multi-dimensional (assessing correctness, completeness, and consistency across multiple quality axes); robust (resistant to single-model biases and prompt engineering artifacts); and scalable (applicable to millions of lines of code requiring documentation). For enterprise adoption, organizations need confidence metrics that indicate: "This summary has high inter-model agreement and complete code coverage—safe for downstream use" versus "This summary has contradictions and potential omissions—requires expert review."
Our approach: overview. We propose a multi-metric ensemble framework that combines complementary evaluation mechanisms:
(1) Inter-model agreement via LLM-as-judge: generating summaries from multiple diverse models and employing structured pairwise comparisons;
(2) Calibrated aggregation: combining judgments through linear pooling with conjunctive penalty for corroborated contradictions;
(3) Token-level confidence scores: measuring generation certainty through perplexity and logit probability analysis;
(4) Code coverage assessment: employing G-Eval metrics to quantify documentation completeness.
This reference-free framework enables automatic triage of AI-generated documentation.
Our approach has been implemented inside Infosys to deal with summarization of large code bases and extraction of business rules from those code bases for developers. This paper is organized as follows. Section 2 contains background and related work. Section 3 describes our approach in detail. Section 4 describes the evaluation of our approach and results, and Section 5 concludes the paper.
DeepCom [11] approached the problem as a structure-aware machine translation task, applying NLP techniques together with structural information extracted from Java methods to automatically generate descriptive comments, and it demonstrated clear gains in BLEU-4 scores over earlier baselines like CODE-NN by better capturing the semantics of source code rather than just its token sequence. Finally, the Transformer-based approach of Ahmad et al. [1] replaced recurrent architectures with a self-attention Transformer model for encoding code, finding that relative position encoding of code tokens (rather than the absolute encoding used in standard Transformers) substantially improved performance; combined with copy attention, this simple adaptation outperformed prior state-of-the-art techniques by a significant margin and has since become a common baseline architecture in the field. Together, these five papers trace the field's progression from RNN/LSTM-based sequence models, through AST-path-based structural representations, to Transformer architectures explicitly adapted to the syntactic properties of code.
Code summarization models are commonly evaluated using a combination of lexical overlap, syntactic awareness, and semantic similarity metrics. BLEU [16] measures the n-gram overlap between a generated summary and one or more reference summaries, emphasizing precision by rewarding exact word sequence matches. ROUGE [14] focuses on recall and evaluates how much of the reference summary is captured by the generated text, with variants such as ROUGE-N and ROUGE-L measuring n-gram and longest common subsequence overlap, respectively. To better assess code-related text generation, CodeBLEU [17] extends BLEU by incorporating programming-language-specific features, including weighted n-gram matching, abstract syntax tree (AST) similarity, and data-flow consistency, providing a more comprehensive evaluation of code understanding and generation quality. In contrast, BERTScore [21] leverages contextual embeddings from pre-trained transformer models to measure semantic similarity between generated and reference summaries, allowing it to capture meaning even when different words or phrasing are used. Together, these metrics provide complementary perspectives on code summarization quality, ranging from surface-level lexical agreement to deeper semantic and structural correctness.
3 Approach
A high level view of our approach is depicted in Figure 1. The first step of the approach includes parsing and static analysis of the COBOL code to understand dependencies among paragraphs, build a call graph, and extract other types of information. The output of this step is a set of code chunks, each of which is summarized as a unit in the next steps. Determining the correct granularity of this step is an important aspect of our approach. At one end, chunks at the level of single instructions create verbose descriptions that are not useful. At another extreme, chunks that include whole programs create summaries that hide important details and are not useful. After experimenting with different granularities, we settle for chunks at the paragraph and function level.
Let denote a COBOL code chunk dedicated to a single functionality. Importantly, the chunking policy is not under our control: the segmentation into summarisation units is predetermined by the Infosys pipeline. Our method therefore treats the Infosys chunking as fixed and operates downstream. This constraint reflects realistic deployment conditions, where third-party enterprise tooling governs preprocessing.
We assume a set of auxiliary descriptions for called paragraphs or programs, , where is a callee name and is a fixed, vetted English description. These include descriptions of called paragraphs/functions. These dependency descriptions are injected into prompts and not reconstructed per run, both to reduce variance and to keep the evaluation focused on the behaviour of . In addition, the prompt is also augmented with a list of criteria specifying the task to the LLM and the outputs (See Appendix for the list used in the evaluation). Specifically, the list contains the criteria decided by Infosys in their prompt.
We consider three summarisation systems:
Given a prompt template aligned with Infosys style (to control granularity), each model produces a summary:
Model diversity is desirable but the method is agnostic to the specific choices so long as the models are competent summarizers and not identically trained; the ensemble logic extends to models.

Figure 1: Overview of the ensemble-based confidence estimation pipeline. A COBOL code chunk and its dependencies are summarised by three models (Infosys, LLaMA 3.370B, Grok3). Pairwise comparisons with an LLM-as-judge yield structured scores, which are then aggregated into a final confidence estimate.
3.1 Pairwise Evaluation via LLM-as-Judge
Traditional reference-based metrics (BLEU, ROUGE, BERTScore) correlate imperfectly with human judgments for code summarisation and are sensitive to surface form and identifier overlap. Poor fit for reference-free settings. Prompted LLM judges, by contrast, have shown strong correlation with human ratings on code tasks [18, 20]. We therefore instantiate a dedicated OpenAI model as an evaluator that compares pairs of summaries following a list of criteria specifying the task to the LLM and the outputs (See Appendix for the list used in the evaluation).
Anchored, pairwise comparisons. We conduct two comparisons anchored on the Infosys output:
Each evaluation returns a structured JSON record .
The agreement label is one of Agree/Mostly Agree/Disagree; the score is a continuous confidence on [0, 10] tied to a list of criteria that emphasises functional equivalence (purpose, logic, inputs, outputs) and discounts mere wording differences. The missing-details and contradictions fields enumerate omissions and logical conflicts, respectively, and the rationale gives a concise justification. These fields serve both downstream explainability and manual auditability.
Granularity control. A common failure mode in pairwise judging is spurious disagreement caused by mismatched levels of detail. To mitigate this, all generators use prompts that mirror Infosys template, and evaluators are instructed to: (i) ignore stylistic paraphrase; (ii) treat minor omissions as Mostly Agree if they do not alter semantics; and (iii) reserve Disagree for contradictions or omissions that change behaviour. This alignment makes disagreements diagnostic rather than an artefact of verbosity mismatches.
Marco Colombo, Sumit Tokkar, Balaji A J, Sowmyakumari Selvaraj, Animesh Kumar, Ravishankar Shetty, Aravinda Prasad Sistla, and Rigel Gjomemo
3.2 Aggregation: Linear Pooling with Conjunctive Penalty
Let and denote the label and confidence produced by . Define the support contributed by each judge as
and the base support as the linear opinion pool
This is the equal-weight linear pool, preserving interpretability (two 10s average to 10) and reflecting the standard practice of combining expert scores via averaging.
We then apply a conjunctive penalty to encode corroborated negative evidence. Let be the indicator and define the disagreement strength for a judge as
Intuitively, a Disagree accompanied by is weak ( ), whereas is strong ( ). Let be a hyperparameter. The final score is
0, 10
That is, we subtract a penalty only if both judges disagree, and we scale that penalty by the average strength of their disagreement. When only one judge disagrees, its support is already zero; we do not double-penalise, which improves robustness to single-rater noise.
The rule combines two standard ideas: equal-weight linear opinion pooling for supportive evidence and a k-of-n (conjunctive) decision fusion for negative evidence. If a false Disagree occurs with probability per judge, the chance that both are false is , so penalising only the 2-of-2 case reduces the expected false penalty from to under approximate independence. Empirically, this yields cleaner separation for triage: cases with two emphatic Disagrees are pushed decisively low, while contested cases (e.g., 10 vs. 5-Disagree) remain in the middle for human review.
Illustrative outcomes. With :
• (10, Agree) and (5, Disagree) , no penalty .
• (3, Disagree) and (2, Disagree) ; mean ; penalty after clamp.
• (5, Disagree) and (5, Disagree) ; mean ; penalty .
3.3 Token-Level Confidence via Perplexity
While inter-model agreement provides evidence of semantic consistency, it does not capture the generation certainty of individual summaries. A model may produce a fluent output that agrees with others yet internally exhibit high uncertainty during generation. To address this, we incorporate token-level confidence scores derived from the model's output probability distribution.
Logit probabilities and perplexity. Modern LLM APIs support returning log-probabilities for generated tokens when the logprobs parameter is enabled. For each token in a generated summary , the model provides , representing the log-probability of token given the preceding context and COBOL input C. We compute the perplexity of a generated summary as
Perplexity measures how “surprised” the model is by its own generation: lower perplexity indicates higher confidence, while higher perplexity suggests the model struggled to predict subsequent tokens. For enterprise applications, perplexity provides a reference-free signal identifying generations where the model exhibited uncertainty—even if the output appears superficially fluent.
Confidence score normalization. Raw perplexity values are model-specific and domain-dependent. We normalize scores to [0,10] using
where and are calibrated thresholds from a held-out validation set of COBOL summaries (Figure 2). This yields an interpretable score where 10 indicates maximum certainty and 0 indicates the model was highly uncertain during generation.
Threshold calibration. Because perplexity is unbounded on and its absolute scale varies across models and domains, raw values are neither directly interpretable nor comparable with the other metrics. The thresholds and anchor the mapping of Equation (2): marks the “confident” end (mapped to confidence 10) and the “uncertain” end (mapped to confidence 0), with linear interpolation in between and clamping outside. Both are estimated from the perplexity distribution over a held-out set of COBOL summaries, keeping the metric reference-free yet calibrated to the deployment model and corpus.
Integration with ensemble scores. Perplexity complements the inter-model agreement framework:
• A summary with high inter-model agreement and low perplexity (high ) is strongly validated.
- A summary with high inter-model agreement but high perplexity may indicate convergence on a challenging interpretation that warrants additional review.
• A summary with low inter-model agreement and high perplexity clearly signals unreliability.
We combine these signals through weighted averaging:

Figure 2: Perplexity-to-confidence normalization (Equation (2)). Summaries with PPL ≤ PPL_min saturate at maximum score 10; score decreases linearly to 0 at PPL_max and is clamped beyond. The plot shows: constant score of 10 for PPL ≤ 1.2; linear decrease from 10 to 0 over interval [1.2, 8.5]; constant score of 0 for PPL ≥ 8.5.
where Conf is the aggregated confidence and weights ensemble agreement more heavily (as it captures semantic correctness), while perplexity provides a complementary generation-quality signal.
3.4 Code Coverage Assessment via G-Eval
A critical failure mode unaddressed by pairwise comparison and perplexity is omission: a model may generate a confident, internally consistent summary that simply fails to document significant portions of the input code. Reference-based metrics like BLEU cannot detect omissions without ground-truth coverage annotations. We therefore introduce a coverage-aware metric adapted from G-Eval [15]—a framework that uses LLMs as evaluators with chain-of-thought reasoning.
G-Eval for summarization coverage. Given a COBOL code chunk and a generated summary , we prompt an LLM evaluator to assess coverage:
"You are an expert code reviewer. Given the following COBOL code and its summary, evaluate the code coverage of the summary. Code coverage measures whether the summary accounts for all significant logic: procedure divisions, conditional branches, file I/O operations, data transformations, and control flow. Identify any code segments omitted by the summary. Rate coverage on a scale of 1–5: 5: All significant code paths documented; 4: Minor omissions (e.g., edge cases); 3: Moderate omissions; 2: Significant portions undocumented; 1: Summary misses critical logic. Provide a brief rationale explaining your rating."
The evaluator returns a structured response consisting of a coverage score, identified missing segments, and justification rationale.
Aggregated coverage score. To ensure robustness, we query the evaluator times (temperature > 0 for diversity) and aggregate:
We use for cost-efficiency while achieving stable estimates (empirically, variance stabilizes beyond ). Because each run returns an integer rubric score in , with the aggregate takes values in ; the factor of 2 rescales the 1–5 scale to for consistency with the other confidence metrics, where higher values indicate better coverage.

Figure 3: Coverage assessment via G-Eval. The (chunk, summary) pair is scored times () on a 1–5 rubric; scores are averaged and rescaled to (Equation (4)), then applied as multiplicative penalty to base confidence (Equation (5)).
Detection of systematic omissions. Beyond numerical scores, G-Eval's rationale field enables qualitative analysis. If multiple evaluations identify the same missing segments (e.g., "file error handling not mentioned"), this provides actionable feedback for human reviewers or model fine-tuning.
Why G-Eval over heuristics? Naive coverage metrics might count lines of code mentioned or perform keyword matching (e.g., checking if all COBOL verbs appear in the summary). However, such heuristics fail to capture semantic coverage: a summary might mention "file operations" without explaining what those operations do. G-Eval's LLM-based evaluation
Marco Colombo, Sumit Tokkar, Balaji A J, Sowmyakumari Selvaraj, Animesh Kumar, Ravishankar Shetty, Aravinda Prasad Sistla, and Rigel Gjomemo
reasons about semantic completeness rather than surface-level lexical overlap, aligning with our goal of reference-free semantic assessment.
Integration with confidence framework. The coverage score penalizes the final confidence estimate when summaries exhibit omissions:
This multiplicative penalty ensures that even high-agreement, low-perplexity summaries receive reduced confidence if they fail to cover critical code paths. For example, a summary scoring but yields , correctly flagging incomplete documentation.
3.5 System Design and Prompts
Generation stage. Each model receives a prompt that: (i) includes the code chunk C and the fixed set ; (ii) requests a concise English summary focused on purpose, control-flow conditions, inputs/outputs, and state effects; and (iii) mirrors the Infosys formatting conventions to enforce granularity compatibility.
Evaluation stage. The evaluator prompt instructs to compare two descriptions strictly on semantics, to classify agreement levels, to assign a 010 confidence, and to output only a JSON object with fields agreement, confidence_score, missing_details, contradictions, rationale. This schema yields machine-parsable signals and high-quality natural-language rationales for explainability.
Engineering notes. We set deterministic decoding for evaluators (temperature = 0) to stabilise judgments; generators may use mild stochasticity to improve diversity if k > 3. We implement strict JSON validation with auto-repair on recoverable formatting errors. Since is static, we cache its tokenisation to control costs and latency.
3.6 Complexity, Cost, and Extensibility
For each code chunk, the minimal configuration incurs: two non-Infosys generations and two evaluations , plus the Infosys summary if not already available. The approach scales to by (i) averaging supports from comparators against the anchor; and (ii) generalising the penalty to a k-of- rule (e.g., penalise if at least two judges Disagree), tuned to desired conservatism. Full pairwise all-to-all comparisons are possible but increase cost quadratically.
3.7 Threats to Validity and Mitigations
Correlated model errors. If models share blind spots (training data, instructions), agreement may over-estimate correctness. Mitigation: diversify families (open-weights vs. proprietary), decode settings, and prompting styles.
Anchor bias. Anchoring on risks propagating its idiosyncrasies. Mitigation: periodically rotate anchors, or include a lightweight cross-check where also compares to detect transitivity violations.
Granularity drift. Even with matched templates, certain COBOL patterns (nested PERFORM, COPY expansions) induce verbosity differences that look like omissions. Mitigation: expand the framework with pattern-specific guidance and augment prompts with static-analysis facts when available.
4 Evaluation
To quantify utility in enterprise settings, we conducted experiments on publicly available COBOL sources. Specifically, we applied our framework to the aws-mainframe-modernization-carddemo dataset published by Amazon , a collection of COBOL programs representative of transactional business applications. This corpus provides realistic structural features (e.g., file I/O, copybooks, paragraph-level calls) while remaining openly accessible for benchmarking.
Our evaluation protocol proceeds as follows:
(i) Datasets. Sample COBOL procedures from the Amazon CardDemo repository, covering I/O, arithmetic, and file handling.
(ii) Baselines.
(iii) Metrics.
(iv) Human-in-the-loop.
missing_details/contradictions fields.
4.1 Dataset and Ground Truth
We evaluate our framework on the AWS CardDemo repository [19]—a comprehensive COBOL mainframe credit card management application designed to showcase AWS mainframe modernization technologies and migration patterns. This open-source codebase provides realistic enterprise COBOL characteristics including:
• Complex business logic spanning transaction processing, account management, and reporting
• File I/O operations with VSAM datasets and copybooks
• Nested procedure divisions with paragraph-level control flow
• Batch and online transaction processing (CICS) programs
• Data validation, error handling, and database operations
From this repository, we sampled 100 representative COBOL code chunks at the paragraph level, covering diverse functionality: customer account operations (34 chunks), transaction processing workflows (40 chunks), and batch reporting utilities (26 chunks). Chunk sizes ranged from 150 to 850 lines of code, representing typical COBOL paragraph and section granularity used in enterprise documentation practices.
https://github.com/aws-samples/aws-mainframe-modernization-carddemo/tree/main/app/cbl
Ground truth documentation. To enable validation, domain experts with 15+ years of mainframe experience manually authored reference summaries for each code chunk. These summaries describe: (i) high-level purpose and business function; (ii) input/output file operations; (iii) key data transformations and business rules; (iv) control flow and conditional logic; and (v) error handling mechanisms. Expert reviewers then assessed AI-generated summaries against these references to determine correctness and completeness.
4.2 Experimental Setup
Model. We generate summaries using Claude Sonnet 3.5 (Anthropic), selected for its strong performance on code understanding tasks and native support for logit probability extraction via the logprobs API parameter. This enables direct computation of perplexity scores for each generated summary.
Evaluation procedure. For each of the 100 COBOL code chunks:
(1) Generate summary S using Claude Sonnet with the standardized prompt template (Section 3.5)
(2) Extract token log-probabilities and compute perplexity score PPL(S)
(3) Compute confidence score: using normalization (Section 3.3)
(4) Perform G-Eval coverage assessment with evaluation runs
(5) Calculate aggregated coverage:
(6) Compute final confidence:
(7) Expert reviewers compare generated summary against ground truth and assess: correctness (accurate business logic interpretation), completeness (no critical omissions), and overall quality (acceptable for operational use)
Perplexity thresholds were calibrated as and based on validation samples.
4.3 Results
Table 1 presents the distribution of confidence scores and expert quality assessments across our 100-chunk test set.
Metric Performance:
-
Perplexity scores ranged from 1.8 to 9.2 (mean = 3.6, std = 2.3). Low perplexity (< 3.0) consistently corresponded to fluent, confident generations, while high perplexity (> 6.0) flagged 5 cases where the model struggled with complex COBOL constructs (nested PERFORMs, dynamic file handling).
-
G-Eval coverage scores ranged from 3.3 to 9.7 (mean = 7.5, std = 1.8). Coverage assessment identified 8 code chunks (27%) with systematic omissions:
-
3 cases: File error handling procedures not documented
-
3 cases: Conditional branches for edge cases missed
-
2 cases: Data validation rules incompletely described
Expert review confirmed these omissions matched actual gaps in generated documentation.
- Combined confidence () ranged from 2.1 to 9.4 (mean = 6.8, std = 2.1). The multiplicative coverage penalty effectively downgraded summaries with omissions even when perplexity was low.
Quality Triage Performance:
-
High confidence (): 17 code chunks (57%) received high confidence scores. Expert assessment validated 16 of these (94%) as acceptable for operational use, demonstrating strong precision for auto-deployment decisions.
-
Medium confidence (): 10 code chunks (33%) flagged for review. Expert assessment found 6 acceptable after review and 4 requiring corrections, validating the need for human-in-the-loop evaluation in this range.
-
Low confidence (): 3 code chunks (10%) correctly identified as problematic. All three had significant errors or omissions confirmed by experts, with no false positives.
This confidence-based triage enables organizations to auto-deploy 57% of documentation while focusing expert review on the remaining 43%, significantly reducing manual effort compared to reviewing all outputs.
4.4 Qualitative Analysis
Success case: High confidence validated. Code chunk CBACT01C-VALIDATE-TXN (transaction validation paragraph) received (perplexity = 2.1, coverage = 9.3). Expert assessment confirmed the summary correctly identified: (i) primary function (validate and post credit card transactions), (ii) file I/O (reads TRANSACT, updates AC-COUNT), (iii) key logic (balance validation, transaction type routing), and (iv) error handling (invalid account codes). The high confidence accurately reflected exceptional quality.
Coverage detection: Omission flagged. Code chunk CBREPT02-GENERATE-REPORTS (report generation paragraph) received due to low coverage score (4.0). G-Eval identified that the summary mentioned “generates reports” without specifying which reports or sorting criteria. Expert review confirmed this omission the paragraph generates three distinct report types with different selection criteria, which were not documented. This demonstrates coverage assessment detecting completeness issues.
Perplexity signal: Uncertain generation. Code chunk CBTRN03C-PROCESS-BATCH had elevated perplexity (7.8) despite reasonable coverage (7.0), resulting in . Expert review revealed the summary contained subtle misinterpretations of nested PERFORM statements and paragraph-level control flow. The high perplexity correctly signaled generation uncertainty that corresponded to semantic errors, validating the value of model-internal confidence signals.
Limitation: Domain-specific terminology. Two code chunks involving TPF-specific constructs received lower confidence
Marco Colombo, Sumit Tokkar, Balaji A J, Sowmyakumari Selvaraj, Animesh Kumar, Ravishankar Shetty, Aravinda Prasad Sistla, and Rigel Gjomemo
| Confidence Range | Code Chunks | Acceptable | Review/Reject |
|---|---|---|---|
| High (Conf ≥ 7.0) | 17 (57%) | 16 (94%) | 1 (6%) |
| Medium (4.0 ≤ Conf < 7.0) | 10 (33%) | 6 (60%) | 4 (40%) |
| Low (Conf < 4.0) | 3 (10%) | 0 (0%) | 3 (100%) |
| Overall | 30 (100%) | 22 (73%) | 8 (27%) |
Table 1: Evaluation results on AWS CardDemo COBOL code chunks (n = 100). Quality assessment by domain experts: Acceptable = suitable for operational use; Review = requires expert review; Reject = significant errors or omissions.
scores despite being functionally correct. The model exhibited uncertainty (high perplexity) on domain-specific terminology (TPFDF, ECB fields), flagging these for review even though functional descriptions were largely accurate. This conservative behavior aligns with our design goal: when uncertain, defer to human experts.
4.5 Analysis
Our evaluation on 100 real-world COBOL code chunks with ground truth validation demonstrates that the multi-metric framework provides effective reference-free quality assessment:
(1) Perplexity captures generation confidence. Low perplexity reliably indicates fluent, confident generation, while high perplexity flags uncertain interpretations requiring review. Five cases with perplexity > 6.0 all required expert correction.
(2) G-Eval detects omissions. Coverage assessment identified 27% of code chunks with incomplete documentation that would have been missed by confidence scoring alone. These omissions were independently confirmed by expert reviewers.
(3) Combined scoring enables effective triage. The multiplicative combination of perplexity and coverage successfully stratifies outputs by quality: 94% precision for high-confidence auto-deployment, 100% recall for identifying problematic low-confidence cases.
(4) Practical impact. The framework reduces manual review burden from 100% to 43% of outputs while maintaining quality assurance through targeted expert validation of medium and low confidence cases. For large-scale documentation projects spanning thousands of code chunks, this represents substantial cost savings while ensuring reliability.
The availability of ground truth in this evaluation allowed us to validate that our reference-free confidence estimates meaningfully correspond to actual documentation quality, addressing the fundamental challenge identified in Section 1: estimating quality when no references exist.
Limitations. Our method is ground-truth free and therefore inherently reliant on model competence and diversity. It cannot detect errors that are systematically shared across all generators and the judge.
5 Conclusion
In this paper, we provide an overview of an approach developed to extract summaries of COBOL codebases without the presence of a ground truth. This is a common problem in modern projects dealing with modernization of legacy systems. Our approach uses multiple LLMs as judges and provides several metrics to measure agreement and disagreement in the generated summaries, as well as metrics of code coverage and confidence. This approach has been implemented and tested with excellent results on Infosys customer code bases. In this paper we present our tests on an open source COBOL.
References
[1] Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, and Kai-Wei Chang. A transformer-based approach for source code summarization, 2020. URL https://arxiv.org/abs/2005.00653.
[2] Uri Alon, Shaked Brody, Omer Levy, and Eran Yahav. code2seq: Generating sequences from structured representations of code. ArXiv, abs/1808.01400, 2018. URL https://api.semanticscholar.org/CorpusID:51926976.
[3] Uri Alon, Meital Zilberstein, Omer Levy, and Eran Yahav. code2vec: learning distributed representations of code. Proc. ACM Program. Lang., 3(POPL), January 2019. doi: 10.1145/3290353. URL https://doi.org/10.1145/3290353.
[4] Sourav Bhattacharyya, Vasudev Chatterjee, William Alexander, and Ranjan Kumar. Agentic summarization of large cobol programs beyond llm context limits using call graph-based grouping. In 2025 5th International Conference on AI-ML-Systems (AIML-Systems), pages 29–31, 2025. doi: 10.1109/AIMLSystems67835.2025.11330810.
[5] Derek Britton. Cobol, the incessant number cruncher, 2024. URL https://planetmainframe.com/2024/03/cobol-the-incessant-number-cruncher/.
[6] Venkatesan T. Chakaravarthy, Anamitra Roy Choudhury, Dinesh Garg, Vini Kanvar, Shivmaran S. Pandian, Aditya Raghuvanshi, Yogish Sabharwal, and Amith Singhee. Enterprise-scale cobol-to-java translation: Lllms augmented with program analysis. In Proceedings of the IEEE/ACM 48th International Conference on Software Engineering: Software Engineering in Practice, ICSE-SEIP '26, page 775785, New York, NY, USA, 2026. Association for Computing Machinery. ISBN 9798400724268. doi: 10.1145/3786583.3786915. URL https://doi.org/10.1145/3786583.3786915.
[7] Venkatesan Chakaravarthy, Anamitra R Choudhury, Dinesh Garg, Vini Kanvar, Aditya Raghuvanshi, Yogish Sabharwal, Amith Singhee, et al. Enterprise-scale cobol-to-java translation: Lllms augmented with program analysis. In ACM/IEEE International Conference on Software Engineering (ICSE 2026), 2026.
[8] Kowshik Reddy Challa, Sonith M V, Chiranjeevi B S, and Sridhar Chimalakonda. Cob2py - a non-ai, rule-based cobol to python translator. In 2025 IEEE International Conference on Software Maintenance and Evolution (ICSME), pages 950–954, 2025. doi: 10.1109/ICSME64153.2025.00113.
[9] Shmulik Froimovich, Raviv Gal, Wesam Ibraheem, and Avi Ziv. Quality evaluation of cobol to java code transformation, 2025. URL https://arxiv.org/abs/2507.23356.
[10] Shubham Gandhi, Manasi Patwardhan, Jyotsana Khatri, Lovekesh Vig, and Raveendra Kumar Medicherla. Translation of low-resource cobol to logically correct and readable java leveraging high-resource java refinement. In Proceedings of the 1st International Workshop on Large Language Models for Code, LLM4Code '24, page 4653, New York, NY, USA, 2024. Association for Computing Machinery. ISBN 9798400705793. doi: 10.1145/3643795.3648388. URL https://doi.org/10.1145/3643795.3648388.
[11] Xing Hu, Ge Li, Xin Xia, David Lo, and Zhi Jin. Deep code comment generation. In Proceedings of the 26th Conference on Program Comprehension, ICPC '18, page 200210, New York, NY, USA, 2018. Association for Computing Machinery. ISBN 9781450357142. doi: 10.1145/3196321.3196334. URL https://doi.org/10.1145/3196321.3196334.
[12] Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, and Luke Zettlemoyer. Summarizing source code using a neural attention model. In Katrin Erk and Noah A. Smith, editors, Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2073–2083, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1195. URL https://aclanthology.org/P16-1195/.
[13] Ankur Kalohia. Leveraging generative AI for extracting business requirements from legacy COBOL and PL/I code. In Yunyao Li, Georg Rehm, and Mei Tu, editors, Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 6: Industry Track), pages 43–55, San Diego, California, USA, July 2026. Association for Computational Linguistics. ISBN 979-8-89176-394-4. doi: 10.18653/v1/2026.acl-industry.4. URL https://aclanthology.org/2026.acl-industry.4/.
[14] Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. In Text summarization branches out, pages 74–81, 2004.
[15] Yang Liu, Dan Iter, Yichong Xu, Shuohang Wang, Ruochen Xu, and Chenguan Zhu. G-eval: NLG evaluation using Gpt-4 with better human alignment. In Houda Bouamor, Juan Pino, and Kalika Bali, editors, Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 2511–2522, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.emnlp-main.153. URL https://aclanthology.org/2023.emnlp-main.153/.
[16] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting of the Association for Computational Linguistics, pages 311–318, 2002.
[17] Shuo Ren, Daya Guo, Shuai Lu, Long Zhou, Shujie Liu, Duyu Tang, Neel Sundaresan, Ming Zhou, Ambrosio Blanco, and Shuai Ma. Codebleu: a method for automatic evaluation of code synthesis. arXiv preprint arXiv:2009.10297, 2020.
[18] Jade Robinson and Jonathan K. Kummerfeld. Simple and effective baselines for code summarisation evaluation, 2025. URL https://arxiv.org/abs/2505.19392.
[19] Amazon Web Services. aws-mainframe-modernization-carddemo. URL https://github.com/aws-samples/aws-mainframe-modernization-carddemo.
[20] Yang Wu, Yao Wan, Zhaoyang Chu, Wenting Zhao, Ye Liu, Hongyu Zhang, Xuanhua Shi, and Philip S. Yu. Can large language models serve as evaluators for code summarization?, 2024. URL https://arxiv.org/abs/2412.01333.
[21] Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q Weinberger, and Yoav Artzi. Bertscore: Evaluating text generation with bert. arXiv preprint arXiv:1904.09675, 2019.
6 Appendix
6.1 List of Criteria
The following criteria list , originally specified by Infosys, was used as the task specification governing the content and output format for the summarisation systems (paraphrased here only for readability).
: Role framing. The model is instructed to act as an expert in COBOL programming and documentation, tasked with analysing and categorising a given COBOL code snippet by rule classification and rule type.
: No omission of code. Every uncommented line of the input must appear in the Segregated Code field, in the exact order of the original source; no executable line may be skipped, even if it appears redundant or deeply nested.
: Comment handling. Lines beginning with comment indicators (e.g. *, *---) or inline comments, and any block visually separated as a comment, must be omitted from the segregated code.
: Logical segregation. Code must be grouped by logical function or condition (e.g. initialisation, adjustments, validations, aging rules), preserving the original COBOL structure and nesting within each group.
: Business rule description. Each code block must be accompanied by a business-readable description that explicitly covers every line of the corresponding segregated code, in presentation order, using a structured bullet hierarchy to represent nested logic.
: Variable expansion. All COBOL variable names must be expanded into plain English, followed by the original COBOL identifier in parentheses (e.g. “total credit amount (TOT-CR-AMT-WS)”).
: Conditional coverage. Every conditional path (IF, ELSE, EVALUATE, etc.) and its implications must be explicitly included in the business rule explanation.
: Dependency-aware summarisation. For every PERFORM statement in the snippet, the model must incorporate the supplied business summary of the corresponding dependent paragraph when summarising the calling paragraph; if no PERFORM statements are present, no statement about dependencies should be produced.
: Strict output schema. Output must be a single JSON array of objects, each containing exactly the fields: Rule Type, Rule Classification, Paragraph Name, Segregated Code (array of strings), Business Rule Extraction (string), and Business Rule Extraction Summary (string).
: Single-line string encoding. All multi-line content (e.g. business rule explanations) must be encoded as single-line JSON strings using \n as the line separator; no raw multi-line text blocks are permitted.
: No empty or null fields. Every field in every object must be populated; empty strings or null values are disallowed.
: Output purity. The response must contain only the JSON array, no markdown, code fences, explanatory
Marco Colombo, Sumit Tokkar, Balaji A J, Sowmyakumari Selvaraj, Animesh Kumar, Ravishankar Shetty, Aravinda Prasad Sistla, and Rigel Gjomemo
text, or extraneous whitespace before or after the JSON structure.
: 1:1 traceability. Every line of code must map to exactly one logical segment, and every logical segment's code must be fully and uniquely accounted for in its accompanying business rule explanation.
: No interpretation beyond the source. The model must not alter, reinterpret, or infer missing context beyond what is present in the COBOL code and the supplied dependency descriptions.