ai-AnIma/malpyung_korean_language_rag_sota
<p align="left"> <img src="https://huggingface.co/cpm-ai/Ocelot-Ko-self-instruction-10.8B-v1.0/resolve/main/ocelot.webp" width="50%"/> <p>
AnIma / Ocelot f_1
Update @ 2025.08.04: First release of malpyungkoreanlanguageragsota
<!-- Provide a quick summary of what the model is/does. -->
This model card corresponds to the 10.8B Instruct version of the Yanolja EEVE model.
Resources and Technical Documentation:
Citation
@misc {ai-AnIma/malpyung_korean_language_rag_sota,
author = { {frcp, nebchi, DaKu00, philosokey-M} },
title = { malpyung_rag },
year = 2025,
url = { https://huggingface.co/ai-AnIma/malpyung_korean_language_rag_sota },
publisher = { Hugging Face }
}Model Developers: frcp, nebchi, DaKu00, philosokey-M
과제 개요: 국립국어원 한국어 어문 규범 기반 생성
- 본 과제는 한국어 어문 규범 관련 질문에 대해, 국어 지식을 참조하여 정답과 그 이유를 생성하는 것을 목표로 합니다. 이 과제는 국립국어원의 「2024년 글쓰기 첨삭 지원을 위한 지시문 기반 생성 말뭉치 구축 연구」 사업의 결과물인 「글쓰기 첨삭 지원을 위한 기초 자료」 를 기반으로 설계되었습니다. ---
🧠 Model Details
검색 구조: Hybrid Search + Reranker
- 본 시스템은Hybrid Search에 Cross-Encoder 기반 Reranker를 결합한 Advanced RAG 구조를 채택하였습니다.
- Hybrid Search는 `Reciprocal Rank Fusion (RRF)` 알고리즘을 통해 다양한 검색 결과의 순위를 통합하여, 검색 정밀도와 다양성을 동시에 확보하였습니다.
- 이후 Cross-Encoder Reranker가 질의와 후보 문서 간 의미 정합성을 평가하여 최종 응답 품질을 극대화합니다.
임베딩 및 Reranker 모델: Qwen3 아키텍처 기반
- Qwen3 기반 Embedding 모델과 Cross-Encoder Reranker는 모두 Open Model로, MTEB벤치마크의 Retrival과 STS에서 SOTA를 기록한 아키텍처입니다.
- 한국어를 포함한 다양한 언어에서 문맥 파악, 의미 표현, 정확한 문서 재정렬에 강점을 지니며, 실제 질의 응답 흐름에서 고정밀 검색 성능을 발휘합니다.
PDF 문서 처리:
- PDF 기반 문서의 정제된 정보 추출을 위해 Layout 분석(layout analyzing) 기법과 Semantic Chunking을 활용하여 문단 구조를 임베딩 모델을 활용하여 처리하였습니다.
- OCR을 병행 적용하여, 문서 내 모든 정보가 검색 및 RAG에 활용 가능하도록 전처리 파이프라인을 구축하였습니다.
해당 파이프라인은 의미 단위 청크 구성 → 임베딩 → Hybrid 검색의 흐름을 기반으로 정확도 높은 검색 및 응답 생성을 실현합니다. ---
🛠️ 모델 사용 예시
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
from langchain.vectorstores import Qdrant
from langchain.vectorstores.qdrant import QdrantVectorStore, RetrievalMode
# 모델 및 토크나이저 로드
tokenizer = AutoTokenizer.from_pretrained("ai-AnIma/malpyung_korean_language_rag_sota")
model = AutoModelForCausalLM.from_pretrained(
"ai-AnIma/malpyung_korean_language_rag_sota", device_map="auto"
)
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=4096)
# Qdrant 벡터 DB 로드
qdrant = QdrantVectorStore(
client=client,
collection_name="my_documents",
embedding=embeddings,
sparse_embedding=sparse_embeddings,
retrieval_mode=RetrievalMode.HYBRID,
vector_name="dense",
sparse_vector_name="sparse",
)
# 질의
query = "'가축을 기를 때에는 {먹이량/먹이양}을 조절해 주어야 한다.' 가운데 올바른 것을 선택하고, 그 이유를 설명하세요."
# 문서 검색
found_docs = qdrant.similarity_search(query, k=5)
found_texts = "\n".join([doc.page_content for doc in found_docs])
# 프롬프트 템플릿 채우기
prompt_template = """
다음 정보를 바탕으로 질문에 답하세요:
{context}
질문: {question}
주어진 질문에만 답변하세요. 문장으로 답변해주세요. 답변할 때 질문의 주어를 써주세요.
답변:
"""
filled_prompt = prompt_template.format(context=found_texts, question=query)
messages = [
{"role": "user", "content": filled_prompt}
]
# Chat template 적용
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# 생성
outputs = pipe(prompt, temperature=0.2, top_p=0.9)
print(outputs[0]["generated_text"][len(prompt):])
results
"가축을 기를 때에는 먹이양을 조절해 주어야 한다."가 옳다. 한 음절의 한자어는 앞말이 고유어나 외래어일 때는 독립적인 한 단어로 인식하여 두음 법칙을 적용하고, 앞말이 한자어일 때는 하나의 단어로 인정하지 않아 두음 법칙을 적용하지 않는다. 따라서 한자어 '量'은 앞말이 고유어나 외래어일 때는 '양'이 되고 한자어일 때는 '량'이 된다. '먹이'는 고유어이므로 '먹이양'이 맞는 말이다.✅ Evaluation Results
본 모델 AnIma/f_1은 내부 베이스라인 모델과 비교해서 모든 주요 지표에서 최고 성능을 기록했습니다. | Model ID | F1 Score | BLEURT | BERTScore | ROUGE-1 | 제출 일시 | |----------------------------------|----------|---------|-----------|---------|----------------------| | AnIma/f_1 (Hybrid+Reranker) | 68.52 | 59.06 | 80.01 | 45.56 | 2025.07.31 21:40 | | try_01 (Not Hybrid) | 57.41 | 57.22 | 55.17 | 40.22 | 2025.07.21 13:41 | | qwen-8b (대회 제출) | 42.19 | 34.54 | 53.13 | 70.36 | 2025.06.16 07:45 | | hyperclovax-1.5b (대회 제출) | 39.27 | 31.93 | 46.73 | 70.69 | 2025.06.16 07:44 |
- 기존 자체 실험 모델 대비 BLEURT, BERTScore, ROUGE-1 모두에서 +10~30점의 유의미한 성능 향상을 기록했습니다.
- 경진대회 baseline 모델 대비 BLEURT 기준 최대 +24.5점, BERTScore 기준 +33점 향상되었으며, 평균 점수 기준으로도 약 20점 이상 향상된 결과를 보였습니다.
