MoSE: Hierarchical Self-Distillation Enhances Early Layer Embeddings

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Gurioli, Andrea, Pennino, Federico, Monteiro, João, Gabbrielli, Maurizio
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866908783891972096
author Gurioli, Andrea
Pennino, Federico
Monteiro, João
Gabbrielli, Maurizio
author_facet Gurioli, Andrea
Pennino, Federico
Monteiro, João
Gabbrielli, Maurizio
contents Deploying language models often requires navigating accuracy vs. performance trade-offs to meet latency constraints while preserving utility. Traditional model distillation reduces size but incurs substantial costs through training separate models. We introduce ModularStarEncoder (MoSE), a 1-billion-parameter multi-exit encoder for code retrieval and classification that employs a novel Self-Distillation mechanism. This approach significantly enhances lower-layer representations, enabling flexible deployment of different model portions with favorable performance trade-offs. Our architecture improves text-to-code and code-to-code search by targeting specific encoder layers as exit heads, where higher layers guide earlier ones during training, thereby improving intermediate representations at minimal additional cost. We further enhance MoSE with a repository-level contextual loss that maximizes training context window utilization. Additionally, we release a new dataset created through code translation that extends text-to-code benchmarks with cross-language code-to-code pairs. Evaluations demonstrate the effectiveness of Self-Distillation as a principled approach to trading inference cost for accuracy across various code understanding tasks.
format Preprint
id arxiv_https___arxiv_org_abs_2503_03008
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle MoSE: Hierarchical Self-Distillation Enhances Early Layer Embeddings
Gurioli, Andrea
Pennino, Federico
Monteiro, João
Gabbrielli, Maurizio
Computation and Language
Artificial Intelligence
Programming Languages
Software Engineering
Deploying language models often requires navigating accuracy vs. performance trade-offs to meet latency constraints while preserving utility. Traditional model distillation reduces size but incurs substantial costs through training separate models. We introduce ModularStarEncoder (MoSE), a 1-billion-parameter multi-exit encoder for code retrieval and classification that employs a novel Self-Distillation mechanism. This approach significantly enhances lower-layer representations, enabling flexible deployment of different model portions with favorable performance trade-offs. Our architecture improves text-to-code and code-to-code search by targeting specific encoder layers as exit heads, where higher layers guide earlier ones during training, thereby improving intermediate representations at minimal additional cost. We further enhance MoSE with a repository-level contextual loss that maximizes training context window utilization. Additionally, we release a new dataset created through code translation that extends text-to-code benchmarks with cross-language code-to-code pairs. Evaluations demonstrate the effectiveness of Self-Distillation as a principled approach to trading inference cost for accuracy across various code understanding tasks.
title MoSE: Hierarchical Self-Distillation Enhances Early Layer Embeddings
topic Computation and Language
Artificial Intelligence
Programming Languages
Software Engineering
url https://arxiv.org/abs/2503.03008