Local NL-to-SQL Pipeline Using Qwen3 4B and Deterministic Planning
A developer has implemented a fully local natural language to filter generation system on hardware lacking a GPU. The solution utilizes the Qwen3 4B Instruct model running via llama.cpp with CPU-only inference. Rather than generating SQL directly, the model focuses on semantic intent and structured filter selection. A deterministic query planner subsequently handles the SQL generation and optimization processes. The pipeline employs a BM25 and embedding hybrid retrieval method using FAISS for vector storage. It retrieves the top four matching examples from approximately 800 embedded semantic instances to inject into the prompt. This approach allows the system to function effectively within strict constraints of limited RAM and no internet access.