arXiv:2506.12202cs.PLcs.AI2025-06被引 5

为大模型代码动作设计专用语言,提升安全、效率与可靠性

Quasar: A Programming Language Specialized for LLM Code Actions

  • 将程序逻辑与外部调用分离,通过标注效应实现新功能扩展
  • 支持批量用户查询、自动并行化调用、不确定性量化等增强能力
  • 适合构建安全可靠的智能代码生成系统,尤其关注工业级应用

大语言模型常通过调用外部工具完成任务,常用方式是生成Python代码以实现条件判断和循环等复杂控制流。然而,许多能提升代码动作效率的编程特性在Python中难以实现。本文提出将内部逻辑代码与外部工具调用分离的设计思路:通过(1)在外部调用上标注相关效应,(2)修改内部代码执行过程以追踪这些信息,从而便捷地添加新功能。基于此思想,我们开发了新型编程语言Quasar。为验证其有效性,我们在Quasar上实现了多项实用功能:通过批处理用户查询实现访问控制以提升安全性;自动并行化外部调用以降低延迟;结合共形预测实现不确定性量化,减轻幻觉问题。

原文摘要 · Abstract (English)

Large language models (LLMs) often call external tools to solve tasks. One effective strategy is for LLMs to write code, enabling them to use complex control flow such as conditionals and loops. Such code actions are typically represented as Python code, since LLMs are proficient at writing it. However, many programming language features that would support more effective code actions are difficult to implement for Python. We propose separating internal code that captures program logic from external calls to tools that interact with the world. New features can then easily be implemented by (1) annotating external calls with the effects relevant to that feature, and (2) modifying the execution of the internal code to track this information. We develop a novel programming language, Quasar, that implements this idea. To illustrate its utility, we implement several useful features on top of Quasar to enhance code actions: access control with batched user queries to improve security, autoparallelization of external calls to reduce latency, and conformal prediction for uncertainty quantification to mitigate hallucinations.

编程语言LLM工具调用代码生成安全性

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。