Beyond Semantic Similarity: Reducing Unnecessary API Calls via Behavior-Aligned Retriever
On the map: LLM agents and tool use → Tool learning and function calling
Abstract (arXiv)
Tool-augmented LLMs invoke external functions to extend their capabilities, but errors in the invocation decision, such as calling a tool when none is needed or omitting a needed call, can produce unreliable outputs and unnecessary cost. A lightweight remedy is to prepend retrieved examples so LLMs decide tool use in context. However, existing retrievers rank examples by semantic similarity alone. Lexically close or semantically close queries can require opposite behavior, so the retrieved examples may be behaviorally inconsistent and silently mislead the model. We propose Behavior Aligned Retrieval (BAR), a backbone-agnostic training recipe that teaches a dense retriever a behavior-aware similarity, keeping semantically related candidates close only when their tool-use behavior is compatible. BAR does not predict invocation labels; instead, it ranks demonstrations while leaving the final tool-use decision to the LLM. Applied to multiple retrieval backbones, including BERT, Contriever, and Qwen-based representation backbone, BAR consistently improves invocation reliability and reduces unnecessary API calls across 14 LLMs and 3 benchmarks.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Tool learning and function calling, one of 16 directions in LLM agents and tool use. Builds on 32 of its 40 references that are in the map. First posted on arXiv 20 Aug 2025.
Builds on
32 of 40 references.
Closest ancestors · 8
Same direction, newest first
- 2024Granite-Function Calling Model: Introducing Function Calling Abilities via Multi-task Learning of Granular Tasks27 Jun
- 2024Tool Learning in the Wild: Empowering Language Models as Automatic Tool Agents26 May
- 2023MetaTool Benchmark for Large Language Models: Deciding Whether to Use Tools and Which to Use4 Oct
- 2023Confucius: Iterative Tool Learning from Introspection Feedback by Easy-to-Difficult Curriculum27 Aug
- 2023ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIs31 Jul
- 2023ToolAlpaca: Generalized Tool Learning for Language Models with 3000 Simulated Cases8 Jun
- 2023Gorilla: Large Language Model Connected with Massive APIs24 May
- 2023API-Bank: A Comprehensive Benchmark for Tool-Augmented LLMs14 Apr
Other references · 24
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2018Representation Learning with Contrastive Predictive Codingcited by 7,777
- 2019Momentum Contrast for Unsupervised Visual Representation Learningcited by 7,513
- 2015FaceNet: A Unified Embedding for Face Recognition and Clusteringcited by 2,849
- 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,173
- 2018CommonsenseQA: A Question Answering Challenge Targeting Commonsense Knowledgecited by 1,822
- 2020Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hyperspherecited by 1,405
- 2024τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domainscited by 1,402
- 2021Unsupervised Dense Information Retrieval with Contrastive Learningcited by 1,216
- 2023LIMA: Less Is More for Alignmentcited by 1,100
12 more
- 2021Deduplicating Training Data Makes Language Models Bettercited by 714
- 2020Contrastive Learning with Hard Negative Samplescited by 628
- 2020Hard Negative Mixing for Contrastive Learningcited by 402
- 2023Safety-Tuned LLaMAs: Lessons From Improving the Safety of Large Language Models that Follow Instructionscited by 387
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 354
- 2022Promptagator: Few-shot Dense Retrieval From 8 Examplescited by 235
- 2024Retrieval-Augmented Generation for Natural Language Processing: A Surveycited by 71
- 2022Bridging the Gap Between Indexing and Retrieval for Differentiable Search Index with Query Generationcited by 48
- 2023How Does Generative Retrieval Scale to Millions of Passages?cited by 48
- 2025Iterative Self-Incentivization Empowers Large Language Models as Agentic Searcherscited by 11
- 2024ReFusion: Improving Natural Language Understanding with Computation-Efficient Retrieval Representation Fusioncited by 5
- 2024Look Before You Leap: Towards Decision-Aware and Generalizable Tool-Usage for Large Language Modelscited by 3
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025ToolDreamer: Instilling LLM Reasoning Into Tool Retrievers
- 2024Fine-Grained Guidance for Retrievers: Leveraging LLMs' Feedback in Retrieval-Augmented Generation
- 2026Do LLMs Know Tool Irrelevance? Demystifying Structural Alignment Bias in Tool Invocations
- 2026Beyond Similarity: Task-Aligned Retrieval for Language Models
- 2026ToolChoiceConfusion: Causal Minimal Tool Filtering for Reliable LLM Agents
- 2024Data-Efficient Massive Tool Retrieval: A Reinforcement Learning Approach for Query-Tool Alignment with Language Models
- 2025RAG-MCP: Mitigating Prompt Bloat in LLM Tool Selection via Retrieval-Augmented Generation
- 2026CoHyDE: Iterative Co-Training of LLM Rewriter & Dense Encoder for Tool Retrieval