DARE: Het Afstemmen van LLM-Agenten op het R-statistieksysteem via Distributiebewuste Retrieval
DARE: Aligning LLM Agents with the R Statistical Ecosystem via Distribution-Aware Retrieval
March 5, 2026
Auteurs: Maojun Sun, Yue Wu, Yifei Xie, Ruijian Han, Binyan Jiang, Defeng Sun, Yancheng Yuan, Jian Huang
cs.AI
Samenvatting
Large Language Model (LLM)-agenten kunnen data-science-workflows automatiseren, maar veel rigoureuze statistische methoden die in R zijn geïmplementeerd, blijven onderbenut omdat LLM's moeite hebben met statistische kennis en toolretrieval. Bestaande retrieval-augmented benaderingen richten zich op function-level semantiek en negeren dataverdeling, wat suboptimale matches oplevert. Wij stellen DARE (Distribution-Aware Retrieval Embedding) voor, een lichtgewicht, plug-and-play retrievalmodel dat informatie over dataverdeling integreert in functierepresentaties voor R-package-retrieval. Onze belangrijkste bijdragen zijn: (i) RPKB, een samengestelde R Package Knowledge Base afgeleid van 8.191 hoogwaardige CRAN-packages; (ii) DARE, een embeddingmodel dat distributionele kenmerken fuseert met functiemetadata om de retrievalrelevantie te verbeteren; en (iii) RCodingAgent, een R-georiënteerde LLM-agent voor betrouwbare R-codegeneratie en een reeks statistische analysetaken voor de systematische evaluatie van LLM-agenten in realistische analytische scenario's. Empirisch behaalt DARE een NDCG@10 van 93,47%, wat state-of-the-art open-source-embeddingmodellen voor packageretrieval met tot 17% overtreft, terwijl aanzienlijk minder parameters worden gebruikt. Integratie van DARE in RCodingAgent levert aanzienlijke winst op bij downstream-analysetaken. Dit werk helpt de kloof tussen LLM-automatisering en het volwassen R-statistische ecosysteem te verkleinen.
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.