Manuscript Offprint

arXiv:2608.29284

Cloud and On-Premises Deployment of Uzbek Legal RAG via Targeted Retriever Fine-Tuning

Tatul Danielyan, Mariam Avetisyan, Hrant Davtyan

Abstract

Deploying large language models for legal question answering raises challenges that general-purpose leaderboards do not capture, particularly for low-resource languages and under hard operational constraints. We report on building and operating a retrieval-augmented (RAG) legal assistant for Uzbek that must run in two regimes: a managed cloud service that maximizes answer quality within a per-token cost ceiling, and an on-premises deployment for clients whose legal data may not leave their infrastructure, restricting us to open-weight models on limited local hardware under latency constraints. Because no evaluation existed for this setting, we build two domain benchmarks: a retrieval benchmark of 178 expert-annotated legal queries with gold provision spans, and an end-to-end benchmark of 504 expert-curated question-answer pairs scored by an LLM judge whose ratings we validate against human judgments and against an independent-family judge. Applying these benchmarks under each regime, we find the open-versus-proprietary gap is small and cheaply closed by fine-tuning. Therefore, we train UTE-1, which is a state-of-the-art text embedder among open models for Uzbek. We also demonstrate that closing the performance gap via fine-tuning is both impractical due to the intensive hardware demands of long-context legal Q&A and unnecessary, given that legal acts change frequently. We support this by reporting a negative result from a QLoRA experiment. We distill practical guidance for similar deployments, drawn from a system serving real users in production. We release our benchmarks, evaluation code and the fine-tuned embedder (UTE-1) at this https URL to support future work on low-resource legal NLP.

1 Introduction

Large language models (LLMs) are increasingly deployed in legal and governmental settings, where citizens and professionals ask natural-language questions and expect answers grounded in the applicable statutes. Such systems are typically built as retrieval-augmented generation (RAG) pipelines (Lewis et al., 2020; Gao et al., 2023): a retriever selects relevant legal text, and an LLM composes an answer conditioned on it. RAG is a natural fit for the legal domain because the law is large, frequently amended, and demands attribution to specific provisions.

Most published guidance on building such systems is implicitly written for high-resource languages and a single, unconstrained deployment target. Real deployments are neither. We describe a production legal assistant for Uzbek, a Turkic language spoken by tens of millions but under-served by NLP resources, grounded in the national legal corpus (lex.uz). The system is commercially deployed and serves real users; per the double-blind policy we omit the product and organization names.

Two facts make model selection for this system non-obvious. First, the same assistant ships in two deployment regimes with conflicting constraints. The cloud regime is a multi-tenant SaaS offering: any model is permissible, but a per-token cost ceiling rules out the most expensive frontier APIs, and the objective is to maximize quality within that budget. The on-premises regime serves enterprise and public-sector clients whose legal documents cannot leave their infrastructure; data sovereignty restricts us to open-weight models, which must then run on the client's limited local hardware under latency constraints. Second, general multilingual leaderboards poorly predict quality here: strong aggregate ability does not imply strong Uzbek legal retrieval or answer quality, and the public Uzbek leaderboards that exist measure generic language ability, not grounded legal QA. Principled model choice therefore requires task- and language-specific evaluation that did not previously exist.

We make three contributions.

(1) A deployment case study with a transfer-able decision procedure. We cast cloud and on-premises model selection as two constrained optimization problems and show how one evaluation suite drives both, yielding two deployed model stacks.

(2) Evaluation infrastructure for Uzbek legal QA. We release a 178-query retrieval benchmark with gold provision spans and a 504-item end-to-end QA benchmark, plus a human-validated LLM-as-judge protocol cross-checked against an independent-family judge—the linchpin of any such study. Both benchmarks and evaluation code are released.

(3) The finding that, under deployment constraints, the retriever is where to invest. Existing legal-RAG work fine-tunes the generator (Ma et al., 2025; Octadion, 2024), and parallel work (Butler and Butler, 2026) finds the retriever dominant but does not fine-tune it. We fine-tune an open embedder to a state-of-the-art open result for Uzbek (cheaply closing roughly half the in-domain gap to proprietary embeddings), and report a negative result: fine-tuning the generator under the same constraints is both costly to pursue and, given that laws change and multilingual LLMs keep improving, unnecessary. The heuristic—fine-tune the retriever, rent or swap the generator—is the paper's central, reusable lesson. The text embedder is released publicly to further facilitate NLP applications in Uzbek language.