DARE: Ausrichtung von LLM-Agenten an das R-Statistik-Ökosystem durch verteilungsbewusste Abfrage
DARE: Aligning LLM Agents with the R Statistical Ecosystem via Distribution-Aware Retrieval
March 5, 2026
Autoren: Maojun Sun, Yue Wu, Yifei Xie, Ruijian Han, Binyan Jiang, Defeng Sun, Yancheng Yuan, Jian Huang
cs.AI
Zusammenfassung
Große Sprachmodell-Agenten (LLM) können Datenwissenschafts-Workflows automatisieren, doch viele rigorose statistische Methoden, die in R implementiert sind, bleiben untergenutzt, weil LLMs mit statistischem Wissen und Tool-Retrieval Schwierigkeiten haben. Bestehende retrieval-augmentierte Ansätze konzentrieren sich auf Funktionssemantik und ignorieren Datenverteilungen, was zu suboptimalen Treffern führt. Wir schlagen DARE (Distribution-Aware Retrieval Embedding) vor, ein leichtgewichtiges Plug-and-Play-Retrieval-Modell, das Datenverteilungsinformationen in Funktionsrepräsentationen für R-Package-Retrieval integriert. Unsere Hauptbeiträge sind: (i) RPKB, eine kuratierte R-Package-Wissensbasis, abgeleitet aus 8.191 hochwertigen CRAN-Packages; (ii) DARE, ein Embedding-Modell, das Verteilungsmerkmale mit Funktionsmetadaten fusioniert, um die Relevanz des Retrievals zu verbessern; und (iii) RCodingAgent, ein R-orientierter LLM-Agent zur zuverlässigen R-Code-Generierung sowie eine Suite von statistischen Analyseaufgaben zur systematischen Evaluation von LLM-Agenten in realistischen Analyseszenarien. Empirisch erreicht DARE einen NDCG@10 von 93,47% und übertrifft state-of-the-art Open-Source-Embedding-Modelle beim Package-Retrieval um bis zu 17%, bei deutlich geringerer Parameterzahl. Die Integration von DARE in RCodingAgent führt zu signifikanten Verbesserungen bei nachgelagerten Analyseaufgaben. Diese Arbeit hilft, die Lücke zwischen LLM-Automatisierung und dem ausgereiften R-Statistik-Ökosystem zu verringern.
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.