arXiv:2610.39800cs.CLOct 2026

Manuscript Offprint

arXiv:2610.39800

Grammar Control for Language Learning with Sequential Monte Carlo and Small Language Models

Kate McCurdy, Jacob Hoover Vigly, Thomas Hikaru Clark, Karolina Stańczak, Yahya Emara, Joshua B. Tenenbaum, Alexander K. Lew, Ryan Cotterell, Timothy J. O'Donnell

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Second language learners benefit from exposure to level-appropriate grammar in interactive language use. While prompted frontier language models can usually produce target grammar structures, less resource-intensive models that can be run on device often fail in this task. We use sequential Monte Carlo (SMC) to steer dialogue turn generation in small language models toward target grammar constructions from an expert-developed pedagogical resource. With a minimal set of hand-coded potential functions, SMC achieves near-perfect coverage of target grammar, enabling small models to outperform state-of-the-art results from models 140 times larger. We also use code synthesis with frontier models to generate new potentials, showing that our method scales to hundreds of target grammar skills with no need for additional training or supervised data.

1 Introduction

A key task in second language pedagogy is exposing language learners to level-appropriate target grammatical structures in diverse natural contexts. For example, a learner who speaks English at an advanced beginner level (e.g., level A2 in CEFR, the Common European Framework of Reference) should be able to understand and use the verb enjoy followed by a verb in its gerund (-ing) form (e.g., enjoy swimming, enjoy cooking). A capable English-language instructor can use this target construction in dialogue (e.g., I enjoy cycling. What exercises do you enjoy?), encouraging learners to practice and develop this grammatical skill—that is, producing grammatical constructions (e.g., enjoy swimming) rather than ungrammatical word sequences (e.g., enjoy to swim). We would like language models to provide similar interactive support for learners. Whether a model can do so reliably, however, depends heavily on its scale. Frontier language models can usually produce learner-appropriate grammatical constructions through prompting, but smaller, less resource-intensive models often fail to reliably produce grammar targets (Sun et al., 2023; Ribeiro-Flucht et al., 2025). Bridging this gap could make efficient, on-device language learning tools more feasible, reducing costs and reliance on cloud-based frontier-model APIs while broadening access to learning applications.

This problem is naturally formulated as a constrained generation task: Given some set of level-appropriate grammar skills, we want to constrain language model generations such that they contain the target constructions. Pedagogical resources such as the English Grammar Profile (O'Keeffe and Mark, 2017) identify a range of grammatical targets at specific proficiency levels. Previous research has investigated grammar control via prompting, fine-tuning, reinforcement learning, and classifier-based constrained decoding, but none have yet achieved reliable elicitation of target constructions from small language models (Okano et al., 2023; Glandorf and Meurers, 2024; Glandorf et al., 2025).

We can formulate constrained generation as a probabilistic inference problem. A language model defines a prior p(x)p(\boldsymbol{x}) over strings x∈Σ∗\boldsymbol{x} \in \Sigma^*, where Σ\Sigma is an alphabet of tokens. Given a potential φ(x)\varphi(\boldsymbol{x})—a binary function that checks whether a string x\boldsymbol{x} satisfies the constraint—we want to sample from the posterior p(x)φ(x)∑x′∈Σ∗p(x′)φ(x′)\frac{p(\boldsymbol{x})\varphi(\boldsymbol{x})}{\sum_{\boldsymbol{x}' \in \Sigma^*} p(\boldsymbol{x}')\varphi(\boldsymbol{x}')}. The denominator term sums over all strings, which is intractable; this motivates use of approximate inference techniques such as sequential Monte Carlo (SMC). SMC builds an importance-weighted population of candidate strings (particles) whose empirical distribution approximates the target posterior. Recent work has used SMC to approximate target distributions for constrained generation from language models (Lew et al., 2023; Zhao et al., 2024; Loula et al., 2025; Lipkin et al., 2025; Xefteri et al., 2025; Grand et al., 2025; Emara et al., 2026; Golowich et al., 2026; Kim et al., 2025). Crucially, SMC operates at inference time on any base language model. In our setting, it enables small, efficient models to achieve high levels of target grammar coverage without additional training.

In this work, we specify potential functions via the GenLM Control library, 1^{1} using short, interpretable, human-readable programs to steer generation. For example, a potential function for the enjoy + gerund construction might parse the candidate sentence and return a high score if and only if the verb enjoy is followed by a verb gerund, excluding superficially similar sequences (e.g., enjoy something). Because potential functions can be implemented as explicit programs, they can be flexibly developed, modified, and composed. Programmers can directly write functions to specify target grammar constructions, which we do in Experiment 1. Such programs can also be synthesized by large language models, and refined through iterative generation and testing, a technique known as self-steering SMC (Grand et al., 2025); we demonstrate that this approach can scale to cover tens (Experiment 2) or hundreds (Experiment 3) of targets. In all cases, potential functions can be inspected and refined by domain experts (e.g., instructors or curriculum designers), allowing flexible adaptation for specific pedagogical goals.

In this work, we apply SMC 2^{2} to elicit dialogue turns with target grammar constructions from language models with fewer than 10 billion parameters (Figure 1). We make the following contributions:

  • We show that SMC steering can raise the target grammar accuracy of a model with 0.5B parameters from 58% up to 98%—outperforming previous state-of-the-art (SotA) from a model 140 times larger—while optionally composing with other pedagogically-motivated constraints (Experiment 1).

  • We show that frontier models can effectively synthesize grammar potential functions through self-steering, and combining up to 6 generated potentials at inference time outperforms previous SotA results (Experiment 2).

ID (CEFR)Can-do statement, describing grammar skillExamples of correct target use in English learner corpora
258 (A1)FORM: PHRASE + PHRASE Can use single word conjunctions ('and, but, or') to combine phrases.My home is very light and very comfortable.I live with my mother and her boyfriend.My house is small but very nice.
262 (A1)USE: 'BUT', CONCESSIVE Can use 'but' to add an unexpected contrast.I really like my home, it is very small but it is very easy to clean.I like my home, it's small but so comfortable.
265 (B1)FORM/USE: 'PLUS' WITH CLAUSES Can use 'plus' to connect clauses and sentences, often to point out a positive addition or advantage.I would be more than pleased to receive you at home, it's not too big, but we could have a lot of fun, plus you won't have to pay a thing!It will be fun because everyone is going to be there. Plus, the park is the best place for a picnic, we can run and just have fun!

Table 1: Example EGP target grammar skills.

Moreover, this approach scales to hundreds of targets with no need for supervised data or additional training (Experiment 3).