{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2025,10,22]],"date-time":"2025-10-22T23:37:47Z","timestamp":1761176267212,"version":"build-2065373602"},"reference-count":0,"publisher":"IOS Press","isbn-type":[{"value":"9781643686318","type":"electronic"}],"license":[{"start":{"date-parts":[[2025,10,21]],"date-time":"2025-10-21T00:00:00Z","timestamp":1761004800000},"content-version":"unspecified","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by-nc\/4.0\/"}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":[],"published-print":{"date-parts":[[2025,10,21]]},"abstract":"<jats:p>Query routing, the task to route user queries to different large language model (LLM) endpoints, can be considered as a text classification problem. However, out-of-distribution queries must be handled properly, as those could be about unrelated domains, queries in other languages, or even contain unsafe text. Here, we thus study a guarded query routing problem, for which we first introduce the Guarded Query Routing Benchmark (GQR-Bench, released as Python package gqr), covers three exemplary target domains (law, finance, and healthcare), and seven datasets to test robustness against out-of-distribution queries. We then use GQR-Bench to contrast the effectiveness and efficiency of LLM-based routing mechanisms (GPT-4o-mini, Llama-3.2-3B, and Llama-3.1-8B), standard LLM-based guardrail approaches (LlamaGuard and NVIDIA NeMo Guardrails), continuous bag-of-words classifiers (WideMLP, fastText), and traditional machine learning models (SVM, XGBoost). Our results show that WideMLP, enhanced with out-of-domain detection capabilities, yields the best trade-off between accuracy (88%) and speed (&lt;4ms). The embedding-based fastText excels at speed (&lt;1ms) with acceptable accuracy (80%), whereas LLMs yield the highest accuracy (91%) but are comparatively slow (62ms for local Llama-3.1:8B and 669ms for remote GPT-4o-mini calls). Our findings challenge the automatic reliance on LLMs for (guarded) query routing and provide concrete recommendations for practical applications. Source code is available: https:\/\/github.com\/williambrach\/gqr.<\/jats:p>","DOI":"10.3233\/faia251304","type":"book-chapter","created":{"date-parts":[[2025,10,22]],"date-time":"2025-10-22T09:57:37Z","timestamp":1761127057000},"source":"Crossref","is-referenced-by-count":0,"title":["Guarded Query Routing for Large Language Models"],"prefix":"10.3233","author":[{"ORCID":"https:\/\/orcid.org\/0009-0000-0069-969X","authenticated-orcid":false,"given":"Richard","family":"\u0160l\u00e9her","sequence":"first","affiliation":[{"name":"Faculty of Informatics and Information Technologies, Slovak University of Technology in Bratislava"}]},{"ORCID":"https:\/\/orcid.org\/0009-0002-0321-0321","authenticated-orcid":false,"given":"William","family":"Brach","sequence":"additional","affiliation":[{"name":"Faculty of Informatics and Information Technologies, Slovak University of Technology in Bratislava"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-6817-6297","authenticated-orcid":false,"given":"Tibor","family":"Sloboda","sequence":"additional","affiliation":[{"name":"Faculty of Informatics and Information Technologies, Slovak University of Technology in Bratislava"},{"name":"aleph0 s.r.o., NetFire LLC"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-0679-4588","authenticated-orcid":false,"given":"Kristi\u00e1n","family":"Ko\u0161t\u2019\u00e1l","sequence":"additional","affiliation":[{"name":"Faculty of Informatics and Information Technologies, Slovak University of Technology in Bratislava"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-6124-1092","authenticated-orcid":false,"given":"Lukas","family":"Galke","sequence":"additional","affiliation":[{"name":"Centre for Machine Learning, University of Southern Denmark"}]}],"member":"7437","container-title":["Frontiers in Artificial Intelligence and Applications","ECAI 2025"],"original-title":[],"link":[{"URL":"https:\/\/ebooks.iospress.nl\/pdf\/doi\/10.3233\/FAIA251304","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,10,22]],"date-time":"2025-10-22T09:57:37Z","timestamp":1761127057000},"score":1,"resource":{"primary":{"URL":"https:\/\/ebooks.iospress.nl\/doi\/10.3233\/FAIA251304"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,10,21]]},"ISBN":["9781643686318"],"references-count":0,"URL":"https:\/\/doi.org\/10.3233\/faia251304","relation":{},"ISSN":["0922-6389","1879-8314"],"issn-type":[{"value":"0922-6389","type":"print"},{"value":"1879-8314","type":"electronic"}],"subject":[],"published":{"date-parts":[[2025,10,21]]}}}