AIJian/TrustSQL-4B

TEXT GENERATIONPricing:Input $0.4 / Cached $0.08 / Output $0.8Concurrent Unit Cost:1Model Size:4BQuant:BF16Context Size:32kTool Calling:SupportedPublished:Mar 20, 2026License:apache-2.0Architecture:Transformer Open Weights Featherless Exclusive Cold

AIJian/TrustSQL-4B is a 4.0 billion parameter Text-to-SQL model fine-tuned from Qwen3-4B, developed by AIJian. It specializes in generating SQL queries from natural language over unknown database schemas, utilizing multi-turn reinforcement learning and tool integration. This model is optimized for robust performance on Text-to-SQL benchmarks like BIRD-Dev and Spider-Test under unknown schema conditions, making it suitable for complex database interaction tasks.

Loading preview...

TrustSQL-4B: Text-to-SQL with Tool-Integrated Reinforcement Learning

TrustSQL-4B is a 4.0 billion parameter Text-to-SQL model, fine-tuned from Qwen3-4B by AIJian. Its core innovation lies in its approach to handling unknown database schemas, a common challenge in real-world applications. The model employs a sophisticated two-stage training pipeline involving SFT warm-up followed by Phase-Aware GRPO optimization, and integrates a multi-turn reinforcement learning strategy.

Key Capabilities

  • Text-to-SQL Generation: Translates natural language questions into executable SQL queries.
  • Unknown Schema Handling: Designed to operate effectively even when the database schema is not fully known beforehand, leveraging tool integration for schema exploration.
  • Reinforcement Learning: Utilizes multi-turn reinforcement learning for improved accuracy and robustness.
  • Tool Integration: Interacts with external tools for schema exploration, proposal, and SQL execution, following an Explore → Propose → Generate → Confirm protocol.

Performance

TrustSQL-4B demonstrates strong performance on key Text-to-SQL benchmarks under the Unknown Schema setting:

  • BIRD-Dev: Achieves 64.9% (Greedy) and 67.2% (Majority voting).
  • Spider-Test: Achieves 82.8% (Greedy) and 85.0% (Majority voting).

When to Use This Model

This model is ideal for applications requiring reliable Text-to-SQL capabilities, especially in environments where database schemas are dynamic or not fully pre-defined. It is particularly suited for scenarios where an orchestrator can provide schema exploration and SQL execution tools, allowing the model to ground its decisions in environmental feedback rather than fabricated schema descriptions. Users should validate generated SQL before deployment in sensitive database operations.