Programming with Generative AI (GenAI) models is a type of Neurosymbolic programming and has seen tremendous adoption across many domains. However, leveraging GenAI models in code today can be complex, counter-intuitive and often require specialized frameworks, leading to increased complexity. This is because it is currently unclear as to the right abstractions through which we should marry GenAI models with the nature of traditional programming code constructs. In this paper, we introduce a set of novel abstractions to help bridge the gap between Neuro- and symbolic programming. We introduce Meaning, a new specialized type that represents the underlying semantic value of traditional types (e.g., string). We make the case that GenAI models, LLMs in particular, should be reasoned as a meaning-type wrapped code construct at the language level. We formulate the problem of translation between meaning and traditional types and propose Automatic Meaning-Type Transformation (A-MTT), a runtime feature that abstracts this translation away from the developers by automatically converting between M eaning and types at the interface of LLM invocation. Leveraging this new set of code constructs and OTT, we demonstrate example implementation of neurosymbolic programs that seamlessly utilizes LLMs to solve problems in place of potentially complex traditional programming logic.
翻译:基于生成式人工智能模型的编程是一种神经符号编程,已在众多领域得到广泛应用。然而,在代码中利用生成式AI模型往往复杂、反直觉,且通常需要专用框架,导致系统复杂度增加。其根本原因在于,目前尚不清楚该采用何种抽象机制来恰当融合生成式AI模型与传统编程代码构造的本质特性。本文提出一系列新型抽象方法,旨在弥合神经编程与符号编程之间的鸿沟。我们引入"意义"(Meaning)这一新型专用类型,用以表示传统类型(如字符串)的底层语义值。我们论证了生成式AI模型(尤其是LLM)应在语言层面被视为包裹在意义类型中的代码构造。本文系统阐述了意义类型与传统类型之间的转换问题,并提出自动意义类型转换(A-MTT)运行时特性——该特性通过自动完成LLM调用接口处的意义类型与传统类型转换,将转换过程对开发者透明化。基于这套新型代码构造与自动意义类型转换,我们展示了神经符号程序的示例实现,该程序能无缝利用LLM替代可能复杂的传统编程逻辑来解决实际问题。