How AI Understands Language: Visualizing Meaning with Sentence Embeddings
Ray Poynter, 4 November 2025
Have you ever wondered how an AI system, like a search engine or a chatbot, understands that the sentences “A dog chases the ball” and “A canine pursues the sphere” mean approximately the same thing?
Of course, it’s not magic. It’s advanced mathematics, called semantic similarity, and the powerful concept of Sentence Embeddings.
If you are curious, here is a high-level explanation.
The Semantic Space: Mapping Meaning
The key to this technique is the Semantic Space, a high-dimensional conceptual space where every collection of words can be mathematically mapped to a unique location.
An AI model, typically based on a Transformer (the T in GPT), converts each sentence into a single numerical representation called a vector (or embedding). These vectors are essentially coordinates in the semantic space.
The rule of this space is simple: The closer two vectors are, the more similar their meanings are.
An Example with Four Phrases and Their Vectors
Here are four example phrases, and we will see how their meaning dictates their position in this space.
| Phrase | Vector Location (Conceptual) | Core Concept |
| P1: A dog chases the ball | Vector 1 (400 to 1000 coordinates) | Animal chasing object |
| P2: A canine chases the sphere | Vector 2 (400 to 1000 coordinates) | Animal chasing object (Synonyms) |
| P3: The car drove quickly | Vector 3 (400 to 1000 coordinates) | Vehicle/Motion |
| P4: A cat chases the ball | Vector 4 (400 to 1000 coordinates) | Animal chasing object (Different Species) |
Measuring the Difference with Cosine Similarity
Once the sentences are converted into vectors, the system measures the distance between them using Cosine Similarity. This metric calculates the cosine of the angle between two vectors, resulting in a score between -1 (opposite meaning) and 1 (identical meaning).
Let’s visualize the scores for our phrases:
1. High Similarity
When comparing P1 and P2, the AI recognizes that a dog is like a canine and a ball is like a sphere. Since the meaning is nearly identical, the vectors point almost in the exact same direction.
| Comparison | Semantic Relationship | Example Score | Interpretation |
| P1 vs. P2 | Word-for-word Synonyms | ${0.95}$ | Extremely Close—The AI knows these are paraphrases. |
2. Close, but Distinct Similarity
When we introduce P4, the meaning is still within the same conceptual category (“animal activity”), but the subject (cat vs. dog) is a genuine semantic difference. The vector for P4 sits close to the P1 position but is pulled slightly away.
| Comparison | Semantic Relationship | Example Score | Interpretation |
| P4 vs. P1 | Same action/object, different species | ${0.85}$ | Very Similar—A high score, but measurably lower than the paraphrase. |
Comparing any of the “animal” phrases to the “car” phrase shows a massive semantic gap. The vectors point in fundamentally different directions in the semantic space.
| Comparison | Semantic Relationship | Example Score | Interpretation |
| P1 vs. P3 | Animal vs. Machine | ${0.10}$ | Low Similarity—Concepts are unrelated. |
The Relevance for AI Understanding
This simple visualization reveals the power of modern NLP models:
- Context Over Keywords: The AI doesn’t rely on simple keyword overlap (“dog” is not in P2). Instead, it understands the underlying concept, making it robust to variations in phrasing.
- Graduated Meaning: It can distinguish between an almost perfect match (P1 vs. P2), a close conceptual match (P1 vs. P4), and an unrelated concept (P1 vs. P3), assigning an accurate, graduated numerical score for each comparison.
- Real-World Applications: This is the engine behind crucial AI applications like:
- Semantic Search: Finding relevant documents even if the query uses different words.
- Paraphrase Detection: Identifying duplicate content or verifying textual entailment.
- Clustering: Grouping similar user reviews, news articles, or chat transcripts by theme.
By converting sentences into vectors and mapping them into a semantic space, AI moves beyond simple pattern matching to truly grasp the meaning of language.
How do Humans Process Phrases
There seems to be good evidence, from the neuroscientists and fMRI scans that humans do a similar process, creating strings in the brain. See ‘Natural speech reveals the semantic maps that tile human cerebral cortex’, Huth et al, which can be accessed here.

However!
If I were interpreting the meaning of ‘A dog chases the ball’ and ‘A canine chases the sphere’, I would group them closely. But if I were assessing two people and one used the first phrase and the other the second, I would not group them very closely 🙂