Introduction
Text embeddings are fundamental to modern natural language processing, serving as the backbone for semantic search, recommendation systems, and Retrieval-Augmented Generation (RAG). While standard training typically relies on Contrastive Learning (InfoNCE loss) to align positive pairs, this approach often falls short on tasks requiring fine-grained nuance, such as Semantic Textual Similarity (STS), or tasks with explicit labels like classification. Piccolo2, developed by SenseTime Research, addresses these limitations through a multi-task hybrid loss strategy and Matryoshka Representation Learning (MRL), establishing a new state-of-the-art (SOTA) for Chinese text embeddings.
Methodology
Multi-Task Hybrid Loss Training
The core innovation of Piccolo2 is its move away from a "one-size-fits-all" training objective. Instead, it employs a tailored loss strategy for different task types:
- Retrieval & Reranking: Utilizes standard InfoNCE with in-batch negatives to optimize for broad document matching.
- STS & Pair Classification: Employs Cosent loss, which is specifically designed to handle fine-grained similarity scores, allowing the model to distinguish between varying degrees of semantic overlap.
- Classification & Clustering: Implements a specialized Label-based Triplet Loss. By mapping documents close to their specific category labels rather than just to other documents in the same category, the model establishes clearer semantic anchors.
Architectural Enhancements
Piccolo2 scales the embedding dimension from the standard 768 to 1792 using a learnable linear layer. To maintain efficiency, the model incorporates Matryoshka Representation Learning (MRL). This technique produces nested embeddings, allowing users to truncate the 1792-dimensional vector down to as few as 256 dimensions with minimal loss in accuracy, significantly reducing storage and compute costs.
Training Data and Evaluation
The model was trained on a comprehensive mixture of approximately 3.7 million supervised samples, including standard benchmarks like MMarco and T2Retrieval, alongside 200k synthetic retrieval pairs generated via a GPT-4 pipeline to ensure domain diversity. Evaluation was conducted on the Chinese Massive Text Embedding Benchmark (CMTEB), spanning 31 datasets across six categories.
Results
Piccolo2 achieved an average score of 70.95 on CMTEB, outperforming significantly larger models. Despite having only 300M parameters, it surpasses 7B-parameter models like gte-Qwen1.5-7B-instruct in overall performance and efficiency.
Ablation Study
Ablation experiments confirm that the hybrid loss strategy is critical to the model's success. Moving from a base retrieval loss ($L_{re}$) to a full hybrid setup ($L_{re} + L_{sts} + L_{cls}$) improved the average score from 68.75 to 70.95. Notably, the inclusion of classification and clustering losses provided a massive +7.45 point boost in clustering tasks, demonstrating that specialized losses enhance the general utility of the embeddings.
Conclusion
Piccolo2 demonstrates that sophisticated multi-task training and flexible representation learning can outperform massive parameter scaling. By treating different semantic tasks with specialized mathematical objectives, Piccolo2 provides a robust, efficient, and highly flexible solution for Chinese text representation.
Summary updated