Downloads · 30 days
0
yeongseok11/gemma-2-9b-it-korean-nl2sql
gemma-2-9b-it-korean-nl2sql is a text generation model from yeongseok11. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as gemma.
본 모델은 Google의 Gemma-2-9B-it 모델을 베이스로 하여, 실무용 PostgreSQL 환경에서 한국어 자연어 질의를 고정밀 SQL 쿼리로 변환(NL2SQL)할 수 있도록 파인튜닝 및 가중치 병합(Weight Merge)을 완료한 9B 체급 최강의 특화 모델입니다.
Downloads · 30 days
0
Access
Public
Updated May 16, 2026
Parameters
9.2B
18.5 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors18.5 GB · 100%
From the Hugging Face model README
본 모델은 Google의 Gemma-2-9B-it 모델을 베이스로 하여, 실무용 PostgreSQL 환경에서 한국어 자연어 질의를 고정밀 SQL 쿼리로 변환(NL2SQL)할 수 있도록 파인튜닝 및 가중치 병합(Weight Merge)을 완료한 9B 체급 최강의 특화 모델입니다.
본 연구의 실험 과정에서 **단 2건의 구문 에러(Initial Syntax Error)**만 기록했을 정도로 PostgreSQL 문법 구조에 대한 이해도와 무결성이 압도적으로 뛰어난 것이 특징입니다.
실무용 ERP 데이터베이스 스키마와 난이도별(Level 1 ~ 5) 평가 데이터셋 400문항을 바탕으로 엄밀하게 측정한 벤치마크 결과입니다.
| Difficulty | Pure Acc | Final Acc | Errors | Repaired | Repair Rate |
|---|---|---|---|---|---|
| Level 1 | 93.75% | 93.75% | 0 | 0 | 0.00% |
| Level 2 | 90.00% | 90.00% | 1 | 0 | 0.00% |
| Level 3 | 83.75% | 83.75% | 0 | 0 | 0.00% |
| Level 4 | 62.50% | 62.50% | 1 | 0 | 0.00% |
| Level 5 | 65.00% | 65.00% | 0 | 0 | 0.00% |
| TOTAL | 79.00% | 79.00% | 2 | 0 | 0.00% |
Gemma 2의 공식 Chat Template 규격을 준수하여 자원을 효율적으로 추론하는 예시 코드입니다.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "yeongseok11/gemma-2-9b-it-korean-nl2sql"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
model.eval()
# Prompt Template (Gemma-2 전용 템플릿 준수)
prompt = """<start_of_turn>user
당신은 실무용 PostgreSQL 전문가입니다. 오직 SQL 쿼리만 답변하세요.
### 스키마:
CREATE TABLE emp (
emp_id INT PRIMARY KEY,
emp_name VARCHAR(50),
dept_id INT,
salary INT
);
### 질문:
기획팀(dept_id = 10) 직원들의 평균 급여를 구하는 쿼리를 짜줘.<end_of_turn>
<start_of_turn>model
### SQL:
"""
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.0,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True).split("### SQL:\n")[-1])
📝 연구 및 한계점 (Limitations & Future Work)
본 모델은 높은 문법적 완성도를 자랑하지만, 인간이 설계한 복잡하고 비정형화된 데이터 레이크 환경에서는 의미론적(Semantic) 매핑 오차가 발생할 수 있습니다.
이를 극복하기 위해 향후 본 연구는 LLM 지향적 메타데이터 확장 파이프라인(AI-Friendly Metadata Enrichment) 및 에이전트 기반의 능동형 데이터 내비게이션 아키텍처 연구로 확장될 예정입니다.