Instructions to use ManasAIDev/minicpm5-2b-text2sql-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ManasAIDev/minicpm5-2b-text2sql-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ManasAIDev/minicpm5-2b-text2sql-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ManasAIDev/minicpm5-2b-text2sql-GGUF") model = AutoModelForCausalLM.from_pretrained("ManasAIDev/minicpm5-2b-text2sql-GGUF", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ManasAIDev/minicpm5-2b-text2sql-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ManasAIDev/minicpm5-2b-text2sql-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ManasAIDev/minicpm5-2b-text2sql-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ManasAIDev/minicpm5-2b-text2sql-GGUF
- SGLang
How to use ManasAIDev/minicpm5-2b-text2sql-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ManasAIDev/minicpm5-2b-text2sql-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ManasAIDev/minicpm5-2b-text2sql-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ManasAIDev/minicpm5-2b-text2sql-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ManasAIDev/minicpm5-2b-text2sql-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ManasAIDev/minicpm5-2b-text2sql-GGUF with Docker Model Runner:
docker model run hf.co/ManasAIDev/minicpm5-2b-text2sql-GGUF
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
- 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
- -
Model tree for ManasAIDev/minicpm5-2b-text2sql-GGUF
Base model
openbmb/MiniCPM5-2B-SFT