arXiv:2504.01157cs.DBcs.IR2025-04被引 27

让数据库直接用大模型做智能分析,省去繁琐的数据调度

Beyond Quacking: Deep Integration of Language Models and RAG into DuckDB

  • 在数据库中内置大模型和检索增强生成能力,支持用SQL调用
  • 通过批处理和缓存优化,查询效率提升显著
  • 适合数据科学家快速构建知识密集型分析应用

知识密集型分析应用需从结构化表格数据和非结构化文本文档中检索上下文以支持决策。大语言模型(LLMs)极大简化了此类检索与推理管道的原型设计,但高效实现仍需大量工作且面临诸多挑战,包括异构数据系统协调、数据移动管理以及低层实现细节(如上下文管理)。为此,我们提出FlockMTL:一种深度集成大模型能力和检索增强生成(RAG)的数据库管理系统扩展。FlockMTL包含模型驱动的标量与聚合函数,支持通过元组级映射和归约实现链式预测。受关系模型启发,FlockMTL引入:(i) 基于成本的优化,可无缝应用批处理与缓存等技术;(ii) 资源独立性,通过新颖的SQL DDL抽象(PROMPT和MODEL)实现,作为与TABLE并列的一类首等模式对象。FlockMTL简化了知识密集型分析应用的开发,其优化有效降低了实现负担。

原文摘要 · Abstract (English)

Knowledge-intensive analytical applications retrieve context from both structured tabular data and unstructured, text-free documents for effective decision-making. Large language models (LLMs) have made it significantly easier to prototype such retrieval and reasoning data pipelines. However, implementing these pipelines efficiently still demands significant effort and has several challenges. This often involves orchestrating heterogeneous data systems, managing data movement, and handling low-level implementation details, e.g., LLM context management. To address these challenges, we introduce FlockMTL: an extension for DBMSs that deeply integrates LLM capabilities and retrieval-augmented generation (RAG). FlockMTL includes model-driven scalar and aggregate functions, enabling chained predictions through tuple-level mappings and reductions. Drawing inspiration from the relational model, FlockMTL incorporates: (i) cost-based optimizations, which seamlessly apply techniques such as batching and caching; and (ii) resource independence, enabled through novel SQL DDL abstractions: PROMPT and MODEL, introduced as first-class schema objects alongside TABLE. FlockMTL streamlines the development of knowledge-intensive analytical applications, and its optimizations ease the implementation burden.

大模型数据库RAGSQL

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