Beyond Translation: How Feyn AI’s SQRL Model is Redefining Text-to-SQL Accuracy

For years, the industry standard for converting natural language into SQL has been treated as a straightforward translation task. Developers and researchers alike have approached the problem by feeding a database schema into a Large Language Model (LLM) and hoping the output correctly maps user intent to a valid query. However, YC-backed startup Feyn AI argues that this paradigm is fundamentally flawed. In a significant shift for the field, Feyn has introduced SQRL, a new family of models that treats text-to-SQL not as a translation exercise, but as an inspection process.

By allowing models to "look before they leap"—querying the database for metadata and record samples before committing to a final SQL command—Feyn is achieving accuracy levels that challenge even the most sophisticated frontier models.


The Core Problem: Valid SQL is Not Always Correct SQL

The prevailing belief in AI development is that if a model generates syntactically correct SQL, the task is complete. Feyn AI posits that this is a dangerous misconception. A query can be perfectly valid SQL—passing all syntax checks—while being functionally disastrous.

Common pitfalls include joining the wrong tables, misinterpreting ambiguous column headers, or filtering for data values that simply do not exist in the specific instance of the database. Because these errors do not trigger standard SQL syntax exceptions, they remain "silent failures." The database returns an empty result set or, worse, an incorrect aggregation, leaving the user with a false sense of confidence in the data.

The Limits of Schema-Based Inference

Traditional systems rely almost exclusively on the provided database schema (tables, columns, types, and primary/foreign key relationships). However, schema information is inherently shallow. It describes the structure of the container, not the contents of the vessel. A schema cannot reveal, for instance, that a "county" column might store data as "Alameda," "Alameda County," or "ALAMEDA." It cannot predict which join will lead to a combinatorial explosion of duplicate rows.

The BIRD (Big Bench for Large-scale Database Grounding) benchmark has been instrumental in exposing these limitations. By utilizing real-world, messy databases with nontrivial relationships, BIRD forces models to confront the reality that data is rarely as clean or as logical as an idealized schema suggests.


SQRL: Inspecting Before Answering

Feyn AI’s solution is to grant the model agency. The SQRL model architecture follows an interactive loop. When a natural language question is posed, the model receives the schema and any available evidence. If the model determines that the context is insufficient, it pauses. It then emits a read-only "observation" query—a probe—to the database.

The harness executes this probe, returns the resulting rows, and feeds them back to the model. This loop can occur up to five times, allowing the model to refine its understanding of the data before it commits to an <answer> block.

The Architecture of Interaction

The interaction protocol is governed by two distinct markers:

  1. <sql> tags: These represent the model’s intent to gather more information.
  2. <answer> tags: These signify that the model has sufficient information to formulate the final, definitive query.

Crucially, this is not a one-size-fits-all approach. If a user asks a simple question like "How many rows are in the Users table?", the model recognizes that no inspection is required and answers directly. This efficiency ensures that the model only incurs the computational and latency costs of a database round-trip when the question actually demands it.


Technical Chronology: Training the Decision to Inspect

Developing SQRL was not merely a matter of fine-tuning for syntax; it was about teaching a model the "meta-cognition" of when to look.

Cleaning the Training Pool

Feyn AI started by cleaning the BIRD and Spider datasets. The team identified and purged any examples where the "ground truth" reference SQL was either broken or failed to produce a useful result. To ensure the highest quality, they employed a multi-stage review process where three separate model judges reviewed the training pairs, discarding any query that did not accurately address the user’s prompt.

Feyn AI Releases SQRL, a Text-to-SQL Model Family That Inspects the Database Before Writing a Query

The Power of CISPO

The flagship SQRL-35B-A3B model was trained using CISPO (a reinforcement learning method derived from the M1 research by MiniMax). Unlike traditional policy optimization, which can be sensitive to gradient instability, CISPO clips importance-sampling weights. This allows the model to preserve gradient signals from rare but highly decisive tokens.

By running eight complete trajectories for every question, the model learned to distinguish between successful and failed paths. The training focused on the "mixed zone"—instances where some attempts succeeded and others failed. This provided the model with the necessary contrastive signal to learn exactly which investigative steps contributed to a correct final answer.

Fine-Tuning and Deployment

The final training set consisted of approximately 10,200 trajectories that included reasoning, exploration queries, and observations. The smaller 4B and 9B student models were fine-tuned on this dataset, then refined using the same CISPO execution reward mechanism, ensuring that even the smaller models retained the "look-before-you-leap" capability.


Supporting Data: Benchmarking Against the Giants

The performance metrics on the BIRD Dev benchmark demonstrate that Feyn’s approach is not just conceptually sound—it is highly effective.

  • SQRL-35B-A3B: Achieved 70.60% execution accuracy, surpassing Claude Opus 4.6 (68.77%).
  • SQRL-9B: Reached 69.80%, a remarkable feat for a model of its size.
  • SQRL-4B: Matched Claude Opus 4.6 at 68.80%, providing a high-performance option for resource-constrained environments.

For context, these figures place SQRL ahead of several frontier models, including Claude 3.5 Sonnet (67.34%), Qwen3-Coder-480B (66.17%), and DeepSeek-R1 (61.67%). The ability of the 4B model to match the performance of significantly larger, proprietary frontier models highlights the efficiency of Feyn’s approach to database grounding.


Implications for the Industry

Privacy and Local Control

One of the most significant implications of the SQRL release is the ability to run these models locally or within a controlled cloud environment. Because the 4B and 9B models are performant enough to be hosted on standard hardware using vLLM, organizations no longer need to ship their database schemas—or the data itself—to third-party API providers to achieve high-accuracy SQL generation. This is a critical development for industries with stringent data privacy requirements, such as finance, healthcare, and legal services.

Changing the "Hot Path" of Development

Historically, developers have had to choose between two extremes:

  1. Single-shot models: Cheap and fast, but prone to logical errors.
  2. Complex pipelines: Involving multi-step retrieval, critique, and generation, which are often too slow for production "hot paths."

SQRL collapses these two strategies. By building the inspection logic directly into the model weights, it eliminates the need for a brittle, external orchestration layer. It makes "critique-and-correct" an inherent part of the model’s internal reasoning process.


Implementation and Best Practices

For those looking to deploy SQRL, Feyn AI recommends the 9B model as the "sweet spot" for most production applications. The deployment requires a simple application loop:

  1. Execute the model’s <sql> output against the database in read-only mode.
  2. Inject the resulting rows into the next prompt as an <observation>.
  3. Repeat until the model emits an <answer>.

A Vital Caveat: Feyn warns that users should not enable a standard "serving-layer reasoning parser" if it automatically strips content between <think> tags. The SQRL action protocol is embedded in the raw content; stripping it will inadvertently remove the very tags the application harness needs to trigger the database inspection.


Final Thoughts

The success of SQRL marks a pivot in the evolution of AI-driven data analysis. By shifting the focus from simple text generation to informed, data-driven inspection, Feyn AI has addressed the primary failure point of existing text-to-SQL systems. As these models move from the lab to the production floor, the ability to "interrogate" a database will likely become the standard requirement for any AI agent tasked with managing complex, real-world data.

For developers, the message is clear: the future of SQL generation isn’t just about knowing the language—it’s about knowing the data. By providing open access to the SQRL family via Hugging Face, Feyn is inviting the community to push the boundaries of what is possible when models are given the tools to verify their own reasoning.

Back To Top