Basics ยท Inside LEAF Multi-Task Distillation ยท MRL & Binary Quantization

Matryoshka Truncation & 1-Bit Binary Compression Lab

MongoDB's mdbr-leaf-mt model card highlights two compression superpowers inherited during LEAF distillation: MRL prefix truncation (384d โ†’ 256d โ†’ 128d โ†’ 64d) and vector quantization (int8 4ร— and 1-bit binary Hamming 32ร—). Measure live retention on your device in a single worker forward pass.

1. Configure evaluation corpus

2. Compression retention & storage trade-off

Pos/Neg margin by representation

Live compression benchmark

Live MRL truncation, scalar int8, and 1-bit binary quantization metrics
Format Bytes/vec Ratio Top-1 Margin Rank ฯ
Run the probe above to measure live MRL and binary compression.

Per-sentence L2 norm, WordPiece token count & binary bit agreement

Token count, L2 norm, float32 cosine, and 1-bit binary Hamming match per sentence
Sentence Tokens L2 norm 384-d cos 64-d MRL cos 1-bit bit match
Waiting for live forward passโ€ฆ

Show the code

Show the code: Matryoshka truncation + L2 renormalization (mt-core.mjs)
Show the code: MRL + int8 + 1-bit binary curve evaluation (mt-core.mjs)