# The geometry of meaning: evaluating sentence embeddings from diverse transformer-based models for natural language inference

**Authors:** Mohammed Alsuhaibani

PMC · DOI: 10.7717/peerj-cs.2957 · PeerJ Computer Science · 2025-06-16

## TL;DR

This paper evaluates how different transformer-based models and pooling strategies affect sentence embeddings for natural language inference tasks.

## Contribution

The study introduces a systematic evaluation framework for sentence embeddings in NLI using various pooling techniques and model layers.

## Key findings

- Max pooling with L2 norm across specific layers achieves the best NLI performance.
- BERT, GPT, RoBERTa, and XLNet show varying effectiveness in generating sentence embeddings.
- The model achieved 90% accuracy on SNLI and 84% F1-score on MedNLI datasets.

## Abstract

Natural language inference (NLI) is a fundamental task in natural language processing that focuses on determining the relationship between pairs of sentences. In this article, we present a simple and straightforward approach to evaluate the effectiveness of various transformer-based models such as bidirectional encoder representations from transformers (BERT), Generative Pre-trained Transformer (GPT), robustly optimized BERT approach (RoBERTa), and XLNet in generating sentence embeddings for NLI. We conduct comprehensive experiments with different pooling techniques and evaluate the embeddings using different norms across multiple layers of each model. Our results demonstrate that the choice of pooling strategy, norm, and model layer significantly impacts the performance of NLI, with the best results achieved using max pooling and the L2 norm across specific model layers. On the Stanford Natural Language Inference (SNLI) dataset, the model reached 90% accuracy and 86% F1-score, while on the MedNLI dataset, the highest F1-score recorded was 84%. This article provides insights into how different models and evaluation strategies can be effectively combined to improve the understanding and classification of sentence relationships in NLI tasks.

## Full-text entities

- **Diseases:** NLI (MESH:D007806)
- **Species:** Homo sapiens (human, species) [taxon 9606]

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/PMC12193426/full.md

## Figures

5 figures with captions in the complete paper: https://tomesphere.com/paper/PMC12193426/full.md

## References

39 references — full list in the complete paper: https://tomesphere.com/paper/PMC12193426/full.md

---
Source: https://tomesphere.com/paper/PMC12193426