8 min read

Text Embedding Model Evaluation: Semantic Discrimination Performance

Text Embedding Model Evaluation: Semantic Discrimination Performance
Photo by Andreas Fickl / Unsplash

Executive Summary

We evaluated six embedding models using the sentence-transformers framework to assess their semantic discrimination capabilities across 50+ test cases. Using all-MiniLM-L6-v2 as our baseline, we identified BGE-M3 as the optimal choice. BGE-M3 consistently distinguished between semantically similar and dissimilar content, showing an average 8.1 percentage point gap between relevant and irrelevant similarity scores, with 100% reliability in ranking relevant content higher than irrelevant content across all test cases. Our study revealed inherent challenges in embedding-based similarity measurement, particularly the compressed similarity ranges (60-90%) that require score scaling for practical applications.

Methodology

Technical Framework

Our evaluation utilized the sentence-transformers library as the core framework, deployed through a custom FastAPI embedding service with Docker containerization for model isolation. We deliberately chose a pure embedding-based semantic matching approach, avoiding the hybrid BM25+embedding methods commonly used in search applications.

This decision was driven by domain-specific challenges we encountered. Classical keyword matching introduces excessive false positives in noisy signal environments, while domain-specific language requires semantic understanding that goes beyond exact matches. Additionally, user query patterns typically involve natural language descriptions that don't align well with professional terminology, making pure semantic matching more appropriate for our use case.

Understanding Model Limitations

While embedding models utilize transformer architecture, they remain significantly smaller than commercial large language models, ranging from 22M to 560M parameters compared to 175B+ for LLMs. This size difference translates to limited semantic discrimination power compared to LLM reasoning capabilities, along with inherent model biases that affect nuanced semantic understanding.

We made a conscious trade-off, prioritizing efficiency in terms of speed and cost over perfect accuracy for search applications requiring real-time performance. This approach acknowledges that while embedding models may not achieve LLM-level understanding, they provide sufficient capability for practical search scenarios.

Test Framework Design

Our evaluation framework included 50 systematic test cases distributed across 20 categories, with each case involving a 3-way similarity analysis comparing Query↔Similar, Query↔Dissimilar, and Similar↔Dissimilar relationships. We conducted two distinct test types: overall discrimination assessment and terminology recognition evaluation.

The discrimination score serves as our primary metric, calculated as the difference between similarity to relevant items versus similarity to irrelevant items. For example, if a query matches similar items at 78% similarity and dissimilar items at 72% similarity, the discrimination score would be 6%. Higher values indicate better semantic understanding, while standard deviation across test cases reveals consistency in performance.

Model Evaluation Results

Baseline Models: The Foundation

We began with all-MiniLM-L6-v2 [1] as our initial baseline, a compact 22M parameter model with 384 dimensions and 256 token context. This model demonstrated poor discrimination in domain-specific scenarios, struggling to distinguish between semantically different categories, which motivated our search for more capable alternatives.

The BGE-Base model (BAAI/bge-base-en-v1.5) [2] served as our improved baseline, offering 109M parameters with 768 dimensions and 512 token context. This represented a significant step up in capability while maintaining sentence-transformers compatibility. BGE-Large [3] extended this architecture further with 335M parameters and 1024 dimensions, providing the scaled version we needed to assess the impact of model size on discrimination performance.

The Winner: BGE-M3

BGE-M3 [4] emerged as our optimal choice, featuring 560M parameters, 1024 dimensions, and an impressive 8192 token context window. This model achieved exceptional performance with 8.1% ± 2.9% discrimination in overall testing, demonstrating 100% positive discrimination across all 50 test cases. Remarkably, 82% of cases showed greater than 5% discrimination, with similarity patterns showing Query↔Similar at 75.8% and Query↔Dissimilar at 67.8%.

In terminology recognition testing, BGE-M3 maintained strong performance with 6.2% ± 2.9% discrimination and 98% positive discrimination rate across 49 of 50 cases. While 60% of cases achieved greater than 5% discrimination, we observed a cross-practice issue where T1-T2 similarity (78.3%) exceeded Q-T1 (75.6%) by 3.9%, indicating some challenges in maintaining proper semantic boundaries across different practice areas.

BGE-M3 Performance Overall Discrimination Terminology Recognition
Average Score 8.1% ± 2.9% 6.2% ± 2.9%
Positive Rate 100% (50/50) 98% (49/50)
Strong Cases (>5%) 82% 60%

Alternative Approaches: Lessons Learned

The Instructor-Large model (hkunlp/instructor-large) [5] represented our exploration of instruction-based architectures. Despite its 340M parameters and true instruction-first design, this model delivered poor performance with only 2.49% discrimination. The fundamental issue was extremely high baseline similarities in the 95%+ range, providing minimal separation between relevant and irrelevant content.

Our domain-specialized model, fine-tuned specifically for our use case, provided the most surprising results. This ~340M parameter model achieved only 1.8% ± 4.8% discrimination with merely 64% positive discrimination rate across 32 of 50 cases. The remaining 36% showed reverse discrimination, where the model actually rated dissimilar items as more similar than similar ones. This represents a 4.5x performance degradation compared to general-purpose models, demonstrating that over-specialization can destroy discriminative capability.

Interestingly, the domain-specialized model showed one advantage in terminology recognition testing, achieving +4.0% cross-practice structure compared to BGE-M3's -3.9%, but this single benefit was overshadowed by its overall poor performance with only 60% positive discrimination rate.

Critical Discovery: The Instruction Problem

Our analysis revealed a concerning pattern with instruction-based approaches for short discriminative texts. While our testing was limited (n=2 models with comprehensive instruction support), every model we tested showed significant performance degradation when instructions were added, regardless of their underlying architecture or supposed instruction compatibility.

BGE-Base similarity increased from 80.12% to 89.89% with instructions, representing a 9.77% degradation. BGE-Large showed similar patterns, jumping from 82.72% to 91.54% (8.82% worse), while BGE-M3 increased from 77.51% to 87.58% (10.07% worse). This pattern held consistently across tested models, suggesting a fundamental architectural limitation, though more extensive testing would be needed to confirm universality.

Model Without Instructions With Instructions Performance Impact
BGE-Base 80.12% 89.89% +9.77% worse
BGE-Large 82.72% 91.54% +8.82% worse
BGE-M3 77.51% 87.58% +10.07% worse

The root cause appears to be a token proportion effect where instructions (typically 10-20 tokens) dominate short professional profiles (100-200 tokens), creating semantic saturation. When identical instructions are prepended to all profiles, they increase cross-similarity between otherwise distinct content. Even models designed with "native instruction support" couldn't overcome this fundamental issue, leading us to conclude that instructions are counterproductive for short discriminative text tasks regardless of model architecture.

Performance Testing Results

We conducted comprehensive performance testing using 10 concurrent users in a development environment with AMD CPU infrastructure, 8GB RAM allocation, and Docker containerization running 4 worker processes with resource constraints. The testing involved realistic query patterns over extended duration to assess both performance and reliability characteristics.

The system demonstrated solid performance metrics with an average response time of 2.3 seconds and 95th percentile latency of 6.07 seconds, comfortably under our 10-second threshold for batch processing scenarios. The 90th percentile came in at 5.15 seconds, while maintaining a perfect 0% failure rate and achieving 3.19 requests per second throughput.

System reliability proved excellent across 773 total requests, transferring 29MB received and 975KB sent with a 100% success rate across all 1546 checks. These results represent development environment performance using CPU infrastructure, and we expect significantly better performance in production GPU deployments. The current setup effectively handles 10 concurrent users, though horizontal scaling will be necessary for production loads.

Key Findings and Implications

The Pure Embedding Success Story

Despite deliberately avoiding BM25 coupling, our pure embedding approach achieved acceptable semantic discrimination for noisy domain environments. This validates the approach for scenarios where keyword matching introduces too much noise and semantic understanding becomes crucial for quality results.

Model Evolution Patterns

The clear progression from all-MiniLM-L6-v2 through BGE-Base and BGE-Large to BGE-M3 demonstrated consistent performance improvements correlating with model size and sophistication. Larger models provided better semantic discrimination while remaining orders of magnitude smaller than commercial LLMs, representing practical sweet spots for production deployment.

The Specialization Paradox

Perhaps our most counterintuitive finding was that fine-tuned domain models performed 4.5x worse than general-purpose models. While this could indicate that over-specialization destroys broad discriminative capabilities, it's equally possible that the specific domain model we tested was simply poorly trained or inadequately optimized for our use case. This finding warrants careful interpretation rather than blanket dismissal of domain-specific approaches.

Universal Instruction Harm

Every model tested showed degraded performance with instructions, making this a critical architectural consideration for production deployments. This finding challenges common assumptions about instruction-tuned models and highlights the importance of understanding token proportion effects in short-text scenarios.

The Similarity Compression Challenge

All similarities compressed into a 60-90% range, representing a fundamental limitation of embedding-based approaches that requires careful handling in production systems. This compression makes raw similarity scores less interpretable and necessitates normalization strategies to provide meaningful user experiences.

Production Implementation Strategy

Score Scaling Requirements

Raw similarity scores typically fall within a compressed 60-90% range, which we transform to a more intuitive 40-95% display range using min-max normalization per query. This transformation makes the 8.1% discrimination meaningful as percentage differences that users can interpret effectively.

Industry Note: Score rescaling is a common practice across the industry. Major search providers use confidence scores rather than raw similarity percentages. Vector database platforms like Elasticsearch, Pinecone, and Weaviate provide score normalization options in their query interfaces. Companies like Netflix have developed sophisticated heuristics based on empirical data, using percentile-based scoring and dynamic thresholds that adapt to content type and user behavior patterns, acknowledging that raw embedding similarities rarely provide intuitive user experiences without post-processing.

Performance and Scaling Considerations

Development environment testing with CPU infrastructure (AMD, 8GB RAM, 4 workers) showed 2.3s average response time with 6.07s 95th percentile latency. Production GPU deployment using NVIDIA A100 or similar instances should deliver 5-10x latency improvements, potentially achieving sub-500ms response times, while horizontal scaling will be necessary for high-concurrency scenarios. The current architecture demonstrates excellent reliability with 0% failure rates across comprehensive testing.

Recommendations

Our evaluation leads to six key recommendations for production implementation:

• Deploy BGE-M3 without instructions using the sentence-transformers framework to maximize semantic discrimination while maintaining operational efficiency

• Implement score amplification using standard normalization techniques to make similarity differences meaningful to users

• Adopt ranking-based approaches rather than relying on absolute similarity thresholds, which helps mitigate the compression effects inherent in embedding similarities

• Plan GPU infrastructure for production deployment (NVIDIA A100 or V100 instances) to achieve acceptable latency for real-time applications with expected 5-10x performance improvements

• Monitor semantic limitations and consider lightweight LLM fallback mechanisms for edge cases where embedding discrimination proves insufficient - such as using smaller, faster models like Claude Haiku or GPT-3.5-turbo for cost-efficient query reformulation or disambiguation rather than full semantic analysis

• Approach domain-specialized models with caution - while they can work in principle, avoid blindly pursuing fine-tuning or domain-specific adaptation unless there is clear evidence for improvement, as modern general-purpose models are exceptionally well-generalized across domains even without specialized training

Conclusion

Pure embedding approaches using sentence-transformers can achieve acceptable semantic discrimination for search applications despite inherent limitations compared to large language models. BGE-M3 without instructions provides the optimal balance of semantic understanding and operational efficiency, with 8.1% average discrimination representing meaningful semantic separation after score transformation.

The 560M parameter model represents a practical sweet spot between capability and resource requirements, significantly outperforming both smaller general models and larger specialized variants. This evaluation demonstrates that careful model selection and configuration can deliver production-ready semantic search capabilities while maintaining reasonable computational requirements.

Our findings challenge several common assumptions about embedding model deployment, particularly regarding the value of domain specialization and instruction-based approaches. While domain-specific models can theoretically provide benefits, modern general-purpose models demonstrate remarkable cross-domain generalization capabilities that often eliminate the need for specialized training. The results provide a clear path forward for organizations seeking to implement effective semantic search systems using current embedding technology.

References