A text-to-SQL agent that answered sports questions for live users lost 13 points of weekly factual accuracy in eight weeks on a largely static configuration, falling from 88% to 75% as the season changed, data sources were added and database fields were revised. That is the starting point of Sports Agent, a technical report posted to arXiv on November 25, 2026 by a 13-person team at Alibaba Token Hub. Their fix is an architecture in which the agent’s SQL model, its prompts and its skills are all rebuilt from logged failures, under tests that decide which changes ship.
Text-to-SQL agent vs text-to-SQL: what changes
A text-to-SQL agent treats SQL as one action inside a multi-step loop, while classic text-to-SQL maps a question to a single SQL statement for a known schema and is scored by exact match or execution accuracy. The Sports Agent report draws exactly this line for its Agentic SQL Model.
At each step the model picks one action: fetch schema information, inspect a table or field, execute a query, or verify a result. The observation that comes back is schema metadata, a result set or an error message, and the model uses it to fix syntax, field references and filter conditions before it answers. Evaluation follows the same logic and looks at the whole trajectory as well as the final answer.
That matters for real databases, where the hard part of a question is rarely the SQL syntax. A sports question such as “career regular-season wins” needs the right entity, the right metric definition, the right season scope and implicit conditions that the user never states. An agent can look these up in the schema and check its own output; a single-shot generator has to get them right from the prompt.
One question, several model calls. Because each answer now takes a loop of tool calls rather than one generation, the choice of model for each role, and what each call costs, shapes the whole system. If you are prototyping a loop like this and want to try different hosted models behind one API key, a shared gateway such as PackyAPI is one option.
Disclosure: this page contains an affiliate link. If you sign up through it, we may earn a commission at no extra cost to you.
Why text-to-SQL agents degrade in production
Text-to-SQL agents degrade because the questions, the data and the models underneath them keep changing while the prompts, schema descriptions and routing rules stay fixed. The authors measured all three in their own product before they changed anything.

Figure 1 from the Sports Agent paper: the three sources of drift and the eight-week decline in weekly factual accuracy of the static agent.
- Query mix. Database-oriented questions made up about 63% of traffic during the playoffs and 43% in the offseason, when users asked about trades, the draft and rosters instead of scores and standings. Tool-routing rules tuned for one phase fit the other poorly.
- Data and schema drift. Over six months the team added three data sources and modified more than 100 fields. An agent that relies on fixed schema descriptions and example queries starts referencing fields that no longer mean what it thinks, a problem that semantic layers such as NVIDIA’s Auto Ontology for text-to-SQL agents also try to contain.
- Model changes. A model’s built-in knowledge lags current player status and standings, and swapping in a new model changes how it follows instructions and uses tools, so old prompts and skills may stop fitting or become unnecessary.
Patching each failure by hand did not keep up, and the authors note that piling up prompts, rules and skills tends to overfit single cases while making the harness harder to maintain.
Text-to-SQL agent architecture: SQL model, harness and feedback engine
The Sports Agent architecture has three parts: an Agentic SQL Model that does the structured-data work, a Sports Agent Harness that plans and orchestrates tools, and a Feedback Engine that turns logged runs into changes for the other two. The figure at the top of this page is the authors’ overview.
At runtime the path is short. An orchestration model follows the harness, meaning the system prompt, skills, tool contracts and routing rules, to plan the task. When a question needs the database it calls the Agentic SQL Model, which runs its own schema-and-query loop. Web search and knowledge-base retrieval cover news, rules and background, and the final answer is assembled from all of the retrieved evidence. Every run is stored as runtime evidence: the query, the answer and the execution trace.
Offline, the Feedback Engine reads that evidence, checks claims, diagnoses failures and sends two kinds of signal. Model signals go to a training loop for the SQL model; harness signals go to an editing loop for prompts and skills. Only the Agentic SQL Model’s weights are trained in this work. The orchestration model that plans and picks tools keeps its parameters, so planning improves only through harness edits.
This split mirrors a broader pattern in production agents, where the harness rather than the framework owns state, tool boundaries and control loops. Sports Agent adds a rule for deciding which layer a failure belongs to before anything is changed, which the self-evolving agents literature usually leaves open.
Text-to-SQL LLM training: SQL-first data and failure-driven questions
The text-to-SQL LLM in Sports Agent is Qwen3.6-35B-A3B, a mixture-of-experts model with few active parameters, chosen to balance capability against inference cost. It is trained in rounds of supervised fine-tuning, each round adding data aimed at the gaps the Feedback Engine found in the previous model, followed by one reinforcement-learning stage at the end.
SQL-to-Question Scaling: write the SQL first
Instead of asking a model to invent questions from a schema, the pipeline generates an executable SQL query first and then rewrites it as a natural-language question. Each query is steered by a control vector: one of 14 task categories (retrieval, filtering, aggregation, ranking, comparison, trend analysis and others), single or multiple tables, a theme such as players, teams, schedules, standings or injuries, and a difficulty level from L1 to L4. Candidate SQL is checked for syntax, schema consistency and valid multi-table references, and deduplicated in normalized form. The rewritten question has to keep every filter, aggregation, ordering and cardinality constraint while hiding table names, field names and SQL vocabulary.
Because the SQL exists before the question, every training question is known to be answerable and carries a verified reference.
Graph-Guided Scaling: aim at diagnosed errors
Predefined categories do not cover every way the model fails in production. The Feedback Engine’s diagnoses are merged into an error-attribution graph with five node types: root cause, sports concept, semantic intent, schema and error pattern. Root causes with the most supporting cases are sampled first, together with the concepts, intents and tables linked to them, and each sampled subgraph becomes a recipe for new questions that hit the same weakness from a different angle. To limit memorization and test leakage, generation never reuses the original failed question, its SQL or its entity combination, and candidates are checked against the test set.
Trajectory distillation and Post-RL
For each new question, Qwen3.8-Max acts as the teacher: it explores the schema, writes and runs SQL, repairs errors and answers from the returned rows. The student learns from the full trajectory, not just the answer, which is how schema exploration and error recovery get taught; the same idea underlies on-policy and off-policy AI distillation. A quality gate discards trajectories with syntax or field errors, timeouts, missing tool results, repeated SQL execution, abnormal length or incomplete answers. The fine-tuning loss covers only the model’s own tokens, including tool calls, and skips tool observations.
After the last round, a GSPO reinforcement-learning stage optimizes task outcomes. Questions with a single correct SQL answer are rewarded by execution equivalence with the reference, staged for multi-part tasks. Open-ended analysis questions are scored by an LLM judge, repeated several times and averaged, that checks intent coverage, query validity and trajectory efficiency. A format gate can zero out a positive reward when the interaction format breaks, but never turns a zero into a positive.

Figure 5 from the Sports Agent paper: same base model and training setup, trained on the curated seed set versus the evolved set.
The data pipeline carries most of the gain. Holding the base model and training recipe fixed, switching from the curated seed set to the evolved set raised accuracy from 89.4% to 96.7% on routine sports questions and from 59.0% to 70.7% on hard ones. The evolved set has about 3.5 times as many multi-table combinations, roughly twice the multi-table coverage and average SQL length, and more joins, subqueries, common table expressions and window functions, with some long-tail structures appearing four to nine times as often as in the seed set.
Text-to-SQL models benchmark: Qwen3.6-35B-A3B vs Qwen3.8-Max, GLM-5.2 and DeepSeek-V4-Pro
On the authors’ sports database tasks, the trained 35B mixture-of-experts model beats every model they tested on routine questions and comes second on hard ones, behind DeepSeek-V4-Pro. All models ran with explicit thinking turned off to match production latency limits, and each test item was run three times and averaged.
| Model | Sports-Normal | Sports-Hard |
|---|---|---|
| Qwen3.8-Max | 94.5% | 72.3% |
| GLM-5.2 | 92.5% | 60.0% |
| DeepSeek-V4-Pro | 89.6% | 76.0% |
| Qwen3.6-35B-A3B (base) | 83.5% | 45.7% |
| Qwen3.6-35B-A3B-Evolve | 96.7% | 70.7% |
| Qwen3.6-35B-A3B-Evolve + RL | 97.8% | 74.0% |
Task correctness on the authors’ internal sports agentic SQL sets (Table 2 of the paper). Sports-Hard covers more complex analytical questions.
Against its own base model, the evolved model also cut latency by 52.3% on routine questions and 58.6% on hard ones, with 29.6% and 52.6% fewer tool-call rounds. The abstract puts its inference efficiency at about three times that of Qwen3.8-Max, the teacher it was distilled from.
To test whether the gains carry beyond sports, the team ran two public agentic SQL benchmarks, LiveSQLBench and BIRD-Interact:
| Model | LiveSQLBench Lite | Full | Large | BIRD-Interact Lite | Full |
|---|---|---|---|---|---|
| Qwen3.8-Max | 46.7% | 34.3% | 32.3% | 23.0% | 21.9% |
| Qwen3.6-35B-A3B (base) | 41.5% | 29.3% | 24.8% | 15.2% | 13.9% |
| Qwen3.6-35B-A3B-Evolve + RL | 47.4% | 37.2% | 31.9% | 54.0% | 41.0% |
Task reward on the general benchmarks as reported by the authors (Table 3, abridged; the full table also lists Kimi-K3 and GLM-5.2).
The largest jump is on BIRD-Interact, where the RL stage lifted the evolved model’s Lite reward from 28.4% to 54.0%. On LiveSQLBench Large the RL stage slightly lowered the score, so the final model sits just under Qwen3.8-Max there. These are the authors’ own runs; nobody has reproduced them yet.
Text-to-SQL agent prompt and skill updates: gated harness evolution
Sports Agent changes its prompts and skills only when several related failures point to the same cause, and every edit has to beat the current version on held-out questions before it ships. Across 30 successive harness versions scored on a fixed test set, the aggregate performance score rose from 78.2 to 89.0.
Each failure is first assigned to a layer. A prompt gap is a missing rule that should apply to every task. Skill content means a loaded skill has wrong or incomplete knowledge or procedures. Skill activation means the right skill exists but was not retrieved. Skill harm means an activated skill pushed the agent the wrong way. A failure where the agent ignored a rule it already had is not a harness problem and goes to model training instead.
Repair intents with the same target pile up across daily batches, and only when a group reaches a support threshold does it become an edit. Each edit is small and typed: a policy change to the system prompt, or a content, activation or structure change to a skill. Prompt rules may not contain entity-specific values, numerical answers or task templates, which keeps specialized knowledge out of global policy. Then come two checks. An independent model audits the edit for evidence, scope and consistency; the runtime then runs the current and edited harness side by side to measure gains on target cases and regressions elsewhere. Edits that pass are applied together and replayed on a held-out split, and the new version is accepted only if its gain is larger than the evaluator’s noise.
A cleanup pass follows. Overlapping entries are merged, entries with sustained evidence of harm are retired, and components that have gone unused are marked dormant instead of deleted. The slimmer version replaces the edited one only if it scores no worse than it within the noise margin, so the harness can shrink without paying for it in accuracy.

Figure 14 from the Sports Agent paper: aggregate performance score (30% general quality, 70% application criteria) across 30 harness versions on a fixed test set.
The curve is not monotonic. The score peaked at 89.5 at V19 and dropped several times along the way, which the authors read as edits for one failure category hurting other tasks. That is the case for running fixed-set regression tests on every round, the same question HarnessDev asks about LLM-written harness edits on unseen tasks.
Text-to-SQL agent failure diagnosis: two real SQL errors
The Feedback Engine decides whether a wrong answer should change the model or the harness by reproducing the error and testing a hypothesis against the database. Two cases from the paper show how the same symptom, a wrong number from a valid-looking query, leads to different fixes.
Assessment comes first. Simple metrics such as relevance are scored straight from the question and answer. Factual checks extract claims from the answer and verify each one against the evidence in the trace, a map step for local checks and a reduce step for scoring, instead of asking one judge call to read a long trace and score it in a single pass. For a confirmed factual error, Diagnosis reruns the request in new sessions to see if the error recurs, registers a predicted value for the original and corrected query, and compares both in one read-only SQL run.
Case 1: the rule was there, the model skipped it. Asked for Kobe Bryant’s career regular-season wins, the agent answered 920. The correct count of games he played in and his team won is 836. The query filtered by player, regular season and win, but left out the appearance condition (minutes played above zero, or any core statistic above zero) that the guidance loaded before the query had spelled out. Adding the condition removed 84 records and reproduced 836. Since the rule was already in context, the fix is training data that makes the SQL model apply appearance rules.
Case 2: the skill was missing a rule. For the career regular-season field-goal percentage leaderboard, the standard eligibility bar is 2,000 field goals made. The agent used 2,000 field-goal attempts instead and ranked Daniel Gafford first at 70.22% (1,660 of 2,364). With the correct bar, Gafford drops out and DeAndre Jordan leads at 67.34%. The leaderboard skill had explained the ratio and scope but never stated the eligibility rule, so the fix is a skill edit that documents the standard criterion and its source while keeping user-defined conditions.
Text-to-SQL agent production results: accuracy, depth and latency
In the live product, the evolved text-to-SQL agent raised the factual correctness score from 75.8 to 86.3 and cut average end-to-end latency from 26.4 to 15.5 seconds, a 41.3% drop. The product launched in June 2026 for users in mainland China and was upgraded to the Sports Agent framework between June and September.

Figure 13 from the Sports Agent paper: baseline and evolved systems on a shared 500-question evaluation set.
The evaluation set had 500 questions: 400 curated internally and 100 generated by an AI agent from daily trending topics, covering factual lookups, statistics, real-time information and multi-part questions. Correctness is an LLM-as-a-judge score of the core factual claims on a 0 to 100 scale. Average answer length grew from 240.8 to 621.5 characters, which the authors use as a proxy for richer answers; length on its own says nothing about quality.
Requests also needed fewer tool calls: during the playoffs and the offseason, 73.3% and 89.1% of requests needed at least two tool calls. After the evolved system shipped, that share fell to 33.6%, and 46.1% of requests were answered with a single call. The authors credit better context management, reuse of intermediate evidence and revised task-termination policies. The regular season, with its different question mix, began over the same period, so part of the shift may come from the calendar rather than the system.
How to build a text-to-SQL agent that improves: five rules
To build a text-to-SQL agent that keeps improving, log every trace, decide whether each failure belongs to the model, the prompt or a skill, and ship only changes that win on held-out tests. The paper turns this into five rules that apply to any agent whose traces you log and whose answers you can check.
- Attribute before updating. Decide whether a failure belongs to the model, the prompt or a skill before changing anything. Ambiguous cases need more verification, not an edit.
- Do not fix single failures. One wrong answer can come from an ambiguous request or random generation. Wait until related cases accumulate.
- Generalize the mechanism, not the example. Training on variants of the failed question invites overfitting and test leakage. Train on new questions that share the root cause.
- Ground supervision in something executable. Writing verified SQL before the question is one way to make generated data checkable; the same principle drives verification setups that agents cannot game.
- Simplify the harness as the model improves. Remove rules and skills the model no longer needs, test each removal and keep the previous version to roll back to.
For a team starting out, the cheapest pieces to copy are the logging and the gate: store query, answer and full trace for every run, and refuse any prompt or skill change that does not beat the current version on a held-out set. The SQL-first data generation becomes worth building once you have a stable schema and enough logged failures to know where the model is weak. Sports Agent’s code and weights are not public, so the report is a design reference rather than something you can install.
References
- Chao Chen, Fuqi Lin, Ze Chen, Ziyan Liu, Chen Li, Haishu Jiang, Bo Xu, Zihan Jiang, Yue Wu, Zheng Wang, Kun Wang, Zhihang Fu and Jieping Ye (Alibaba Token Hub), “Sports Agent: A Self-Evolving System for Conversational Data Analytics”, arXiv 2611.33700v1, November 25, 2026 (HTML version with figures).
- BIRD team (bird-bench), LiveSQLBench, GitHub, accessed November 30, 2026.
- BIRD team (bird-bench), BIRD-Interact, GitHub, accessed November 30, 2026.