Neon-Studio-Dreams-MANASAIDEV

ManasAIDev

MiniCPM5-2B Text2SQL

Natural Language → SQL | Fine-Tuned Small Language Model

A fine-tuned 2B-class language model designed to translate natural-language questions into SQL queries for database applications.


Highlights

MiniCPM5-2B-Text2SQL is a fine-tuned version of ""openbmb/MiniCPM5-2B-SFT"" (https://huggingface.co/openbmb/MiniCPM5-2B-SFT), developed by ManasAIDev for natural-language-to-SQL generation.

The objective is to adapt a compact language model for database querying, with an emphasis on schema-aware SQL generation and local deployment.

  • Text-to-SQL specialization: Fine-tuned to generate SQL from natural-language instructions.
  • Compact model: Built on the MiniCPM5-2B-SFT model family.
  • Parameter-efficient fine-tuning: Trained using LoRA/QLoRA with rank 16.
  • Local inference: Includes a GGUF Q4_K_M export for compatible llama.cpp runtimes.
  • Database integration: Designed to work with a supplied database schema and a natural-language question.
  • Open development: Built as part of the ManasAIDev small-language-model and AI automation projects.

These are the intended capabilities. Benchmark performance and execution accuracy have not yet been established in this model card.

Model Information

Property| Details Model name| MiniCPM5-2B-Text2SQL Developer| ManasAIDev Base model| openbmb/MiniCPM5-2B-SFT Model family| MiniCPM5 Task| Text-to-SQL generation Fine-tuning method| LoRA / QLoRA LoRA rank| 16 Export format| GGUF Quantization| Q4_K_M Inference runtime| llama.cpp-compatible runtimes Model parameters| Approximately 2B-class base model Evaluation status| Awaiting held-out evaluation

Introduction

Text-to-SQL allows users to interact with structured databases using natural language instead of writing SQL manually.

For example, a user could ask:

«Show the five organizations with the highest number of employees.»

The model should translate the question into a SQL query based on the database schema supplied in the prompt.

The model is intended for experimentation and integration into database assistants, analytics tools, and AI automation workflows.

Intended use cases

  • Natural-language database querying
  • SQL generation for SQLite and other compatible SQL databases
  • Database question-answering pipelines
  • Analytics and reporting assistants
  • Local AI applications with limited inference resources
  • Text-to-SQL components in AI automation systems

Actual compatibility and accuracy depend on the SQL dialect, schema, prompt format, and evaluation results.

Training Details

Base model

""openbmb/MiniCPM5-2B-SFT"" (https://huggingface.co/openbmb/MiniCPM5-2B-SFT)

Fine-tuning method

The model was fine-tuned using LoRA/QLoRA in Unsloth Studio.

  • LoRA rank: 16
  • Training objective: Supervised fine-tuning for SQL generation
  • Training dataset: "master_sql_train.jsonl"
  • Export: GGUF Q4_K_M

The dataset filename and training configuration are known; the complete dataset composition, number of training examples, train/validation split, and final hyperparameters have not been documented here.

Training data

The fine-tuning dataset is a JSONL file containing the examples used for training.

The exact schemas, SQL dialects, data sources, licensing, and number of examples should be documented before making the dataset or model available for unrestricted public use.

The base model's original pretraining and post-training datasets should not be interpreted as the fine-tuning dataset for this release.

Model Files

The following files or variants may be published as they become available.

Variant| Purpose GGUF Q4_K_M| Compact local inference GGUF Q5_K_M| Alternative quantization, if exported GGUF Q8_0| Higher-precision quantization, if exported Merged 16-bit| Transformers-based inference, if published LoRA adapter| Parameter-efficient adapter distribution, if published

Quick Start

  1. Download the model

GGUF Models — Download

Download the GGUF quantization that best fits your hardware.

Quantization File Best for
Q4_K_M MiniCPM5-2B-SFT.Q4_K_M.gguf Recommended balance of size and quality
Q5_K_M MiniCPM5-2B-SFT.Q5_K_M.gguf Higher quality, if available
Q8_0 MiniCPM5-2B-SFT.Q8_0.gguf Higher precision, if available
F16 MiniCPM5-2B-SFT.F16.gguf Large storage and memory budget, if available

Download: Browse all available files in the Files and versions tab.

Only download files that actually exist in this repository.

Download with Hugging Face CLI

hf download ManasAIDev/minicpm5-2b-text2sql \
  MiniCPM5-2B-SFT.Q4_K_M.gguf \
  --local-dir ./models/minicpm5-text2sql

Download all GGUF files

from huggingface_hub import HfApi, hf_hub_download

repo_id = "ManasAIDev/minicpm5-2b-text2sql"
api = HfApi()

files = api.list_repo_files(repo_id=repo_id)

gguf_files = [f for f in files if f.lower().endswith(".gguf")]

for filename in gguf_files:
    print(f"Downloading: {filename}")
    hf_hub_download(
        repo_id=repo_id,
        filename=filename,
        local_dir="./models/minicpm5-text2sql",
    )


Install a compatible llama.cpp build and download the GGUF file from this repository.

pip install -U huggingface_hub

hf download ManasAIDev/minicpm5-2b-text2sql \
  MiniCPM5-2B-SFT.Q4_K_M.gguf \
  --local-dir ./models/minicpm5-text2sql

The filename must match the file uploaded to the repository.

2. Run inference

llama-cli \
  --model ./models/minicpm5-text2sql/MiniCPM5-2B-SFT.Q4_K_M.gguf \
  --ctx-size 4096 \
  --temp 0 \
  --n-predict 256 \
  --prompt "Convert this question to SQL: List all organizations."

This is a basic inference example. For reliable results, use the chat template and prompt structure expected by the fine-tuning dataset. The example does not establish that the model has been tested successfully with this exact prompt.

3. Provide a database schema

A schema-aware prompt should include the relevant table and column definitions.

Example:

### Task
Generate a SQL query for the given question.

### Database schema
Table: organizations
- organization_id INTEGER
- name TEXT
- industry TEXT
- country TEXT
- number_of_employees INTEGER

### Question
List the five organizations with the most employees.

### SQL

Expected SQL:

SELECT name, number_of_employees
FROM organizations
ORDER BY number_of_employees DESC
LIMIT 5;

This is an illustrative expected output, not a measured model prediction.

Recommended Evaluation

The model should be evaluated on a held-out dataset that was not used during training.

Metric| Purpose
Exact-match accuracy| Measures exact agreement with reference SQL
Execution accuracy| Measures whether the generated query returns the correct result
Valid SQL rate| Measures syntactic validity
Schema-grounding accuracy| Measures correct use of tables and columns
Join accuracy| Measures correctness of multi-table queries
Aggregation accuracy| Tests "COUNT", "SUM", "AVG", and "GROUP BY"
Filter accuracy| Tests conditions, date ranges, and comparisons
Latency| Measures inference speed
Peak memory| Measures deployment resource requirements

Results should be reported with the dataset, test-set size, SQL dialect, decoding settings, and evaluation procedure.

No numerical benchmark results are claimed in this release.

Limitations

- The model may generate syntactically valid but semantically incorrect SQL.
- Complex joins, nested queries, and unfamiliar schemas may reduce accuracy.
- SQL dialect differences can affect query compatibility.
- The model may hallucinate table names or column names when schema information is missing.
- Quantization can affect generation quality.
- Generalization to databases outside the training distribution has not yet been established.

Safe deployment

Treat generated SQL as untrusted input. Validate queries before execution, use read-only database credentials wherever possible, restrict permitted SQL operations, and apply execution timeouts and resource limits.

The model alone should not be considered a SQL security boundary.

Intended Audience

Developers, AI researchers, database engineers, and builders of local AI applications interested in small language models for natural-language database interaction.

License

The fine-tuned model is derived from MiniCPM5-2B-SFT. Confirm the upstream license and its redistribution requirements before publishing this repository under Apache-2.0. Also review the rights and licenses of the fine-tuning data.

Acknowledgements

- "OpenBMB MiniCPM" (https://github.com/OpenBMB/MiniCPM) — base model family
- "MiniCPM5-2B-SFT" (https://huggingface.co/openbmb/MiniCPM5-2B-SFT) — fine-tuning base
- "Unsloth" (https://github.com/unslothai/unsloth) — fine-tuning and model export tooling

Author

ManasAIDev

A small-language-model project focused on SQL generation, local AI inference, and AI automation.
Downloads last month
-
Safetensors
Model size
3B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ManasAIDev/minicpm5-2b-text2sql-GGUF

Quantized
(1)
this model