Manuscript Offprint

arXiv:2609.11414

SWRouter: Similarity-Contractive Window Routing for Multi-Turn Large Language Model Conversations

Yu Wang, Yuchen Li, Rui Kong, Xinran Chen, Jiamin Chen, Hengyi Cai, Shuaiqiang Wang, Jiashu Zhao, Yulun Zhang, Zhonghao Lyu, Haoyi Xiong, Linghe Kong, Jimmy Xiangji Huang, Dawei Yin

YU WANG, Department of Big Data Management and Application, Shanghai Jiao Tong University, China

YUCHEN LI, School of Computer Science, Shanghai Jiao Tong University, China and Baidu Inc., China

RUI KONG, Baidu Inc., China

XINRAN CHEN, Baidu Inc., China

JIAMIN CHEN, Baidu Inc., China

HENGYI CAI, Baidu Inc., China

SHUAIQIANG WANG, Baidu Inc., China

JIASHU ZHAO, Wilfrid Laurier University, Canada

YULUN ZHANG, School of Computer Science, Shanghai Jiao Tong University, China

ZHONGHAO LYU, Department of Computer Science, The Hang Seng University of Hong Kong, China

HAOYI XIONG, Baidu Inc., China

LINGHE KONG, School of Computer Science, Shanghai Jiao Tong University, China

JIMMY XIANGJI HUANG, York University, Canada

DAWEI YIN, Baidu Inc., China

Large language models exhibit complementary strengths, motivating routing methods that dispatch each query to the most suitable model. Although existing routers are effective in single-turn settings, they do not directly transfer to multi-turn dialogue, where routing performance critically depends on how historical context is segmented, retained, and incorporated into the current prompt. This introduces two fundamental challenges: preventing information loss and information confusion during context construction, and evaluating routing quality without conflating model selection with prompt construction quality. In this paper, we propose SWRouter, a Similarity-Contractive Window Router for multi-turn large language model routing. SWRouter combines a similarity-based context segmentation mechanism for prompt construction with a dual-metric evaluation framework that decouples construction accuracy from router performance. Experiments on multi-turn dialogue benchmarks demonstrate that SWRouter consistently surpasses strong baselines, achieving a 16.26% improvement in evaluation accuracy over the best individual large language model and an additional 8.22% gain over the Conv-ID Context baseline. Our results highlight that multi-turn large language model routing requires a joint design of context construction and evaluation, rather than a direct extension of single-turn routing methods.

CCS Concepts: • Information systems → Retrieval models and ranking; • Computing methodologies → Natural language generation; Machine learning approaches.

Authors' Contact Information: Yu Wang, wangyv123@sjtu.edu.cn, Department of Big Data Management and Application, Shanghai Jiao Tong University, Shanghai, China; Yuchen Li, yuchenli1230@gmail.com, School of Computer Science, Shanghai Jiao Tong University, Shanghai, China and Baidu Inc., Beijing, China; Rui Kong, monster119120@gmail.com, Baidu Inc., Beijing, China; Xinran Chen, fantastique0910@gmail.com, Baidu Inc., Beijing, China; Jiamin Chen, jmchen26-c@my.cityu.edu.hk, Baidu Inc., Beijing, China; Hengyi Cai, hengyi1995@gmail.com, Baidu Inc., Beijing, China; Shuaiqiang Wang, shqiang.wang@gmail.com, Baidu Inc., Beijing, China; Jiashu Zhao, jzhao@wlu.ca, Wilfrid Laurier University, Waterloo, Canada; Yulun Zhang, yulun100@gmail.com, School of Computer Science, Shanghai Jiao Tong University, Shanghai, China; Zhonghao Lyu, lzhon@kth.se, Department of Computer Science, The Hang Seng University of Hong Kong, Hong Kong SAR, China; Haoyi Xiong, haoyi.xiong.fr@ieee.org, Baidu Inc., Beijing, China; Linghe Kong, linghe.kong@sjtu.edu.cn, School of Computer Science, Shanghai Jiao Tong University, Shanghai, China; Jimmy Xiangji Huang, jhuang@yorku.ca, York University, Toronto, Canada; Dawei Yin, yindawei@acm.org, Baidu Inc., Beijing, China.

Wang et al.

Additional Key Words and Phrases: Large Language Models, Multi-turn Dialogue, LLM Routing, Context Segmentation, Evaluation Framework, Model Selection

1 Introduction

Large Language Models (LLMs) have become core infrastructure for a wide range of intelligent applications, including conversational assistants, code generation, content creation, and increasingly, AI search and agentic question answering [10, 27, 28]. Their rapid adoption has also stimulated growing efforts to improve the efficiency of long-context processing and inference [29, 30]. Meanwhile, many organizations have developed their own LLM families, such as OpenAI's ChatGPT [35], DeepSeek's DeepSeek [15], Meta's LLaMA [42], Google's Gemini [17], and Anthropic's Claude [5]. However, no single model consistently performs best across all tasks and applications. For example, OpenAI's GPT series is known for strong text generation ability [35], DeepSeek demonstrates strength in mathematical reasoning [39], and Claude is particularly effective in code generation and understanding [5]. Such heterogeneity has motivated a growing line of work on LLM routing, which dynamically dispatches each query to the most suitable model rather than relying on a fixed model for all inputs.

Existing routing methods have achieved promising results in single-turn settings, where the routing decision is made from a single prompt in isolation. Representative examples include routers that select among models of similar scale, such as RouterDC [9], as well as methods that decide between small and large models, such as C2MAB-V [14]. However, directly applying these routing strategies to multi-turn dialogue is fundamentally difficult, because model selection in conversational systems depends not only on the current user query, but also on how the dialogue history is segmented, retained, and incorporated into the prompt. In multi-turn dialogue, naive use of historical context introduces two fundamental challenges.

• First, there is a lack of context segmentation mechanism. When historical information is not properly segmented and integrated, the router may fail to distinguish relevant from irrelevant past context. This leads to two concrete failure modes: information loss, where critical historical information required for the current response is omitted, and information confusion, where outdated context is mistakenly carried into a new topic. As illustrated in Figure 1, missing prior context can cause failure on rule-dependent queries, while incorrect reuse of obsolete context can degrade performance after topic shifts.

• Second, there is an attribution bias in multi-turn router evaluation. In multi-turn settings, final response quality is jointly determined by two factors: the quality of context construction and the selected model's performance under the constructed prompt. A poorly constructed prompt may substantially degrade the responses of all candidate models, regardless of which model is selected. Conversely, even with well-constructed context, poor model selection can still lead to unsatisfactory responses.

As illustrated in Figure 1, a well-combined prompt and a poorly combined prompt may lead to dramatically different response quality across all candidate models (e.g., 0.9/0.7/0.3 vs. 0.09/0.07/0.03). However, the observed inference accuracy alone does not indicate whether such performance variation comes from the context construction stage or from errors in the trained router. This conflates construction quality with routing quality, making faithful evaluation of multi-turn routing systems difficult.

To address these issues, we propose SWRouter, a multi-turn LLM routing framework that jointly addresses context construction, router training, and evaluation. SWRouter consists of three tightly coupled components: (1) a similarity-based context segmentation mechanism that selectively incorporates semantically relevant historical turns when Manuscript submitted to ACM

Figure

(a) Lack of context segmentation mechanism

Figure

(b) Attribution bias in multi-turn router evaluation

Fig. 1. Illustration of the two challenges in multi-turn large language model routing. (a) The context-construction stage receives a dialogue history and the current user turn, then decides which historical turns should be retained before routing. When this step drops necessary history, the routed model receives an under-specified prompt and suffers from information loss; when it carries obsolete turns across a topic shift, the prompt contains misleading context and causes information confusion. (b) The evaluation stage observes only the final routed response score, but that score is jointly determined by prompt construction and model selection. A high-quality window can raise the absolute scores of all candidate LLMs, whereas a poor window can depress them even if the router still chooses the relatively best model, producing attribution bias unless construction quality and router performance are measured separately.

constructing the prompt, thereby reducing both information loss and information confusion; (2) a pluggable router backbone trained on the constructed prompts with contrastive objectives to select the most suitable model; and (3) a decoupled evaluation framework that separates construction accuracy from router performance, enabling faithful assessment of each component independently. We evaluate SWRouter on multi-turn dialogue benchmarks and compare it against representative routing baselines and strong individual LLMs. Empirically, SWRouter consistently matches or surpasses the Conv-ID Context baseline, improves average accuracy by 16.26% over the best individual LLM, and further achieves an 8.22% gain over the Conv-ID Context baseline on multi-turn dialogue benchmarks.

Our contributions are summarized as follows:

• We identify that the lack of context segmentation in multi-turn dialogue routing leads to two concrete failure modes—information loss and information confusion. To address this issue, we propose a similarity-based prompt construction mechanism that integrates historical and current information.

• We reveal a classification bias in existing router evaluation protocols and introduce a decoupled evaluation framework with three complementary metrics: evaluation accuracy, construction accuracy, and router performance.

• We construct a strong Conv-ID Context baseline and conduct extensive in-distribution and out-of-distribution evaluations. SWRouter achieves 16.26% and 8.22% gains over the best single LLM and Conv-ID Context on multi-turn benchmarks, and outperforms Conv-ID Context by 2.68% on OOD tasks. Decoupled metric analysis further confirms that the gains stem from improved construction accuracy ( wˉ\bar{w}), while router performance ( Prouter>1P_{router} > 1) validates effective model selection across all settings.

Wang et al.

References (19)