--- language: - bo license: other task_categories: - token-classification pretty_name: Tibetan Annotation Layer Detection tags: - tibetan - openpecha - tsadra - ner - quotation - span-detection - buddhist-studies size_categories: - n<1K configs: - config_name: default data_files: - split: train path: data/train-* - split: validation path: data/validation-* - split: test path: data/test-* - config_name: windowed_w8192_s4916 data_files: - split: train path: windowed_w8192_s4916/train/*.parquet - split: validation path: windowed_w8192_s4916/validation/*.parquet - split: test path: windowed_w8192_s4916/test/*.parquet --- # Tibetan Annotation Layer Detection 266 annotated Classical Tibetan books with seven annotation layers — Quotation, Sabche, Tsawa, Yigchung, Chapter, Author, BookTitle — stored as character-offset spans over a flat base text. Each row is one book: `book_id`, `text`, `spans` (`{start, end, label}`), and `in_scope_layers`. Book-level split: **217 train / 25 validation / 24 test**. A book is never split across partitions. This revision (`v1.1`) is a span-level clean of `v1.0`. Texts, book membership, split assignment, and split order are unchanged. ## What changed in v1.1 Every span with `start == end` was dropped, on all seven layers. No other spans were removed. Impossible geometries (`start > end`, negative offsets, offsets beyond the book text) were scanned and **none were found**. Character mass uses inclusive length `end - start + 1` (see caveat below). | Layer | Spans before | Spans after | Removed | Char mass before | Char mass after | |---|---:|---:|---:|---:|---:| | Quotation | 24,730 | 24,722 | 8 | 3,415,105 | 3,415,097 | | Sabche | 18,847 | 18,845 | 2 | 1,608,291 | 1,608,289 | | Tsawa | 6,845 | 6,811 | 34 | 1,285,298 | 1,285,264 | | Yigchung | 9,025 | 8,804 | 221 | 841,535 | 841,314 | | Chapter | 1,637 | 1,637 | 0 | 94,724 | 94,724 | | Author | 311 | 311 | 0 | 12,160 | 12,160 | | BookTitle | 266 | 266 | 0 | 21,938 | 21,938 | | **Total** | **61,661** | **61,396** | **265** | **7,279,051** | **7,278,786** | All 265 removals were `start == end`. 43 books lost at least one span: | Book | Spans removed | |---|---:| | P000036 | 58 | | P000140 | 33 | | P000236 | 21 | | P000275 | 20 | | P000087 | 16 | | P000123 | 14 | | P000153 | 14 | | P000195 | 8 | | P000138 | 6 | | P000073 | 5 | | P000132 | 5 | | P000174 | 4 | | P000030 | 4 | | P000034 | 3 | | P000037 | 3 | | P000054 | 3 | | P000089 | 3 | | P000119 | 3 | | P000130 | 3 | | P000152 | 3 | | P000159 | 3 | | P000010 | 3 | | P000011 | 3 | | P000171 | 3 | | P000218 | 3 | | P000055 | 2 | | P000199 | 2 | | P000230 | 2 | | P000021 | 1 | | P000028 | 1 | | P000050 | 1 | | P000051 | 1 | | P000096 | 1 | | P000126 | 1 | | P000156 | 1 | | P000175 | 1 | | P000203 | 1 | | P000207 | 1 | | P000216 | 1 | | P000224 | 1 | | P000258 | 1 | | P000151 | 1 | | P000246 | 1 | `v1.0` remains reachable as the `v1.0` tag (commit `aaa17607`). ## Why `start == end` spans are zero-length or one-character stray marks, not real annotations. The previous validator only checked geometric coherence (negative, inverted, out of bounds), so these passed silently. ## Flagged books (zero spans for an in-scope layer) These books are **retained**. Their in-scope layer with no remaining spans is unresolved — they are not dropped from the split. - **P000218** (test): 847,725 characters; had 3 Quotation spans, all `start == end`. After this clean it has **no Quotation annotation at all**, while still marked in-scope for Quotation. - **P000126** (train): already had **zero** Quotation spans while marked in-scope. Unchanged by this clean (one non-Quotation `start == end` span was dropped). No other in-scope layer on any book went to zero spans as a result of this clean. ## Known remaining issues (not fixed here) - Some books have very low annotation density relative to their length. - Some books have large positional gaps with no annotation. - Damage has only been systematically examined for **Quotation**. The other six layers were cleaned of `start == end` here but have not been inspected for density or gaps. - No minimum-length rule, density filter, or gap detection was applied. The offset convention (inclusive vs half-open) has not been independently verified. ## License Packaging, split, and this clean are released under CC0 1.0. Underlying texts and original annotations come from OpenPecha / Tsadra; per-book source licenses vary. # Config `windowed_w8192_s4916` (tag v2.0) # WARNING — derived data This dataset is **derived** from a specific tokenizer, window length, and stride. **Regenerate it** if any of those change. Do not mix windows from different tokenizers or strides in the same training run. Load the named config, never the unpinned default (that is still book-level): ```python from datasets import load_dataset ds = load_dataset("karma689/layer_detection", "windowed_w8192_s4916", revision="v2.0") ``` `revision="v1.1"` (default config) stays book texts + character spans. Tag `v1.1` is not moved by this publish. ## Schedule warning v1.3 trains on **14,338** windows/epoch (HF stride 5120, step 3072, 62.5% overlap, `dataset_revision: null`). This config is step 4916 (~40% overlap). The continuous extras-scale estimate was **~9,060** windows/epoch. The **measured** HF overflow total is **8,906** (217+25+24 books → 6877+897+1132). That 8,906 is the per-book tokenizer count, **not** the naive `14338 × 3072/4916` formula and **not** 9,103 (false 1843-step model). Relative to 14,338 this is ~38% fewer windows. **Warmup and the LR schedule must be rescaled** or the same nominal epoch count undertrains. ## Provenance | Field | Value | |---|---| | Source dataset | `karma689/layer_detection` | | Source revision | `v1.1` | | Source tag commit | `b9576f90b675240a6c59d5d0768afc89735a4bf3` | | Tokenizer repo (files used) | `karma689/mmbert-base-layer-detection-v1.3` | | Upstream tokenizer | `jhu-clsp/mmBERT-base` | | Vocab size | 256000 | | tokenizer.is_fast | True | | Combined tokenizer-file sha256 | `d582312d8c4ccd73ba5a5199026bd161a869503946e488c5e79deb569150469f` | | Window length (`max_length`) | 8192 | | HF tokenizer `stride` (overlap) | 3276 | | Step (CLI `--stride`) | 4916 | | Label scheme | 15-class BIO softmax | | Gold spans split across windows | **0** | | Damaged books (O-mask on `loss_mask`) | P000218, P000271, P000078, P000126 | | Measured max span | 3095 tokens — P000151 QUOTATION `[304112, 308503]` | ## Tokenizer file hashes | File | sha256 | |---|---| | `tokenizer.json` | `609d8f4c067cd3950f88594c5a802616cea245823836ef5848ee4fc40aab5b6f` | | `tokenizer_config.json` | `14b147f2a4f939d9b12ab36e9633917040dd948fa78ce283b03402e4cf2c9cba` | Hub name `s4916` is the **step**, not the HuggingFace `stride` argument. `tokenizer(..., max_length=8192, stride=3276)` yields step 4916. The longest gold span is 3,095 tokens. A span fits whole in at least one window iff its length is ≤ overlap. Step 4,916 clears that floor with margin. ## Window counts | Split | Books | Windows | |---|---:|---:| | train | 217 | 6877 | | validation | 25 | 897 | | test | 24 | 1132 | | **total** | **266** | **8906** | Seventeen books are shorter than 8192 tokens; each produced exactly one window. Shortest: P000052, 84 tokens. `scope_mask` uses the same confirmed-scope policy as v1.3 training (`apply_confirmed_scope`): P000010 excludes Quotation, P000100 excludes Tsawa. Offset convention is **inclusive** `[start, end]` (`text[start:end+1]`). Do not convert to half-open — that would change BIO and the v2 token indices. BookTitle gold stays in `labels` as `B-BOOKTITLE` / `I-BOOKTITLE`. The same positives v1.2/v1.3 ignore are zeroed on **`loss_mask` only**. Overlapped tokens are labelled `-100` in every window except the first that covers them, so each content token contributes to the BIO loss **once**. ## 15-label id → name (v1.3) | id | label | |---:|---| | 0 | `O` | | 1 | `B-QUOTE` | | 2 | `I-QUOTE` | | 3 | `B-SABCHE` | | 4 | `I-SABCHE` | | 5 | `B-TSAWA` | | 6 | `I-TSAWA` | | 7 | `B-YIGCHUNG` | | 8 | `I-YIGCHUNG` | | 9 | `B-CHAPTER` | | 10 | `I-CHAPTER` | | 11 | `B-AUTHOR` | | 12 | `I-AUTHOR` | | 13 | `B-BOOKTITLE` | | 14 | `I-BOOKTITLE` | ## Columns | Column | Description | |---|---| | `book_id` | OpenPecha id | | `window_index` | 0-based window within the book | | `input_ids` / `attention_mask` | mmBERT window (no padding) | | `labels` | 15-class BIO, winner-takes-all (Quotation wins). Unmasked BookTitle. | | `scope_mask` | Per-label in-scope mask | | `offset_mapping` / `special_tokens_mask` | For char ↔ token maps | | `spans` | Every overlapping gold span (not collapsed): Hub `layer`, half-open window token `start`/`end`, `truncated`, `span_id`, `char_start`/`char_end` | | `start_targets` / `end_targets` | `[7, T]` float, MODEL_LAYERS order, smoothing 1.0/0.3/0.1 with `max()` | | `loss_mask` | `[T]` float; 0 on specials/pad, BookTitle BIO tokens, and damaged-book tokens outside every gold span | `span_id` is `{book_id}:{label}:{char_start}:{char_end}:{source_index}` and is stable across windows that cover the same gold span.