Grammar Control in Dialogue Response Generation for Language Learning Chatbots (2025)

Abstract: Chatbots based on large language models offer cheap conversation practice opportunities for language learners. However, they are hard to control for linguistic forms that correspond to learners’ current needs, such as grammar. We control grammar in chatbot conversation practice by grounding a dialogue response generation model in a pedagogical repository of grammar skills. We also explore how this control helps learners to produce specific grammar. We comprehensively evaluate prompting, fine-tuning, and decoding strategies for grammar-controlled dialogue response generation. Strategically decoding Llama3 outperforms GPT-3.5 when tolerating minor response quality losses. Our simulation predicts grammar-controlled responses to support grammar acquisition adapted to learner proficiency. Existing language learning chatbots and research on second language acquisition benefit from these affordances. Code available on GitHub.

## introduction the language input that learners receive, their production of language output, and the opportunity to interact using language are paramount to second language acquisition @xcite . chatbots based on large language models (llms) can simulate a partner for free-flowing conversations, offering these three components. however, general-purpose chatbots, such as chatgpt, currently do not implement the pedagogical strategy of providing developmentally proximal input as suggested by popular learning theories @xcite . they do not support the noticing of grammatical forms by increasing their frequency in dialogues, an effective setting for language practice by reinforcing the learner's input processing when prompting them to produce a meaningful reaction @xcite . ideally, a chatbot should purposely demonstrate the usage of linguistic forms that a learner is ready to acquire, as a teacher or tutor would. the positive effects of role models on language development have been demonstrated in different conversational contexts @xcite . although adapted chatbots have started to produce dialog utterances aimed at developing learners' language proficiency @xcite , they lack grounding in a comprehensive framework of language proficiency development. the common european framework of references for languages (cefr) (council of europe, 2020) is such a description of functional language development, complemented by the english grammar profile (egp) (o' @xcite , which provides a corresponding empirical description of the language forms produced by learners at different developmental stages based on an extensive learner corpus linked to the cambridge certificate testing. the egp induces a curricular progression of linguistic forms that can define the underlying logic for a pedagogically optimized chatbot that acts as a conversation partner. in this paper, we develop and evaluate strategies to control an llm to use developmentally beneficial grammar forms when generating dialogue responses, i.e., learner's inputs, as exemplified in figure 1 . the set of grammar forms originates from the egp; these are either explicitly specified by a teacher (task 1) or a learner profile exploiting the egp-induced progression along different categories of grammar skills (task 2). we test gpt-3.5 and llama3 using a prompting baseline for these tasks posed for everyday conversation datasets. then, we create a dataset of constrained dialogue responses and fine-tune llama3 on it. we also adopt a decoding strategy that modifies llama's output toward the specified grammar. to evaluate these strategies, we measure the presence of grammar forms, response quality, and efficiency. to show how this grammar-controlled input can elicit desired grammar in learner output, we simulate the impact of controlled grammar input on learners at different proficiency levels. to this end, following @xcite , we present an experiment in which we identify common input-output pairs of grammar forms in a dialogue corpus and exploit the relationships in a simulated conversation. our results show that guided decoding is a promising model adaptation strategy to generate egp-controlled responses with the best balance between grammar control and response quality, successfully including 59.3% of requested grammar forms and being as grammatically correct as gpt-3.5. the learner simulation shows that 25 out of 47 tested grammatical input-output pairs can significantly increase grammar usage in learners' output. overall, this paper contributes methods for training pedagogically controllable conversation chatbots for language learning by adaptively fostering learners' grammatical proficiency in a functional dialogue setting, a unique combination impossible to realize without the advancements of current llms and their grounding in a comprehensive pedagogical repository of language development. ## problem statement given a sequence of n previous dialogue turns @xmath0, d 2 , . . . , d n ], and a repository of grammar skills g, our problem is to generate a chatbot response r. to ensure that r is useful for language practice, we formulate two pedagogically motivated control tasks: task 1: explicit grammar constraints require r to include a subset g ⊂ g of grammar skills in the generated dialogue response. task 2: categorical grammar constraints require r to include grammar skills on a specified cefr level per egp category. in task 1, teachers can allow students to practice multiple recently taught grammar skills simultaneously. they select the skills that should appear in the conversations. the chatbot then demonstrates to the students how to use them in conversations about topics of their interest. task 2 is motivated by a hypothetical learner model that describes grammar proficiency differentiated by categories. for example, a learner may need more input of "superlatives" skills on level a2 while they already know "would" skills on level b1 and hence should be exposed to more sophisticated ones. ## methods we first explain how we detect grammar skills in dialogues (section 4.1) and then how we adapt models to control for grammar (section 4.2). ## experimental results to assess our strategies to solve the two tasks, we draw random dialog snippets of four turns as the context d to generate r. we use topical-chat and the document grounded dataset as testsets; the remainder is used in fine-tuning. computational details of the experiments are in appendix f. ## impact on conversation practice in this application of our work, we simulate the effect of grammar-controlled chatbot responses on learner responses at different proficiency levels. while traditional grammar practice, such as fill-inthe-gap exercises, forces learners to produce target grammar (i.e., grammar to learn), practice in free-flowing dialogues requires other approaches to make learners use this grammar. according to language acquisition theories, learners sometimes immediately reproduce grammar structures that they encounter in their input and can thereby ## discussion we explored automatic grammar detection to measure and improve grammar control in dialog responses. our preliminary work in section 4.1 has shown that only manually curated training data yields robust grammar detectors. this implies a dependency on human annotation to improve grammar control via fine-tuning and decoding. the improved grammar control with our approaches can readily support the pedagogical use case. not only can we generate grammar-enriched language input to increase the chances of the learner noticing developmentally proximal grammar structures from the egp but we can also generate them fast enough for the dialogue setting, which supports deeper input processing by the learner via the mechanisms of output and interaction @xcite . this reduces the need for isolated grammar drills and affords more authentic language practice, closer to the functionoriented pedagogy underlying the cefr. the response evaluation revealed an unexpected property of the overall winning decoding approach. it outperformed the instruction fine-tuning approach in response quality in the first task, which is surprising due to the local optimization in guided decoding, usually reducing text quality. our finding might point to low-quality dialogue data because the model learns during fine-tuning to copy the style of dialogue responses. this hypothesis is supported by the similar response quality in the second task where the prompt different from the fine-tuning demonstrations might make the model resort to its original style. we believe that the drastically increased constraint satisfaction in the decoding approach compensates for the slightly reduced response relevance given that the answers are as grammatically correct. this effect is likely also observable in teachers or tutors who try to use a linguistic form in a given context and have to adapt the meaning of their example to apply the form. the generated responses largely varied in grammar constraint satisfaction between skills across all approaches. contrary to expectation, using different adaptation strategies depending on the types of skills (such as more syntactic versus more semantic) seems not helpful as the constraint satisfaction rates of all approaches are highly correlated. this can be caused by the random combination of skills with dialogue contexts. for example, the barely included skill of using "would" in reported speech may have not been appropriate in most contexts and may even have an overall lower saliency than other skills. therefore, grammar-controlled conversation practice should preferably be used for the skills that are already possible to control, which we make transparent in appendix h. we are in favor of a mixed-methods approach in language instruction and do not think that one approach can satisfy all needs in grammar instruction. we mitigated this issue in the final application of the response generator in the simulation study by ensuring that the controlled grammar was in the response we used to simulate the learner. however, grammatical cooccurrences were less exploitable at lower levels of language proficiency despite previous research showing that alignment is more pronounced among them @xcite . this observation questions the validity of the learner simulation, where the in-depth analysis shows that the lower proficiency is exaggerated compared to baselines from a learner corpus. ## conclusion and future work this work explored the problem of generating pedagogically controllable dialogue responses with specified grammar and tested common prompting and model adaptation approaches. specifically, we defined two tasks based on grammar skills from the english grammar profile and publicly available topical and daily dialogues, and conducted a comprehensive automatic evaluation by including different response quality measures and inference speed. our simulation study confirmed that the approaches could potentially help learners of different levels of proficiency in conversation practice produce the desired grammar skills more often. in the future, the generative models and predictions in the simulation study should be tested with real teachers and learners. such a study would ensure utility as perceived by teachers, analyze whether learners notice reduced response quality, and quantify learning gains from grammarcontrolled conversation practice. the approach will realize its full potential only if all skills from the english grammar profile are detectable. moreover, it should be explored how other types of teacherspecified attributes can be automatically controlled in conversation practice.