Token Classification
Transformers
ONNX
Safetensors
English
Japanese
Chinese
bert
anime
filename-parsing
Eval Results (legacy)
Run this model with HF Jobs
Run ModerRAS/AniFileBERT on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/ModerRAS/AniFileBERT. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ModerRAS/AniFileBERT on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use ModerRAS/AniFileBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ModerRAS/AniFileBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="ModerRAS/AniFileBERT")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("ModerRAS/AniFileBERT") model = AutoModelForTokenClassification.from_pretrained("ModerRAS/AniFileBERT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Simplify title-boundary title span heuristic
Browse filesFiles changed (4)
133 unmodified lines134135136137138139140141142143144145146147148149133 unmodified lines```For reviewer calibration, run stratified samples before full review. Use`--title-boundary-heuristic-contains` to inspect high-similar duplicate/aliaskeeps, structural keeps, and path-boundary keeps that are normally skipped bythe ambiguous merge review:```powershellcargo run --release --manifest-path tools\rust_dmhy_template_apply\Cargo.toml -- `--review-title-boundaries-pi-rpc `--recipes reports\dmhy_template_recipes.full_top5000.title_boundary_trial.seed.jsonl `--title-boundary-decisions-output reports\dmhy_title_boundary_pi_rpc_highsim_keep_sample.jsonl `--title-boundary-heuristic-contains keep_similar_duplicate_or_alias `--title-boundary-min-similarity 0.85 `--title-boundary-max-similarity 1.0 `--threads 4 `133 unmodified lines134135136137138139140141142143144145146147148149150151133 unmodified lines```For reviewer calibration, run stratified samples before full review. Use`--title-boundary-heuristic-contains` to inspect high-similarity adjacent-titlemerges, structural keeps, and path-boundary keeps that are normally skipped bythe ambiguous merge review. The old high-similarity duplicate/alias keepheuristic was removed after Pi RPC review found it over-preserved titlecontinuations:```powershellcargo run --release --manifest-path tools\rust_dmhy_template_apply\Cargo.toml -- `--review-title-boundaries-pi-rpc `--recipes reports\dmhy_template_recipes.full_top5000.seed.jsonl `--title-boundary-decisions-output reports\dmhy_title_boundary_pi_rpc_adjacent_highsim_sample.jsonl `--title-boundary-heuristic-contains merge_adjacent_title_continuation `--title-boundary-min-similarity 0.85 `--title-boundary-max-similarity 1.0 `--threads 4 `
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177# Title-Boundary Heuristic Experiments
This note records deterministic Rust heuristic changes and Pi RPC reviewer evidencefor DMHY template `title_spans` generation. The reviewer output is evidence only;recipes and training JSONL are changed only by Rust code.
## Baseline
Input recipe evidence:
- `reports/dmhy_template_recipes.full_top5000.title_boundary_trial.seed.jsonl`- total title-boundary decisions: `5631`
Decision distribution:
| decision | count || --- | ---: || `merge_dissimilar_title_continuation` | 4661 || `keep_similar_duplicate_or_alias` | 463 || `keep_structural_boundary` | 502 || `keep_path_boundary` | 5 |
Pi RPC stratified sample, `--threads 4`:
| stratum | rows | model result | note || --- | ---: | --- | --- || ambiguous merge, similarity `0.25..0.85` | 20 | 20 merge | Good. Reviewer cited concrete title-word pairings. || high-sim `keep_similar_duplicate_or_alias`, similarity `0.85..1.0` | 20 | 19 merge, 1 parse-error | Bad baseline heuristic. Examples such as `Asobi ni Iku yo!`, `Code Geass ~Akito the Exiled~`, `Yagate Kimi ni Naru`, and `Big Order` were wrongly kept separate by the heuristic. || structural keep | 20 | 18 keep, 1 merge, 1 skip | Mostly good. Covers category+title, multilingual aliases, and distinct fields. || path keep | 5 | 5 keep | Good. Covers path duplicate/category boundaries. |
Conclusion: `keep_similar_duplicate_or_alias` was too broad because it used maxliteral similarity. Short connector repeats (`no`, `wa`, `ni`, `the`, `of`) andrepeated title words inflated similarity to `1.0` even for ordinary contiguoustitle phrases.
## Experiment 1: strict substantive duplicate keep
Change tried:
- Keep adjacent `TITLE SEP TITLE` only when top literals include a substantive duplicate/near-duplicate pair.- Ignore short connectors and literals with normalized length `< 6`.
Generated recipe output:
- `reports/dmhy_template_recipes.full_top5000.strictdup.seed.jsonl`
Decision distribution:
| decision | count || --- | ---: || `merge_dissimilar_title_continuation` | 4661 || `merge_adjacent_title_continuation` | 444 || `keep_similar_duplicate_or_alias` | 19 || `keep_structural_boundary` | 502 || `keep_path_boundary` | 5 |
Pi RPC review of all 19 remaining `keep_similar_duplicate_or_alias` decisions:
| rows | model result || ---: | --- || 19 | 19 merge |
Examples the reviewer judged as merge:
- `Air In Summer`, `Assault Lily BOUQUET`- `Aoki Hagane no Arpeggio Ars Nova`- `Shoujo Kageki Revue Starlight`- `Motto! Ojamajo Doremi`- `Fate stay night Heaven's Feel`- `Arafou Otoko no Isekai Tsuuhan Seikatsu`- `Watashi, Nouryoku wa Heikinchi de tte Itta yo ne!`
Conclusion: strict duplicate evidence still produced false keeps. The repeatedliteral was often a real repeated word inside one title phrase or a top-literalartifact, not a duplicate/alias boundary.
## Experiment 2: merge all adjacent separator-only title slots
Final change:
- `TITLE PATH TITLE` remains `keep_path_boundary`.- Non-separator structural boundaries remain `keep_structural_boundary`.- Every separator-only adjacent title boundary, `TITLE SEP TITLE`, now merges.- Low-similarity merges keep the old decision name `merge_dissimilar_title_continuation`.- High-similarity merges use `merge_adjacent_title_continuation`.- `keep_similar_duplicate_or_alias` is no longer emitted by the deterministic heuristic.
Generated recipe output:
- `reports/dmhy_template_recipes.full_top5000.mergeall.seed.jsonl`
Decision distribution:
| decision | count || --- | ---: || `merge_dissimilar_title_continuation` | 4661 || `merge_adjacent_title_continuation` | 463 || `keep_structural_boundary` | 502 || `keep_path_boundary` | 5 |
Pi RPC sample of high-similarity `merge_adjacent_title_continuation` decisions:
| rows | model result || ---: | --- || 30 | 29 merge, 1 parse-error |
The reviewer cited concrete title continuations such as:
- `Asobi ni Iku yo!`- `Code Geass ~Akito the Exiled~`- `Kami nomi zo Shiru Sekai`- `Yagate Kimi ni Naru`- `Big Order`- `Gate Jieitai Kanochi nite Kaku Tatakaeri`- `JoJo's Bizarre Adventure - Stardust Crusaders`
Conclusion: merge-all adjacent separator-only title slots is the best of thetried heuristics. It matches Pi RPC evidence and simplifies downstream synthetictitle-span replacement.
## Synthetic generation smoke
Generated schema v2 synthetic augmentation with merge-all recipes:
- `data/schema_v2_synthetic_aug.mergeall.jsonl`- `data/schema_v2_synthetic_aug.mergeall.manifest.json`
Validator passed. Manifest summary:
| metric | value || --- | ---: || `generated_rows` | 49998 || `numeric_title_rows` | 30000 || `path_rows` | 19998 || `path_series_rows` | 15000 || `path_movie_rows` | 1666 || `path_special_rows` | 1666 || `path_confuser_rows` | 1666 || `dropped_media_kind_mismatch` | 19611 |
## Commands
Pi RPC high-sim adjacent merge sample:
```powershellcargo run --release --manifest-path tools\rust_dmhy_template_apply\Cargo.toml -- ` --review-title-boundaries-pi-rpc ` --recipes reports\dmhy_template_recipes.full_top5000.mergeall.seed.jsonl ` --title-boundary-decisions-output reports\dmhy_title_boundary_pi_rpc_mergeall.adjacent_highsim.jsonl ` --title-boundary-heuristic-contains merge_adjacent_title_continuation ` --title-boundary-min-similarity 0.85 ` --title-boundary-max-similarity 1.0 ` --threads 4 ` --limit 30```
Synthetic smoke:
```powershellcargo run --release --manifest-path tools\schema_v2_synthetic_augment\Cargo.toml --bin schema_v2_synthetic_augment -- ` --recipes reports\dmhy_template_recipes.full_top5000.mergeall.seed.jsonl ` --label-schema-file label_schema.json ` --numeric-title-seeds data\synthetic_numeric_titles.txt ` --path-prefix-seeds data\synthetic_path_prefixes.txt ` --limit-templates 3000 ` --max-rows 50000 ` --output data\schema_v2_synthetic_aug.mergeall.jsonl ` --manifest-output data\schema_v2_synthetic_aug.mergeall.manifest.json
cargo run --release --manifest-path tools\schema_v2_synthetic_augment\Cargo.toml --bin validate_synthetic_aug_jsonl -- ` --input data\schema_v2_synthetic_aug.mergeall.jsonl ` --manifest data\schema_v2_synthetic_aug.mergeall.manifest.json```83 unmodified lines84858687888990919293949583 unmodified linesFor stratified audits, select heuristic strata explicitly:```powershell# High-similarity duplicate/alias keep candidates.cargo run --release --manifest-path tools\rust_dmhy_template_apply\Cargo.toml -- `--review-title-boundaries-pi-rpc `--recipes reports\dmhy_template_recipes.full_top5000.seed.jsonl `--title-boundary-decisions-output reports\dmhy_title_boundary_pi_rpc_highsim_keep.jsonl `--title-boundary-heuristic-contains keep_similar_duplicate_or_alias `--title-boundary-min-similarity 0.85 `--title-boundary-max-similarity 1.0 `--threads 4 `83 unmodified lines8485868788899091929394959683 unmodified linesFor stratified audits, select heuristic strata explicitly:```powershell# High-similarity adjacent-title merges. The old high-similarity keep heuristic# was removed after Pi RPC review found it over-preserved title continuations.cargo run --release --manifest-path tools\rust_dmhy_template_apply\Cargo.toml -- `--review-title-boundaries-pi-rpc `--recipes reports\dmhy_template_recipes.full_top5000.seed.jsonl `--title-boundary-decisions-output reports\dmhy_title_boundary_pi_rpc_adjacent_highsim.jsonl `--title-boundary-heuristic-contains merge_adjacent_title_continuation `--title-boundary-min-similarity 0.85 `--title-boundary-max-similarity 1.0 `--threads 4 `
823 unmodified lines82482582682782882983019 unmodified lines8508518528538548558568578588598608614463 unmodified lines53255326532753285329533053311 unmodified line53335334533553365337533853395340823 unmodified lineslet mut spans: Vec<Vec<usize>> = Vec::new();let mut decisions: Vec<Value> = Vec::new();let mut current_span: Vec<usize> = Vec::new();let similarity_keep_threshold = 0.72;for title_index in title_indices {if current_span.is_empty() {19 unmodified lines}));spans.push(current_span);current_span = vec![title_index];} else if only_separators_between && similarity < similarity_keep_threshold {decisions.push(json!({"left_role_index": previous,"right_role_index": title_index,"similarity": similarity,"decision": "merge_dissimilar_title_continuation","source": "heuristic",}));current_span.push(title_index);4463 unmodified lines}#[test]fn title_span_metadata_keeps_similar_duplicates_separate() {let key = "TEXT SEP TEXT SEP EPISODE";let roles = suggested_roles(key);let mut cluster = Cluster::default();1 unmodified linecluster.position_literals[0].insert("Frieren".to_string(), 10);cluster.position_literals[2].insert("Frieren".to_string(), 10);let (spans, decisions) = compute_title_span_metadata(key, &roles, &cluster);assert_eq!(spans.len(), 2, "{spans:?} {decisions:?}");assert_eq!(decisions[0]["decision"], "keep_similar_duplicate_or_alias");}#[test]823 unmodified lines82482582682782882983019 unmodified lines8508518528538548558568578588598608614463 unmodified lines53255326532753285329533053311 unmodified line533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359823 unmodified lineslet mut spans: Vec<Vec<usize>> = Vec::new();let mut decisions: Vec<Value> = Vec::new();let mut current_span: Vec<usize> = Vec::new();let low_similarity_threshold = 0.72;for title_index in title_indices {if current_span.is_empty() {19 unmodified lines}));spans.push(current_span);current_span = vec![title_index];} else if only_separators_between {decisions.push(json!({"left_role_index": previous,"right_role_index": title_index,"similarity": similarity,"decision": if similarity < low_similarity_threshold { "merge_dissimilar_title_continuation" } else { "merge_adjacent_title_continuation" },"source": "heuristic",}));current_span.push(title_index);4463 unmodified lines}#[test]fn title_span_metadata_merges_similar_adjacent_titles() {let key = "TEXT SEP TEXT SEP EPISODE";let roles = suggested_roles(key);let mut cluster = Cluster::default();1 unmodified linecluster.position_literals[0].insert("Frieren".to_string(), 10);cluster.position_literals[2].insert("Frieren".to_string(), 10);let (spans, decisions) = compute_title_span_metadata(key, &roles, &cluster);assert_eq!(spans.len(), 1, "{spans:?} {decisions:?}");assert_eq!(decisions[0]["decision"],"merge_adjacent_title_continuation");}#[test]fn title_span_metadata_merges_high_similarity_short_connectors() {let key = "TEXT SEP TEXT SEP EPISODE";let roles = suggested_roles(key);let mut cluster = Cluster::default();cluster.position_literals = vec![HashMap::new(); key.split_whitespace().count()];cluster.position_literals[0].insert("no".to_string(), 10);cluster.position_literals[2].insert("no".to_string(), 10);let (spans, decisions) = compute_title_span_metadata(key, &roles, &cluster);assert_eq!(spans.len(), 1, "{spans:?} {decisions:?}");assert_eq!(decisions[0]["decision"],"merge_adjacent_title_continuation");}#[test]
AGENTS.md+8-6
docs/title_boundary_heuristic_experiments.mdAdded+177
tools/rust_dmhy_template_apply/README.md+4-3
tools/rust_dmhy_template_apply/src/main.rs+25-6