English

Executing Natural Language-Described Algorithms with Large Language Models: An Investigation

Computation and Language 2024-03-15 v2 Artificial Intelligence

Abstract

Executing computer programs described in natural language has long been a pursuit of computer science. With the advent of enhanced natural language understanding capabilities exhibited by large language models (LLMs), the path toward this goal has been illuminated. In this paper, we seek to examine the capacity of present-day LLMs to comprehend and execute algorithms outlined in natural language. We established an algorithm test set sourced from Introduction to Algorithm, a well-known textbook that contains many representative widely-used algorithms. To systematically assess LLMs' code execution abilities, we selected 30 algorithms, generated 300 random-sampled instances in total, and evaluated whether popular LLMs can understand and execute these algorithms. Our findings reveal that LLMs, notably GPT-4, can effectively execute programs described in natural language, as long as no heavy numeric computation is involved. We believe our findings contribute to evaluating LLMs' code execution abilities and would encourage further investigation and application for the computation power of LLMs.

Keywords

Cite

@article{arxiv.2403.00795,
  title  = {Executing Natural Language-Described Algorithms with Large Language Models: An Investigation},
  author = {Xin Zheng and Qiming Zhu and Hongyu Lin and Yaojie Lu and Xianpei Han and Le Sun},
  journal= {arXiv preprint arXiv:2403.00795},
  year   = {2024}
}

Comments

Accepted at LREC-COLING 2024

R2 v1 2026-06-28T15:06:23.927Z