arXiv:2609.03213cs.CLSep 2026

Manuscript Offprint

arXiv:2609.03213

LLMs Learn Better In-Context from Rules than from Examples

Xiang Fu, Seungmin Cho, Yukyung Lee, Najoung Kim

Abstract

Large language models (LLMs) exhibit in-context learning capabilities, where they can learn new tasks from prompt contexts without weight updates. We compare the learning efficacies of two prominent modes of in-context learning: (1) learning from descriptions of rules (instruction following); and (2) learning from examples of input-output demonstrations (few-shot prompting). Through five learning tasks that cover diverse domains (games, arithmetic, linguistic inferences), we compare two modes of learning (rules vs. examples) specifying the same underlying task. We furthermore explore model and task properties that modulate the learning efficacies. We find that models generally learn more reliably from rules than from examples alone, and additional examples on top of rules or simply scaling up the number of examples do not lead to consistent and significant gains. Instruction tuning amplifies the benefit of rule-based learning while keeping example-based learning capacities intact. Surprisingly, we find no privileged effect of example-based learning in base models, and rules still lead to gains in algebraic task domains. Overall, the comparative efficacy of rules over examples is larger when the task recruits algebraic abstractions and computations, and smaller when the task requires distributional sensitivity and/or recruits parametric knowledge.

datasets/tin-lab/rules_vs_examples

tinlaboratory/rules-vs-examples

1 Introduction

Large language models (LLMs) have been shown capable of in-context learning, where a task can be learned from prompt contexts without weight updates (Brown et al., 2020; Chung et al., 2024; Lampinen et al., 2024). Two predominant ways in which the task is communicated in context are: (1) through verbal descriptions or instructions for the task (Sanh et al., 2022; Chung et al., 2024) (instruction- or rule-based learning); and (2) through input-output demonstrations (Brown et al., 2020) (demonstration- or example-based learning).

Recent work (Davidson et al., 2026) showed that even when both types of learning specify the same underlying task, LLMs do not induce a single common function vector representation, but instead activate partly overlapping mechanisms. They take this as support for the practice of combining rules and examples for the same task. However, distinct mechanisms do not necessarily indicate additive performance benefits when they are combined. In this work, we aim to conduct a systematic comparison of rule- vs. example-based learning of novel complex tasks to investigate their learning efficacies, and furthermore elucidate the properties of the learners and the tasks that modulate learning efficacy. The most similar work to ours is Liu et al. (2024), who reported as a part of their finding that rule-based learning generally outperforms example-based when the given rules are correct, although their main focus was relations to rule inference.

We compare rule- vs. example-based learning through in-context learning experiments with a suite of novel tasks. We focus on tasks that require complex reasoning, meaning that they involve inferring more than a single relational property or a single latent variable that underlies valid input-output mappings (e.g., the country-capital task). Our tasks cover domains of games (Set Game and Tapatan), arithmetic (Operator Function), and linguistic inferences (Noun Class Agreement and Lexical Category Inference). We instantiate each task in three different learning setups: rules, examples, and combined (rules + examples), and evaluate them on the same test items. This design lets us hold the latent task fixed while varying only how the task is communicated.

∗^{*}Equal contribution.

Figure

Figure 1: Visualization of our experiment design. (A) illustrates our tasks and (B) shows how the same task is presented to the model in different learning conditions.

Our research questions are as follows:

  • RQ1: Do models learn complex, novel tasks more reliably from rules (instructions) or from examples (demonstrations)?

  • RQ2: What is the effect of the learner on the learning efficacy from rules vs. examples, especially the effect of instruction tuning?

  • RQ3: What are the properties of the task itself that lends itself to better/worse learning from rules or examples?

Across task domains and model types, we find that learning from rules overall outperforms learning from (minimum coverage) examples. Providing examples on top of rules or scaling up the number of in-context examples do not lead to consistent and significant gains. Furthermore, the degree to which rules provide an advantage varies significantly depending on the nature of the task, where the comparative efficacy of rules over examples is larger when the task recruits algebraic abstractions and computations, and smaller when the task requires distributional sensitivity and/or recruits parametric knowledge. This opens up interesting future work for predicting the efficacy of different in-context learning approaches based on task specifications, as well as better methods for tasks where rule-based learning yields limited gains.

References (23)