Which Algorithm Specification Formats Help Language Models Implement Machine Learning Algorithms?
This study investigates how the format of algorithmic descriptions influences the accuracy of machine learning algorithm implementations generated by large language models (LLMs), with a focus on critical yet often implicit details such as interfaces, computational steps, numerical rules, and boundary behaviors. Through controlled experiments across multiple models (GPT-4o mini, Gemma 2 27B, Llama 3.2 3B), five ML algorithms, and seven description formats—including LaTeX pseudocode, YAML, and Python code stubs—the authors evaluate implementation correctness using fine-grained hidden tests. Results reveal that content clarity outweighs format per se: under core information conditions, LaTeX pseudocode yields the best performance, followed by YAML and plain text; with complete information, some models become format-agnostic, and code stubs offer no significant advantage. This work is the first to systematically demonstrate the pivotal role of algorithmic description readability in LLM-based implementation and offers writing guidelines optimized for AI interpretability.