arXiv:2611.00960cs.CLOct 2026

Manuscript Offprint

arXiv:2611.00960

Self-Refining Prompt Induction for Streaming Text-to-SQL

Gaetano Rossiello, Alfio Gliozzo, Nandana Mihindukulasooriya, Erick Lee, Nabila Siregar, Lisa Amini

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Text-to-SQL assistants for streaming engines must handle dialect-specific types, windowing rules, and temporal semantics, including constructs poorly handled by generic prompts. We present Self-Refining Prompt Induction (SRPI), an offline method that converts generation failures into reusable dialect instructions while keeping model weights fixed. A Refiner revises the Generator's prompt using reference-conditioned feedback from three LLM judges; a sampled regression guard checks earlier successes, and a separate Compressor reduces prompt length. Inference uses the frozen prompt without retrieval or query repair. We evaluate cross-domain and cross-model transfer on Confluent Cloud Flink SQL using a controlled synthetic workload seeded by 30 expert-written examples, with 335 induction examples and 257 questions from held-out domains. The same induced prompt improves mean judge scores across seven Generators by 7.1–19.2 percentage points, including an increase from 85.3% to 97.5% for the induction model. A separate compression study reduces prompt length by 52.7% with a 0.19-percentage-point score decrease. An assistant using the induced prompt is in early access, with initial user feedback to inform subsequent refinement.

1 Introduction

Text-to-SQL assistants broaden access to data platforms, but success on Spider and BIRD does not establish reliability on a particular production engine (Yu et al., 2018; Li et al., 2023). Cross-dialect evaluation exposes backend differences (Perlitz et al., 2026), while enterprise workloads add schema and domain complexity (Chen et al., 2024).

Our assistant generates Confluent Cloud Flink SQL from English requests and definitions of user-selected tables (Figure 1). Streaming SQL unifies operations over streams and tables (Begoli et al., 2019), but correct queries still depend on times-

Figure

Figure 1: A natural-language request and a Flink SQL query over a stream. The dashed region highlights the window table-valued function (TVF), which assigns events to ten-minute windows.

tamp types, event-time semantics, window membership, and engine-specific conventions. For example, the managed service exposes the Kafka record timestamp through $rowtime; confusing it with a business event timestamp can change a query's meaning (Confluent, 2026a). Errors can reject a statement or silently change its answer.

Supervised fine-tuning (SFT) adapts weights for specialised Text-to-SQL tasks (Tritto et al., 2026; Glass et al., 2025). We instead keep Generator weights fixed and learn reusable instructions. Prompts can be inspected, versioned, and rolled back across Generators without model-specific retraining. This suits inference-only access and frequent model changes, at the cost of longer inputs. Comparison with SFT remains open.

Self-Refining Prompt Induction (SRPI) targets a practical maintenance problem: converting failures on long-tail dialect constructs into guidance reusable across domains and Generators. The aim is to encode the target engine's syntax and usage constraints in a prompt. SRPI rewrites instructions

Figure

Figure 2: SRPI separates offline induction and compression from online generation. Reference SQL is visible to the judges and Refiner, never to the Generator. The guard tests each rewrite before commitment; the requested compression budget need not be met. Online use requires one Generator call with the static prompt.

using three judges' reference-conditioned feedback, checks earlier successes, and compresses the result. The Generator and Refiner use the same model; judges and optimisation procedure remain fixed.

We study this process in a controlled synthetic workload executed on a live managed cluster. Judge-score targets are 95% for single-construct questions and 75% for questions combining at least three constructs. The assistant is in early access, with initial real-user feedback forthcoming. Informal feedback from Flink and streaming-data experts has been encouraging.

The contributions are:

  • System design: an offline adaptation workflow integrating reference-based feedback, whole-prompt self-refinement, a regression guard, and separate compression.

  • Data and transfer: a controlled workload testing reuse of one induced prompt across seven Generators and held-out domains within a shared dialect repertoire.

  • Engineering evidence: measured trade-offs in prompt growth, regression checks, compression, and feedback sources.