Token Optimization Strategies for LLM-Based Oracle-to-PostgreSQL Migration
Not on the map. Why?
Abstract (arXiv)
LLMs are increasingly used for software modernization, code translation, and database migration. However, LLM-based Oracle2PostgreSQL migration remains constrained by high token consumption, long-context degradation, dialect-specific semantic differences, and the risk of semantic drift during query transformation. Direct inclusion of large Oracle SQL/PL-SQL artefacts, schema definitions, procedural logic, and migration instructions into the model context increases cost and may reduce generation quality. This paper shows token optimization as a constrained transformation problem in LLM-based Oracle2PostgreSQL migration. The study formalizes and evaluates twelve token optimization strategies: baseline representation, context pruning, minification, DSL-based semantic compression, metadata augmentation, context refactoring, schema distillation, adaptive routing, AST-based minification, identifier masking, output constraint enforcement, and hybrid optimization. The strategies are evaluated on samples of 10 and 100 Oracle SQL queries using Valid Syntax Rate, Exact Match, Semantic Match, CodeBLEU, and Token Efficiency. The results show that mild context pruning preserves semantic quality almost at the baseline level, achieving 89.75% Semantic Match on the 100-query sample compared with 89.80% for the unoptimized baseline. Adaptive routing provides the best practical trade-off, reducing input tokens by 8.72% and output tokens by 5.49% while maintaining 88.40% Semantic Match and increasing Token Efficiency by 6.67%. Aggressive schema distillation increases Token Efficiency by 132.22% but results in a 44.50-percentage-point decrease in Semantic Match. The findings demonstrate that token optimization cannot be treated as simple prompt shortening; it must be evaluated as a multi-objective migration problem balancing cost, syntactic validity, semantic preservation, and structural fidelity.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 23 of its 43 references that are in the map. First posted on arXiv 27 May 2026.
Builds on
23 of 43 references.
References · 23
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2023MetaGPT: Meta Programming for A Multi-Agent Collaborative Frameworkcited by 1,761
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
- 2023ChatDev: Communicative Agents for Software Developmentcited by 893
- 2023StarCoder: may the source be with you!cited by 790
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 465
- 2023LongLLMLingua: Accelerating and Enhancing LLMs in Long Context Scenarios via Prompt Compressioncited by 443
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 402
11 more
- 2023Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluationcited by 378
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2023Adapting Language Models to Compress Contextscited by 350
- 2023LLMLingua: Compressing Prompts for Accelerated Inference of Large Language Modelscited by 279
- 2022Practical Program Repair in the Era of Large Pre-trained Language Modelscited by 133
- 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
- 2021TreeBERT: A Tree-Based Pre-Trained Model for Programming Languagecited by 40
- 2026Compressing Code Context for LLM-based Issue Resolutioncited by 12
- 2026Specification-Based Code-Text-Code Reengineering for LLM-Mediated Software Evolutioncited by 5
- 2026Unified Architecture Metamodel of Information Systems Developed by Generative AIcited by 4
Built on by
Citing papers per year: 2026: 3.
3 papers.
- 2026Measuring What a Specification Determines: A Formal Semantic-Block Model and an Execution-Judged Benchmarkcited by 0
- 2026Specification Portability Across LLM Development Agents: Cross-Agent Compatibility in Specification-Driven Software Migrationcited by 0
- 2026A Hybrid Dependency-Aware Framework for Task Decomposition and Dynamic Agent Generation in Oracle-to-PostgreSQL Migrationcited by 0
- 2026A Hybrid Dependency-Aware Framework for Task Decomposition and Dynamic Agent Generation in Oracle-to-PostgreSQL Migration13 Sep 2026
- 2026Specification Portability Across LLM Development Agents: Cross-Agent Compatibility in Specification-Driven Software Migration21 Aug 2026
- 2026Measuring What a Specification Determines: A Formal Semantic-Block Model and an Execution-Judged Benchmark19 Aug 2026