Executable SQL generation is typically studied in text-to-SQL settings, where tables are provided as fully linearized textual schemas and contents. While effective, this formulation assumes access to structured text and incurs substantial token overhead, which is misaligned with many real-world scenarios where tables appear as visual artifacts in documents or webpages. We investigate whether compact optical representations can serve as an efficient interface for executable semantic parsing. We present OptiSQL, a vision-driven framework that generates executable SQL directly from table images and natural language questions using compact optical tokens. OptiSQL leverages an OCR-oriented visual encoder to compress table structure and content into a small set of optical tokens and fine-tunes a pretrained decoder for SQL generation while freezing the encoder to isolate representation sufficiency. Experiments on a visualized version of Spider 2.0-Snow show that OptiSQL retains strong execution accuracy while reducing table input tokens by an order of magnitude. Robustness analyses further demonstrate that optical tokens preserve essential structural information under visual perturbations.
翻译:可执行SQL生成通常在文本到SQL的设置中进行研究,其中表格以完全线性化的文本模式和内容形式提供。虽然有效,但这种表述假设可以访问结构化文本,并会产生大量的标记开销,这与许多现实场景不符,在这些场景中,表格以文档或网页中的视觉形式出现。我们研究紧凑的光学表示是否可以作为可执行语义解析的高效接口。我们提出了OptiSQL,这是一个视觉驱动的框架,它使用紧凑的光学标记直接从表格图像和自然语言问题生成可执行SQL。OptiSQL利用面向OCR的视觉编码器将表格结构和内容压缩为一小组光学标记,并微调预训练的解码器以生成SQL,同时冻结编码器以隔离表示的充分性。在Spider 2.0-Snow的可视化版本上的实验表明,OptiSQL在保持强大执行准确性的同时,将表格输入标记减少了一个数量级。鲁棒性分析进一步证明,光学标记在视觉扰动下保留了必要的结构信息。