Skip to content

Principled, invariant-backed reversibility (lossless round-trip transliteration) #171

Description

@raeq

Goal / statement of intent

Add a guaranteed-lossless, reversible transliteration mode whose round-trip is a machine-checked invariant, and extend reverse coverage beyond Russian/Ukrainian/Greek. Intent: give users a Latinization they can faithfully invert, and add a new provable property to translit's invariant suite (I1–I7 → +1).

Non-goals: making the default (readable) transliteration reversible; guaranteeing readability of reversible output; covering scripts where a clean bijection is infeasible.

Success metrics (how we measure done)

  • Primary (correctness): reverse(transliterate(x, reversible=True)) == x holds for 100% of inputs over each covered script, verified by exhaustive enumeration (same rigor as the existing Hangul/BMP/CJK domain tests) plus Hypothesis.
  • Coverage: reverse support extended from 3 scripts to ≥ N (fix N during scoping; state it in the PR).
  • New invariant: a round-trip invariant (e.g. I8) added to the formal suite and CI-gated.
  • Efficiency (only if the compression variant is pursued): report measured file-size and token-count reduction (Huffman reference: ~50% size, 50–80% tokens).
  • Guarantees: no unsafe, no new runtime deps, linear-time preserved.

Acceptance criteria / definition of done

  • reversible=True (or equivalent) mode implemented for a documented script set.
  • Round-trip invariant added, proven by exhaustive enumeration, gated in CI.
  • Scope documented: which scripts are reversible and why others are excluded.
  • Benchmarks committed for any size/token claims.

Summary

Reverse transliteration today covers Russian, Ukrainian, and Greek only (src/reverse.rs; reverse_ru/uk/el.tsv). The literature offers a principled framework for guaranteed-lossless, reversible transliteration that would let translit extend reverse coverage and add a round-trip property to its formal-invariant suite (I1–I7).

Product–market fit

  • Who: data-pipeline and storage engineers needing reversible Latinization (round-trip native↔Latin with no information loss), tokenization/compression use cases, and anyone who must recover the original script after processing.
  • Pain: most romanization is lossy and one-way; users who Latinize for indexing or ease of typing cannot faithfully recover the source, and lossy mappings silently corrupt round-trips.
  • Why translit: the project already prizes determinism + machine-checked invariants. A reversibility invariant is directly in that wheelhouse and is a property neural transliterators cannot guarantee.
  • Wedge: offer transliterate(..., reversible=True) with a typed round-trip guarantee for a defined set of scripts; market translit as "the transliterator with a proven round-trip."

Academic grounding

  • Zhuang, Sun & Zhao 2025, "Enhancing Cross-Lingual Transfer through Reversible Transliteration: A Huffman-Based Approach," ACL 2025 (arXiv:2509.17493) — a complete transliteration framework with guaranteed 100% lossless back-conversion, plus ~50% file-size and 50–80% token reduction and no vocabulary expansion. The most architecturally relevant single paper for translit's round-trip ambitions. https://arxiv.org/abs/2509.17493
  • Jayakumar et al. 2026, "Scripts Through Time" (survey) — situates reversibility and inference-efficiency among the core motivations for transliteration. https://arxiv.org/abs/2604.18722
  • Supporting: back-transliteration framing in Chari et al. 2025, "Lost in Transliteration: Bridging the Script Gap in Neural IR," SIGIR 2025 (arXiv:2505.08411) and the established Dakshina reverse-direction task. https://arxiv.org/abs/2505.08411

Full texts attached in the project literature graph.

SWOT

Strengths — perfect fit with the invariant-driven, exhaustively-tested design; a verifiable round-trip is a strong, defensible differentiator; aligns with compression/tokenization wins.
Weaknesses — true bijectivity conflicts with human-readable Latin (readable romanization is inherently lossy); reversible encodings can produce less-natural output; scope must be bounded to scripts where a bijection is feasible.
Opportunities — pairs with the LLM-preprocessing direction (lossless and compact tokens); systematically extend reverse coverage beyond ru/uk/el; a new round-trip invariant strengthens the formal-verification story.
Threats — users may expect readability and reversibility (mutually constraining); maintaining bijective tables across Unicode versions adds upkeep; demand may be niche relative to effort.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestideaOpen-ended extension idea or new use case

Projects

Status
Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions