Feyn AI が DB 事前検査型 Text-to-SQL モデル「SQRL」発表
YC ベースのスタートアップ Feyn AI が、データベースを事前に検査して曖昧性を解消する「SQRL」モデルファミリーを発表し、BIRD Dev ベンチマークで既存の最先端モデルを上回る性能を示した。
キーポイント
パラダイムシフト:翻訳から検査へ
従来のテキストから SQL への「翻訳」アプローチではなく、クエリ生成前にデータベースを直接検査(Inspection)することで、構文は正しくても論理的に誤った回答を防ぐ新手法を採用している。
BIRD Dev ベンチマークでの高性能
フラグシップモデル「SQRL-35B-A3B」が 70.6% の実行精度を達成し、Claude Opus 4.6(68.77%)を上回る結果を出しており、実世界データの複雑さに対処する能力が証明された。
動的な探索メカニズム
質問の文脈だけで判断できない場合、モデルは読み取り専用クエリを実行してデータを取得し(<sql>ブロック)、その結果を元に最終的な SQL を作成する(<answer>ブロック)という 2 段階のプロセスを採用している。
オープンソース化と実用性
4B、9B、35B-A3B の 3 つのチェックポイントが Hugging Face で公開されており、Schema 情報だけでは解決できない列名や値の曖昧さ(例:「Alameda」vs「ALAMEDA」)をデータ自体から解決できる。
トレーニングデータの厳格なクリーニング
BIRD と Spider データセットから、実行結果がない参照クエリや質問に答えていない例を削除し、モデルの学習精度を向上させた。
CISPO による強化学習と混合ゾーン戦略
稀な決定トークンの勾配信号を保持する CISPO アルゴリズムを使用し、正解と不正解が混在する「混合ゾーン」のデータで学習することで、いつ検査を行うかを効果的に教えた。
教師モデルから学生モデルへの転移学習
35B の教師モデルが生成した約 10,200 件の成功事例(推論プロセスと最終 SQL を含む)を基に、4B および 9B の学生モデルをファインチューニングし、Qwen3.5/3.6 ベースで SQRL を構築した。
重要な引用
Most text-to-SQL systems treat the task as translation. Feyn AI reframes it around inspection.
A query can be valid SQL and still return the wrong answer.
The model simply needs permission to ask for it.
SQRL inspects before it answers.
The model pays the cost of looking only when the question needs it.
Feyn therefore trained on the 'mixed zone,' where only some of the eight attempts succeeded, so every group could reinforce the choices that separated a correct trajectory from an incorrect one.
影響分析・編集コメントを表示
影響分析
この発表は、テキストから SQL を生成する技術の成熟度を示す重要な転換点であり、単なる言語変換モデルから、データベースという「環境」を理解し対話できる自律的なエージェントへの進化を象徴しています。実運用におけるクエリの信頼性を劇的に向上させる可能性があり、データ分析や BI ツールの開発において、より堅牢な AI 活用を可能にする基盤技術となるでしょう。
編集コメント
「翻訳」から「検査」へのアプローチ転換は、Text-to-SQL の実用化における最大の障壁であった論理的誤りを解決する画期的な手法です。特に BIRD ベンチマークで Claude Opus を上回る結果を出した点は、大規模言語モデルが単なる知識の蓄積ではなく、環境との対話を通じて推論能力を高める方向へ進化していることを示唆しています。
テキストから SQL を生成するシステムは、往々にして「翻訳」の問題として扱われます。しかし、YC ベースのスタートアップである Feyn AI は、このタスクを「検査(インスペクション)」を中心に再定義しました。
Feyn チームが公開した SQRL は、自然言語の質問を SQL 文に変換するモデルファミリーです。SQRL は即座にクエリを生成するのではなく、まずデータベースを検査します。これにより曖昧さを解消し、データが実際に存在する範囲内でのみ有効なクエリのみを書き出すことが可能になります。
Feyn チームによると、フラッグシップモデルである SQRL-35B-A3B は、BIRD Dev ベンチマークにおいて 70.6% の実行精度を達成しました。これは、同じ評価条件下で Claude Opus が示した 68.77% をわずかに上回る結果です。
現在、Hugging Face では SQRL-4B、SQRL-9B、SQRL-35B-A3B の 3 つのチェックポイントがオープンソースとして公開されています。
SQL 文として正しくても、結果は間違っている可能性がある
テキストから SQL を生成する問題は「翻訳」問題と説明されることが多いですが、その枠組みでは最も難しい部分を見落としてしまいます。生成されたクエリが文法的に完璧な SQL であっても、返される答えが間違うことはよくあります。
例えば、結合対象のテーブルを間違えたり、曖昧なカラムを誤って解釈したり、存在しない値でフィルタリングを行ったりするケースです。これらすべてのミスはエラーとして検出されないため、実行結果だけを見ていても発見できません。
スキーマ情報だけではこれらのミスを防ぐことはできません。スキーマにはテーブル名、カラム名、データ型、場合によっては関係性が記載されていますが、「county」という情報が「Alameda」なのか「Alameda County」なのか「ALAMEDA」なのかといった詳細までは開示されません。また、どの結合方法を使えば重複行が発生するかを教えることもできません。
BIRD ベンチマークは、これらの失敗を定量化する指標となります。同ベンチのデータベースは実世界のドメインにまたがり、不完全な値や曖昧な列、複雑な関係性を含んでいます。システムの評価は、生成された SQL を実行し、その結果行を正解データと比較することで決定されます。クエリ言語において、構文が正しいだけでは不十分です。
Feyn の核心的な洞察は、不足している情報はすでにデータベース内に存在するという点にあります。モデルに必要なことは、それを問い合わせる許可を得ることだけです。
SQRL は回答する前にデータベースを検査します
SQRL は質問とスキーマ、そしてデータベースに関する任意の証拠を受け取ります。この文脈だけで十分であれば、即座にクエリを返します。しかし何らかの曖昧さが残っている場合、読み取り専用のクエリを実行し、その結果行をもとに最終的な回答を構成します。検査を行うかどうかは状況次第です。単一のテーブルの行数を数える程度なら参照する必要はなく、SQRL は即座に回答します。
この相互作用には 2 つの異なるアクションが用いられます。` ブロックはデータベースからの観測値を要求するものであり、 ブロックは最終クエリへのコミットを表します。ハーン(実行環境)は探索用のクエリを読み取り専用モードで実行し、その結果行を ` タグ内に返します。SQRL は最大 5 回まで検査を行えますが、多くの質問はそれより少ないステップで完了します。
以下の解説では、実際の例を通じて両方の動作を順を追って説明し、その後 BIRD Dev における SQRL ファミリーと最先端モデルの比較を行います。
(function(){
window.addEventListener("message", function(e){
if(e && e.data && e.data.type === "sqrl-resize"){
var f = document.getElementById("sqrl-mtp-frame");
if(f && e.data.height){ f.style.height = e.data.height + "px"; }
}
});
})();
従来の戦略を両方取り入れたモデル
Text-to-SQL(自然言語から SQL を生成する技術)の歴史には、主に 2 つのアプローチがありました。それぞれに重要なトレードオフがあります。
シングルショットモデルは、一度の呼び出しでクエリ全体を生成します。コストを抑えられますが、スキーマ情報だけからすべての論理を推測する必要があり、結果として論理的な誤りが生じるリスクがあります。一方、最先端のパイプライン方式では、まず文脈を取得し、候補を生成して批判的に検討した上で回答を選択します。精度は最大化できますが、質問ごとに複数の高コストな処理と、データベースとの往復が必要になります。このコストのため、こうしたパイプラインをホットパス(頻繁に利用される経路)に配置するのは現実的ではありません。
SQRL はこれら 2 つのアプローチを単一のモデルに統合しました。簡単な質問には短く対応し、曖昧な質問にはデータベースの検査を行います。必要な時だけ、そのコストを支払う仕組みです。
検査を行うかどうかの判断を学習する
モデルにデータベースへのアクセス権限を与えるだけでは、いつ・どのように検索すべきかは教わりません。この振る舞いは訓練によって習得する必要があり、実行ベースの学習は非常に厳しいものです。もし参照となるクエリ自体が間違っていれば、正解した回答に対して誤った報酬が与えられてしまいます。そこで Feyn はまずトレーニングデータを精査しました。BIRD と Spider のデータセットから始め、参照 SQL が実用的な結果を返さない事例を除外します。その後、3 つのモデル判定者が残りのペアを検証し、質問に答えていないクエリも削除しました。テスト用スプリットは、未使用の Spider スプリットと BIRD の開発データ(dev)を組み合わせて構成され、残りのデータがトレーニングに回されました。
35B-A3B の教師モデルは、MiniMax の M1 研究から生まれた強化学習手法「CISPO」を用いて直接訓練されています。CISPO はポリシー比ではなく、重要性サンプリングの重みをクリップする仕組みを採用しており、稀だが決定的なトークンからの勾配信号を保持します。各質問に対してモデルは 8 つの完全な軌道(トラジェクトリ)を生成し、Feyn は最終的なクエリを実行しました。参照結果と一致した回答には報酬が与えられ、これは文章の表現ではなく返された行のみをチェックするバイナリ信号です。
グループ相対学習では、各グループ内に多様性が必要です。8 つすべてが成功しても失敗しても、どの判断が役立ったのかというシグナルは得られません。そこで Feyn は「ミックスゾーン」で訓練を行いました。ここでは 8 つの試行のうち一部のみが成功するケースを扱い、各グループ内で正しい軌道と誤った軌道を分ける選択を強化できるようにしたのです。これが教師モデルに「いつデータベースを検索すべきか」を学ばせた方法です。
実用化に向けて、Feyn チームは教師モデルの完全な実行軌跡をサンプリングし、最終的な SQL クエリが正解を返すもののみを選別しました。これにより、推論プロセスや探索クエリ、観測結果、そして最終回答を含む約 10,200 の事例データが作成されました。4B と 9B の学生モデルはこれらの軌跡で微調整され、さらに CISPO による実行報酬を用いて洗練されています。SQRL は Qwen3.5 および Qwen3.6 モデルファミリーを基盤に構築されています。
ファミリー全体での性能評価
Feyn は BIRD Dev ベンチマークで SQRL を評価しました。ここでは、参照結果と同じ出力を返すクエリが正解とみなされます。SQRL-35B-A3B は 70.60% のスコアを記録し、トークンあたり約 3B パラメータを活性化します。一方、9B の学生モデルは 69.80% とほぼ同等の性能を維持しています。4B モデルも 68.80% を達成しており、Claude Opus 4.6 に匹敵する結果です。このサイズならどこでもホスト可能で、スキーマやクエリ、観測データをユーザーが管理するインフラ上に保持できるため、セキュリティ面でも安心です。
Feyn が報告した比較では、最先端モデル群も SQRL には及びませんでした。Claude 4.5 Sonnet は 67.34%、Qwen3-Coder-480B-A35B は 66.17%、GLM-4.7 は 63.82%、DeepSeek-R1 は 61.67%、Kimi-K2-Thinking は 60.63% です。
デプロイに関する推奨事項
Feyn では、SQRL-9B をデフォルトチェックポイントとして推奨しています。予算が限られる場合は SQRL-4B を、最高精度が必要な場合に SQRL-35B-A3B を選択するのが良いでしょう。9B モデルは vLLM で動作します。
vllm serve feyninc/sqrl-9b \
--served-model-name sqrl-9b \
--gpu-memory-utilization 0.90 \
--max-model-len 32768アプリケーションのループは非常にシンプルです。データベースの実行は常に読み取り専用とし、モデルが回答を出力するまで、各観測結果を逐次返します。
ただし、一つだけ注意すべき点があります。サービング層に推論用パーサーを有効化しないことです。アクションプロトコルは、閉じタグの直後のコンテンツ内に記述されるため、その部分を削除するとモデルの思考(think)やアクションが失われてしまいます。そのため、生のメッセージ内容を解析し、最終的な「think」タグ以降の内容はすべて保持する必要があります。
モデルカードには、完全なシステムプロンプトと参照用ハッチェンが含まれています。
主なポイント
SQRL は、最終クエリを実行する前にデータベースを検査するための読み取り専用プローブを実行するテキストから SQL へのモデルファミリーです。
Feyn が報告した SQRL-35B-A3B の BIRD Dev ベンチマークにおける実行精度は 70.6% で、同じ評価における Claude Opus の 68.77% を上回っています。
フラッグシップモデルは 4B と 9B の学生モデルに蒸留されており、SQRL-4B はこのテストで Opus と同等の性能を維持しながら、自己ホスティングも可能です。
トレーニングでは BIRD と Spider データセットをクリーニングし、実行結果の一致に対して報酬を与えました。また、CISPO(Contrastive Instruction Selection for Prompt Optimization)と蒸留手法を組み合わせて、モデルに「いつ検査を行うべきか」を学習させました。
これら 3 つのチェックポイントはすべて Hugging Face で公開されており、vLLM を介して読み取り専用ハッチェンで提供されています。このハッチェンは、観測結果をモデルへフィードバックする役割を果たします。
SQRL は Feyn によって開発されました。チームは GitHub、Hugging Face、X(旧 Twitter)でも確認できます。
※本記事は MarkTechPost に掲載された「Feyn AI Releases SQRL, a Text-to-SQL Model Family That Inspects the Database Before Writing a Query」の続編です。
原文を表示
Most text-to-SQL systems treat the task as translation. Feyn AI (YC-backed startup) reframes it around inspection. The Feyn team has released SQRL, a family of models that turn natural language questions into SQL. Instead of generating a query immediately, SQRL can inspect the database first. This lets it resolve ambiguity and write only queries the data actually supports.
Feyn team reports that the flagship SQRL-35B-A3B reaches 70.6% execution accuracy on BIRD Dev. That figure edges Claude Opus 4.6 at 68.77% under the same evaluation. Three checkpoints ship openly on Hugging Face: SQRL-4B, SQRL-9B, and SQRL-35B-A3B.
A query can be valid SQL and still be wrong
Text-to-SQL is often described as a translation problem, but that framing misses the hardest part. A query can be perfectly valid SQL and still return the wrong answer. It can join the wrong tables, read an ambiguous column incorrectly, or filter for values that do not exist. None of these mistakes throws an error, so none is caught by execution alone.
Schema information does not prevent them. A schema lists tables, columns, types, and sometimes relationships. It does not reveal whether a county is stored as Alameda, Alameda County, or ALAMEDA. It cannot tell you which join produces duplicate rows.
The BIRD benchmark makes these failures measurable. Its databases span real domains and contain imperfect values, ambiguous columns, and nontrivial relationships. A system is scored by executing its SQL and comparing the returned rows against a reference result. For query languages, syntactic correctness is not enough. Feyn’s core insight is that the missing information already lives inside the database. The model simply needs permission to ask for it.
SQRL inspects before it answers
SQRL receives a question, its schema, and optional evidence about the database. If that context is enough, it returns a query at once. If something remains ambiguous, it runs read-only queries and uses the returned rows to draft its final answer. The decision to inspect is circumstantial. Counting rows in a single table needs no lookup, so SQRL answers directly.
The interaction uses two distinct actions. An <sql> block requests an observation from the database. An <answer> block commits to the final query. The harness executes exploration queries in read-only mode and returns their rows inside <observation> tags. SQRL can inspect up to five times, though most questions finish in fewer steps.
The explainer below walks through both behaviors on real examples, then compares the family against frontier models on BIRD Dev.
(function(){
window.addEventListener("message", function(e){
if(e && e.data && e.data.type === "sqrl-resize"){
var f = document.getElementById("sqrl-mtp-frame");
if(f && e.data.height){ f.style.height = e.data.height + "px"; }
}
});
})();
One model that folds in both traditional strategies
Text-to-SQL has historically followed two approaches, and each trades away something important.
Single-shot models generate the entire query in one turn. They are inexpensive to serve, but they must infer everything from the schema, which can produce logically incorrect queries. Frontier pipelines instead retrieve context, generate candidates, critique them, and then select an answer. This can maximize accuracy, but every question requires several expensive frontier calls and multiple database round trips. That cost makes such pipelines hard to place on the hot path.
SQRL combines both in a single model. Easy questions stay short, while ambiguous questions earn an inspection. The model pays the cost of looking only when the question needs it.
Training the decision to inspect
Giving a model database access does not teach it when or how to look. That behavior has to be trained, and execution-based training is unforgiving. If a reference query is itself wrong, a correct model answer receives the wrong reward. Feyn therefore cleaned the training pool first. Starting from BIRD and Spider, it removed examples whose reference SQL produced no usable result. Three model judges then reviewed the remaining pairs and dropped any query that did not answer its question as written. The test split combines a held-out Spider split with BIRD dev, and the rest of the data went into training.
The 35B-A3B teacher trained directly with CISPO, a reinforcement learning method from MiniMax’s M1 work. CISPO clips the importance-sampling weights rather than the policy ratio, which preserves gradient signal from rare but decisive tokens. For each question, the model produced eight complete trajectories. Feyn executed every final query and rewarded a result that matched the reference, a binary signal that ignores wording and checks only the returned rows.
Group-relative training needs variation inside each group. Eight correct or eight failed attempts carry no signal about which decisions helped. Feyn therefore trained on the ‘mixed zone,’ where only some of the eight attempts succeeded, so every group could reinforce the choices that separated a correct trajectory from an incorrect one. That is how the teacher learned when to inspect.
To make the behavior deployable, Feyn team sampled complete teacher trajectories and kept only runs whose final SQL returned the correct result. This produced about 10,200 examples, each preserving the reasoning, exploration queries, observations, and final answer. The 4B and 9B students were fine-tuned on these trajectories, then refined with the same CISPO execution reward. SQRL builds on the Qwen3.5 and Qwen3.6 model families.
Performance across the family
Feyn evaluated SQRL on BIRD Dev, scoring a query correct when it returns the same result as the reference. SQRL-35B-A3B scores 70.60% and activates about 3B parameters per token. The 9B student holds nearly all of that at 69.80%. SQRL-4B reaches 68.80%, matching Claude Opus 4.6 on this evaluation in a model small enough to host anywhere, so your schema, queries, and observations stay on infrastructure you control.
In Feyn’s reported comparison, the frontier field trails: Claude 4.5 Sonnet at 67.34%, Qwen3-Coder-480B-A35B at 66.17%, GLM-4.7 at 63.82%, DeepSeek-R1 at 61.67%, and Kimi-K2-Thinking at 60.63%.
Deployment notes
Feyn recommends SQRL-9B as the default checkpoint, with SQRL-4B for the tightest budgets and SQRL-35B-A3B for the highest accuracy. The 9B model serves with vLLM:
Copy CodeCopiedUse a different Browser
vllm serve feyninc/sqrl-9b \
--served-model-name sqrl-9b \
--gpu-memory-utilization 0.90 \
--max-model-len 32768
The application loop is small. Keep database execution read-only, and return each observation to the model until it emits an answer. One caveat matters. Do not enable a serving-layer reasoning parser. The action protocol appears in the content after the closing </think> tag, so stripping that content removes the model’s <sql> or <answer> action. Parse the raw message content and preserve everything after the final think tag. The model cards contain the complete system prompt and a reference harness.
Key Takeaways
SQRL is a text-to-SQL model family that runs read-only probes to inspect a database before committing to a final query.
Feyn reports SQRL-35B-A3B at 70.6% execution accuracy on BIRD Dev, above Claude Opus 4.6 at 68.77% in the same evaluation.
The flagship distills into 4B and 9B students; SQRL-4B matches Opus on this test while staying self-hostable.
Training cleaned BIRD and Spider, rewarded execution matches, and used CISPO plus distillation to teach the model when to inspect.
All three checkpoints are open on Hugging Face and serve with vLLM through a read-only harness that feeds observations back to the model.
SQRL is built by Feyn. You can find the team on GitHub, Hugging Face, and X.
The post Feyn AI Releases SQRL, a Text-to-SQL Model Family That Inspects the Database Before Writing a Query appeared first on MarkTechPost.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み