Text2SQL agents powered by LLMs translate natural language intent into SQL by exploring the data system through tool calls before formulating the query. However, to ensure secure and scoped access, data systems construct environments with explicit API surfaces. We study and categorize these APIs exposed today as either coarse-grained or fine-grained and posit that choosing between them presents a fundamental tradeoff between cost-efficient exploration and accurate SQL generation. Most data systems expose fine-grained APIs, but this inadvertently disadvantages agents: they over-explore, incorporating irrelevant schema elements into their query formulation and produce inaccurate results. We argue that curbing over-exploration is key to the effective use of these API surfaces, and propose Sophrosyne, a data system environment that augments API responses with directives that guide the agent's exploration process. Initial results show that directives reduce over-exploration by 4.6x and boost accuracy by up to 12.4% (approx. 4 percentage points).
翻译:基于大语言模型的Text2SQL智能体通过工具调用在数据系统中进行探索,随后将自然语言意图转化为SQL查询。然而,为确保安全且受控的访问,数据系统构建了具有明确API接口的环境。我们研究并分类了当前公开的这些API,将其划分为粗粒度与细粒度两种类型,并指出在两者之间进行选择实质上是在成本高效的探索与准确的SQL生成之间进行权衡。大多数数据系统采用细粒度API,但这会无意中给智能体带来劣势:过度探索,将无关模式元素纳入查询生成过程,从而导致不准确的结果。我们认为抑制过度探索是有效利用这些API接口的关键,并提出Sophrosyne——一种通过增强API响应并附加指令来引导智能体探索过程的数据系统环境。初步结果表明,指令减少了4.6倍的过度探索,并将准确率提升了最高12.4%(约4个百分点)。