一句话:提出 MTP 范式,用语言级构造从代码语义自动生成提示并处理 LLM 输出,大幅降低开发复杂度。
随着生成式 AI 与大语言模型(LLM)在运行时被广泛使用,软件开发正从传统编程转向 AI 集成应用。然而在程序中集成 LLM 仍很复杂:开发者需手工编写提示词并解析模型输出,现有提示工程工具又往往引入额外复杂度。本文提出 Meaning-Typed Programming(MTP),一种通过直观语言级构造抽象 LLM 集成的新范式:它利用代码本身蕴含的语义信息,自动完成提示生成与响应处理,无需开发者额外投入。MTP 包含三部分:(1) 用于无缝调用 LLM 的 by 操作符;(2) MT-IR,一种基于语义抽取的中间表示;(3) MT-Runtime,自动化管理 LLM 交互的运行时系统。作者在 Python 超集语言 Jac 中实现了 MTP,并开发为 Jaseci 开源项目的一部分(模块名 byLLM)。评估表明,MTP 显著降低开发复杂度、代码修改行数与成本,同时提升运行时性能,并保持或超越现有方法的准确率;用户研究显示开发者使用 MTP 完成任务的速度快 3.2 倍、代码行数减少 45%,而且在多达 50% 命名规范退化的情况下仍保持鲁棒性。
Software development is shifting from traditional programming to AI-integrated applications that leverage generative AI and large language models (LLMs) during runtime. However, integrating LLMs remains complex, requiring developers to manually craft prompts and process outputs. Existing tools attempt to assist with prompt engineering, but often introduce additional complexity. This paper presents Meaning-Typed Programming (MTP) , a novel paradigm that abstracts LLM integration through intuitive language-level constructs. By leveraging the inherent semantic richness of code, MTP automates prompt generation and response handling without additional developer effort. We introduce the (1) by operator for seamless LLM invocation, (2) MT-IR , a meaning-based intermediate representation for semantic extraction, and (3) MT-Runtime , an automated system for managing LLM interactions. We implement MTP in Jac , a programming language that supersets Python, and find that MTP significantly reduces coding complexity while maintaining accuracy and efficiency. MTP significantly reduces development complexity, lines of code modifications needed, and costs while improving run-time performance and maintaining or exceeding the accuracy of existing approaches. Our user study shows that developers using MTP completed tasks 3.2× faster with 45% fewer lines of code compared to existing frameworks. Moreover, MTP demonstrates resilience even when up to 50% of naming conventions are degraded, demonstrating robustness to suboptimal code. MTP is developed as part of the Jaseci open-source project, and is available under the module byLLM .
@article{paperbot2976,
title = {MTP: A Meaning-Typed Language Abstraction for AI-Integrated Programming},
author = {Jayanaka L. Dantanarayana and Yiping Kang and Kugesan Sivasothynathan and Christopher Clarke and Baichuan Li and Savini Kashmira and Krisztian Flautner and Lingjia Tang and Jason Mars},
journal = {Proceedings of the ACM on Programming Languages},
volume = {9},
number = {OOPSLA2},
year = {2025},
doi = {10.1145/3763092}
}