Skip to content

feat(hangul_benchmark): Seq2Seq comparison of Hangul Factorizer vs Three-Hot Tokenizer - #902

Open
kahye wants to merge 6 commits into
ReaLLMASIC:masterfrom
kahye:nochar-hybrid-pos-tokenizer
Open

kahye wants to merge 6 commits into
ReaLLMASIC:masterfrom
kahye:nochar-hybrid-pos-tokenizer

Conversation

@kahye

@kahye kahye commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Description:

Overview

This PR introduces a comprehensive evaluation and benchmark suite comparing our 23-Lane Hangul Factorizer against the Three-Hot Tokenizer introduced in Cognetta et al. (EACL 2023), alongside the 24-lane hybrid Hangul factorizer architecture without character stream overhead.

Key Changes

  1. Full Seq2Seq Translation Benchmark (benchmarks/seq2seq_hangul_comparison/):
    • Trained on 77,516 parallel pairs (10 epochs on NVIDIA A100 GPU) comparing:
      • Seq2SeqThreeHotConditional (3-step unrolled RNN: $i \to v \to f$)
      • Seq2SeqThreeHotIndependent (3 independent projection heads)
      • Seq2SeqHangulFactorizer (23 multi-lane parallel heads)
    • Evaluated with paper-compliant subcharacter canonicalization, Bits-Per-Jamo (BPJ), BLEU-4, and chrF order 18.
  2. Adversarial Noise & Slang Robustness (NSMC):
    • Evaluated on 500 colloquial movie reviews under uncorrupted vs. 80% adversarial syllable corruption conditions (Dubeolsik keyboard typos, batchim drops/swaps, vowel shifts, leetspeak).
  3. OOV Contextual Safety Stress Testing:
    • Tested across 11 irregular Unicode prompt batteries (Middle Korean archaic jamos, 64-stroke Hanja, 7-codepoint ZWJ Emoji ligatures, Zalgo text, logic notation).
  4. Zero-Shot Probability Evaluations (KLUE-NER & KLUE-DP):
    • Measured token-level BPJ and zero-shot classification on named entity spans and syntactic dependency relationships.
  5. Documentation & Reports:
    • Added benchmarks/seq2seq_hangul_comparison/benchmark_report.md and README.md containing all tables, architectural diagrams, and analysis.

Benchmark Highlights

Metric / Task Three-Hot Conditional (EACL 2023) Three-Hot Independent (Song et al.) Hangul Factorizer (Ours)
Seq2Seq Test BPJ 7.02 13.82 17.97
Seq2Seq chrF (order 18) 2.80 4.95 4.54
NSMC Corrupted chrF 1.21 1.83 1.13
Irregular OOV Safety ⚠️ Loop in math prompt Safe 0 loops, 0 crashes
KLUE-NER Zero-Shot Acc 2.0% 2.0% 41.0%
KLUE-DP Zero-Shot Acc 49.0% 49.0% 13.67%

kahye added 6 commits August 11, 2026 19:18
…ility evaluation suite

- Expand Korean POS dataset in get_dataset.sh with OPUS-100 and KLUE task splits (DP, NER, MRC, NLI, RE, STS, YNAT) and update lane_metadata.json
- Add --pos_loss_weight argument in train_args.py and handle POS loss weighting and milestone checkpoint saving in train.py
- Add --mc_ckpt and --base_ckpt path override support to benchmarks/run_phonetic_slang_eval.py and benchmarks/run_vocab_tail_perplexity.py
- Add 4-capability evaluation benchmark suite (benchmarks/run_four_capability_evals.py) covering KLUE-NER, KLUE-DP, noisy text resilience (NSMC/UnSmile), and rare vocabulary/OOV (KorMedMCQA)
- Add evaluation runner demos/run_all_epoch_evals.sh, Option 1 sweep runner run_option1_sweep.py, and 10-epoch experiment runner run_opt1_10ep_experiment.py
… POS tagsets, and benchmark support

- Implement HangulFullPosFactorizedTokenizer (46 Sejong tags) and HangulCoarsePosFactorizedTokenizer (17 mapped macro tags) in hangul_factorizer.py
- Add make_byte_fallback_meta() to support 256-byte companion character stream without OOV drop
- Update POS lane metadata and unit tests in test_hangul_factorizer.py
- Add 59.5M token milestone checkpoint saves (3ep: 10899, 5ep: 18165, 10ep: 36330) in train.py
- Add prepare_pos_and_byte_lanes.py to prepare Full POS and 256-Byte Fallback companion stream
- Add run_pos_byte_experiments.py automation runner for training and evaluating Full vs Coarse POS under Weighted and Unweighted loss
- Update evaluation benchmarks (run_four_capability_evals.py, run_ko_hellaswag.py, run_vocab_tail_perplexity.py, run_phonetic_slang_eval.py) to support byte fallback and full/coarse POS models
… and tokenizer byte-fallback improvements

- Add curated 20-prompt OOV and Unicode benchmark suite in benchmarks/prompts/ covering archaic Hangul, rare Hanja, ancient scripts, complex emojis, and mathematical notation
- Add benchmarks/run_oov_evaluations.py to evaluate baseline and multicontext models on OOV prompts
- Optimize CharBPETokenizerWithByteFallback encoding loop with length bucketing and interval progress updates
- Update benchmark encoders across capability tests to properly use get_tokenizer_functions
- Update milestone checkpoint save iterations in train.py
- Update .gitignore to track benchmark prompt files
…m overhead, training pipeline, and downstream evaluation suite

- Add HangulHybridPosTokenizer in data/template/utils/korean/hangul_pos_hybrid_tokenizer.py
  - Surface-level script segmentation: pure Korean segments factorized into 22 phonetic/articulatory lanes + 1 Kiwi POS lane
  - Non-Korean segments tokenized into Lane 0 via SentencePiece byte-fallback BPE (vocab 4,096) with 256-byte fallback
  - Korean syllable steps flagged with <hangul> user symbol in Lane 0, zero-padded in factor lanes
  - 100% lossless roundtrip decoding across Korean, English, numbers, symbols, emojis, and Hanja
- Add prepare_hybrid_pos_lanes.py with 8-worker parallel Kiwi preprocessing and lane bin generation (37,075,473 sequence tokens, ~37% sequence compression)
- Add run_nochar_hybrid_pos_experiments.py multi-stage training pipeline (3, 5, 10 epochs) across coarse/full POS and weighted/unweighted loss
- Update benchmarks (run_four_capability_evals.py, run_ko_hellaswag.py, run_phonetic_slang_eval.py, run_vocab_tail_perplexity.py, run_oov_evaluations.py) to support 24-lane hybrid models
- Add run_comprehensive_evaluation_suite.py evaluating all 12 checkpoint variants and 10 baselines

TAG=agy
CONV=93668715-1772-4398-915c-c5b81edba888
…ree-Hot Tokenizer, NSMC adversarial, and KLUE zero-shot evaluations

- Add English-to-Korean Seq2Seq training pipeline for 23-lane Hangul Factorizer vs Three-Hot Tokenizer (EACL 2023 conditional RNN and independent heads)
- Add subcharacter canonicalization, BPJ (Bits-Per-Jamo), BLEU, and chrF order 18 evaluation metrics
- Add adversarial noise and slang benchmark on NSMC (uncorrupted vs 80%-corrupted)
- Add OOV contextual safety stress test battery (Middle Korean, complex Hanja, Emoji ligatures, Zalgo, logic notation)
- Add zero-shot probability evaluation suite on KLUE-NER and KLUE-DP
- Include comprehensive comparative benchmark report

TAG=agy
CONV=6107adad-8ad5-480d-9a0a-6e7f85e34df5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant