From Matching to Generation: Learning Hierarchical Semantic Motion IDs for Generative Text-to-Motion Retrieval

Yizhou Chen, Guangtao Lyu, Chenghao Xu, Jiexi Yan, Yanhua YangarXiv 2026

TL;DR

Finding a specific 3D human motion in a massive database using text usually means compressing both into single vectors and measuring cosine similarity—a blunt approach that blurs fine movement details and slows down as databases grow. HiMoID flips the script from matching to generation: it assigns every motion a hierarchical, Dewey-Decimal-style "Semantic ID" and trains a sequence model to generate the right ID directly from your text prompt. The result is sharper fine-grained retrieval and constant-time search speeds, even across hundreds of thousands of motions.

What Problem Does This Paper Address?

Suppose you’re animating a game and search a motion capture gallery for "a person squats down to pick up a box." Standard embedding-based retrieval encodes your text and every motion in the database independently into fixed-size vectors, ranking them via a single dot product. Because the text and motion don't deeply interact during matching, subtle physical distinctions—like squatting with the knees versus bending at the waist—often get lost in translation. Plus, scoring a query against millions of candidates exhaustively becomes a major bottleneck.

Figure 1. Comparison of text-to-motion retrieval paradigms. (a) Embedding-based retrieval ranks motions by text–motion similarity in a shared embedding space. (b) Our generative retrieval combines hierarchical semantic IDs with retrieval-oriented generation supervision.

Generative retrieval offers an intriguing alternative: represent every database item as a short sequence of discrete tokens (a Semantic ID) and train an autoregressive language model to generate relevant IDs token-by-token. However, bringing this to human motion hits two roadblocks:

  1. The Representation Trap: Standard vector quantization groups globally similar items, obscuring local pose and timing differences, and doesn't guarantee that closely related motions share ID prefixes in a neat coarse-to-fine hierarchy.
  2. The Ranking Mismatch: Standard autoregressive cross-entropy trains the generator to maximize the probability of one ground-truth ID, leaving it clueless about how to rank near-misses or alternative valid motions.

Methods

HiMoID solves these two challenges in a clean, two-stage pipeline, backed by standard backbones (MoMask for motion, DistilBERT for text alignment, and T5-base for generation).

Figure 2. Overview of the proposed HiMoID. Stage 1 learns semantic IDs through reconstruction-guided motion quantization and semantic similarity-guided prefix organization. Stage 2 combines quantization proximity with query-branch semantic compatibility to construct target probabilities and trains an autoregressive generator with cross-entropy and tree-Wasserstein supervision. At inference, gallery motions are indexed offline, and queries retrieve motions via trie-constrained semantic ID generation and index lookup.

Stage 1: Hierarchical Semantic Motion Quantization
Using standard Residual Quantization (RQ), each motion is compressed into a 3-token ID (256 codewords per level). What’s new is how those tokens are shaped:

  • Reconstruction-Guided Quantization: Alongside standard text-motion contrastive alignment, a decoder must reconstruct the full motion sequence and local joint positions from the quantized vector. This forces the discrete IDs to retain fine physical nuances rather than just coarse text semantics.
  • Semantic Similarity-Guided Prefix Organization (SPO): Using caption similarities from a text teacher, the authors supervise how early or late two motion IDs diverge. Motions doing the same broad action share early tokens (e.g., [105, 238, ...]), leaving the final token free to capture posture variations.

Stage 2: Retrieval-Oriented Semantic ID Generation
With IDs frozen into a prefix tree (trie), T5-base learns to translate text queries into IDs. Instead of relying solely on single-target cross-entropy, the authors introduce Tree-Structured Distribution Supervision:

  • They build soft, query-conditioned probability targets across branches of the tree—rewarding sibling branches that are both close in motion space and semantically compatible with the prompt.
  • They apply a tree-Wasserstein loss (L_TW), which measures earth-mover's distance along the ID tree. Putting probability mass on a motion that diverges at token 1 incurs a much heavier penalty than confusing two variations that only differ at token 3.

At inference, trie-constrained beam search ensures the generator only outputs valid gallery IDs, looking up motions in an offline index without scanning the database.

Datasets

The authors evaluate HiMoID on two standard public 3D motion-language benchmarks (no new datasets are introduced):

  • HumanML3D: 23,384 training, 1,460 validation, and 4,380 test motions.
  • KIT-ML: 4,888 training, 300 validation, and 830 test motions.

Key Insights and Ideas

  • Reconstruction and prefix supervision play tug-of-war in a good way: Left alone, full-motion reconstruction reduces prefix sharing across the board because it pushes the quantizer to separate distinct physical executions. Adding SPO pulls semantically related motions back together at shallow tree depths—giving you an organized hierarchy without sacrificing pose detail.
  • Where you make a mistake matters: Standard token-level cross-entropy treats all wrong tokens equally. Supervising the generator with tree-Wasserstein distance teaches it the geometry of the database, turning an autoregressive text model into a calibrated hierarchical ranker.
  • Search speed decouples from gallery size: Because online decoding only traverses a fixed-depth prefix tree with a fixed beam width (20), retrieval latency stays virtually flat no matter how many motions you index.
Figure 3. Online retrieval throughput on HumanML3D as the can- didate pool grows from 100K to 850K motions.

Key Results

  • State-of-the-Art Recall: HiMoID beats all prior embedding-based methods across every metric. On HumanML3D, it reaches 14.73% R@1 and 51.10% R@10 (surpassing WaMo at 14.02% R@1 and PST at 48.22% R@10). On KIT-ML, it hits 19.52% R@1 and 60.12% R@10.
  • Constant-Time Scalability: As an expanded HumanML3D gallery grows from 100K to 850K candidates, a strong embedding baseline (SGAR) plummets from 40.19 to 5.67 queries per second (QPS). HiMoID holds steady at ~14.6 QPS throughout—roughly 2.6× faster at 850K motions.
  • Intuitive Prefix Trees: Qualitative results confirm the hierarchy works as advertised. For instance, squatting to pick up a box gets ID [105, 238, 133], while bending at the waist to pick something up gets [105, 238, 25].
Qualitative retrieval examples showing shared prefixes for related motions

Limitations and Future Work

While there is no dedicated "Limitations" section, the authors surface two clear operational trade-offs in their analysis:

  • ID Collisions: Residual quantization doesn't guarantee unique IDs—8.6% of HumanML3D test motions share an ID with another motion. While 69.5% of these buckets are benign (matching identical captions), non-identical motions in the same bucket fall back to an arbitrary, fixed gallery-index order.
  • Depth Bottlenecks: Increasing quantization depth beyond L = 3 tokens actually hurts recall (dropping R@1 from 14.73% at L=3 to 13.61% at L=6), as longer sequences compound autoregressive decoding errors.

Future directions are not explicitly discussed in the paper.

Summary updated

BibTeX
@misc{chen2026from,
  author = {Yizhou Chen and Guangtao Lyu and Chenghao Xu and Jiexi Yan and Yanhua Yang},
  title = {{From Matching to Generation: Learning Hierarchical Semantic Motion IDs for Generative Text-to-Motion Retrieval}},
  year = {2026},
  eprint = {2611.36827},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.36827},
}
Figure