What this checkpoint shows
- Method: K-Guard REAP
- Korean MC macro: 51.2 (base 68.8, -17.5 pp)
- Academic 10-benchmark macro: 36.9 (base 65.5, -28.6 pp)
- Coding 2-benchmark macro: 63.4 (base 76.0, -12.6 pp)
- Protection budget: 20 layers exceeded the 32-Expert budget; 185 protected Experts were force-dropped.
Benchmark results
Table with columns: benchmark, base, K-Guard 12.5%, K-Guard 25%, K-Guard 50%, REAP-Code 25%| benchmark | base | K-Guard 12.5% | K-Guard 25% | K-Guard 50% | REAP-Code 25% |
|---|
| Korean (held-out harness) | | | | | |
| KMMLU | 49.4 | 48.8 | 42.4 | 23.6 | 35.0 |
| KoBEST BoolQ | 90.2 | 87.7 | 78.8 | 74.3 | 79.6 |
| KoBEST COPA | 70.7 | 69.7 | 65.0 | 55.9 | 51.7 |
| KoBEST SentiNeg | 74.8 | 71.8 | 70.5 | 53.7 | 49.6 |
| KoBEST HellaSwag | 58.8 | 55.0 | 57.4 | 48.8 | 51.6 |
| English reasoning / knowledge | | | | | |
| ARC-Challenge | 87.1 | 86.1 | 79.9 | 36.9 | 79.1 |
| HellaSwag (en) | 74.2 | 67.4 | 55.3 | 32.6 | 61.7 |
| WinoGrande | 67.4 | 65.6 | 59.2 | 53.1 | 63.5 |
| MMLU-Pro | 41.2 | 36.9 | 34.2 | 14.8 | 33.8 |
| TruthfulQA MC2 | 47.3 | 46.0 | 43.1 | 40.6 | 44.6 |
| MMLU-en | 69.7 | 64.5 | 56.6 | 30.1 | 59.6 |
| Math | | | | | |
| GSM8K | 86.3 | 86.7 | 81.8 | 61.3 | 86.7 |
| MathQA | 30.5 | 29.1 | 24.8 | 21.3 | 28.7 |
| Coding | | | | | |
| HumanEval+ | 81.1 | 75.6 | 74.4 | 65.2 | 80.5 |
| MBPP+ | 70.9 | 69.3 | 67.5 | 61.6 | 67.5 |
| Safety / bias | | | | | |
| BBQ | 76.6 | 69.9 | 59.8 | 33.6 | 74.0 |
| SafetyBench | 74.8 | 73.0 | 69.1 | 44.3 | 72.1 |
| Macro | | | | | |
| Korean MC macro | 68.8 | 66.6 | 62.8 | 51.2 | 53.5 |
| Academic 10-bench macro | 65.5 | 62.5 | 56.4 | 36.9 | 60.4 |
| Coding 2-bench macro | 76.0 | 72.5 | 70.9 | 63.4 | 74.0 |
Compatibility
- Runtime: Hugging Face Transformers 5.0.0 or newer, PyTorch/CUDA; validated on DGX Spark.
- Architecture:
Glm4MoeLiteForCausalLM.
- Model code: native Transformers implementation; no repository-side
modeling_*.py is
required, and the checkpoint loads with trust_remote_code=False.
- Preserved: first Dense layer, shared Experts,
topk_method=noaux_tc,
norm_topk_prob=true, router correction bias, and routed_scaling_factor=1.8.
- Routing: top-4 remains unchanged; only routed Expert tensors and corresponding router rows/bias
entries were compacted with one old→new ID map per layer.
- The extra layer-47 MTP/NextN tensors are retained for checkpoint completeness, but runtime
validation reports
mtp_compatible=false. Use standard autoregressive generation; speculative
MTP/NextN decoding is not supported by this release.
How it was made
Source checkpoint
- Base: zai-org/GLM-4.7-Flash
- Frozen revision:
7dd20894a642a0aa287e9827cb1a1f7f91386b67
- Original routed MoE layout: first layer Dense, then 46 routed MoE layers with 64 Experts,
top-4 routing, plus shared Experts.
Calibration dataset
Table with columns: Group, Records, Role| Group | Records | Role |
|---|
| Korean/English semantic pairs | 2,752 | Korean↔English routing contrast |
| Common Korean | 2,752 | Korean routing coverage |
| General replay | 1,344 | General-capability retention |
| GLM-specialized | 1,344 | Documents, language retention, reasoning, security, structured output, tool calling |
| Total | 8,192 | 5,472 Korean / 2,720 English; 1,376 pairs |
- 6,848 records contain source teacher responses.
- 1,344 GLM-specialized records use deterministic base-model rollouts.
- Prompt/response observations cover 3,898,756 token memberships.
- The manifest passed independent token-length and exact-prompt contamination checks.
Observation and scoring
- Selected-only observer: only routed Expert assignments were measured; no dense
[experts, tokens, hidden] activation tensor was retained.
- REAP contribution: normalized dispatch weight × L2 norm of the unweighted Expert output.
- Router selection and dispatch were checked separately so GLM's correction bias affects selection
without being mistaken for the actual dispatch weight.
- The observed model remained logit-identical to the uninstrumented eager model in validation.
Pruning
- Uniform routed Experts per layer:
64 → 32.
- Shared Experts and the first Dense layer were not pruned.
- Top-4 and routed scaling factor 1.8 were retained.
- Safetensors surgery physically compacted Expert tensors, router rows, and correction-bias entries.
- Protection result: 20 layers exceeded the 32-Expert budget; 185 protected Experts were force-dropped.
Evaluation scope
These are decision-grade experimental results, not release-certified leaderboard numbers:
- KMMLU: deterministic 500-example subset (seed 42).
- KoBEST: declared BoolQ, COPA, SentiNeg, and HellaSwag evaluation splits.
- ARC-Challenge, HellaSwag-en, WinoGrande, MMLU-Pro, TruthfulQA MC2, MMLU-en, GSM8K, MathQA,
BBQ, and SafetyBench: deterministic 512-example subsets.
- HumanEval+: full 164 tasks; MBPP+: frozen full 378-task revision; greedy pass@1.
- LiveCodeBench was excluded from this run.
decision_eligible=true, release_eligible=false; do not compare these subset scores directly
with full-set or few-shot leaderboard values.
Machine-readable results and the exact survivor manifest are included under evaluation/.
Certification status: 50% pruning is outside the plan's initial GLM release grid. It force-dropped 185 protected Experts and is published only as a compression-ceiling artifact.
Usage
Install a Transformers release that includes Glm4MoeLiteForCausalLM:
pip install "transformers>=5.0.0" accelerate safetensors
The checkpoint was validated with Transformers 5.0.0 and NVIDIA PyTorch 25.09.
It uses the native Transformers model implementation and does not execute custom
code from this repository.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "buugiiiiii/GLM-4.7-Flash-KGuard-REAP-32E"
tokenizer = AutoTokenizer.from_pretrained(
model_id,
trust_remote_code=False,
)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=False,
attn_implementation="eager",
experts_implementation="eager",
)
model.eval()
messages = [{"role": "user", "content": "한국어로 이진 탐색을 설명해줘."}]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.inference_mode():
output = model.generate(
**inputs,
max_new_tokens=256,
do_sample=False,
pad_token_id=tokenizer.eos_token_id,
)
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Limitations
Expert pruning is irreversible within this checkpoint and can change routing behavior sharply on
tasks not represented by the calibration or evaluation sets. No post-pruning recovery or
fine-tuning was applied. Reported Korean behavior is relative to the tested base checkpoint and
harness; it does not imply universal Korean-language safety or quality preservation. The current
release is not validated for speculative MTP/NextN decoding.
Included research artifacts
-
evaluation/glm-full-b19-results.json: machine-readable five-model benchmark results
-
evaluation/glm-full-b19-long-scores.csv: long-format benchmark scores
-
evaluation/survivor-manifest.json: exact per-layer old Expert IDs retained
-
artifacts/calibration-validation.json: independent calibration-manifest validation
-
artifacts/observation-validation.json: selected-only observation validation
-
artifacts/expert-statistics.csv: per-Expert scoring/features used for this method
-
: exact K-Guard protected set and evidence
Provenance
- Base model: zai-org/GLM-4.7-Flash, revision
7dd20894a642a0aa287e9827cb1a1f7f91386b67
- Base license: MIT
- Research code: K-REAP
- Project: K-Guard-REAP
- Team: RAS-LAB
- Benchmark report SHA256:
7f7ac2f767e68c61528082e62c4eef3a6027429ab1e47b654de10b4c93b760d6
- Model card generated from a benchmark report with status
PASS and zero validation failures.
Citation
Please cite the original GLM work and the K-Guard/K-REAP repository when using this checkpoint.