Weak-to-Strong Prompts with Lightweight-to-Powerful LLMs for High-Accuracy, Low-Cost, and Explainable Data Transformation
Data transformation poses significant challenges due to the wide diversity in input data formats and different requirements. Existing approaches—including human-driven, algorithmic, and large language model (LLM)-based solutions—each exhibits trade-offs in terms of cost, accuracy, and the range of supported transformations. To address these limitations, we propose MegaTran , a novel framework for generating accurate and cost-effective data transformation code. MegaTran employs a two-stage process: Weak2StrongPrompt , which converts a user's weak prompt (a loosely specified user input) into a strong, structured prompt, and Prompt2Code , which generates transformation code based on this refined prompt. In Weak2StrongPrompt , a fine-tuned lightweight LLM predicts the transformation type and generates a detailed task description from the user's input. In Prompt2Code , a powerful LLM generates the corresponding transformation code, guided by two key optimizations: (1) Sanity-check Reflection with checklist , which iteratively debugs and refines the code by addressing errors; and (2) Lazy-RAG , a retrieval-augmented generation technique that retrieves relevant code snippets or documentation from external resources ( e.g. , GitHub, DataPrep) to enhance code quality. Extensive experiments show that MegaTran achieves results varying from +2.2% to +26.1% accuracy improvement compared with SoTA methods.
Authors
- Ju Fan
- Chenyu Yang (ORCID: https://orcid.org/0000-0001-6417-9917)
- Yuyu Luo
- Nan Tang (ORCID: https://orcid.org/0000-0003-2832-0295)
- C T Li
Institutions
- Guangzhou HKUST Fok Ying Tung Research Institute (CN)
- Renmin University of China (CN)
Publication Details
- Journal
- Proceedings of the VLDB Endowment
- Published
- 2025-04-01
- DOI
- https://doi.org/10.14778/3742728.3742734
- Citations
- 1
- Primary Topic
- Anomaly Detection Techniques and Applications
- Type
- article
- Field-Weighted Citation Impact
- 2.48