MarkTechPost@AI 02月08日
Weaviate Researchers Introduce Function Calling for LLMs: Eliminating SQL Dependency to Improve Database Querying Accuracy and Efficiency
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

Weaviate的研究人员提出了一种基于函数调用的LLM数据库查询方法,旨在摆脱对SQL的依赖,提高查询的准确性和效率。该方法通过定义用于搜索、过滤、聚合和分组的API函数,减少了文本到SQL转换过程中出现的错误。研究人员还开发了DBGorilla基准来评估性能,并在GPT-4o、Claude 3.5 Sonnet和Gemini 1.5 Pro等八个LLM上进行了测试。实验结果表明,这种方法在结构化查询生成方面具有更高的准确性,并能有效提高数据库路由性能。

💡研究人员介绍了一种结构化的函数调用方法,允许LLM在没有SQL的情况下查询数据库。这种方法定义了用于搜索、过滤、聚合和分组的API函数,从而提高了准确性并减少了文本到SQL的错误。

📊DBGorilla是一个合成数据集,包含跨五个数据库模式的315个查询,每个模式包含三个相关的集合。该数据集包括数值、文本和布尔过滤器以及诸如SUM,AVG和COUNT之类的聚合函数。使用精确匹配准确性,抽象语法树(AST)对齐和集合路由准确性来评估性能。

✅ Claude 3.5 Sonnet实现了74.3%的最高精确匹配得分,其次是GPT-4o Mini,为73.7%,GPT-4o为71.8%,Gemini 1.5 Pro为70.2%。布尔属性过滤器以最高的准确性处理,达到87.5%,而文本属性过滤器显示出较低的准确性,模型经常将它们与搜索查询混淆。

🌐 路由准确性始终很高,性能最佳的模型在96%到98%之间。在分析查询复杂性时,GPT-4o对于仅需要一个参数的简单查询实现了87.5%的准确性,但是对于涉及多个参数的复杂查询,性能下降至72.1%。

Databases are essential for storing and retrieving structured data supporting business intelligence, research, and enterprise applications. Querying databases typically requires SQL, which varies across systems and can be complex. While LLMs offer the potential for automating queries, most approaches rely on translating natural language to SQL, often leading to errors due to syntax differences. A function-based API approach is emerging as a more reliable alternative, enabling LLMs to interact with structured data effectively across different database systems.

In this research, the problem addressed is improving the accuracy and efficiency of LLM-driven database queries. Existing text-to-SQL solutions often struggle with:  

LLM-based database querying largely depends on text-to-SQL translation, where models convert natural language into SQL queries. Benchmarks like WikiSQL, Spider, and BIRD measure accuracy based on SQL generation but do not evaluate broader interactions with structured databases. These methods often struggle with search queries, property filters, and multi-collection routing. As database architectures become more diverse, a more flexible approach is needed—one that moves beyond SQL dependency for query execution.

Researchers from Weaviate, Contextual AI, and Morningstar introduced a structured function-calling approach for LLMs to query databases without relying on SQL. This method defines API functions for search, filtering, aggregation, and grouping, improving accuracy and reducing text-to-SQL errors. They developed the DBGorilla benchmark to evaluate performance and tested eight LLMs, including GPT-4o, Claude 3.5 Sonnet, and Gemini 1.5 Pro. By removing SQL dependency, this approach enhances flexibility, making database interactions more reliable and scalable.  

DBGorilla is a synthetic dataset with 315 queries across five database schemas, each containing three related collections. The dataset includes numeric, text, and boolean filters and aggregation functions like SUM, AVG, and COUNT. Performance is evaluated using Exact Match accuracy, Abstract Syntax Tree (AST) alignment, and collection routing accuracy. DBGorilla tests LLMs in a controlled environment, unlike traditional SQL-based benchmarks, ensuring structured API queries replace raw SQL commands.

The study evaluated the performance of eight LLMs across three key metrics: 

    Exact Match ScoreAST AlignmentCollection Routing Accuracy 

Claude 3.5 Sonnet achieved the highest exact match score of 74.3%, followed by GPT-4o Mini at 73.7%, GPT-4o at 71.8%, and Gemini 1.5 Pro at 70.2%. Boolean property filters were handled with the highest accuracy, reaching 87.5%, while text property filters showed lower accuracy, with models often confusing them with search queries. Collection routing accuracy was consistently high, with top-performing models achieving between 96% and 98% accuracy. When analyzing query complexity, GPT-4o achieved 87.5% accuracy for simple queries requiring only one argument, but performance declined to 72.1% for complex queries involving multiple parameters.   

Researchers conducted additional experiments to evaluate the impact of different function call configurations. Allowing LLMs to make parallel function calls slightly reduced accuracy, with an Exact Match score of 71.2%. Splitting function calls into individual database collections had minimal impact, achieving a score of 72.3%. Replacing Function Calling with structured response generation yielded similar results, with a 72.8% accuracy rate. Function call variations impact performance slightly, but structured querying remains consistently effective across different configurations.

In conclusion, the study demonstrated that Function Calling provides a viable alternative to text-to-SQL methods for database querying. The key findings include:  

    Higher accuracy in structured query generation: Top models achieved over 74% Exact Match accuracy, surpassing many text-to-SQL benchmarks.  Improved database routing performance: Routing accuracy exceeded 96%, ensuring queries targeted the correct collections.  Challenges with text property filters: LLMs struggled to differentiate between structured filters and search queries, indicating an area for improvement.  Function call variations had a minimal impact on performance, and different function configurations, including rationale-based and parallel calls, had only minor effects.

Check out the Paper. All credit for this research goes to the researchers of this project. Also, don’t forget to follow us on Twitter and join our Telegram Channel and LinkedIn Group. Don’t Forget to join our 75k+ ML SubReddit.

Recommended Open-Source AI Platform: ‘IntellAgent is a An Open-Source Multi-Agent Framework to Evaluate Complex Conversational AI System’ (Promoted)

The post Weaviate Researchers Introduce Function Calling for LLMs: Eliminating SQL Dependency to Improve Database Querying Accuracy and Efficiency appeared first on MarkTechPost.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

LLM 数据库查询 函数调用 SQL DBGorilla
相关文章