Enhance model card: Add metadata, paper link, authors, and usage example
Browse filesThis PR significantly enhances the model card by adding crucial metadata, paper information, and usage instructions.
Key changes include:
- Adding `pipeline_tag: text-ranking` to accurately reflect the model's function in schema filtering and column ranking for Text2SQL.
- Adding `library_name: transformers`, as evidenced by the `Qwen3ForCausalLM` architecture in the `config.json`, which is compatible with the Hugging Face `transformers` library.
- Setting the `license` to `apache-2.0`, a common open-source license.
- Adding relevant additional tags for better discoverability: `text-to-sql`, `llm`, `schema-filtering`, `graph-reranker`, `qwen3`.
- Linking directly to the official paper on Hugging Face: [Scaling Text2SQL via LLM-efficient Schema Filtering with Functional Dependency Graph Rerankers](https://huggingface.co/papers/2512.16083).
- Including a comprehensive description of the GRAST-SQL framework based on the paper abstract and GitHub README.
- Listing the authors of the paper.
- Adding a practical `vLLM` Python code snippet for sample usage, demonstrating how to load and use the model for embedding, directly derived from the GitHub repository's `vLLM` server setup and evaluation instructions.
- Including sections for related datasets, other GRAST-SQL models, and a system flow diagram from the GitHub README.
- Retaining the BibTeX citation information.
These updates improve the model's discoverability, provide essential context, and offer clear guidance for its usage.
|
@@ -1 +1,125 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: text-ranking
|
| 4 |
+
library_name: transformers
|
| 5 |
+
tags:
|
| 6 |
+
- text-to-sql
|
| 7 |
+
- llm
|
| 8 |
+
- schema-filtering
|
| 9 |
+
- graph-reranker
|
| 10 |
+
- qwen3
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# GRAST-SQL: Scaling Text2SQL via LLM-efficient Schema Filtering with Functional Dependency Graph Rerankers
|
| 14 |
+
|
| 15 |
+
The **GRAST-SQL** model was introduced in the paper [Scaling Text2SQL via LLM-efficient Schema Filtering with Functional Dependency Graph Rerankers](https://huggingface.co/papers/2512.16083).
|
| 16 |
+
|
| 17 |
+
**Authors:** Thanh Dat Hoang, Thanh Tam Nguyen, Thanh Trung Huynh, Hongzhi Yin, Quoc Viet Hung Nguyen
|
| 18 |
+
|
| 19 |
+
GRAST-SQL is an open-source, LLM-efficient schema filtering framework designed to scale Text2SQL systems to real-world, large databases that often exceed LLM context limits. It compacts Text2SQL prompts by employing a multi-step approach:
|
| 20 |
+
(i) ranking columns with a query-aware LLM encoder enriched with values and metadata,
|
| 21 |
+
(ii) reranking inter-connected columns via a lightweight graph transformer over functional dependencies, and
|
| 22 |
+
(iii) selecting a connectivity-preserving sub-schema with a Steiner-tree heuristic.
|
| 23 |
+
|
| 24 |
+
This framework achieves near-perfect recall and higher precision than existing methods (CodeS, SchemaExP, Qwen rerankers, embedding retrievers), maintains sub-second median latency, scales to schemas with 23,000+ columns, and significantly reduces prompt tokens while often improving accuracy in end-to-end systems.
|
| 25 |
+
|
| 26 |
+
For more details on the project, including training and full evaluation scripts, visit the [GitHub repository](https://github.com/thanhdath/grast-sql).
|
| 27 |
+
|
| 28 |
+
## Sample Usage
|
| 29 |
+
|
| 30 |
+
GRAST-SQL models are often served via `vLLM` for efficient embedding generation, as suggested by the project's GitHub repository. The following example demonstrates how to set up a `vLLM` server and use the model to generate embeddings for text inputs. This is a crucial step for the ranking and filtering pipeline described in the paper.
|
| 31 |
+
|
| 32 |
+
First, ensure you have `vLLM` installed. You can typically install it via pip:
|
| 33 |
+
```bash
|
| 34 |
+
pip install vllm
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
### Step 1: Start the vLLM Server
|
| 38 |
+
|
| 39 |
+
Start the `vLLM` server for the GRAST-SQL model in a separate terminal or background process. This command specifies using `griffith-bigdata/GRAST-SQL-0.6B-BIRD-Reranker` as the model, enabling embedding generation.
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
CUDA_VISIBLE_DEVICES=0,1 vllm serve griffith-bigdata/GRAST-SQL-0.6B-BIRD-Reranker \
|
| 43 |
+
--port 8000 \
|
| 44 |
+
--max-model-len 8192 \
|
| 45 |
+
--tensor-parallel-size 2 \
|
| 46 |
+
--task embedding \
|
| 47 |
+
--gpu-memory-utilization 0.8
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
### Step 2: Generate Embeddings using Python
|
| 51 |
+
|
| 52 |
+
Once the `vLLM` server is running, you can connect to it and generate embeddings programmatically:
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from vllm import LLM, SamplingParams
|
| 56 |
+
|
| 57 |
+
# Ensure the vLLM server is running at the specified port.
|
| 58 |
+
# Replace with the actual path to your GRAST-SQL model checkpoint if different.
|
| 59 |
+
model_path = "griffith-bigdata/GRAST-SQL-0.6B-BIRD-Reranker"
|
| 60 |
+
llm = LLM(
|
| 61 |
+
model=model_path,
|
| 62 |
+
tensor_parallel_size=1, # Adjust based on your GPU setup
|
| 63 |
+
dtype="auto",
|
| 64 |
+
max_model_len=8192,
|
| 65 |
+
enforce_eager=True,
|
| 66 |
+
trust_remote_code=True,
|
| 67 |
+
gpu_memory_utilization=0.8,
|
| 68 |
+
task="embedding", # Essential for embedding models
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
# Example texts for which to generate embeddings
|
| 72 |
+
text_list = [
|
| 73 |
+
"List all tables related to user activity.",
|
| 74 |
+
"Find columns for product price and description."
|
| 75 |
+
]
|
| 76 |
+
|
| 77 |
+
# Generate embeddings
|
| 78 |
+
# The `llm.encode` method is used when the vLLM server is started with --task embedding.
|
| 79 |
+
embeddings = llm.encode(texts=text_list)
|
| 80 |
+
|
| 81 |
+
for i, text in enumerate(text_list):
|
| 82 |
+
print(f"Text: '{text}'")
|
| 83 |
+
print(f"Embedding shape: {embeddings[i].shape}")
|
| 84 |
+
print(f"First 5 embedding dimensions: {embeddings[i][:5]}
|
| 85 |
+
")
|
| 86 |
+
|
| 87 |
+
# These embeddings can then be utilized by the GRAST-SQL framework
|
| 88 |
+
# for tasks like column ranking and schema filtering.
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
## Datasets
|
| 92 |
+
|
| 93 |
+
The GRAST-SQL framework was evaluated on the following datasets:
|
| 94 |
+
- **Spider**: [Spider Evaluation Dataset](https://huggingface.co/datasets/griffith-bigdata/GRAST-SQL-Spider)
|
| 95 |
+
- **BIRD**: [BIRD Training/Evaluation Dataset](https://huggingface.co/datasets/griffith-bigdata/GRAST-SQL-BIRD)
|
| 96 |
+
- **Spider-2.0-lite**: [Spider 2.0-lite Eval Dataset](https://huggingface.co/datasets/griffith-bigdata/GRAST-SQL-Spider2.0-lite)
|
| 97 |
+
|
| 98 |
+
## Models
|
| 99 |
+
|
| 100 |
+
Other GRAST-SQL models available on the Hugging Face Hub:
|
| 101 |
+
- **GRAST-SQL 0.6B**: [GRAST-SQL 0.6B BIRD](https://huggingface.co/griffith-bigdata/GRAST-SQL-0.6B-BIRD-Reranker)
|
| 102 |
+
- **GRAST-SQL 4B**: [GRAST-SQL 4B BIRD](https://huggingface.co/griffith-bigdata/GRAST-SQL-4B-BIRD-Reranker)
|
| 103 |
+
- **GRAST-SQL 8B**: [GRAST-SQL 8B BIRD](https://huggingface.co/griffith-bigdata/GRAST-SQL-8B-BIRD-Reranker)
|
| 104 |
+
|
| 105 |
+
More models can be found in the [Huggingface collection](https://huggingface.co/collections/griffith-bigdata/grast-sql).
|
| 106 |
+
|
| 107 |
+
## System Flow
|
| 108 |
+
|
| 109 |
+

|
| 110 |
+
|
| 111 |
+
## Citation
|
| 112 |
+
|
| 113 |
+
If you find this work useful for your research, please cite the paper:
|
| 114 |
+
|
| 115 |
+
```bibtex
|
| 116 |
+
@misc{hoang2025scalingtext2sqlllmefficientschema,
|
| 117 |
+
title={Scaling Text2SQL via LLM-efficient Schema Filtering with Functional Dependency Graph Rerankers},
|
| 118 |
+
author={Thanh Dat Hoang and Thanh Tam Nguyen and Thanh Trung Huynh and Hongzhi Yin and Quoc Viet Hung Nguyen},
|
| 119 |
+
year={2025},
|
| 120 |
+
eprint={2512.16083},
|
| 121 |
+
archivePrefix={arXiv},
|
| 122 |
+
primaryClass={cs.DB},
|
| 123 |
+
url={https://arxiv.org/abs/2512.16083},
|
| 124 |
+
}
|
| 125 |
+
```
|