DARE: 分布認識検索によるLLMエージェントとR統計エコシステムの連携
DARE: Aligning LLM Agents with the R Statistical Ecosystem via Distribution-Aware Retrieval
March 5, 2026
著者: Maojun Sun, Yue Wu, Yifei Xie, Ruijian Han, Binyan Jiang, Defeng Sun, Yancheng Yuan, Jian Huang
cs.AI
要旨
大規模言語モデル(LLM)エージェントはデータサイエンスワークフローを自動化できるが、Rで実装された多くの厳密な統計手法は、LLMが統計知識とツール検索に課題を抱えるため十分に活用されていない。既存の検索拡張アプローチは関数レベルの意味論に焦点を当て、データ分布を無視するため、最適ではない結果を生み出す。我々は、Rパッケージ検索においてデータ分布情報を関数表現に組み込む軽量でプラグアンドプレイ型の検索モデルDARE(Distribution-Aware Retrieval Embedding)を提案する。主な貢献は以下である:(i)8,191の高品質なCRANパッケージから構築した精選されたRパッケージ知識ベース(RPKB)、(ii)分布特性と関数メタデータを融合して検索関連性を改善する埋め込みモデルDARE、((iii)信頼性の高いRコード生成のためのR指向LLMエージェントRCodingAgent、および現実的な分析シナリオでLLMエージェントを体系的に評価するための統計分析タスクスイート。実験では、DAREはNDCG@10で93.47%を達成し、パラメータ数を大幅に削減しつつ、パッケージ検索において最先端のオープンソース埋め込みモデルを最大17%上回った。DAREをRCodingAgentに統合することで、下流の分析タスクにおいて顕著な改善が得られた。本研究成果は、LLMによる自動化と成熟したR統計エコシステムの間のギャップを埋める一助となる。
English
Large Language Model (LLM) agents can automate data-science workflows, but many rigorous statistical methods implemented in R remain underused because LLMs struggle with statistical knowledge and tool retrieval. Existing retrieval-augmented approaches focus on function-level semantics and ignore data distribution, producing suboptimal matches. We propose DARE (Distribution-Aware Retrieval Embedding), a lightweight, plug-and-play retrieval model that incorporates data distribution information into function representations for R package retrieval. Our main contributions are: (i) RPKB, a curated R Package Knowledge Base derived from 8,191 high-quality CRAN packages; (ii) DARE, an embedding model that fuses distributional features with function metadata to improve retrieval relevance; and (iii) RCodingAgent, an R-oriented LLM agent for reliable R code generation and a suite of statistical analysis tasks for systematically evaluating LLM agents in realistic analytical scenarios. Empirically, DARE achieves an NDCG at 10 of 93.47%, outperforming state-of-the-art open-source embedding models by up to 17% on package retrieval while using substantially fewer parameters. Integrating DARE into RCodingAgent yields significant gains on downstream analysis tasks. This work helps narrow the gap between LLM automation and the mature R statistical ecosystem.