Building ThakiEdu: An AI Model Ecosystem for Korean Education and Public Institutions
Part 5 of 5 in the series “Building AI for Korean Education and Public Services”. Parts 1-4 each cover one released model. This one covers the whole program: what we tried to build, what we released, what we did not release, and why.
TL;DR
- We kept 15 model tracks under research for Korean education administration and classrooms. Four sets of weights are public as Research Previews: ThakiEdu-Embedding-KO, ThakiEdu-Reranker-KO, ThakiEdu-Safety-KO-568M and ThakiEdu-1.7B.
- Each released model beats its own baseline on its own evaluation. Statute retrieval Recall@10 went from 0.277 (bge-m3) to 0.804 on a 207,591-article corpus. Safety false positives on benign text went from 0.117 to 0.0067 on a fresh confirmation set. The 1.7B student goes from 0.453 (base) to 0.817 on an in-house verifier set.
- We did not release PII, Law Selector, Assessment, English, Classifier, Document, Admin, Finance or Math as weights. Each of them either missed a gate fixed before the run, has unverified integration, or did not need new weights. The reasons are in this post with numbers.
- The architecture figure below (Safety → Retrieval → 1.7B → Paxis/Metis) is a target integration architecture. The models were evaluated one at a time. End-to-end performance of the chain has not been measured yet.
1. Problem: what a school or education office actually needs
A Korean education office handles official documents, statutes and ordinances, school accounting, lesson materials, assessments and student-facing tutoring. Most of this text is Korean, much of it is legal or administrative, and some of it involves minors. Three constraints shaped the program from the start:
- On-premise or private-cloud deployment. Public institutions often cannot send documents to an external API, so the parts that run on every request (safety filtering, retrieval) need to run on CPU.
- Data terms. Most of our task-specific Korean data comes from AI Hub (AI-Hub). Under AI Hub’s written guidance, the applicant may train and evaluate in their own domestic environment and may publish trained weights and evaluation numbers with attribution. Raw data and reprocessed derivatives (subsets, crops, converted labels, samples) may not be shared, published or moved abroad. So we can publish weights and aggregate numbers only.
- Decisions stay with staff. Teachers make final grading decisions and authorized officials make final administrative decisions. A model that only looks like a grader is a liability.
The internal execution directive listed 15 model tracks: Admin, Document, Law, Finance, Classifier, Safety, PII, Embedding, Reranker, Teacher, Exam, Assessment, Tutor, Math and English. For each one the directive required a baseline (base model, base + RAG, reused adapter, new LoRA, LoRA + RAG, tool calls with verification) before any new training. It also said that a FAIL ends one experiment and never the research line, and that evaluation criteria must not be relaxed afterwards.
2. Related work we built on
We did not invent the components. The released models are fine-tunes of public models, and the methods are standard:
- Dense retrieval and reranking.
BAAI/bge-m3(multilingual dense encoder) andBAAI/bge-reranker-v2-m3(cross-encoder) are the bases: the embedding and safety models start from bge-m3, the reranker from bge-reranker-v2-m3. Candidate generation fuses BM25 and dense results with Reciprocal Rank Fusion (Cormack, Clarke and Büttcher, 2009). - Parameter-efficient fine-tuning. LoRA (Hu et al., 2021) on
Qwen/Qwen3-1.7B. - Knowledge distillation. In the broad sense of Hinton et al. (2015), a small student trained on a larger teacher’s outputs. Here the teacher outputs are filtered by deterministic verifiers before they become training targets (sometimes called rejection-sampling distillation).
- Pre-registration. We use the term in its clinical-trials sense: hypothesis, metric, threshold and analysis are written and committed before the run.
3. Data
| Source | Used for | Terms |
|---|---|---|
| AI 허브(AI-Hub) · 금융 법률 문서 기계독해 (71610) | Embedding and reranker training queries | applicant-only, domestic; weights publishable with attribution |
| AI 허브(AI-Hub) · 행정 문서 대상 기계독해 (569) | Leakage check, admin QA evaluation | same |
| AI 허브(AI-Hub) · 국어 교과 지문형 문제 (71857) | Passages inside some 1.7B tutor and exam prompts | same |
| AI Hub 71818, 71819 (essay scoring) | Assessment research (not released) | same |
| National Law Information Center texts via Legalize-KR | Statute corpus (207,591 articles in snapshot v2) | public works |
| Self-hosted Qwen3.8-27B (Apache-2.0) | Synthetic safety data, distillation targets | in-house |
데이터 재배포 불가, 신청자 본인 내부 이용. None of the four HF repositories contains AI Hub originals, reprocessed data, samples or evaluation items. The Safety model contains no AI Hub data at all; its training and evaluation text is synthetic.
Data engineering was a larger share of the work than model training. Some examples from the ingest ledger: one dataset’s JSON files all carried a UTF-8 BOM and needed utf-8-sig. Two essay datasets had about 216,000 physical records, but only 36,006 and 18,010 independent (question, answer, rater) samples once we found that the CSV rows were a writing-prompt bank, not scored answers. Splits are fixed by seed before evaluation sets are built, and every evaluation set gets an overlap check against training text.
4. Training methods (one paragraph per released model)
Embedding (bge-m3 → ThakiEdu-Embedding-KO). Contrastive training with in-batch negatives plus same-statute hard negatives, i.e. other articles from the statute that contains the gold article. With query $q$, gold article $d^+$ and negatives $\mathcal{N}$:
\[\mathcal{L}_{\text{emb}} = -\log \frac{\exp(s(q,d^+)/\tau)}{\exp(s(q,d^+)/\tau) + \sum_{d^- \in \mathcal{N}} \exp(s(q,d^-)/\tau)}, \quad s = \cos(\text{CLS}(q), \text{CLS}(d)).\]Three rounds (r1 → r2 → r3). r1 and r2 used easy negatives drawn from other documents; only r3 mined same-statute hard negatives with the previous checkpoint (r2). Details: Part 1.
Reranker (bge-reranker-v2-m3 → ThakiEdu-Reranker-KO). A cross-encoder scores (question, article) pairs and is trained so the gold article outscores hard negatives mined by the earlier embedding and reranker. Five rounds; r5 is released. Details: Part 2.
Safety (bge-m3 backbone → ThakiEdu-Safety-KO-568M). A 568M encoder with six sigmoid outputs [inj, harm, pii, leak, other, block]. The decision rule was fixed before training:
flag = max(p[0:5]) >= 0.5
label = allow if not flag
block if p[5] >= 0.5 else review
Details, including how we found and removed training/test contamination: Part 3.
1.7B student (Qwen3-1.7B → ThakiEdu-1.7B). Verifier-filtered distillation:
for prompt x in task_prompts: # assessment, exam, tutor, format
y = teacher_27B(x) # self-hosted, non-thinking
if verifier_task(x, y) passes: # deterministic checks
D.append((x, y))
train LoRA(r=16, alpha=32, all linear) on D # 3,275 rows, 600 steps
Recipes S2 → S4b → S4c raised the training-time held-out mean from 0.743 to 0.801 to 0.841. Details: Part 4.
5. Target architecture

Figure 1. Target integration architecture. Each released model was evaluated on its own. End-to-end performance of this chain has not been validated.
The intended flow:
- Paxis (our agent and mission orchestration layer) receives a request with tenant identity from the gateway. It does not trust a role supplied by the model or the client.
- Safety-KO-568M labels the input
allow,revieworblock.reviewandblockgo to a person or a stronger check. - Embedding-KO retrieves statute articles. Reranker-KO is an optional stage. Our own measurements say it improves recall@8 but lowers top-1 on top of the new embedding (Section 8), so it belongs where an 8-candidate list is consumed, not where a single article is cited.
- ThakiEdu-1.7B produces exam items, rubric-score reasoning or tutor hints. Tutoring needs a serving-side answer-leak guard, which is not in the model repository.
- Metis (our serving layer) runs encoders on CPU via ONNX Runtime and the 1.7B on GPU, with artifacts pinned by sha256.
None of these joins has been measured end to end. We know how each box performs on its own test, and we have one partial join (embedding + reranker on the statute pool). We do not yet know how Safety false positives interact with retrieval on real traffic, or whether the 1.7B makes good use of retrieved articles. Those are the next measurements, not claims.
6. Methodology: from data to serving

Figure 2. The same five stages applied to every model track. A failed gate sends the work back to data or hypothesis, never to a lower threshold.
The evaluation stage carries most of the weight:
- Pre-registered gates. Each experiment has a JSON pre-registration with metric, threshold, seeds and interpretation. The gate code imports thresholds from the earlier round, so nobody can quietly relax them.
- Independent or fresh sets. Safety was selected on set v7 among several arms. It was then confirmed once on a new set v8, generated after the model and policy were frozen, with measured contamination of 0.7% against the 1% limit.
- Paired bootstrap CIs for model-vs-model claims, over queries or items.
- Infrastructure failures are not model failures. If a harness cannot reproduce an earlier score, the run is recorded as incomplete and only a same-condition rerun is allowed.
- Release checkpoint rules fixed before results. For the 1.7B and the embedding we release the median seed, not the best one.
Compression was deliberately conservative. We shipped ONNX FP32 only. Our INT8 exports changed rankings: embedding overlap@10 against FP32 averaged 0.904 with a minimum of 0.80, and an earlier reranker INT8 build agreed on top-1 only 0.833 of the time. For a retrieval model that is a different model, so INT8 is not offered.
7. Results for the four released models

Figure 3. Each released model against its own baseline, on its own evaluation. Panels are not comparable with each other.
| Model | Headline (released checkpoint) | Baseline | Evaluation type |
|---|---|---|---|
| Embedding-KO (seed 29) | R@10 0.804, R@1 0.373 on 207,591 articles, 458 queries | bge-m3 0.277; our r2 0.304 | dev-pool queries, not sealed |
| Reranker-KO (r5) | pipeline recall@8 0.806-0.823 | previous reranker r4: +0.15 to +0.20 (CI excludes 0) | single seed, reused dev slices |
| Safety-KO-568M | v8: benign FP 0.0067, benign-hard FP 0.0067, harm recall 0.980 [0.943, 0.993] | previous r13b: 0.117, 0.240 | fresh single-use confirmation set, synthetic |
| ThakiEdu-1.7B (seed 28) | 0.817 (294/360) | base 0.453; 27B teacher reference 0.803 | in-house verifier held-out, not sealed |
Things that a single headline number hides:
- Embedding. On a 12,000-article subsample the same model scores R@10 0.887. That number is about 8 points optimistic, which is why we report the full-corpus 0.804. Across three seeds R@10 is stable (0.799-0.804) but R@1 is not (0.373-0.465). On administrative-document QA every model ties around R@10 0.98, so this is a statute-retrieval model, not a general upgrade.
- Safety. The reduction in benign false positives is 95.7% on v7 (0.115 → 0.005), where the arm was selected, and 94.3% on v8 (0.117 → 0.0067), where it was confirmed. Harm recall on v8 sits exactly on its 0.98 gate. One training seed, synthetic data, and a generator shared between training and test.
- 1.7B. The three seeds, measured from the merged weights, give 0.817 / 0.881 / 0.792 (mean 0.830). The training-time ledger mean was 0.841, and seed 28 dropped from 0.850 at training time to 0.817 after re-merging; we have not pinned down why. The 27B reference scores below the student because the student learned the output format these verifiers check. This is not a claim that 1.7B beats 27B. It is also not a grader: in separate studies, agreement with human scores (QWK) was 0.21-0.34 overall (AS7 0.320, AS8 0.257-0.297, AS9b 0.339 as the best teacher, AS10 students 0.206-0.272; human-human 0.638). Without a guard the tutor states the answer in 11.8% of cases (independent judge). With the serving guard this drops to 0.2%, at the cost of 5.6% fallback, 4.5-5.3× tokens and 1.56-1.75× latency.
8. Ablations that changed decisions
| Question | Result | Decision |
|---|---|---|
| Does a 4B student beat 1.7B with the same recipe? | 0.849 vs 0.841, +0.008 < pre-set +0.03 | keep 1.7B |
| Does the new embedding improve the reranked pipeline? | recall@8 +0.01 to +0.02, CI includes 0 | reranker is optional |
| Does reranking help top-1 on the new embedding? | dense-only @1 0.49-0.51 vs reranked 0.38-0.43 | do not rerank when citing one article |
| Does doubling synthetic Law Selector data help? | end-to-end −0.061 [−0.097, −0.027] | bottleneck is not quantity |
| INT8 vs FP32 for retrieval | overlap@10 mean 0.904, min 0.80 | ship FP32 only |
| Tutor serving guard on/off | leak 0.118 → 0.002 | guard required for tutoring |
9. What we did not release, and why

Figure 4. Tracks that were not released, with observed value against a gate fixed before the run.
| Track | Status | Key numbers |
|---|---|---|
| Assessment (essay scoring) | not adopted | Even the 27B teacher with 16K-token reasoning reached QWK 0.339 against a 0.588 gate (human-human 0.638). Distilling its rationales into 1.7B gave raw Pearson 0.349-0.356 below the 0.40 transfer bar, so we recorded TRANSFER_FAILED. The ceiling looks like the teacher signal, not student capacity. |
| Law Selector (pick the one article) | below product gate | listwise r3: end-to-end 0.611 vs 0.65, oracle 0.748 vs 0.85. Doubling synthetic groups lowered the score. A 27B selector without training reached e2e 0.663 on one slice but oracle 0.755, so it also fails. |
| English (conversation feedback) | NOT_YET | 6 of 7 gates pass (reading 0.988, grammar 0.813, vocab 0.922). Conversation rubric is 3.07 vs 4.11. Cleaning the data removed invented errors (hallucination 0.605 → 0.268) but halved the error-hit rate (0.334 vs teacher 0.690). Our data-cleaning hypothesis was rejected. |
| PII | blocked | A rule-augmented model passed every gate on its own template family (F1 0.9993). On an independently generated set the same model fell to F1 0.919 with leak 0.087, which looks like template overfitting. The latest round fails four gates (document leak 0.065), and its harness could not reproduce an earlier baseline, so it is recorded as incomplete. |
| Classifier (department routing) | gate failed, top-3 usable | sealed holdout, 3 seeds: exact 0.873 vs 0.90, macro F1 0.670 vs 0.85. Minority departments collapse (one has recall 0.0-0.2). Top-3 accuracy is ≥ 0.98, so a top-3 suggestion feature is plausible. It has not been independently evaluated. |
| Document (HWPX forms) | not verified | Field facts 0.982 and numbers 1.000 on the dev set. Package round-trip structure 5/5 on synthetic forms. Not yet opened in Hancom Office itself. |
| Admin (27B tool-calling LoRA) | not confirmed | tool-call 0.9125 for the 27B baseline (0.77 on unseen families). Adapter location and serving check are not confirmed. |
| Finance, Math | no new weights | The base 27B already scores 0.994 and 0.966. Finance amounts are checked by a deterministic Decimal engine, not by a model. |
| Tutor standalone | inside 1.7B only | usable only with the serving guard. |
Two more failures sit inside released lines. Three Safety arms were contaminated (4.4% of v7 test items overlapped training text against a 1% limit). We stopped judging them, removed the overlap, and retrained; the released checkpoint comes from that rerun. A follow-up reranker recipe (r6a) was unstable across seeds, with top-1 deltas of +0.086, −0.137 and +0.114, so we kept r5 and say in the card that it may be a favourable seed.
10. Reproducibility
- Release checkpoints were chosen by rules fixed before results: median seed for 1.7B and embedding, the single r5 checkpoint for the reranker, and the single pre-fixed R5d arm for Safety.
- The 1.7B base revision is pinned (
Qwen/Qwen3-1.7B@70d244cc…), and our mirror’s shard sha256 values match it. Re-merging the same adapter twice gives byte-identical weights. Evaluating the same weights twice varies by ±2 items out of 360. - Every public repository ships a
release_manifest.json. Public LFS sha256 values and sizes were compared with the manifests: 0 mismatches across all four repositories. - Evaluation items are not published: that would contaminate future tests, and for AI Hub-derived items it would break the data terms.
11. Limitations
- No end-to-end number. Figure 1 is a plan.
- Mostly dev-pool or synthetic evaluations. Among the four released models, only Safety has a single-use set generated after the model was frozen (v8). Embedding and reranker queries come from the training dev pool, with overlap removed.
- Single seeds for the reranker and Safety.
- Synthetic, generator-shared data for Safety, with no human review.
- Narrow domains. The embedding and reranker were measured on statutes only.
- Extending to legal, financial and public-sector RAG is a hypothesis. The statute retriever, the CPU safety filter and the distillation recipe are not education-specific, so the same stack could serve other public institutions. We have measured nothing outside our education and statute sets, and the general-purpose admin QA result (all models tie) is a reminder that gains do not transfer automatically.
12. Inference code (synthetic text only)
The sketch below wires the four public models in the target order. It runs as written, but it is a demonstration of the interfaces. This chain has not been evaluated end to end.
import torch
from sentence_transformers import SentenceTransformer
from transformers import (AutoTokenizer, AutoModelForSequenceClassification,
AutoModelForCausalLM)
ORG = "ThakiCloud/"
# 1) Safety: allow / review / block
s_tok = AutoTokenizer.from_pretrained(ORG + "ThakiEdu-Safety-KO-568M-v0.1")
s_mod = AutoModelForSequenceClassification.from_pretrained(ORG + "ThakiEdu-Safety-KO-568M-v0.1").eval()
def safety(text):
enc = s_tok([text], truncation=True, max_length=384, return_tensors="pt")
with torch.no_grad():
p = torch.sigmoid(s_mod(**enc).logits.float())[0].tolist()
if max(p[:5]) < 0.5:
return "allow"
return "block" if p[5] >= 0.5 else "review"
# 2) Retrieval over a tiny synthetic corpus (invented articles)
corpus = [
"제1조(목적) 이 규칙은 학교 현장체험학습의 안전한 운영에 필요한 사항을 정한다.",
"제2조(신청) 보호자는 체험학습 시작 3일 전까지 신청서를 학교장에게 제출한다.",
"제3조(출장비) 교원의 출장비는 별표 기준에 따라 실비로 정산한다.",
]
emb = SentenceTransformer(ORG + "ThakiEdu-Embedding-KO-v0.1")
d_vec = emb.encode(corpus, normalize_embeddings=True)
r_tok = AutoTokenizer.from_pretrained(ORG + "ThakiEdu-Reranker-KO-v0.1")
r_mod = AutoModelForSequenceClassification.from_pretrained(ORG + "ThakiEdu-Reranker-KO-v0.1").eval()
def retrieve(question, k=2, rerank=False):
q_vec = emb.encode([question], normalize_embeddings=True)
order = (q_vec @ d_vec.T)[0].argsort()[::-1][:k].tolist()
if rerank: # optional: improves recall@8 in our tests, can lower top-1
batch = r_tok([question] * len(order), [corpus[i] for i in order], padding=True,
truncation="longest_first", max_length=512, return_tensors="pt")
with torch.no_grad():
scores = r_mod(**batch).logits[:, 0].tolist()
order = [i for _, i in sorted(zip(scores, order), reverse=True)]
return [corpus[i] for i in order]
# 3) Generation with the 1.7B student (tutor use needs a separate answer-leak guard)
g_tok = AutoTokenizer.from_pretrained(ORG + "ThakiEdu-1.7B-v0.1")
g_mod = AutoModelForCausalLM.from_pretrained(ORG + "ThakiEdu-1.7B-v0.1",
torch_dtype="bfloat16", device_map="auto")
question = "체험학습 신청은 언제까지 해야 하나요?"
if safety(question) == "allow":
context = "\n".join(retrieve(question))
msgs = [{"role": "user", "content": f"다음 조문을 근거로 답하세요.\n{context}\n\n질문: {question}"}]
text = g_tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True,
enable_thinking=False)
out = g_mod.generate(**g_tok(text, return_tensors="pt").to(g_mod.device), max_new_tokens=256)
print(g_tok.decode(out[0], skip_special_tokens=True))
else:
print("routed to human review")
The 1.7B was trained on exam, rubric and tutor tasks, not on statute QA, so the generation step above shows only the interface. Its quality on this kind of prompt was not measured.
13. Deployment: what has been verified
Only facts already recorded in the release ledgers:
- Integrity. Public LFS sha256 and size match the release manifests for all four repositories (0 mismatches). The Safety
model.safetensorssha256 matches the checkpoint used in the v8 confirmation. -
Safety ONNX FP32 vs PyTorch. On 400 held-out confirmation items the policy labels agree 1.000, with max Δlogit 1.6e-5. CPU (onnxruntime, 8 threads, synthetic text): 128 tokens p50 105 ms, 384 tokens p50 355 ms. - Embedding ONNX FP32. Cosine 1.0 against Sentence Transformers. Overlap@10 1.0 on 50 queries × 500 documents. CPU batch-1: 128 tokens p50 115 ms, 512 tokens p50 496 ms.
- Reranker ONNX FP32. Max score difference 1.05e-5, Kendall τ 1.0, top-1 agreement 1.0 on 20 synthetic queries × 10 documents. CPU: 1 query × 10 documents p50 376 ms; single pair p50 44 ms.
- 1.7B. The assembled repository loads with transformers, and the PEFT adapter applies on the pinned base. Merged and adapter outputs differ slightly because of bf16 rounding.
Clean-environment check. After release we downloaded all four public repositories without credentials or a local cache. Embedding, Reranker and Safety produced correct outputs on short synthetic inputs, and the 1.7B model generated text but showed an English-reasoning problem in its summary section (see part 4). The public ONNX files also ran under ONNX Runtime and matched PyTorch (embedding cosine 1.0, reranker max score difference 1.2e-6, safety logits within 2e-5 with identical labels).
14. Series and models
- Part 1: Searching 207,591 Korean statute articles
- Part 2: Does a reranker always improve retrieval?
- Part 3: A 568M safety classifier for Korean education chat
- Part 4: Distilling 27B into 1.7B for education tasks
- Part 5: this post
Collection: https://huggingface.co/collections/ThakiCloud/thakiedu-korean-education-and-statute-search-6b0d09302cbcb3cea9d70fc5
- https://huggingface.co/ThakiCloud/ThakiEdu-Embedding-KO-v0.1
- https://huggingface.co/ThakiCloud/ThakiEdu-Reranker-KO-v0.1
- https://huggingface.co/ThakiCloud/ThakiEdu-Safety-KO-568M-v0.1
- https://huggingface.co/ThakiCloud/ThakiEdu-1.7B-v0.1
Evidence
Numbers in this post come from these ledger files in the project repository:
RELEASE_STATUS.md: release status, excluded models, checkpoint selection rules, ONNX/CPU checks, integrity checkdata/ledgers/STATUS-models-1128.md: 15-track status tabledocs/EXECUTION_DIRECTIVE.md,docs/EXECUTION_PLAN.md,docs/DATA_INVENTORY.md: program scope, method, data ingest factsdata/ledgers/release/result-embed-full-corpus-1130.md: embedding full-corpus retrievaldata/ledgers/release/result-law-combined-1130.md: embedding + reranker pipelinedata/ledgers/release/result-thakiedu-1p7b-check-1130.md: 1.7B re-measurement, base and 27B referencedata/ledgers/distill/result-distill-s4c-1128.md,result-distill-s4c-4b-1128.md: distillation recipe, 4B ablationdata/ledgers/safety/result-safety-r14-1129.mdandrelease/cards_en/ThakiEdu-Safety-KO-568M-v0.1.md: Safety v7 / v8data/ledgers/assess/result-assess-as9b-1129.md,result-assess-as10-1129.md: Assessmentdata/ledgers/law-diag/result-law-selector-r3-1130.md,result-law-selector-r3-marm27b-1129.md: Law Selectordata/ledgers/english/result-english-e4e-1129.md: Englishdata/ledgers/pii-indep/result-pii-r19-1130.md,data/ledgers/STATUS-models-1128.md(PII r17/r18): PIIdata/ledgers/sft-classifier/result-a7b-holdout-1128.md: Classifierrelease/cards_en/*.md: model cards
Attribution: 금융 법률 문서 기계독해 (71610), 행정 문서 대상 기계독해 (569), 국어 교과 지문형 문제 (71857), all from AI 허브(AI-Hub). 데이터 재배포 불가, 신청자 본인 내부 이용.