Skip to content

byungjin0826/SAFEDB

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAFE 📚 — Safety-oriented AI Framework for Engineering

한국 건축구조공학 특화 RAG 데이터베이스 & 벤치마크

Retrieval-Augmented Generation을 위한 최초의 한국어 구조공학 지식 DB


1. 개요

SAFE DB는 한국 건축·구조공학 도메인에 특화된 대규모 검색-증강 생성(RAG)용 지식베이스이자 평가용 벤치마크입니다.
LLM이 구조 설계, 내진 성능평가, 실무 판정 등 안전이 직결되는 작업에서 신뢰할 수 있는 답변을 생성하도록 지원하기 위해 구축되었습니다.
모든 문서는 JSONL 형식으로 제공되며, 각 스니펫에는 출처, 주제, 문서 ID 등의 메타데이터가 포함됩니다.


2. 리포지토리 구조

SAFE-DB/
├── glossary.jsonl          # 핵심 용어집 (6.2K snippets)
├── standards.jsonl         # 국내·국제 설계기준 (145K snippets)
├── textbooks.jsonl         # 구조공학 교과서 (134K snippets)
├── reports.jsonl           # 프로젝트·실험 보고서 (97K snippets)
├── structcorpus.jsonl      # 통합 코퍼스 (위 네 파일을 병합)
└── benchmark/
    ├── mmlu_struct.jsonl       # (1) MMLU-Struct 시험 셋
    ├── structqa_ko.jsonl       # (2) StructQA-KO (구조기술사)
    ├── sped.jsonl              # (3) SPED (성능평가)
    ├── structmcqa.jsonl        # (4) StructMCQA (객관식)
    └── structcase_yn.jsonl     # (5) StructCase-Y/N

3. 코퍼스 통계

데이터 유형 문서 수 스니펫 수 토큰 평균
Glossary 6,100+ 6,200+ 51
Standards/Codes 1,300+ 145,000+ 235
Textbooks 23 134,000+ 184
Project Reports 43 97,000+ 153
StructCorpus 7,500+ 377,000+ 171

4. 벤치마크 과업

ID Task 설명 문항 수
MMLU-Struct 일반 구조공학 지식 평가 다중 선택 QA ≈1,100
StructQA-KO 한국 구조기술사 기출 다중 선택 QA ≈1,000
SPED 구조 안정성·특수 구조물 설계 단답 QA ≈800
StructMCQA 구조공학 종합 객관식 다중 선택 QA ≈900
StructCase-Y/N 실무 사례 판정 예/아니오 ≈400

5. 사용 예시 (Python)

import json
import random

def load_jsonl(path):
    with open(path, "r", encoding="utf-8") as f:
        return [json.loads(line) for line in f]

# ❶ 코퍼스 로드
snippets = load_jsonl("structcorpus.jsonl")
print(f"{len(snippets):,} snippets loaded.")

# ❷ 임의 질의와 매칭되는 스니펫 5개 추출
query = "KDS 41xx 내진 설계 중요도 계수"
candidates = [s for s in snippets if "내진" in s["text"]]
print(random.sample(candidates, 5)[0]["text"])

6. 평가 스크립트

examples/evaluate_rag.py는 다음을 한 번에 실행할 수 있는 CLI를 제공합니다.

  • Retriever (BM25 / Dense / StructCPT)
  • LLM (OpenAI GPT-4o, Gemma 등)
  • 메트릭 (Accuracy, EM, BLEU)
python evaluate_rag.py \
  --task structqa_ko \
  --corpus structcorpus.jsonl \
  --retriever structcpt \
  --llm gpt-4o \
  --top_k 24

7. 라이선스

  • DB 콘텐츠: CC BY-NC 4.0
  • 코드: Apache-2.0

상업적 사용 또는 2차 배포 시 원 출처 및 저자 표기가 필요합니다.


8. 인용 정보

@article{Heo2025SAFE,
  title   = {SAFE: Safety-oriented AI Framework for Engineering},
  author  = {Seok-Jae Heo and Won-Jun Choi and Sang-Hyun Lee},
  journal = {J. Comput. Struct. Eng. Inst. Korea},
  year    = {2025}
}

9. 문의

구분 연락처
Issue/PR GitHub Issues
연구 협업 mill@dankook.ac.kr

SAFE-DB: Safety-oriented AI Framework for Engineering
Author: 허석재 (Seok-Jae Heo)
Contact: mill@dankook.ac.kr

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors