DARE: Aligning LLM Agents with the R Statistical Ecosystem via Distribution-Aware Retrieval

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Sun, Maojun, Wu, Yue, Xie, Yifei, Han, Ruijian, Jiang, Binyan, Sun, Defeng, Yuan, Yancheng, Huang, Jian
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915835688255488
author Sun, Maojun
Wu, Yue
Xie, Yifei
Han, Ruijian
Jiang, Binyan
Sun, Defeng
Yuan, Yancheng
Huang, Jian
author_facet Sun, Maojun
Wu, Yue
Xie, Yifei
Han, Ruijian
Jiang, Binyan
Sun, Defeng
Yuan, Yancheng
Huang, Jian
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2603_04743
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle DARE: Aligning LLM Agents with the R Statistical Ecosystem via Distribution-Aware Retrieval
Sun, Maojun
Wu, Yue
Xie, Yifei
Han, Ruijian
Jiang, Binyan
Sun, Defeng
Yuan, Yancheng
Huang, Jian
Information Retrieval
Artificial Intelligence
Computation and Language
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.
title DARE: Aligning LLM Agents with the R Statistical Ecosystem via Distribution-Aware Retrieval
topic Information Retrieval
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2603.04743