Skip to content

Author

Wen-Syan Li

2 papers indexed here

We haven’t gathered this author’s papers yet. Follow them and we’ll fetch their work.

Not the right person? Other researchers publish under this name.

Open access 2026

NL2SQL+: An Extended Framework for SQL Generation With On-Demand Embedded ML Functions

Modern enterprise systems are increasingly adopting natural language (NL) interfaces for querying structured data. However, most natural language to SQL (NL2SQL) approaches focus on retrieval and aggregation over stored records, whereas many business queries require predictive computation through embedded machine learning (ML) functions. We introduce NL2SQL+, an extended NL2SQL framework for generating SQL with on-demand embedded ML functions. Given an NL query and database metadata, NL2SQL+ determines whether predictive ML is required, extracts a structured representation of the user intent, retrieves or selects a suitable ML model or function, and instantiates platform-specific training or inference SQL templates for database-native ML platforms. The framework consists of a Router for detecting ML-aware NL queries, an Extractor for intent parsing, a Model Explorer that uses an ML Model Pool for model/function selection, and a template-based SQL Generator targeting BigQuery ML and Postgres ML. We evaluate NL2SQL+ using platform-agnostic intent matching for structured intent extraction and by executing generated training SQL during ML Model Pool construction. The Router achieves an F1 score of 94%. For structured intent extraction, a fine-tuned small language model improves exact-match performance by 67.08% over OpenAI o1-mini and 9.77% over OpenAI o3-mini, and achieves nearly a fourfold gain compared with a direct LLM baseline using GPT-5-mini under the same metric. The empirical findings indicate that factorizing ML-aware SQL generation into four distinct stages—query routing, structured intent extraction, model or function selection, and template-guided SQL synthesis—enhances semantic controllability and token efficiency when formulating predictive natural language queries over database-native ML systems. These results are useful for database researchers, enterprise analytics teams, and practitioners who aim to provide natural-language access to predictive analytics over database-native ML platforms. The code, dataset, and prompts are available at https://github.com/simonjisu/NL2ML-SQL

Jisoo Jang, Mingyoo Son, Wen-Syan Li · 0 citations
Open access 2026

Graph-of-Context: Recoverable Fold/Unfold and Scoped Fork for Instrumented Long-Horizon Multi-Turn LLM Agentic Workflows

Large language model (LLM) agents still tend to run long-horizon workflows as a single linear transcript. This representation is straightforward to implement, but it becomes brittle once a task spans many turns, tool outputs, updates, and late-binding pivots. We examine context management for an instrumented, single-session, long-horizon, multi-turn agentic workflow in which dependency links are available from workflow metadata, tool logs, citations, or controller annotations, and introduce Graph-of-Context (GoC) as a split between a recoverable storage graph and a budget-constrained active context. GoC is built around three recoverable operators: fold, which compresses inactive episodes into proxy nodes in the active view while preserving the original subgraph in storage; unfold, which restores a budget-feasible dependency-supporting subgraph at expensive checkpoints; and scoped fork, which creates a temporary least-privilege view for a specialist sub-agent and rejoins the result with explicit provenance edges. We formalize the storage graph, active-context construction, dependency closure, fork-time projection, and rejoin procedure. In LLM-based TraceOps experiments with gpt-4.1-mini, the validated fold/unfold core raises delayed-activation decision accuracy from 25.0% to 42.5%, cuts mean prompt tokens by 54%, and reduces over-commitment from 0.625 to 0.340. A deterministic selector study then isolates fork scope quality: in the mismatch setting ( $d=6$ ), dependency-scoped fork reaches the full-context performance upper bound at roughly one-third of the token cost and surpasses similarity-scoped fork under a matched token budget. A limited end-to-end workflow validation further shows that fork alone is not sufficient, but that a mixed graph-native policy can match full-history prompting accuracy (0.396) while reducing mean prompt tokens from 49.1k to 38.1k and median prompt tokens from 69.2k to 35.6k. Workflow-level comparisons show that graph-native policies improve over similarity-only retrieval and proxy summarization in long-horizon support restoration, and failure/sensitivity analyses identify remaining error sources. In a six-seed dependency perturbation study, closure-only restoration changes from 0.368 at baseline to 0.340 under 30% edge removal and 0.347 under 20% noisy-edge injection; the Mixed-Heuristic policy retains higher absolute accuracy across the same conditions (0.493, 0.493, and 0.465, respectively). Overall, the results support a focused claim: GoC introduces recoverable, graph-native context management for instrumented single-session workflows with available or constructible dependency traces, and scoped fork adds dependency-aware projection with provenance-preserving rejoin within that trace graph.

Joo-Ho Lee, Wen-Syan Li · 0 citations