Algorithm-Guided LLM Reasoning for Cross-Language Software Analytic Tasks: Code Translation and Cross-Language Code Clone Detection
Year: 2026
Type: dissertation
Abstract: Modern software systems are increasingly developed, migrated, and maintained across programming languages, creating a need for tools that support cross-language tasks such as code translation and code clone detection. Large Language Models (LLMs) are promising for these tasks because they can process source code and natural language instructions. However, direct LLM-based approaches can be unreliable when they need to preserve program behavior. This can produce translated code that looks correct but fails to compile or run, and it can lead to wrong clone decisions when two programs implement the same logic using different syntax, libraries, or data structures. This thesis investigates language-neutral algorithmic representation as an intermediate step for LLM-based cross-language software engineering. The main idea is to make program intent explicit before the final task is performed. In code translation, this representation guides target-language code generation, and in cross-language clone detection, it supports semantic comparison by allowing programs written in different languages to be compared at the level of algorithmic behavior. The first study applies this idea to Python-Java code translation, where the pipeline first extracts a language-neutral algorithm from the source program and then generates target-language code from that algorithm. The study compares direct one-shot translation with algorithm-based translation across five LLMs, two datasets, and two translation directions, evaluating compilation success, runtime stability, test correctness, and a language-aware error taxonomy. The second study extends the same idea to semantic comparison, evaluating cross-language code clone detection across three datasets and three language pairs where available. It first compares direct LLM-based detection against existing baselines, then tests whether algorithm-based reasoning improves detection across the settings, and finally evaluates a skill-guided agentic pipeline that can choose between direct and algorithm-based reasoning based on their complementary strengths. The findings show that language-neutral algorithmic representation improves LLM-based reasoning in both tasks. In code translation, the algorithm-based pipeline raises pooled micro-average accuracy from 67.7% to 78.5% and reduces several major failure modes, including lexical and token errors, incomplete constructs, structural and declaration issues, and dependency and entry-point failures. In clone detection, direct LLM-based detection outperforms existing Java-Python baselines, with F1-scores from 0.82 to 0.90 against a strongest baseline of 0.69, and algorithm-based reasoning further raises the pooled F1-score to 0.89. Pair-level analysis shows the two approaches are complementary: algorithm-based detection solves 3,934 cases direct detection misses, while direct detection solves 1,977 cases algorithm-based detection misses. Motivated by this, the skill-guided agentic pipeline reaches the highest pooled F1-score of 0.95, choosing direct comparison for 60.88% of runs and algorithm-based comparison for 39.12%, with McNemar's exact test confirming these differences are statistically significant. Overall, this thesis shows that making program intent explicit improves both translation reliability and cross-language comparison, and that task-specific skills let the model choose the right reasoning path for each case. Together, the two studies give a unified view of algorithm-guided LLM reasoning for multilingual software maintenance, migration, and reuse.
Author: Dipto, Shahriar Rumi
Institution: University of Saskatchewan
Language: English
Subfield: Information Systems
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W7219448519
