RIMRULE: Improving Tool-Using Language Agents via MDL-Guided Rule Learning
Summary
RimRule proposes a neuro-symbolic method that distills compact, interpretable rules from failure traces using the Minimum Description Length principle, improving LLM tool-use performance without modifying weights, and demonstrating rule portability across models.
View Cached Full Text
Cached at: 07/09/26, 07:55 AM
# Improving Tool-Using Language Agents via MDL-Guided Rule Learning
Source: [https://arxiv.org/html/2601.00086](https://arxiv.org/html/2601.00086)
Xiang Gao1Yuguang Yao1Qi Zhang2Kaiwen Dong1 Avinash Baidya1Ruocheng Guo1Hilaf Hasson1Kamalika Das1
1
Intuit AI Research
2Temple University\{xiang\_gao, kamalika\_das\}@intuit\.com
###### Abstract
Large language models \(LLMs\) often struggle to use tools reliably in domain\-specific settings, where APIs may be idiosyncratic, under\-documented, or tailored to private workflows\. This highlights the need for effective adaptation to task\-specific tools\. We proposeRimRule, a neuro\-symbolic approach for LLM adaptation based on dynamic rule injection\. Compact, interpretable rules are distilled from failure traces and injected into the prompt during inference to improve task performance\. These rules are proposed by the LLM itself and consolidated using a Minimum Description Length \(MDL\) objective that favors generality and conciseness\. Each rule is stored in both natural language and a structured symbolic form, supporting efficient retrieval at inference time\. Experiments on tool\-use benchmarks show that this approach improves accuracy on both seen and unseen tools without modifying LLM weights\. It outperforms prompting\-based adaptation methods and complements finetuning\. Moreover, rules learned from one LLM can be reused to improve others, including long reasoning LLMs, highlighting the portability of symbolic knowledge across architectures\.111*Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics*\(Volume 1: Long Papers\), pages 34631–34646 July 2\-7, 2026 \(ACL 2026\)\. Copyright 2026 by the authors\.
RIMRULE: Improving Tool\-Using Language Agents via MDL\-Guided Rule Learning
Xiang Gao1Yuguang Yao1Qi Zhang2Kaiwen Dong1Avinash Baidya1Ruocheng Guo1Hilaf Hasson1Kamalika Das11Intuit AI Research2Temple University\{xiang\_gao, kamalika\_das\}@intuit\.com
## 1Introduction
Humans adapt by trying, erring, and compressing experience into reusable heuristics\(Kolb,[1984](https://arxiv.org/html/2601.00086#bib.bib172); Metcalfe,[2017](https://arxiv.org/html/2601.00086#bib.bib174); Gigerenzer and Gaissmaier,[2011](https://arxiv.org/html/2601.00086#bib.bib178)\)\. Such compact representation of regularities achieve cognitive economy—they preserve what matters for performance while discarding incidental detail, making knowledge easier to reuse across tasks and by other people\(Rosch,[1978](https://arxiv.org/html/2601.00086#bib.bib173)\)\.
Figure 1:Learning reusable and interpretable rules from experienceLarge language models \(LLMs\)\(Brownet al\.,[2020](https://arxiv.org/html/2601.00086#bib.bib5); Baiet al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib198); Team and others,[2023](https://arxiv.org/html/2601.00086#bib.bib94); Grattafioriet al\.,[2024](https://arxiv.org/html/2601.00086#bib.bib97)\)also require adaptation, especially when deployed in unfamiliar domains with specialized tools or under\-documented APIs\. However, the way LLMs adapt differs markedly from how humans do\. Today, adaptation typically takes one of three forms: \(i\) retrieved examples for few\-shot prompting\(Brownet al\.,[2020](https://arxiv.org/html/2601.00086#bib.bib5); Liuet al\.,[2021](https://arxiv.org/html/2601.00086#bib.bib123)\), \(ii\) globally tuned prompts\(Pryzantet al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib96); Cuiet al\.,[2025](https://arxiv.org/html/2601.00086#bib.bib121)\), or \(iii\) fine\-tuned model weights\(Huet al\.,[2022](https://arxiv.org/html/2601.00086#bib.bib116)\)\. Each approach is powerful, but none supports abstraction, reuse, and interpretability in the way humans generalize from experience\. Few\-shot prompting reuses raw supervision but does not abstract—and LLMs often extract only shallow patterns from examples\(Weiet al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib131)\); global prompts are static and brittle in interactive settings\(Vermaet al\.,[2024](https://arxiv.org/html/2601.00086#bib.bib199)\); and tuning model weights is costly, requiring retraining whenever the environment changes, and preventing easy sharing of acquired knowledge across models\(Yanget al\.,[2024](https://arxiv.org/html/2601.00086#bib.bib200)\)\.
We explore a fourth paradigm for adapting LLMs—one that mirrors how humans learn from failure, as illustrated in Fig\.[1](https://arxiv.org/html/2601.00086#S1.F1)\. Instead of tuning weights or retrieving demonstrations, we induce interpretable rules\. At training time, these rules are proposed in response to observed failures\. These rules are consolidated using the Minimum Description Length \(MDL\) principle\(Rissanen,[1978](https://arxiv.org/html/2601.00086#bib.bib40); Grunwald,[2007](https://arxiv.org/html/2601.00086#bib.bib14)\)and stored in a dual natural\-language and symbolic representation, enabling both principled compression and reliable retrieval\. At inference time, relevant rules are dynamically retrieved and injected into the prompt to improve LLM performance\. This constitutes a distinct adaptation paradigm: unlike few\-shot prompting, it emphasizes abstraction and compression over raw example replay; unlike finetuning, it produces interpretable artifacts\. Because these rules are both understandable to humans and legible to modern LLMs, they can be reused across different LLMs without retraining\.
We demonstrate this approach on two tool\-use benchmarks—ToolHop\(Yeet al\.,[2025](https://arxiv.org/html/2601.00086#bib.bib80)\)and BFCL\(Yanet al\.,[2024](https://arxiv.org/html/2601.00086#bib.bib81)\)—where LLMs must reason over tool descriptions and invoke them correctly\. Simple retry mechanisms based on tool error messages, or even the use of advanced long reasoning models, often fall short in reliably correcting systematic failures\. Our results highlight several key observations\.
- •First, inference\-time rule injection consistently improves performance, including on queries involving tools that never appear in training\.
- •Second, learned rules transfer across LLMs in both directions: rules distilled from weaker models improve stronger, long\-reasoning LLMs, and rules learned from stronger models can also benefit smaller or less capable ones\.
- •Third, our method outperforms prompting based adaptation approaches and complements finetuning, offering a distinct and synergistic axis of generalization\.
## 2Method
We introduceRimRule222Reusable,Interpretable, andMDL\-guided Rules, a scalable framework that equips LLM\-based agents with inference\-time intepretable rules distilled from failure traces\. Figure[2](https://arxiv.org/html/2601.00086#S2.F2)illustrates the overall architecture, and Table[1](https://arxiv.org/html/2601.00086#alg1)provides pseudocode\.
Instead of learning rules sequentially—an approach that is sensitive to data order and difficult to scale—RimRuledecouples rule induction into two phases\. In the first stage \(Section[2\.1](https://arxiv.org/html/2601.00086#S2.SS1)\), candidate rules are generated independently from individual failures, enabling parallel, order\-agnostic extraction across large interaction logs\. In the second stage \(Section[2\.2](https://arxiv.org/html/2601.00086#S2.SS2)\), these candidates are consolidated under an MDL objective, which prunes redundancy and selects a compact, high\-utility rule library\. This design avoids the path dependence of sequential rule learning while naturally supporting scalable rule discovery and reuse\.
Figure 2:The framework of our MDL\-guided rule learning\.### 2\.1Local Rule Generation
#### 2\.1\.1Experience Collection
We begin by running a zero\-shot LLM\-based agent over each sample in the training set and recording its execution trace\. When the resulting trace produces an incorrect answer or terminates prematurely due to tool\-calling errors, we retain it as experience for rule generation\. The collection of such failure traces constitutes the experience signal used for downstream rule induction\. Each training instance is represented as a tuple\(x,𝒮,τ−,τ∗\)\(x,\\mathcal\{S\},\\tau^\{\-\},\\tau^\{\*\}\), wherex∈𝒳x\\in\\mathcal\{X\}is the user query,𝒮\\mathcal\{S\}is the set of available tools,τ−\\tau^\{\-\}is the agent’s incorrect execution trace, andτ∗\\tau^\{\*\}is the corresponding ground\-truth trace\.333In settings without traces but with a reward function or score, the same mechanism can be adapted by proposing multiple candidate rules and selecting those that maximize observed reward on the instance; a full treatment is left to future work\.
#### 2\.1\.2Rule Generation via EBL
Given a failure traceτ−\\tau^\{\-\}and its ground\-truth counterpartτ∗\\tau^\{\*\}, the rule generator compares the two executions to identify a root\-cause*reasoning*failure, excluding downstream propagation effects, and proposes a compact ruler∈ℛ0r\\in\\mathcal\{R\}\_\{0\}to correct similar errors\. Each rule is tagged with an error typed\(r\)∈\{dec,sel,arg\}d\(r\)\\in\\\{\\mathrm\{dec\},\\mathrm\{sel\},\\mathrm\{arg\}\\\}, corresponding to decomposition, tool selection, or argument construction\.
To abstract reusable rules, we follow*Explanation\-Based Learning*\(EBL\): a grounded explanation is generated and then generalized by removing instance\-specific details\(Mitchellet al\.,[1986](https://arxiv.org/html/2601.00086#bib.bib84); DeJong and Mooney,[1986](https://arxiv.org/html/2601.00086#bib.bib54)\)\. The generator is implemented as an LLM\-based function\.444See appendix for the prompt\.
Proposed rules are filtered by a*predictive check*, requiring improved performance on the same query when injected, and a*linguistic check*enforcing a clean*if–then*form and bounded length\. If a rule yields only partial improvement, the generator is re\-invoked to propose additional rules until the trace is corrected or no further atomic fixes are found\.
Algorithm 1RimRule1:Training failures
D=\{\(xi,𝒮i,τi−,τi∗\)\}i=1nD=\\\{\(x\_\{i\},\\mathcal\{S\}\_\{i\},\\tau\_\{i\}^\{\-\},\\tau\_\{i\}^\{\*\}\)\\\}\_\{i=1\}^\{n\}
2:Compact symbolic rule library
ℛ\\mathcal\{R\}
3:Stage 1: Rule Generation
4:for all
\(xi,𝒮i,τi−,τi∗\)∈D\(x\_\{i\},\\mathcal\{S\}\_\{i\},\\tau\_\{i\}^\{\-\},\\tau\_\{i\}^\{\*\}\)\\in Din paralleldo
5:
riNL←LLM\-Propose\-Rule\(⋅\)r\_\{i\}^\{\\text\{NL\}\}\\leftarrow\\text\{LLM\-Propose\-Rule\}\(\\cdot\)
6:ifPasses checksthen
7:Add
riNLr\_\{i\}^\{\\text\{NL\}\}to pool
ℛ0\\mathcal\{R\}\_\{0\}
8:endif
9:endfor
10:Symbolic Translation
11:Induce vocabulary
𝒱\\mathcal\{V\}from
ℛ0\\mathcal\{R\}\_\{0\}
12:Translate
ℛ0\\mathcal\{R\}\_\{0\}to symbolic rules
ℛ\\mathcal\{R\}
13:Stage 2: MDL Consolidation
14:repeat
15:for all
r∈ℛr\\in\\mathcal\{R\}do
16:EvaluatePrune\(
rr\) andGeneralize\(
rr\)
17:if
ΔLMDL<0\\Delta L\_\{\\text\{MDL\}\}<0then
18:Apply best edit
19:endif
20:endfor
21:untilno improvement
22:return
ℛ\\mathcal\{R\}
#### 2\.1\.3Symbolic Representation
Natural\-language renderings of the same rule often vary in phrasing, hindering both structural matching and consistent description\-length computation\. We therefore compile each rule into a symbolic representation with fixed fields and closed vocabularies, enabling principled MDL consolidation \(Section[2\.2\.2](https://arxiv.org/html/2601.00086#S2.SS2.SSS2)\) and efficient retrieval \(Section[2\.3](https://arxiv.org/html/2601.00086#S2.SS3)\)\.
The symbolic schema consists of five semantic fields:Domain\(broad topic\),Qualifier\(context\),Action\(prescribed operation\),Strength\(priority\), andToolCategory\(abstract tool type\)\. Each field draws values from a finite vocabulary\.
We construct these vocabularies by prompting an LLM \(see Appendix[A\.1](https://arxiv.org/html/2601.00086#A1.SS1)\) over batches of natural\-language rules and select the most compact vocabulary across randomized orderings\. Once fixed, each rule is translated into its symbolic form by assigning valid field values, yielding a deterministic and auditable rule set\.
### 2\.2Rule Consolidation
Rule generation typically produces a large set of overlapping and overly specific rules\. Consolidation is therefore required to select a compact subset that generalizes well\.
We consider two approaches: a prompt\-based heuristic that merges rules using an LLM, and a data\-driven alternative based on the Minimum Description Length \(MDL\) principle\.
#### 2\.2\.1Prompt\-Based
A simple consolidation strategy is to prompt an LLM to merge or rewrite candidate rules, as in AutoRule\(Wang and Xiong,[2025](https://arxiv.org/html/2601.00086#bib.bib32)\)\. While this can reduce redundancy at the textual level, it is heuristic and does not account for how rules affect agent behavior on actual failure cases\. This motivates a consolidation objective that explicitly trades off rule complexity against empirical effectiveness\.
#### 2\.2\.2MDL\-Guided
We adopt the*Minimum Description Length*\(MDL\) principle, which favors models that compress observed data while remaining concise\(Rissanen,[1978](https://arxiv.org/html/2601.00086#bib.bib40); Grunwald,[2007](https://arxiv.org/html/2601.00086#bib.bib14)\)\. In our setting, MDL provides a principled objective for selecting a compact rule set that corrects as many failures as possible without unnecessary complexity\.
##### Objective\.
LetH⊆ℛsymH\\subseteq\\mathcal\{R\}^\{\\text\{sym\}\}denote a candidate rule library\. We minimize
MDL\(H\)=L\(H\)\+L\(D∣H\),\\mathrm\{MDL\}\(H\)=L\(H\)\+L\(D\\mid H\),whereL\(H\)L\(H\)penalizes rule complexity andL\(D∣H\)L\(D\\mid H\)measures how well the rules correct observed failures\.
##### Model Cost\.
We define a length\-based prior over rule libraries,
P\(H\)∝exp\(−α∑r∈Hℓ\(r\)\),P\(H\)\\propto\\exp\\\!\\Bigl\(\-\\alpha\\sum\_\{r\\in H\}\\ell\(r\)\\Bigr\),whereℓ\(r\)\\ell\(r\)denotes thesymbolic token length555Symbolic token length provides a canonical measure of rule complexity by abstracting away incidental natural\-language phrasing\.of rulerrandα\>0\\alpha\>0controls the strength of regularization\. This corresponds to a maximum\-entropy prior under a constraint on expected total rule length\(Jaynes,[1957](https://arxiv.org/html/2601.00086#bib.bib43)\)\. Taking the negative log\-likelihood yields the model code length
L\(H\)=−logP\(H\)=α∑r∈Hℓ\(r\)\+logZ\(α\),L\(H\)=\-\\log P\(H\)=\\alpha\\sum\_\{r\\in H\}\\ell\(r\)\+\\log Z\(\\alpha\),whereZ\(α\)Z\(\\alpha\)is constant for a fixed candidate pool and is therefore omitted during optimization\.
##### Data Cost\.
Given failure casesD=\{\(xi,𝒮i,τi−,τi∗\)\}i=1nD=\\\{\(x\_\{i\},\\mathcal\{S\}\_\{i\},\\tau\_\{i\}^\{\-\},\\tau\_\{i\}^\{\*\}\)\\\}\_\{i=1\}^\{n\}, we defineai\(H\)=1a\_\{i\}\(H\)=1if injectingHHcorrects failureii\. LetkH=∑iai\(H\)k\_\{H\}=\\sum\_\{i\}a\_\{i\}\(H\)\. We model correction outcomes with a Bernoulli likelihood and use the refined MDL plug\-in code
L\(D∣H\)=−\[kHlogp^H\+\(n−kH\)log\(1−p^H\)\],L\(D\\mid H\)=\-\\bigl\[k\_\{H\}\\log\\hat\{p\}\_\{H\}\+\(n\-k\_\{H\}\)\\log\(1\-\\hat\{p\}\_\{H\}\)\\bigr\],wherep^H=kH/n\\hat\{p\}\_\{H\}=k\_\{H\}/n\. This term directly rewards rule sets that correct more failures\.
##### Greedy Consolidation\.
We minimizeMDL\(H\)\\mathrm\{MDL\}\(H\)starting from the full rule pool and applying local edits that strictly reduce the objective\. We consider two operations:*pruning*a rule, and*generalizing*a tool\-specific rule to a category\-level rule\. Edits are accepted only when the reduction in model cost outweighs any increase in data cost\. This greedy procedure terminates when no local edit improves the MDL objective\.
In practice, consolidation scales linearly with the size of the candidate rule pool, as each iteration evaluates a constant set of local edits per rule\. While this greedy procedure does not guarantee a globally optimal solution and may miss beneficial non\-local edits, it follows standard practice in rule learning and MDL\-based pruning, where local edits are commonly used to remove redundancy and over\-specific rules and are empirically effective in improving generalization\(Quinlan,[1987](https://arxiv.org/html/2601.00086#bib.bib7); Fürnkranz,[1997](https://arxiv.org/html/2601.00086#bib.bib10); Grunwald,[2007](https://arxiv.org/html/2601.00086#bib.bib14)\)\. Exploring more global or approximate inference strategies for rule consolidation is an interesting direction for future work\.
##### MDL Behavior\.
Although the termL\(D∣H\)L\(D\\mid H\)could be minimized by correcting no failures, this degenerate case is never reached in practice\. Consolidation proceeds greedily from a high\-performing initial rule set; in this regime, removing a rule that reduces the number of corrected failures sharply increasesL\(D∣H\)L\(D\\mid H\), outweighing the modest reduction in model cost\. Such edits are therefore rejected\.
##### Choice ofα\\alpha\.
We select the regularization strengthα\\alphaby choosing the value that yields the best end\-to\-end accuracy after consolidation on the failure set\. Since each rule is evaluated on failures beyond its originating instance, this selection already reflects cross\-sample generalization\. Performance is stable across a wide range ofα\\alpha, indicating that MDL acts as a robust regularizer\.
### 2\.3Rule Retrieval
At inference time, injecting all learned rules is inefficient and noisy, making retrieval necessary to select only rules relevant to the current query and tool context\.
#### 2\.3\.1Natural language based
A simple baseline retrieves rules directly from their natural\-language form by encoding the query and available tools with an off\-the\-shelf sentence embedding model and selecting the top\-kkrules by cosine similarity\. While easy to implement, this approach relies on generic embeddings that struggle with lexical variability and fine\-grained rule semantics\. Finetuning a dedicated embedding model introduces additional complexity, including limited training data, the need for ground\-truth rule annotations, and reduced scalability\.
#### 2\.3\.2Symbolic\-based
To address these limitations, and inspired by prior work on structure\-aware retrieval\(Munikotiet al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib203); Liet al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib204)\), we perform retrieval over the symbolic representation of rules\. By structuring both rules and queries into shared semantic fields, symbolic matching is more efficient, interpretable, and more robust to incidental linguistic variation than retrieval over raw text\.
Given a queryxqx\_\{q\}and available tools𝒮q\\mathcal\{S\}\_\{q\}, we first convert the state into a symbolic representationzqz\_\{q\}\. Retrieval proceeds in two stages\. First, a coarse filter removes inapplicable rules: decomposition rules are always retained, while tool\-use rules are filtered based on whether their scope matches the available tools or tool categories\. Second, the remaining rules are ranked by semantic similarity between their symbolic fields and those ofzqz\_\{q\}, using a generic embedding model\. We retain the top\-kkrules and inject them into the prompt in natural\-language form\. Unlike retrieval over raw text, similarity is computed over a fixed symbolic vocabulary, where NL\-to\-symbolic conversion has already resolved much of the lexical and structural variation that generic embeddings struggle to capture\.
Table 1:Number of examples in each dataset split\.DatasetTrainTestRandUnseenToolHop3927051BFCL:Live\-Multiple735175143BFCL:Multi\-Turn\-Base906050Table 2:Accuracy \(±\\pmstandard deviation, in %\) and number of rules at each learning stage\. Rule consolidation improves performance while reducing rule count\.ToolHopBFCLTest\-randTest\-unseen\# RulesTest\-randTest\-unseen\# RulesInitial26\.5±1\.326\.5\\scriptstyle\\pm 1\.335\.1±1\.635\.1\\scriptstyle\\pm 1\.6050\.1±0\.950\.1\\scriptstyle\\pm 0\.945\.0±1\.045\.0\\scriptstyle\\pm 1\.00\+ Rule Gen\.27\.6±1\.327\.6\\scriptstyle\\pm 1\.342\.1±1\.642\.1\\scriptstyle\\pm 1\.67254\.8±1\.354\.8\\scriptstyle\\pm 1\.347\.6±1\.447\.6\\scriptstyle\\pm 1\.4151\+ Consolid\.31\.1±1\.3\\mathbf\{31\.1\}\\scriptstyle\\pm 1\.343\.1±1\.6\\mathbf\{43\.1\}\\scriptstyle\\pm 1\.66756\.6±1\.2\\mathbf\{56\.6\}\\scriptstyle\\pm 1\.248\.5±1\.4\\mathbf\{48\.5\}\\scriptstyle\\pm 1\.4121Table 3:Accuracy \(±\\pmstandard deviation\) of LLMs on Toolhop and BFCL, with and without rules\. Rules are learned once from Llama3\.2 and reused across models\.LearnedfromAppliedonToolHopBFCLNo RulesRimRuleNo RulesRimRuleLlama3\.2Llama3\.226\.5±1\.326\.5\\scriptstyle\\pm 1\.331\.1±1\.3\\mathbf\{31\.1\}\\scriptstyle\\pm 1\.350\.1±0\.950\.1\\scriptstyle\\pm 0\.956\.6±1\.2\\mathbf\{56\.6\}\\scriptstyle\\pm 1\.2GPT\-4o58\.1±1\.458\.1\\scriptstyle\\pm 1\.457\.4±1\.457\.4\\scriptstyle\\pm 1\.471\.6±0\.871\.6\\scriptstyle\\pm 0\.875\.6±1\.1\\mathbf\{75\.6\}\\scriptstyle\\pm 1\.1Llama473\.8±1\.273\.8\\scriptstyle\\pm 1\.276\.7±1\.2\\mathbf\{76\.7\}\\scriptstyle\\pm 1\.275\.8±0\.875\.8\\scriptstyle\\pm 0\.877\.5±1\.1\\mathbf\{77\.5\}\\scriptstyle\\pm 1\.1O153\.2±1\.453\.2\\scriptstyle\\pm 1\.457\.4±1\.4\\mathbf\{57\.4\}\\scriptstyle\\pm 1\.475\.6±0\.875\.6\\scriptstyle\\pm 0\.877\.6±1\.1\\mathbf\{77\.6\}\\scriptstyle\\pm 1\.1GPT\-4oLlama3\.226\.5±1\.326\.5\\scriptstyle\\pm 1\.331\.3±1\.3\\mathbf\{31\.3\}\\scriptstyle\\pm 1\.350\.1±0\.950\.1\\scriptstyle\\pm 0\.952\.4±1\.3\\mathbf\{52\.4\}\\scriptstyle\\pm 1\.3GPT\-4o58\.1±1\.458\.1\\scriptstyle\\pm 1\.460\.3±1\.4\\mathbf\{60\.3\}\\scriptstyle\\pm 1\.471\.6±0\.871\.6\\scriptstyle\\pm 0\.876\.4±1\.1\\mathbf\{76\.4\}\\scriptstyle\\pm 1\.1Llama473\.8±1\.273\.8\\scriptstyle\\pm 1\.277\.4±1\.2\\mathbf\{77\.4\}\\scriptstyle\\pm 1\.275\.8±0\.875\.8\\scriptstyle\\pm 0\.877\.7±1\.0\\mathbf\{77\.7\}\\scriptstyle\\pm 1\.0O153\.2±1\.453\.2\\scriptstyle\\pm 1\.456\.1±1\.2\\mathbf\{56\.1\}\\scriptstyle\\pm 1\.275\.6±0\.875\.6\\scriptstyle\\pm 0\.877\.9±1\.1\\mathbf\{77\.9\}\\scriptstyle\\pm 1\.1Table 4:Comparison of prompting\-based adaptation methods on ToolHop and BFCL\.ToolHopBFCLTest\-randTest\-unseenTest\-randTest\-unseenZero\-shot26\.5±1\.326\.5\\scriptstyle~\\pm 1\.335\.1±1\.635\.1\\scriptstyle\\pm 1\.650\.1±0\.950\.1\\scriptstyle~\\pm 0\.945\.0±1\.045\.0\\scriptstyle\\pm 1\.0Few\-shot\(Liuet al\.,[2021](https://arxiv.org/html/2601.00086#bib.bib123)\)29\.9±1\.429\.9\\scriptstyle~\\pm 1\.437\.9±1\.437\.9\\scriptstyle~\\pm 1\.454\.5±0\.954\.5\\scriptstyle~\\pm 0\.946\.6±1\.446\.6\\scriptstyle~\\pm 1\.4SEE\(Cuiet al\.,[2025](https://arxiv.org/html/2601.00086#bib.bib121)\)27\.6±1\.527\.6\\scriptstyle~\\pm 1\.535\.9±1\.535\.9\\scriptstyle~\\pm 1\.552\.2±1\.052\.2\\scriptstyle~\\pm 1\.045\.5±1\.045\.5\\scriptstyle~\\pm 1\.0RimRule\(Ours\)31\.1±1\.3\\mathbf\{31\.1\}\\scriptstyle\\pm 1\.343\.1±1\.6\\mathbf\{43\.1\}\\scriptstyle\\pm 1\.656\.6±1\.2\\mathbf\{56\.6\}\\scriptstyle\\pm 1\.248\.5±1\.4\\mathbf\{48\.5\}\\scriptstyle\\pm 1\.4Table 5:Performance with and withoutRimRulefor finetuned models\.ToolHopBFCLTest\-randTest\-unseenTest\-randTest\-unseenSFT \(Llama3\.2\)43\.8±1\.443\.8\\scriptstyle~\\pm 1\.438\.5±1\.538\.5\\scriptstyle~\\pm 1\.565\.0±0\.965\.0\\scriptstyle~\\pm 0\.958\.7±1\.458\.7\\scriptstyle~\\pm 1\.4\+RimRule50\.0±1\.4\\mathbf\{50\.0\}\\scriptstyle~\\pm 1\.445\.1±1\.6\\mathbf\{45\.1\}\\scriptstyle~\\pm 1\.668\.6±1\.2\\mathbf\{68\.6\}\\scriptstyle~\\pm 1\.262\.7±1\.3\\mathbf\{62\.7\}\\scriptstyle~\\pm 1\.3Function Calling \(GPT4o\)63\.8±1\.463\.8\\scriptstyle~\\pm 1\.483\.0±1\.283\.0\\scriptstyle~\\pm 1\.279\.6±0\.779\.6\\scriptstyle~\\pm 0\.777\.2±0\.877\.2\\scriptstyle~\\pm 0\.8\+RimRule66\.1±1\.4\\mathbf\{66\.1\}\\scriptstyle~\\pm 1\.485\.4±1\.1\\mathbf\{85\.4\}\\scriptstyle~\\pm 1\.181\.7±1\.0\\mathbf\{81\.7\}\\scriptstyle~\\pm 1\.079\.8±1\.0\\mathbf\{79\.8\}\\scriptstyle~\\pm 1\.0
## 3Experiments
### 3\.1Datasets
We evaluate our method on two tool\-use benchmarks:ToolHop666[https://hf\.co/datasets/bytedance\-research/ToolHop](https://hf.co/datasets/bytedance-research/ToolHop), CC BY 4\.0 licenseYeet al\.\([2025](https://arxiv.org/html/2601.00086#bib.bib80)\)andBFCL777[https://hf\.co/datasets/gorilla\-llm/Berkeley\-Function\-Calling\-Leaderboard](https://hf.co/datasets/gorilla-llm/Berkeley-Function-Calling-Leaderboard), Apache license 2\.0Yanet al\.\([2024](https://arxiv.org/html/2601.00086#bib.bib81)\)\. ToolHop consists of compositional, multi\-turn queries requiring multi\-step tool reasoning, while thelive\-multiplesubset of BFCL provides a complementary single\-step setting with a larger and more diverse tool set, making tool selection more challenging\.
For both datasets, we assume access to ground\-truth execution traces during training, but no ground\-truth rules are provided\. To evaluate generalization, we define two splits:test\-rand, a random in\-distribution split, andtest\-unseen, a held\-out split containing queries with tools not seen during training\. Dataset statistics are summarized in Table[1](https://arxiv.org/html/2601.00086#S2.T1)\.
### 3\.2Baselines
We compareRimRuleagainst several established adaptation paradigms:
- •Few\-shot in\-context learningretrieves top\-kktraining examples based on semantic similarity\(Liuet al\.,[2021](https://arxiv.org/html/2601.00086#bib.bib123)\)\.
- •Prompt optimizationwith SEE\(Cuiet al\.,[2025](https://arxiv.org/html/2601.00086#bib.bib121)\), which performs global prompt optimization by jointly evolving instructions and demonstrations\.
- •Finetuning, including supervised finetuning \(SFT\) of open\-source models using LoRA\(Huet al\.,[2022](https://arxiv.org/html/2601.00086#bib.bib116)\), as well as closed\-source models tuned for function calling\. For SFT, we construct training data from ground\-truth execution traces, training the model to generate correct tool selections and arguments conditioned on the query, available tools, and previous tool\-call results\.
All methods, including ours, use aReAct\-style prompting framework\(Yaoet al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib19)\)for tool\-use reasoning, allowing agents to generate intermediate steps and tool calls interactively\. We permit agents to retry based on tool feedback or error messages, a common robustness mechanism that nonetheless struggles with systematic reasoning errors\. Our method builds on this setup by injecting explicit rules to prevent such failures\.
We use short names for evaluated models:Llama3\.2888meta\.llama3\-2\-3b\-instruct\-v1\-0,Llama4999meta\.llama4\-maverick\-17b\-instruct\-v1\-0,GPT\-4o101010gpt\-4o\-2024\-11\-20, andO1111111o1\-mini\-2024\-09\-12, whereO1is a long\-reasoning model\.
The symbolic representation supports rule consolidation and retrieval, not direct symbolic execution\. Because the tool\-use tasks we study involve noisy natural\-language queries and environments, purely symbolic rule application is brittle; accordingly, we do not compare against symbolic rule learners designed for clean, structured data\(Quinlan,[1990](https://arxiv.org/html/2601.00086#bib.bib27); Clark and Niblett,[1989](https://arxiv.org/html/2601.00086#bib.bib182); Cohen,[1995](https://arxiv.org/html/2601.00086#bib.bib8); Fürnkranz,[1997](https://arxiv.org/html/2601.00086#bib.bib10)\)\. Instead, rules are applied in natural\-language form to guide LLM reasoning\.
## 4Results and Discussion
### 4\.1Learning Process
Table[2](https://arxiv.org/html/2601.00086#S2.T2)illustrates the learning trajectory using Llama3\.2 as a representative example\. Other models exhibit similar trends\.
Starting from an empty rule library, we collect failure traces from a zero\-shot agent and generate candidate rules, yielding 72 rules on ToolHop and 151 on BFCL121212See Appendix for sample rules\. This initial rule set improves accuracy on both test\-rand and test\-unseen splits\.
Applying MDL\-guided consolidation further reduces the rule count \(by 7% on ToolHop and 20% on BFCL\) while improving performance on test\-rand and yielding smaller but consistent gains on test\-unseen\. Overall, the process produces a compact, interpretable rule library that improves both in\-distribution and out\-of\-distribution generalization\.
### 4\.2Case Study
Table[6](https://arxiv.org/html/2601.00086#S4.T6)shows a representative failure where the agent directly queries a complex familial relationship, leading to a tool error\.RimRuleidentifies the root cause as improper decomposition and induces a rule that enforces stepwise resolution of intermediate entities\. The resulting rule is abstract and reusable, and its symbolic form enables reliable retrieval for similar queries\. This example illustrates how failure traces are converted into compact rules that correct systematic reasoning errors beyond the original instance\.
Table 6:Case study illustrating failure\-driven rule induction and symbolic representation\.QueryHow many letters \(excluding the first and last\) are there in the first name of Viacheslav I of Kiev’s maternal grandfather?FailureThe agent directly queriesViacheslav I of Kiev’s maternal grandfather\. The tool returns an error:“no data found”\.Proposed RuleIf the user query involves identifying a specific familial relationship \(e\.g\., maternal grandfather\), then decompose the task by first resolving intermediate relationships \(e\.g\., mother, father\) sequentially\.Symbolic Formifdomain=FAMILIAL\_RELATIONSHIPortool\_category=GENEALOGY\_QUERY,then action=\[DECOMPOSE\_QUERY, RESOLVE\_INTERMEDIATE\_ENTITY, SEQUENCE\_SUBTASKS\]strength=MANDATORY
### 4\.3Re\-usability Across LLMs
Humans can share heuristics because they are interpretable across contexts\. By encoding adaptation as symbolic, human\-readable rules, our method enables knowledge to be reused across LLMs without retraining\.
We learn two rule libraries from failure traces produced byLlama3\.2andGPT\-4o, and apply them to models of varying size and reasoning strength, evaluating performance on the test\-rand split\. Table[3](https://arxiv.org/html/2601.00086#S2.T3)shows consistent gains in both directions:strong\-to\-weaktransfer improves smaller models, whileweak\-to\-strongtransfer benefits strong reasoning models such asO1andLlama4\. These results suggest that symbolic rules capture transferable failure patterns not resolved by scale alone\.
Table 7:Test\-rand accuracy \(±\\pmstandard deviation, in %\) comparing retrieval strategies\.MethodToolHopBFCLNat\. Lang\. based29\.4±1\.329\.4\\scriptstyle\\pm 1\.354\.1±1\.054\.1\\scriptstyle\\pm 1\.0Symbolic guided31\.1±1\.3\\mathbf\{31\.1\}\\scriptstyle\\pm 1\.356\.6±1\.2\\mathbf\{56\.6\}\\scriptstyle\\pm 1\.2
### 4\.4Performance on Small Dataset
We evaluateRimRulein a low\-resource setting on themulti\_turn\_basesplit of BFCL using only 90 training samples\. Despite limited supervision, the method learns just four rules \(Appendix[A\.2](https://arxiv.org/html/2601.00086#A1.SS2)\) yet achieves substantial gains: accuracy improves from55\.2%55\.2\\%to62\.1%62\.1\\%on test\-rand and from46\.0%46\.0\\%to60\.0%60\.0\\%on test\-unseen\. These results highlight the sample efficiency and practical applicability of rule\-based adaptation\.
### 4\.5Outperforming Prompting\-based Methods
We compareRimRuleagainst prompting\-based adaptation methods, including ReAct prompting\(Yaoet al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib19)\), few\-shot in\-context learning\(Liuet al\.,[2021](https://arxiv.org/html/2601.00086#bib.bib123)\), and prompt optimization with SEE\(Cuiet al\.,[2025](https://arxiv.org/html/2601.00086#bib.bib121)\)\. As shown in Table[4](https://arxiv.org/html/2601.00086#S2.T4),RimRuleconsistently outperforms all prompting baselines on both ToolHop and BFCL, across test\-rand and test\-unseen splits, demonstrating stronger generalization than fixed\-prompt approaches\.
### 4\.6Complementing Finetuned Models
As shown in Table[5](https://arxiv.org/html/2601.00086#S2.T5), addingRimRuleto finetuned models yields consistent gains, especially on the test\-unseen split, indicating that symbolic rules correct residual systematic errors left by supervised training\. We observe similar improvements when applyingRimRuleto models with native function\-calling capabilities \(Table[5](https://arxiv.org/html/2601.00086#S2.T5)\), showing that rule\-based adaptation operates along an orthogonal axis of generalization\.
Table 8:Test\-rand accuracy \(±\\pmstandard deviation, in %\) comparing consolidation strategies\.MethodToolHopBFCLPrompt\-based27\.5±1\.427\.5\\scriptstyle\\pm 1\.452\.1±0\.952\.1\\scriptstyle\\pm 0\.9MDL\-guided31\.1±1\.3\\mathbf\{31\.1\}\\scriptstyle\\pm 1\.356\.6±1\.2\\mathbf\{56\.6\}\\scriptstyle\\pm 1\.2
### 4\.7Ablation Studies
##### Impact of retrieval method\.
Table[7](https://arxiv.org/html/2601.00086#S4.T7)shows that symbolic retrieval consistently outperforms retrieval based on raw natural\-language similarity on both datasets\.
##### Impact of consolidation method\.
As shown in Table[8](https://arxiv.org/html/2601.00086#S4.T8), MDL\-guided consolidation significantly outperforms prompt\-based rule merging\. Together, these results indicate that both symbolic retrieval and MDL\-based consolidation are essential to our approach\.
## 5Related Work
##### Rule Learning\.
Recent work studies rule learning with LLMs via prompting, extracting rules from demonstrationsGao and Das \([2024](https://arxiv.org/html/2601.00086#bib.bib167)\), graphsChenet al\.\([2024](https://arxiv.org/html/2601.00086#bib.bib72)\), or tracesZhanget al\.\([2024](https://arxiv.org/html/2601.00086#bib.bib56)\)to guide generationZhouet al\.\([2024](https://arxiv.org/html/2601.00086#bib.bib57)\); Wanget al\.\([2024b](https://arxiv.org/html/2601.00086#bib.bib58)\)\. Other approaches use rules at training time for synthetic supervisionMorishitaet al\.\([2024](https://arxiv.org/html/2601.00086#bib.bib69)\), reward modelingWang and Xiong \([2025](https://arxiv.org/html/2601.00086#bib.bib32)\), or distillationSadeqet al\.\([2025](https://arxiv.org/html/2601.00086#bib.bib98)\), or store rules in memoryWanget al\.\([2024c](https://arxiv.org/html/2601.00086#bib.bib70)\)\. In contrast to these largely static or training\-time uses, we learn and consolidate rules from failures for dynamic inference\-time reuse\.
##### Tool\-use Agents\.
Tool\-use agents often rely on retriever–generator pipelines or finetuning to select and call tools\(Qinet al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib73); Patilet al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib22)\), or train models to use tools via self\-supervision or agent tuning\(Schicket al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib20)\)\. Recent work further explores reinforcement learning and agent\-centric optimization for tool use\(Leet al\.,[2025](https://arxiv.org/html/2601.00086#bib.bib206); Zhanget al\.,[2025](https://arxiv.org/html/2601.00086#bib.bib208)\), as well as generative approaches that tokenize tools for unified retrieval and calling\(Haoet al\.,[2023](https://arxiv.org/html/2601.00086#bib.bib201); Wanget al\.,[2024a](https://arxiv.org/html/2601.00086#bib.bib202)\)\. While effective, these approaches primarily encode adaptation in model parameters\. We instead externalize adaptation as a compact, interpretable rule library, enabling modular reuse across LLMs without retraining\.
## 6Conclusion
We proposeRimRule, an approach that adapts LLMs by distilling compact, interpretable rules from failure traces and applying them at inference time\. Without modifying model weights, our method improves both in\- and out\-of\-distribution performance, outperforms prompting\-based methods, and complements finetuned models\. These results position inference\-time rule learning as a practical path toward modular and interpretable LLM adaptation\.
## 7Limitations
Our approach assumes access to failure signals during training, such as execution traces or reliable performance feedback, which may not be available in all deployment settings\. Rule consolidation is performed using a greedy MDL\-based procedure; while efficient and effective at the scales studied, it does not guarantee a globally optimal rule set, and alternative optimization methods deserve future study\. In addition, the symbolic representation relies on a manually designed schema intended for noisy natural\-language tool\-use tasks; other domains may benefit from different symbolic abstractions\. Finally, the effectiveness of learned rules depends on the quality and diversity of observed failures, and gains may be smaller in domains with sparse or highly idiosyncratic errors\.
##### Potential Risks\.
As with any adaptive system, learned rules could overgeneralize or reflect biases present in observed failures if applied outside their intended scope\. We mitigate such risks by keeping rules interpretable and applied at inference time, enabling auditing, revision, or removal\. Future work may further explore safeguards for monitoring and validating rule usage in high\-stakes settings\.
## References
- Qwen technical report\.arXiv preprint arXiv:2309\.16609\.External Links:[Link](https://arxiv.org/abs/2309.16609)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1)\.
- T\. Brown, B\. Mann, N\. Ryder, M\. Subbiah, J\. D\. Kaplan, P\. Dhariwal, A\. Neelakantan, P\. Shyam, G\. Sastry, A\. Askell,et al\.\(2020\)Language models are few\-shot learners\.Advances in neural information processing systems33,pp\. 1877–1901\.External Links:[Link](https://arxiv.org/abs/2005.14165)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1)\.
- Z\. Chen, C\. Xu, D\. Wang, Z\. Huang, Y\. Dou, X\. Jiang, and J\. Guo \(2024\)Rulerag: rule\-guided retrieval\-augmented generation with language models for question answering\.arXiv preprint arXiv:2410\.22353\.External Links:[Link](https://arxiv.org/abs/2410.22353)Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px1.p1.1)\.
- P\. Clark and T\. Niblett \(1989\)The cn2 induction algorithm\.Machine Learning3\(4\),pp\. 261–283\.External Links:[Document](https://dx.doi.org/10.1007/BF00116835),[Link](https://link.springer.com/article/10.1007/BF00116835)Cited by:[§3\.2](https://arxiv.org/html/2601.00086#S3.SS2.p4.1)\.
- W\. W\. Cohen \(1995\)Fast effective rule induction\.InProceedings of the 12th International Conference on Machine Learning \(ICML\-95\),A\. Prieditis and S\. Russell \(Eds\.\),San Francisco, CA,pp\. 115–123\.External Links:[Document](https://dx.doi.org/10.1016/B978-1-55860-377-6.50023-2)Cited by:[§3\.2](https://arxiv.org/html/2601.00086#S3.SS2.p4.1)\.
- W\. Cui, J\. Zhang, Z\. Li, H\. Sun, D\. Lopez, K\. Das, B\. A\. Malin, and S\. Kumar \(2025\)SEE: strategic exploration and exploitation for cohesive in\-context prompt optimization\.InProceedings of the 63rd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 29575–29627\.External Links:[Link](https://arxiv.org/abs/2402.11347)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1),[Table 4](https://arxiv.org/html/2601.00086#S2.T4.12.12.5),[2nd item](https://arxiv.org/html/2601.00086#S3.I1.i2.p1.1),[§4\.5](https://arxiv.org/html/2601.00086#S4.SS5.p1.1)\.
- G\. DeJong and R\. Mooney \(1986\)Explanation\-based learning: an alternative view\.Machine learning1,pp\. 145–176\.External Links:[Link](https://link.springer.com/article/10.1007/BF00114116)Cited by:[§2\.1\.2](https://arxiv.org/html/2601.00086#S2.SS1.SSS2.p2.1)\.
- J\. Fürnkranz \(1997\)Pruning algorithms for rule learning\.Machine Learning27\(2–3\),pp\. 139–171\.External Links:[Document](https://dx.doi.org/10.1023/A%3A1007329424533)Cited by:[§2\.2\.2](https://arxiv.org/html/2601.00086#S2.SS2.SSS2.Px4.p2.1),[§3\.2](https://arxiv.org/html/2601.00086#S3.SS2.p4.1)\.
- X\. Gao and K\. Das \(2024\)Customizing language model responses with contrastive in\-context learning\.InProceedings of the AAAI Conference on Artificial Intelligence,Vol\.38,pp\. 18039–18046\.External Links:[Link](https://dl.acm.org/doi/10.1609/aaai.v38i16.29760)Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px1.p1.1)\.
- G\. Gigerenzer and W\. Gaissmaier \(2011\)Heuristic decision making\.Annual Review of Psychology62,pp\. 451–482\.External Links:[Document](https://dx.doi.org/10.1146/annurev-psych-120709-145346),[Link](https://pure.mpg.de/rest/items/item_2099042_4/component/file_2099041/content)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p1.1)\.
- A\. Grattafiori, A\. Dubey, A\. Jauhri, A\. Pandey, A\. Kadian, A\. Al\-Dahle, A\. Letman, A\. Mathur, A\. Schelten, A\. Vaughan,et al\.\(2024\)The llama 3 herd of models\.arXiv preprint arXiv:2407\.21783\.External Links:[Link](https://arxiv.org/abs/2407.21783)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1)\.
- P\. D\. Grunwald \(2007\)The minimum description length principle\.MIT Press,Cambridge, MA\.External Links:[Link](https://direct.mit.edu/books/monograph/3813/The-Minimum-Description-Length-Principle)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p3.1),[§2\.2\.2](https://arxiv.org/html/2601.00086#S2.SS2.SSS2.Px4.p2.1),[§2\.2\.2](https://arxiv.org/html/2601.00086#S2.SS2.SSS2.p1.1)\.
- S\. Hao, T\. Liu, Z\. Wang, and Z\. Hu \(2023\)ToolkenGPT: augmenting frozen language models with massive tools via tool embeddings\.arXiv preprint\.External Links:2305\.11554Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px2.p1.1)\.
- E\. J\. Hu, Y\. Shen, P\. Wallis, Z\. Allen\-Zhu, Y\. Li, S\. Wang, L\. Wang, and W\. Chen \(2022\)LoRA: low\-rank adaptation of large language models\.InICLR,External Links:2106\.09685Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1),[3rd item](https://arxiv.org/html/2601.00086#S3.I1.i3.p1.1)\.
- E\. T\. Jaynes \(1957\)Information theory and statistical mechanics\.Physical Review106\(4\),pp\. 620–630\.External Links:[Document](https://dx.doi.org/10.1103/PhysRev.106.620)Cited by:[§2\.2\.2](https://arxiv.org/html/2601.00086#S2.SS2.SSS2.Px2.p1.3)\.
- D\. A\. Kolb \(1984\)Experiential learning: experience as the source of learning and development\.Prentice Hall,Englewood Cliffs, NJ\.External Links:[Link](https://books.google.com/books/about/Experiential_Learning.html?id=jpbeBQAAQBAJ)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p1.1)\.
- Q\. M\. Le, M\. S\. K\. Luu, K\. Tran, D\. Nguyen, H\. Pham, Q\. Le, H\. T\. Lam, and H\. D\. Nguyen \(2025\)ToolBrain: a flexible reinforcement learning framework for agentic tools\.Note:Accessed 2026\-01\-xxExternal Links:[Link](https://arxiv.org/abs/2510.00023)Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px2.p1.1)\.
- X\. Li, Z\. Liu, C\. Xiong, S\. Yu, Y\. Gu, Z\. Liu, and G\. Yu \(2023\)Structure\-aware language model pretraining improves dense retrieval on structured data\.InFindings of the Association for Computational Linguistics: ACL 2023,pp\. 11560–11574\.External Links:[Link](https://aclanthology.org/2023.findings-acl.734.pdf)Cited by:[§2\.3\.2](https://arxiv.org/html/2601.00086#S2.SS3.SSS2.p1.1)\.
- J\. Liu, D\. Shen, Y\. Zhang, B\. Dolan, L\. Carin, and W\. Chen \(2021\)What makes good in\-context examples for gpt\-33?\.arXiv preprint arXiv:2101\.06804\.External Links:[Link](https://arxiv.org/abs/2101.06804)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1),[Table 4](https://arxiv.org/html/2601.00086#S2.T4.8.8.5),[1st item](https://arxiv.org/html/2601.00086#S3.I1.i1.p1.1),[§4\.5](https://arxiv.org/html/2601.00086#S4.SS5.p1.1)\.
- J\. Metcalfe \(2017\)Learning from errors\.Annual Review of Psychology68,pp\. 465–489\.External Links:[Document](https://dx.doi.org/10.1146/annurev-psych-010416-044022),[Link](https://www.columbia.edu/cu/psychology/metcalfe/PDFs/Learning%20from%20errorsAnnual%20ReviewMetcalfe2016.pdf)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p1.1)\.
- T\. M\. Mitchell, R\. M\. Keller, and M\. A\. Kedar\-Cabelli \(1986\)Explanation\-based generalization: a unifying view\.Machine Learning1\(1\),pp\. 47–80\.External Links:[Link](https://link.springer.com/article/10.1023/A:1022691120807)Cited by:[§2\.1\.2](https://arxiv.org/html/2601.00086#S2.SS1.SSS2.p2.1)\.
- T\. Morishita, G\. Morio, A\. Yamaguchi, and Y\. Sogawa \(2024\)Enhancing reasoning capabilities of llms via principled synthetic logic corpus\.Advances in Neural Information Processing Systems37,pp\. 73572–73604\.External Links:[Link](https://arxiv.org/abs/2411.12498)Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px1.p1.1)\.
- S\. Munikoti, A\. Acharya, S\. Wagle, and S\. Horawalavithana \(2023\)ATLANTIC: structure\-aware retrieval\-augmented language model for interdisciplinary science\.External Links:[Link](https://arxiv.org/abs/2311.12289)Cited by:[§2\.3\.2](https://arxiv.org/html/2601.00086#S2.SS3.SSS2.p1.1)\.
- S\. G\. Patil, R\. Taori,et al\.\(2023\)Gorilla: large language model connected with massive apis\.External Links:2305\.15334Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px2.p1.1)\.
- R\. Pryzant, D\. Iter, J\. Li, Y\. T\. Lee, C\. Zhu, and M\. Zeng \(2023\)Automatic prompt optimization with" gradient descent" and beam search\.arXiv preprint arXiv:2305\.03495\.External Links:[Link](https://arxiv.org/abs/2305.03495)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1)\.
- S\. Qin, C\. Zhang, and et al\. \(2023\)ToolLLM: facilitating large language models to master 16000\+ real\-world apis\.arXiv preprint arXiv:2307\.16789\.External Links:[Link](https://arxiv.org/abs/2307.16789)Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px2.p1.1)\.
- J\. R\. Quinlan \(1987\)Simplifying decision trees\.International Journal of Man\-Machine Studies27\(3\),pp\. 221–234\.External Links:[Document](https://dx.doi.org/10.1016/S0020-7373%2887%2980053-6)Cited by:[§2\.2\.2](https://arxiv.org/html/2601.00086#S2.SS2.SSS2.Px4.p2.1)\.
- J\. R\. Quinlan \(1990\)Learning logical definitions from relations\.Machine Learning5\(3\),pp\. 239–266\.External Links:[Document](https://dx.doi.org/10.1007/BF00117105)Cited by:[§3\.2](https://arxiv.org/html/2601.00086#S3.SS2.p4.1)\.
- J\. Rissanen \(1978\)Modeling by shortest data description\.Automatica14\(5\),pp\. 465–471\.External Links:[Document](https://dx.doi.org/10.1016/0005-1098%2878%2990005-5)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p3.1),[§2\.2\.2](https://arxiv.org/html/2601.00086#S2.SS2.SSS2.p1.1)\.
- E\. Rosch \(1978\)Principles of categorization\.InCognition and Categorization,E\. Rosch and B\. B\. Lloyd \(Eds\.\),pp\. 27–48\.External Links:[Link](https://www.taylorfrancis.com/chapters/edit/10.4324/9781032633275-4/principles-categorization-eleanor-rosch?context=ubx&refId=54284b77-3001-418b-b10d-fa619099b68a)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p1.1)\.
- N\. Sadeq, X\. Xu, Z\. Xie, J\. McAuley, B\. Kang, P\. Lamba, and X\. Gao \(2025\)Improving in\-context learning with reasoning distillation\.arXiv preprint arXiv:2504\.10647\.External Links:[Link](https://arxiv.org/abs/2504.10647)Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px1.p1.1)\.
- T\. Schick, J\. Dwivedi\-Yu, R\. Dessì, R\. Raileanu, M\. Lomeli, L\. Zettlemoyer, N\. Cancedda, and T\. Scialom \(2023\)Toolformer: language models can teach themselves to use tools\.InAdvances in Neural Information Processing Systems \(NeurIPS\),External Links:2302\.04761Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px2.p1.1)\.
- G\. Teamet al\.\(2023\)Gemini: a family of highly capable multimodal models\.arXiv preprint\.External Links:2312\.11805,[Link](https://arxiv.org/abs/2312.11805)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1)\.
- M\. Verma, S\. Bhambri, and S\. Kambhampati \(2024\)On the brittle foundations of react prompting for agentic large language models\.arXiv preprint arXiv:2405\.13966\.External Links:[Link](https://arxiv.org/abs/2405.13966)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1)\.
- R\. Wang, X\. Han, L\. Ji, S\. Wang, T\. Baldwin, and H\. Li \(2024a\)ToolGen: unified tool retrieval and calling via generation\.arXiv preprint\.External Links:2410\.03439Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px2.p1.1)\.
- S\. Wang, Z\. Wei, Y\. Choi, and X\. Ren \(2024b\)Can llms reason with rules? logic scaffolding for stress\-testing and improving llms\.arXiv preprint arXiv:2402\.11442\.External Links:[Link](https://arxiv.org/abs/2402.11442)Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px1.p1.1)\.
- S\. Wang, Z\. Wei, Y\. Choi, and X\. Ren \(2024c\)Symbolic working memory enhances language models for complex rule application\.arXiv preprint arXiv:2408\.13654\.External Links:[Link](https://arxiv.org/abs/2408.13654)Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px1.p1.1)\.
- T\. Wang and C\. Xiong \(2025\)AutoRule: reasoning chain\-of\-thought extracted rule\-based rewards improve preference learning\.External Links:2506\.15651Cited by:[§2\.2\.1](https://arxiv.org/html/2601.00086#S2.SS2.SSS1.p1.1),[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px1.p1.1)\.
- J\. Wei, J\. Wei, Y\. Tay, D\. Tran, A\. Webson, Y\. Lu, X\. Chen, H\. Liu, D\. Huang, D\. Zhou,et al\.\(2023\)Larger language models do in\-context learning differently\.arXiv preprint arXiv:2303\.03846\.External Links:[Link](https://arxiv.org/abs/2303.03846)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1)\.
- F\. Yan, H\. Mao, C\. C\. Ji, T\. Zhang, S\. G\. Patil, I\. Stoica, and J\. E\. Gonzalez \(2024\)Berkeley function calling leaderboard\.Note:[https://gorilla\.cs\.berkeley\.edu/blogs/8\_berkeley\_function\_calling\_leaderboard\.html](https://gorilla.cs.berkeley.edu/blogs/8_berkeley_function_calling_leaderboard.html)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p4.1),[§3\.1](https://arxiv.org/html/2601.00086#S3.SS1.p1.1)\.
- E\. Yang, L\. Shen, G\. Guo, X\. Wang, X\. Cao, J\. Zhang, and D\. Tao \(2024\)Model merging in llms, mllms, and beyond: methods, theories, applications and opportunities\.arXiv preprint arXiv:2408\.07666\.External Links:[Link](https://arxiv.org/abs/2408.07666)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p2.1)\.
- S\. Yao, J\. Zhao, D\. Yu, N\. Du, I\. Shafran, K\. Narasimhan, and Y\. Cao \(2023\)ReAct: synergizing reasoning and acting in language models\.InInternational Conference on Learning Representations \(ICLR\),External Links:[Link](https://openreview.net/forum?id=WE_vluYUL-X)Cited by:[§3\.2](https://arxiv.org/html/2601.00086#S3.SS2.p2.1),[§4\.5](https://arxiv.org/html/2601.00086#S4.SS5.p1.1)\.
- J\. Ye, Z\. Du, X\. Yao, W\. Lin, Y\. Xu, Z\. Chen, Z\. Wang, S\. Zhu, Z\. Xi, S\. Yuan,et al\.\(2025\)ToolHop: a query\-driven benchmark for evaluating large language models in multi\-hop tool use\.arXiv preprint arXiv:2501\.02506\.External Links:[Link](https://arxiv.org/abs/2501.02506)Cited by:[§1](https://arxiv.org/html/2601.00086#S1.p4.1),[§3\.1](https://arxiv.org/html/2601.00086#S3.SS1.p1.1)\.
- Y\. Zhang, Y\. Zeng, Q\. Li, Z\. Hu, K\. Han, and W\. Zuo \(2025\)Tool\-r1: sample\-efficient reinforcement learning for agentic tool use\.Note:https://arxiv\.org/abs/2509\.12867Accessed 2026\-01\-xxCited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px2.p1.1)\.
- Y\. Zhang, P\. Xiao, L\. Wang, C\. Zhang, M\. Fang, Y\. Du, Y\. Puzyrev, R\. Yao, S\. Qin, Q\. Lin,et al\.\(2024\)RuAG: learned\-rule\-augmented generation for large language models\.arXiv preprint arXiv:2411\.03349\.External Links:[Link](https://arxiv.org/abs/2411.03349)Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px1.p1.1)\.
- P\. Zhou, J\. Pujara, X\. Ren, X\. Chen, H\. Cheng, Q\. V\. Le, E\. Chi, D\. Zhou, S\. Mishra, and H\. S\. Zheng \(2024\)Self\-discover: large language models self\-compose reasoning structures\.Advances in Neural Information Processing Systems37,pp\. 126032–126058\.External Links:[Link](https://arxiv.org/abs/2402.03620)Cited by:[§5](https://arxiv.org/html/2601.00086#S5.SS0.SSS0.Px1.p1.1)\.
## Appendix AAppendix
### A\.1Prompts
This section includes the prompts used throughout our pipeline: for generating rules from failure traces, discovering and updating the classification vocabulary, and translating rules into canonical form\. Prompts are shown as used, with placeholders for query, tools, and traces\.
YouareaseniorAIsystemsinstructortaskedwithhelpingatool\-usinglanguagemodel,referredtoastheToolAgent,improveitsabilitytousetoolsaccurately,efficiently,andreliably,evenwithnewtoolsandunseenqueriesthatarestructurallyand/orsemanticallysimilartopreviouslyseenexamples\.YourroleistoreviewincorrecttoolusagetracesproducedbytheToolAgent,comparethemagainstthecorrect\(groundtruth\)traces,andanalyzeanyembeddederrormessagestoreasonabouttheerror\.
Anincorrecttraceoccurswhenaquery’sexecutionbytheToolAgentdoesn’tmatchthegroundtruthanswer\.Incorrecttracesareeithercomplete\(finishedbutincorrect\)orincompleteduetounrecoverableexecutionerrors\.YouwillbeprovidedwiththeToolAgent’sfullexecutiontrace,includingembeddederrormessages\.
Therearetwotypesoferrors:
i\.Reasoningerrors\(toanalyzeandgeneraterulesfor\)
ii\.Propagationerrors\(toignore,astheyresultfrompriormistakes\)
Stepsmaycontain:
\(i\)noerrors,\(ii\)onlypropagationerrors,or\(iii\)oneormorereasoningerrors\.
Yourgoalistoextractgeneralizable,tool\-schema\-aware,andcontext\-sensitiverulesthatcanguidefuturetoolusage\-evenwithunseenqueriesandschemas\.Thinklikeameta\-cognitiveteacher:diagnoserootcausesandarticulateprecise,reusableabstractions\.
Youwillnowbegiven:
1\.Theuserquery\[INSERTUSERQUERY\]
2\.Theavailabletools\[INSERTTOOLSCHEMAJSON\]
3\.Theincorrecttrace\[INSERTTOOLAGENTTRACE\]
4\.Thegroundtruthtrace\[INSERTGROUNDTRUTHTRACE\]
Yourtaskistoidentifyreasoningerrorsbycomparingthetraces\.
Check:
\-Weresubtasksidentifiedcorrectly?
\-Werethecorrecttoolsselected?
\-Weretheargumentsconstructedcorrectly?
Guidelinesforrulegeneration:
\-Onlygeneraterulesforreasoningerrors
\-Identifyrootcauses,notsuperficialfixes
\-Rulesmustbegeneralizableandschema\-aware
\-Rulesmustnotcontainquery\-specificortool\-specifictokens
\-Eachrulemustbeatomicandclassifiableas:
a\.decompositionerror
b\.toolselectionerror
c\.toolargumentserror
\-Ifmultiplereasoningfailuresoccur,generatemultiplerulesunlessclarityispreserved
Rulesmustbesymbolic,composable,andconformtoastandardform\(e\.g\.,condition=\>action\)\.
Outputformat:
First,writeabriefanalysisexplainingtherootcauseanderrortype\.
Thenoutputoneruleonly,usingthisJSONstructure:
\{
"new\_rule":"<generalizedif\-thenrule\>",
"error\_type":"<decompositionerror/toolselectionerror/toolargumentserror\>"
\}
Listing 1:Prompt used to generate reasoning rules from failure traces\. Placeholders like user query and tool schemas are injected at runtime\.Youareanexpertruleclassificationspecialist\.
YourtaskistoCREATEtheinitialvocabularyforruleclassificationbasedontheprovidedfielddefinitions\.
Analyzetherulescarefullyandcreatecomprehensivecategoriesthatcoverallruletypes\.
Useonlyuppercaseletters,numbers,andunderscoresfortokennames\.
ReturnonlyvalidJSONformat\.
Createinitialvocabularyforruleclassificationbasedonthesedefinitions:
FIELDDEFINITIONS:
DOMAIN\(enum\):Broadtopicaldomain,inferredjointlyfromrulecontent\+toolcontext\+querycontext\.
QUALIFIER\(enum\):Fine\-grainedsituationaltagsthataremorespecificthandomain\.
ACTION\(enum\):Theaction\(s\)theruleprescribes,fromaclosedset\.
STRENGTH\(enum\):Ruleactionpriority\(must,may\)\.Samescope/domain/qualifier,higherpriorityshouldberetrievedratherthanlowpriority\.
Examples:MANDATORY,RECOMMENDED,OPTIONAL
TOOL\_CATEGORY\(enum\):Toolfunctionalcategorybasedontoolcapabilitiesandusagepatterns\.
Thisshouldrepresentbroadtooltypesthatcangroupsimilartoolstogether\.
Examples:DATA\_PROCESSING,SEARCH\_ENGINE,COMPUTATION,TEXT\_PROCESSING\.\.\.
Rulestoanalyze:
\[INSERT\_BULLETS\_HERE\]
Createacomprehensivevocabularycoveringallruletypesintheaboverules\.
Useonlyuppercaseletters,numbers,andunderscoresforcategorynames\.
ReturnJSON:
\{
"vocab\_version":"v1",
"domain":\[\.\.\.\],
"qualifier":\[\.\.\.\],
"action":\[\.\.\.\],
"strength":\[\.\.\.\],
"tool\_category":\[\.\.\.\]
\}
Listing 2:Prompt used to induce the rule classification vocabulary from a batch of rules\. Placeholders are filled dynamically\.Youareanexpertruleclassificationspecialist\.
YourtaskistoUPDATEandEXPANDanexistingvocabularybasedonnewrules\.
Reviewthecurrentvocabulary,identifymissingcategoriesfromnewrules,andreturnthecompleteupdatedvocabulary\.
Useonlyuppercaseletters,numbers,andunderscoresfortokennames\.
Avoidduplicatesandmaintainconsistencywithexistingcategories\.
ReturnonlyvalidJSONformat\.
Updateandexpandvocabularyforruleclassification\.
FIELDDEFINITIONS:
DOMAIN\(enum\):Broadtopicaldomain,inferredjointlyfromrulecontent\+toolcontext\+querycontext\.
QUALIFIER\(enum\):Fine\-grainedsituationaltagsthataremorespecificthandomain\.
ACTION\(enum\):Theaction\(s\)theruleprescribes,fromaclosedset\.
STRENGTH\(enum\):Ruleactionpriority\(must,may\)\.Samescope/domain/qualifier,higherpriorityshouldberetrievedratherthanlowpriority\.
TOOL\_CATEGORY\(enum\):Toolfunctionalcategorybasedontoolcapabilitiesandusagepatterns\.
Currentaccumulatedvocabulary:
DOMAIN:\[INSERTCURRENTDOMAINSOR’Noneyet’\]
QUALIFIER:\[INSERTCURRENTQUALIFIERSOR’Noneyet’\]
ACTION:\[INSERTCURRENTACTIONSOR’Noneyet’\]
STRENGTH:\[INSERTCURRENTSTRENGTHSOR’Noneyet’\]
TOOL\_CATEGORY:\[INSERTCURRENTTOOL\_CATEGORIESOR’Noneyet’\]
Newrulestoanalyze:
\[INSERTNEWRULEBULLETSHERE\]
Instructions:
1\.Reviewthecurrentvocabularyabove
2\.Analyzethenewrulestoidentifyanymissingcategories
3\.Addnewcategoriesifneeded,butavoidduplicates
4\.Keepexistingcategoriesthatarestillrelevant
5\.Returnthecompleteupdatedvocabulary
ReturnJSONwithallcategories\(existing\+new\):
\{
"domain":\["existing\_domains","new\_domains\_if\_any"\],
"qualifier":\["existing\_qualifiers","new\_qualifiers\_if\_any"\],
"action":\["existing\_actions","new\_actions\_if\_any"\],
"strength":\["existing\_strengths","new\_strengths\_if\_any"\],
"tool\_category":\["existing\_tool\_categories","new\_tool\_categories\_if\_any"\]
\}
Listing 3:Prompt used to update and expand the rule classification vocabulary using newly generated rules\.Youareanexpertruleclassificationspecialist\.
Yourtaskistoclassifyindividualrulesusingtheprovidedvocabulary\.
Analyzetherulecontent,toolcontext,andquerycontexttodeterminethemostappropriateclassification\.
Chooseonlyfromthegivenvocabularyoptions\.
ReturnonlyvalidJSONformat\.
Vocabenumerations:
\-domain:\[INSERTdomainlist\]
\-qualifier:\[INSERTqualifierlist\]
\-action:\[INSERTactionlist\]
\-strength:\[INSERTstrengthlist\]
\-tool\_category:\[INSERTtool\_categorylist\]
Ruletoclassify\(analyzeallfieldsforcontext\):
\[INSERTRULEOBJECTASJSON\]
ClassificationGuidelines:
DOMAIN:Inferfromrulecontent\+toolcontext\+querycontext\.Choosethebroadestapplicabledomainthatcoverstherule’stopic\.
QUALIFIER:Selectfine\-grainedsituationaltagsthataremorespecificthandomain\.Youcanselectmultiplequalifiersiftheruleappliestomultiplesituations\.Focusonconditions,constraints,orspecificcontextsmentionedintherule\.
ACTION:Identifythespecificaction\(s\)theruleprescribes\.Choosefromtheclosedsetofavailableactions\.Youcanselectmultipleactionsiftheruleprescribesmultiplesteps\.
STRENGTH:Determinerulepriority\(must,may\)\.MANDATORY=mustfollow,RECOMMENDED=shouldfollow,OPTIONAL=mayfollow\.Considertherule’slanguageandcontexttodeterminepriority\.
TOOL\_CATEGORY:Identifythefunctionalcategoryofthetool\(s\)usedinthisrule\.Choosefromtheavailabletoolcategoriesbasedonthetool’scapabilitiesandusagepattern\.Thisshouldrepresentthebroadfunctionaltypeofthetool\(e\.g\.,DATA\_PROCESSING,SEARCH\_ENGINE,COMPUTATION\)\.
ReturnONLYvalidJSONmatchingthisschema:
\{
"\_id":0,
"domain":"FAMILIAL\_RELATIONSHIPS",
"qualifier":\["SEQUENTIAL","MULTI\_STEP"\],
"action":\["DECOMPOSE","VALIDATE"\],
"strength":"MANDATORY",
"tool\_category":"DATA\_PROCESSING"
\}
Listing 4:Prompt used to classify individual rules using a fixed vocabulary\. Vocabulary values and rule content are injected at runtime\.
### A\.2Sample Rules
Below, we present a representative subset of learned rules\. Each rule is shown in natural language along with its corresponding symbolic representation\.
1\.Iftheuserqueryinvolvesidentifyingacomplexrelationship\(e\.g\.,step\-relative\)andtheavailabletoolsdonotdirectlysupporttherequestedrelationshiptype,thendecomposethequeryintointermediatesubtasksthatprogressivelyresolvetherelationshipthroughsimpler,directlysupportedrelationshiptypes\.
if\(domain=RELATIONSHIP\_RESOLUTIONandqualifier=\[RELATIONSHIP\_CHAIN
\_TRAVERSAL,INTERMEDIATE\_ENTITY\_IDENTIFICATION\]\)then\(action=\[DECOMPOSE\_QUERY,RESOLVE\_INTERMEDIATE\_ENTITY\]\)withstrength=MANDATORY
2\.Ifaqueryinvolvesdeterminingapropertyofanobjectderivedfromintermediatesteps\(e\.g\.,counting,analyzing,ortransforminganattributeofanentity\),thenthedecompositionmustexplicitlyincludeasubtasktoapplytheappropriateprocessortransformationtothederivedattribute\.
if\(domain=QUERY\_DECOMPOSITIONandqualifier=\[MULTI\_STEP\_REASONING,DERIVATIVE\_ENTITY\]\)then\(action=\[DECOMPOSE\_QUERY,TRANSFORM\_INPUT\]\)withstrength=MANDATORY
3\.Ifaqueryfailsduetoinsufficientorincompletedatareturnedbyatool,thenrefinetheinputargumentsbyincludingoptionalparametersthatprovideadditionalcontext\(e\.g\.,variantsofnames,timeperiods,regions,orotherapplicableconstraints\)toimprovedataretrievalaccuracy\.
if\(domain=TOOL\_ARGUMENT\_VALIDATIONandqualifier=\[INCOMPLETE\_DATA
\_REFINEMENT\]\)then\(action=\[REFINE\_INPUT\_ARGUMENTS,HANDLE\_INCOMPLETE\_DATA\]\)withstrength=RECOMMENDED
4\.Ifaqueryinvolvesdetermininganattribute\(e\.g\.,date,location,event\)ofanentitythatisrelatedtoanotherentity\(e\.g\.,familymember\),thendecomposethequerytofirstidentifytherelatedentitybeforeattemptingtodetermineitsattribute\.
if\(domain=QUERY\_DECOMPOSITIONandqualifier=\[RELATIONSHIP\_CHAIN\_
TRAVERSAL,INTERMEDIATE\_ENTITY\_IDENTIFICATION\]\)then\(action=\[DECOMPOSE\_QUERY,RESOLVE\_INTERMEDIATE\_ENTITY\]\)withstrength=MANDATORY
5\.Ifthesubtaskrequiresextractingaspecificsubsetofinformation\(e\.g\.,firstnamefromafullname\),thenconstructargumentsforthetooltorestricttheoutputtomatchtherequestedsubsetbyenablingrelevantoptionalparametersexplicitly,whileleavingunrelatedparametersattheirdefaults\.
if\(domain=NAME\_PROCESSINGandqualifier=\[NAME\_COMPONENT\_EXTRACTION\]\)then\(action=\[CONSTRUCT\_ARGUMENTS,REFINE\_INPUT\_ARGUMENTS\]\)withstrength=MANDATORY
6\.Iftheuserqueryinvolvesidentifyinginformationaboutaspecificfamilialrelationshipacrossmultiplegenerations\(e\.g\.,paternalgrandfather\),thendecomposethequerysuchthatthefamilialrelationshipisresolveddirectlyusingtoolsdesignedtoretrievegenealogicaldata,withoutredundantlyextractingunrelatedimmediaterelationships\.
if\(domain=RELATIONSHIP\_RESOLUTIONandqualifier=\[FAMILIAL\_RELATIONSHIP,RELATIONSHIP\_CHAIN\_TRAVERSAL\]\)then\(action=\[DECOMPOSE\_QUERY,IDENTIFY\_RELATIONSHIP\]\)withstrength=MANDATORY
7\.Ifaqueryinvolvesdeterminingtheancestryofapersonbasedonaspecificfamilialrelationship\(e\.g\.,maternalgrandfather\),thendecomposethetaskintosubtasksthatsequentiallyqueryeachfamiliallink\(e\.g\.,mother,mother’sfather\)andensureintermediateresultsareusedtorefinesubsequentsubtasks\.
if\(domain=HIERARCHICAL\_RELATIONSHIPSandqualifier=\[FAMILIAL\_RELATIONSHIP,RELATIONSHIP\_CHAIN\_TRAVERSAL,INTERMEDIATE\_ENTITY\_IDENTIFICATION\]\)then\(action=\[DECOMPOSE\_QUERY,SEQUENCE\_SUBTASKS,RESOLVE\_INTERMEDIATE\_ENTITY\]\)withstrength=MANDATORY
8\.Ifaqueryinvolvesidentifyinganentityindirectlyrelatedtoanother\(e\.g\.,thefounderofapoliticalpartyidentifiedinapreviousstep\),thenensurethatintermediatesubtaskschainoutputslogicallybyqueryingtherelationshipexplicitlyratherthanassumingassociationsprovidedinthequery\.
if\(domain=INDIRECT\_ENTITY
\_IDENTIFICATIONandqualifier=\[RELATIONSHIP\_CHAIN
\_TRAVERSAL,INTERMEDIATE\_ENTITY\_IDENTIFICATION\]\)then\(action=\[SEQUENCE\_SUBTASKS,RESOLVE\_INTERMEDIATE\_ENTITY\]\)withstrength=MANDATORY
9\.Ifaqueryinvolvesretrievinginformationaboutanindividual’srelative,thedecompositionmustincludeasubtasktoexplicitlyidentifytherelativebeforeretrievingspecificinformationaboutthem\.
if\(domain=RELATIONSHIP\_RESOLUTIONandqualifier=\[FAMILIAL\_RELATIONSHIP,RELATIONSHIP\_CHAIN\_TRAVERSAL\]\)then\(action=\[DECOMPOSE\_QUERY,RESOLVE\_INTERMEDIATE\_ENTITY\]\)withstrength=MANDATORY
10\.Ifthesubtaskinvolvesidentifyingafamilialorsocialrelationshipbetweenentities,thenselectatooldesignedtoqueryrelationships,anddonotselectatooldesignedforextractingnamecomponentsorparsingnames\.
if\(domain=RELATIONSHIP\_RESOLUTIONandqualifier=\[FAMILIAL\_RELATIONSHIP,RELATIONSHIP\_CHAIN\_TRAVERSAL\]\)then\(action=\[MATCH\_TOOL\_TO\_SUBTASK\]\)withstrength=MANDATORY
Listing 5:Sample rules learned from the ToolHop dataset1\.Ifareasoningprocessidentifiesasubtaskrequiringtool\-basedexecution,thenensurethetoolnamegeneratedintheoutputmatchesexactlywithoneoftheavailabletoolsintheschema\.Useschemavalidationtoconfirmthatthegeneratedtoolnameexistsbeforefinalizingtheresponse\.
if\(domain=TRANSPORTATIONandqualifier=\[SCHEMA\_VALIDATION,TOOL\_SELECTION\_ERROR\]\)then\(action=\[CONFIRM\_SCHEMA\_COMPLIANCE,SELECT\_TOOL\_BASED\_ON\_QUERY\]\)withstrength=MANDATORY
2\.IFthequeryinvolvesretrievinggeneralinformationaboutanentity,concept,oreventthatisnotexplicitlytiedtorecentupdatesortemporalrelevance,THENselectatooldesignedforgeneralwebsearchesinsteadofatoolspecializedforretrievingrecentnewsorupdates\.
if\(domain=GENERAL\_INFORMATION
\_RETRIEVALandqualifier=\[TOOL\_SELECTION\_ERROR\]\)then\(action=\[SELECT\_TOOL\_BASED\_ON\_QUERY\]\)withstrength=MANDATORY
3\.Ifthesubtaskrequirescheckingavailabilityorstocklevelsforspecificproductattributes\(e\.g\.,sizes,stockcount\),thenselectatoolwhoseschemaexplicitlysupportsinventory\-relatedoperations,ratherthanusingatooldesignedforgeneralproductdetails\.
if\(domain=INVENTORY\_MANAGEMENTandqualifier=\[TOOL\_SELECTION\_ERROR\]\)then\(action=\[SELECT\_TOOL\_BASED\_ON\_QUERY\]\)withstrength=MANDATORY
4\.Ifthesubtaskinvolvescheckingtheavailabilityofaspecificattribute\(e\.g\.,size,color,orstock\)foraproduct,thenselectatoolwhoseschemaexplicitlyincludesfunctionalityforqueryingavailabilityofattributesratherthanretrievinggeneralproductdetails\.
if\(domain=INVENTORY\_MANAGEMENTandqualifier=\[TOOL\_SELECTION\_ERROR\]\)then\(action=\[SELECT\_TOOL\_BASED\_ON\_QUERY\]\)withstrength=MANDATORY
5\.Ifauserqueryexplicitlyprovidesavalueforaparameter,regardlessofwhethertheparameterhasadefaultvalueintheschema,prioritizetheuser\-providedvalueoverthedefaultvaluewhenconstructingarguments\.
if\(domain=DATABASE\_MANAGEMENTandqualifier=\[USER\_QUERY\_VALUE\_PRIORITY,DEFAULT\_VALUE\_ASSIGNMENT\]\)then\(action=\[PRIORITIZE\_USER\_VALUE,CONSTRUCT\_TOOL\_ARGUMENTS\]\)withstrength=MANDATORY
6\.Iftheuserqueryexplicitlyrequestsunderstanding,explanation,orhelpaboutafunctionality,thenselectatooldesignedtoprovideinformationalassistanceratherthanoneintendedforoperationalexecution\.
if\(domain=GENERAL\_INFORMATION\_RETRIEVALandqualifier=\[TOOL\_SELECTION\_ERROR\]\)then\(action=\[SELECT\_TOOL\_BASED\_ON\_QUERY\]\)withstrength=MANDATORY
7\.Iftheintendedactionistoretrieveinformationbasedonuser\-specifiedfiltersorconstraints,thenselectatoolthatexplicitlysupportsfilteringorconstraint\-basedretrievalinitsschemadescription\.Ensurethesubtaskalignsdirectlywiththetool’sprimaryfunctionasspecifiedinitsschema\.
if\(domain=GENERAL\_INFORMATION\_RETRIEVALandqualifier=\[TOOL\_SELECTION\_ERROR\]\)then\(action=\[SELECT\_TOOL\_BASED\_ON\_QUERY\]\)withstrength=MANDATORY
8\.Ifasubtaskinvolvesidentifyingavailableoptionsorexploringpossiblechoicesforaresource\(e\.g\.,accommodations,flights,attractions\),thenselectatooldesignedforsearchingorbrowsingthoseresourcesratherthanatooldesignedforfinalizingorreservingthem\.
if\(domain=GENERAL\_INFORMATION\_RETRIEVALandqualifier=\[TOOL\_SELECTION\_ERROR\]\)then\(action=\[SELECT\_TOOL\_BASED\_ON\_QUERY\]\)withstrength=MANDATORY
9\.Iftheuserqueryspecifiesaconstraintrelatedtoanentity\(e\.g\.,actorname,directorname,genre,etc\.\),thenconstructthecorrespondingparametervaluebydirectlyextractingtheentitymentionedinthequery,insteadofusingdefaultorplaceholdervalues\.
if\(domain=GENERAL\_INFORMATION\_RETRIEVALandqualifier=\[REQUIRED\_PARAMETER
\_FORMATTING,USER\_QUERY\_VALUE\_PRIORITY\]\)then\(action=\[CONSTRUCT\_TOOL\_ARGUMENTS,PRIORITIZE\_USER\_VALUE\]\)withstrength=MANDATORY
10\.Ifaschemaexplicitlylimitsvalidvaluesforaninputparametertoapredefinedset,thenwhenconstructingarguments,mapuserpreferencestotheclosestvalidvaluewithinthisset,ordefaulttoaneutraloption\(e\.g\.,nofiltering\)whentheschemadisallowsexplicitpreferences\.
if\(domain=GENERAL\_INFORMATION\_RETRIEVALandqualifier=\[SCHEMA\_VALIDATION,DEFAULT\_VALUE\_ASSIGNMENT\]\)then\(action=\[CONSTRUCT\_TOOL\_ARGUMENTS,ASSIGN\_DEFAULT\_VALUE\]\)withstrength=MANDATORY
Listing 6:Sample rules learned from the BFCL: Live\-Multiple dataset1\.Ifasubtaskinvolvesinitiatingasystemorprocesswithpreconditions,thenidentifyandincludeallrequiredpreconditions\(e\.g\.,statevalidations,sequentialactions\)inthetaskdecomposition,ensuringthattheyareexecutedinthecorrectorderpriortoinvokingthemainaction\.Forexample,ifstartingaprocessrequirespreconditionsA,B,andC,verifyandsatisfyA,B,andCsequentiallybeforeinitiatingtheprocess\.
if\(domain=PROCESS\_MANAGEMENTandqualifier=\[PRECONDITION\_VALIDATION,TASK\_SEQUENCE\_VALIDATION\]\)then\(action=\[DECOMPOSE\_TASK,VALIDATE\_PRECONDITIONS,ENSURE\_SEQUENCE\]\)withstrength=MANDATORY
2\.Ifauserqueryinvolvesanactionthatrequiresspecificprerequisitestobemet\(e\.g\.,adependencybetweentasksorastaterequirement\),decomposethequeryintosubtasksthatexplicitlyaddresstheprerequisitesfirst\.Ensureeachprerequisitesubtaskisexecutedandvalidatedbeforeproceedingwiththedependentaction\.
if\(domain=PROCESS\_MANAGEMENTandqualifier=\[PREREQUISITE\_TASK,DEPENDENCY\_MANAGEMENT,TASK\_SEQUENCE\_VALIDATION\]\)then\(action=\[DECOMPOSE\_TASK,VALIDATE\_PRECONDITIONS,EXECUTE\_SUBTASK\]\)withstrength=MANDATORY
3\.Ifthetaskinvolvesconvertingamonetarytargetbetweentwocurrencies,thenensurethebasecurrencymatchesthesourceofthemonetarytargetandthetargetcurrencymatchesthedestinationspecifiedinthequerycontext\.Donotreversetheseroles,asitwillmisaligntheoutputwiththeintendedgoal\.
if\(domain=CURRENCY\_CONVERSIONandqualifier=\[CURRENCY\_CONSISTENCY,PRECONDITION\_VALIDATION\]\)then\(action=\[MATCH\_CURRENCY,VALIDATE\_PRECONDITIONS\]\)withstrength=MANDATORY
4\.Ifaqueryrequiresidentifyingentitiesfromacompleteset\(e\.g\.,allavailableoptions\),thenretrievethecomprehensivesetexplicitlyusingtoolsdesignedforglobalenumerationbeforeattemptingsubtasksthatdependonspecificentities\.Donotattempttoinferthesetbypiecemealorlocalizedretrievalfromindividualcomponents\.
if\(domain=ENTITY\_RETRIEVALandqualifier=\[GLOBAL\_ENUMERATION,DEPENDENCY\_MANAGEMENT\]\)then\(action=\[RETRIEVE\_GLOBAL\_SET,EXECUTE\_SUBTASK\]\)withstrength=MANDATORY
Listing 7:Sample rules learned from the BFCL: Multi\-Turn\-Base dataset
### A\.3Use of LLMs
ChatGPT131313[https://chatgpt\.com](https://chatgpt.com/)is used to polish the writing of this paper\.Similar Articles
RuleChef: Grounding LLM Task Knowledge in Human-Editable Rules
RuleChef is a framework that uses LLMs to generate human-editable, executable rules for NLP tasks, iteratively improving them based on examples and human feedback, resulting in fast, deterministic, and inspectable rule systems.
Model Unlearning Objectives Vary for Distinct Language Functions
The paper argues that unlearning in LLMs should be goal-dependent, proposing a cosine-based meta-learned variant of RMU for dangerous knowledge and a multi-layer objective with probe directions for toxicity, achieving strong results across four 7-8B models.
@dair_ai: New paper on giving LLM agents experience that improves the weights and stays readable at the same time. Agent-experien…
JERP introduces a method for LLM agents to jointly learn interpretable natural-language rules and update policy parameters from the same interaction trajectories, improving performance on AlfWorld and WebShop while maintaining inspectability.
RLearner-LLM: Balancing Logical Grounding and Fluency in Large Language Models via Hybrid Direct Preference Optimization
This paper introduces RLearner-LLM, a framework using Hybrid-DPO to balance logical correctness and fluency in LLM-generated explanations, achieving significant NLI entailment improvements across multiple domains and base models while mitigating the verbosity bias of standard preference signals.
From Residuals to Reasons: LLM-Guided Mechanism Inference from Tabular Data
Introduces Multi-Agent Residual In-Context Learning (MARICL), an agentic framework that uses LLM agents to analyze residuals from a base model on tabular data, hypothesize missing structure, and produce explicit correction terms via textual gradient optimization. Across nine benchmarks, MARICL consistently improves over its base model and demonstrates mechanistic generalization in cell-free protein predictions.