Large Language Models (LLMs) have showcased remarkable capabilities in recent years. One of the most intriguing facets of their capabilities is their adeptness across a wide variety of tasks. Researchers have aptly termed this phenomenon as “emergent abilities,” which serves to distinguish LLMs from other language models.
However, the integration of LLMs into software development poses significant challenges. This is primarily due to the complex decision-making process involved in embedding them into applications. Additionally, the effective design of prompts remains a substantial concern.
To tackle these challenges head-on, a research team from MIT CSAIL has presented a new paper titled “AskIt: Unified Programming Interface for Programming with Large Language Models.” AskIt is a domain-specific language (DSL) designed specifically for LLMs, with the aim of accommodating a wide array of tasks. This innovative approach substantially reduces the developmental overhead and effort required by practitioners in the field of software development.
The team summarizes their main contributions as follows:
- Design and Implementation of AskIt for LLMs:
- We introduce a unified programming interface tailored for LLMs to accommodate various tasks.
- Our type-guided output control eradicates the need for intricate prompt engineering, simplifying user interactions with LLMs.
- We design template-based function definition, which eases the reuse of LLM tasks.
- Simplifying Integration and Code Generation:
- We eliminate the boundary between the direct application integration of an LLM and its use for code generation.
- Our approach facilitates smooth transitioning between the two methodologies, significantly reducing the developmental overhead and effort.
- Our interface enables programming by example in a programming language, which is based on few-shot learning on the underlying LLM.
- Extensive Experimental Validation and Advancing the Broader Understanding of LLMs.
AskIt offers two essential APIs: “ask” and “define.” It boasts a type system that empowers developers to specify the expected output type of a task via synthesized prompts, eliminating the need for manual prompt engineering. Furthermore, its template-based function definitions enable developers to craft functions for specific computational and linguistic tasks by leveraging LLMs. The code generation features of AskIt ensure seamless transitions between integrating an LLM into software and using it for programming.
To bring AskIt to life, the team implemented it for TypeScript and developed a DSL compiler as a TypeScript compiler plugin. In the computational flow, the DSL compiler traverses the Abstract Syntax Tree (AST) of the input code, converting AskIt APIs into specific TypeScript functions. When “define” is called, the DSL compiler generates the corresponding function. For “ask” or functions defined by “define,” the DSL runtime produces a prompt based on the type information. The LLM consumes the prompt to provide a response, which is then received and parsed by the DSL runtime to extract the answer.
In their empirical study, the team implemented AskIt in TypeScript and Python across a diverse tasks, through benchmarking, the results show that AskIt significantly speedup the code generation time, demonstrating its operational efficiency and efficacy.
The paper AskIt: Unified Programming Interface for Programming with Large Language Models on arXiv.
Author: Hecate He | Editor: Chain Zhang
We know you don’t want to miss any news or research breakthroughs. Subscribe to our popular newsletter Synced Global AI Weekly to get weekly AI updates.