llama-3_text_to_sql_kor_04
A Korean Text-to-SQL model: given a Korean question and a database schema (DDL), it generates the SQL query.
_01 to _04 are iterations on the same task; this repository is the latest version.
Training
| Item | Value |
|---|---|
| Base model | allganize/Llama-3-Alpha-Ko-8B-Instruct |
| Data | gretelai/synthetic_text_to_sql — sql_prompt translated into Korean with an LLM; sql_context and sql kept as is |
| Method | LoRA SFT (r=8, alpha=16, all linear layers), merged into the base model, saved in fp16 |
| Hyperparameters | 10 epochs · learning rate 1e-4 · cosine schedule · bf16 |
| Tools | LLaMA-Factory · DeepSpeed ZeRO-3 · single GPU |
Prompt format
The model was trained with the following Korean instruction.
<instruction>
다음 두 가지 입력을 받아 <sql>SQL 쿼리</sql>를 작성한다:
1. <sql_context>: 주어진 데이터베이스 Context
2. <kor_sql_prompt>: 한글로된 SQL 프롬프트, 이 프롬프트로 <sql_context>에 대해 <sql>을 만들어야 한다.
</instruction>
<sql_context>CREATE TABLE ...</sql_context>
<kor_sql_prompt>질문</kor_sql_prompt>
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "hgjun/llama-3_text_to_sql_kor_04"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")
Limitations
An experimental model trained on a small dataset. Quantitative evaluation results are not published yet.