1 Introduction
In my previous articles about RAG and knowledge bases, a word often appears—Vector, and it can be said that vectors are one of the core concepts of AI. Anyone who has had some contact with AI is probably no stranger to this term.
In fact, even if it weren't for AI, everyone should be familiar with vectors: in school, teachers might have asked you to draw arrows, write coordinates, or calculate length and direction in geometry problems. That's right, the vectors mentioned in AI actually mean the same thing as the mathematical concept in our memory:It is essentially a set of numbers, just with more dimensions and wider application scenarios.
So, why are vectors so important in AI? The reason is simple—computers cannot directly understand human vocabulary; they only see numbers and symbols. For example, the word “apple” has a specific meaning and image for us, but for a computer, it is just a string of characters. In order for computers to understand, process, and even find relationships between different objects, a bridge is needed, and this bridge is the vector.
In the world of AI, every piece of text, every word, and even an image or a piece of music can be represented by a vector. Vectors convert abstract things into “points” in the digital world, allowing computers to perform calculations and comparisons in this space, thereby understanding their relationships. This is exactly why vectors are the underlying core in scenarios like RAG, knowledge base retrieval, and recommendation systems: without vectors, it is difficult for AI to convert our language, images, and sounds into actionable information.
So in the following content, I will slowly unpack the concept of vectors, see what they actually are, what they can do, and why they are so indispensable. No formulas or profound theories are needed; with just an easy understanding, you can master a core underlying logic of the AI world.
2 What exactly is a vector?
In fact, you can completely understand vectors as the“universal language”in the AI world. Humans say “apple” and “banana,” but computers don't understand these words at all; they only see numbers. Therefore, we assign a digital coordinate to every word, every sentence, and even an image or a piece of music, just like marking points on a map.
To give an intuitive example:
- In a two-dimensional space, a point can be represented by (x, y), such as (3, 4). This is like marking a location on a flat map.
- If it is a three-dimensional space, there is an additional z-coordinate, such as (3, 4, 5), like marking a point in a three-dimensional room.

AI's vectors just pull the dimensions much higher—there could be 128 dimensions, 512 dimensions, or even thousands of dimensions—where each dimension is a number representing a feature direction. It sounds complex, but the logic is exactly the same as two-dimensional and three-dimensional spaces: each number is a coordinate axis, and you are simply finding a point across more dimensions.
How do we understand these high dimensions? You can imagine: 2D is like a point on a map, 3D is like a point in a room, and high-dimensional is like being in a massive warehouse where every direction represents a feature. You cannot see these dimensions, but every single dimension is meaningful, such as color, shape, style, emotion, and so on. Vectors use numbers to mark all these features, allowing computers to find the position of each object in a high-dimensional space.
So, how does AI determine whether the semantics of human words corresponding to different vectors are similar? The principle is actually very intuitive: AI calculates the “distance” or “angle” between two vectors, and vectors that are closer together represent more similar semantics. For example, the vector distance between “apple” and “banana” is very close, while the vector distance between “apple” and “television” is very far.
What is the use of this judgment? There are plenty of scenarios:
- Semantic Retrieval: When you search for a word, AI can find the content closest to it in the vector space, rather than just matching the exact same words.
- Recommendation Systems: If you like a certain song, AI can find the songs closest to it in the vector space to recommend to you.
- Clustering and Classification: AI can group similar content together based on vector distance, making it easier to understand and process large-scale information.
To use a real-life analogy, when you go to the supermarket to buy fruit and walk to the fruit section, you will see apples, oranges, and bananas next to each other. This means their distance in the“fruit space”is very close. Meanwhile, refrigerators and rice cookers are in the appliance section, far away from the fruit section. Vectors allow computers to draw this kind of “mall map” on their own in the semantic world, helping them distinguish between different categories of things.
Let's look at another interesting example: imagine you have a bunch of playlists, such as pop, rock, and classical, and you want AI to recommend songs you might like. If the songs are not turned into vectors, AI has no idea about the relationship between “the song you like” and “that song next door.” Once the songs are represented by vectors, AI can directly find neighbors based on distance—the one closest to the song you like is the next song it thinks you might like.
The power of vectors doesn't stop there; you can even do“arithmetic”in the vector space: for example, using “King - Man + Woman” to get “Queen.” It sounds like magic, but it is actually just a clever calculation of vectors in a high-dimensional space: by making a “directional shift” in the digital world, you can get a new semantic point.
In short, vectors are the underlying language of AI in the semantic world, enabling AI to “understand” text, images, sounds, and even your preferences. By understanding vectors, you have basically mastered a core map of the AI world.
3 How do vectors make AI smart?
1 Semantic Search: AI's searching by meaning
When people usually search for things on Baidu, Google, or Taobao, it is actually a type of search. But traditional search has an obvious limitation: it only “matches literally.” For example, if you type “cat” in the search box, it will find all web pages, products, and posts containing the word “cat”—but if a certain web page only writes “meow star citizen” (kitty) or “cute pet,” traditional search might not necessarily catch it.
This is the biggest problem with keyword search:It can only look at the literal words, not understand the semantics。
So how does AI solve this? The answer is vectors. AI first converts every word and every sentence into a vector and puts them into a “semantic space”:

This way, when you search for “cute animals”, AI doesn't just foolishly look for the word “animals”, but goes into the semantic space to find the points closest to the vector of “cute animals”. As a result, “kittens”, “puppies”, and “chicks” might all be found:

This is what is called Semantic Search, which can also be called “searching meaning by meaning”. Imagine: traditional search = stubbornly sticking to the keyword catalog on a bookshelf; vector search = asking a clerk in a bookstore: “I'm looking for some light and interesting novels,” and the clerk immediately takes you to the shelves of Haruki Murakami and Keigo Higashino. Isn't that much smarter?
This capability is precisely the underlying support for current AI technologies like RAG (Retrieval-Augmented Generation). ChatGPT's ability to find answers for you from a knowledge base relies on “semantic search”, rather than “obsessing over keywords”.
2 Recommendation Systems: Finding the “neighbors” you are most likely to like”
In addition to search, vectors have another application that everyone encounters daily but might not have noticed—Recommendation SystemsHave you ever had an experience like this:
- You listened to a song on NetEase Cloud Music, and the next few recommended songs actually suited your taste perfectly;
- You swiped to a funny video on Douyin, and sliding down revealed a whole bunch of the same type;
- You bought a cup on Taobao, and it immediately recommended a thermos, a tea canister, a desktop storage box...
It looks like AI is “mind-reading”, but what is actually working behind the scenes is vectors. The logic is actually very simple: every song, every video, and every product can be converted into a vector; the songs you've listened to, the videos you've watched, and the products you've bought also have corresponding vectors. In a high-dimensional semantic space, these vectors will naturally “group themselves”—similar to how interests and categories are automatically classified: athletes“ vectors will be close to each other, animals” vectors will cluster together, and movies, music, and products will each form their own clusters. This way, when AI wants to recommend content to you, it doesn't need to “know what you like”, it just needs to find the nearest neighbors to your existing vectors to accurately recommend related content. You can imagine that a vector is like putting a "digital label" on everything in the semantic space; the closer the distance, the higher the relevance:

What the recommendation system needs to do is, in this massive “vector space”, help you findthe nearest neighbors to the vectors you like:

To use another analogy: in your circle of friends, the people you find easiest to chat with are often those with a closer “interest distance”. In the vector space, AI does the same thing, simply looking for “neighbors”. For example, if you listen to Jay Chou's “Common Jasmine Orange”, AI finds that in the "pop music space", its neighbors are JJ Lin, Mayday, and Stefanie Sun. Thus, their songs appear in your recommendation list.
This is where vectors make AI smart: it doesn't need to hardcode something like “liking Jay Chou = liking JJ Lin”, but instead relies on calculating the “distance” in semantics to dynamically find what you are most likely to like.
3 Multimodal Understanding: Text, images, and audio can all fit into the same “space”
Search and recommendation are already very intuitive, but the power of vectors goes far beyond this. It also allows AI to cross different types of data to achieve what we usually call “multimodal understanding”. What does this mean?
In the human world, our communication is multi-sensory: we can speak (text), hear sounds (audio), and see images (visual). But for computers, these are completely different forms of raw data: text is characters, sound is waveforms, and images are pixel matrices. They are inherently incompatible.
So how can AI put these different types of information “into the same brain”? The answer is still vectors.
AI converts images, text, and audio into vectors and throws them into the same semantic space:

This way, they can be directly compared and connected. Here are a few intuitive examples:
- Image-to-image search: You upload a photo of a cat, and AI doesn't need to know whether it's a JPG or PNG; instead, it converts it into a vector and then goes into the semantic space to find the “nearest neighbors”. As a result, it can help you find “photos of cats” or even “stuffed animals that look like cats”.
- Automatic image pairing: If you write “walking on the beach under the sunset”, AI can find images in the vector space that are semantically close to this sentence, thereby automatically pairing the article with appropriate illustrations.
- Speech recognition + understanding: A segment of speech is first converted into a vector and then aligned with the text vector, so that the content of the speech can correspond to the meaning of the text.
In other words, vectors are the “translators” between different modalities. They allow data like text, images, and sounds, which originally “did not speak the same language”, to finally converse in the same space.
With this, AI can master complex applications such as image-text generation, voice assistants, and video recommendations.
4 AI's “analogy and reasoning” tricks
Vectors can be used not only to “measure distance” but also to perform some mind-blowing calculations. Remember the classic example mentioned earlier: King - Man + Woman = Queen?
This is not mysticism, but a mathematical result in the vector space. Why is this? Because during the training process, the vectors learned by AI are not just “isolated points”, but carry semantic directions. For example: “Man → Woman” represents a change in gender; “King → Queen” is the same change.
So when you do subtraction + additionin the vector space, you are essentially “moving along the same semantic direction”. Thus, you naturally get the point “Queen”:

The magic of this kind of calculation lies in:It gives AI a certain ability for analogy and reasoningTo give a few more lighthearted examples: “Paris - France + Japan ≈ Tokyo”, “iPhone - Apple + Samsung ≈ Galaxy”, “Programmer - Day + Night ≈ Person who stays up late coding” ~.
Of course, the last one is a joke, but it illustrates a fact:Vectors can not only represent semantics, but also make the relationships between semantics “computable”。
This is why vectors are called the “underlying language” of AI: they not only help AI store and retrieve knowledge, but also allow AI to play with logic and reasoning to some extent.
5 Summary: Vectors — AI's coordinate system of thought
Through the previous four sections, we can see that vectors are not just collections of numbers; they are more like AI's coordinate system of thought。
- In semantic search, vectors let AI “search meaning by meaning”, no longer staring at literal words, but understanding the meaning;
- In recommendation systems, they help AI find the “neighbors” you are most likely to like, making content delivery more precise;
- In multimodal understanding, different types of data can enter the same space, enabling cross-modal comparison and matching;
- In vector operations, semantic relationships can be calculated just like arithmetic, giving AI analogy and reasoning capabilities.
Simply put, vectors turn messy, complex, and hard-to-process information into computable, comparable, and inferable pointsIt transforms AI from a “digital machine that cannot understand the world” into an intelligent system capable of understanding, recommending, and analogizing in semantic space.
Once you understand vectors, you have basically mastered the underlying logic behind AI capabilities. This not only helps you understand how tools like ChatGPT, RAG, and knowledge bases work, but also lays a solid foundation for exploring various AI applications in the future.
4 Applications of vectors in Retrieval-Augmented Generation (RAG)
1 A brief review of RAG basic theory
Previously, I have introduced the core concepts and processes of RAG (see article:Home Data Center Series: Understanding RAG from Scratch (Part 1): Principles and Complete Process Analysis), and have done hands-on knowledge base practice using Chatbox and Ollama, building my own embedding model and completing the GPT model's retrieval of knowledge base content (see article:Home Data Center Series: Building Your Own Embedding Model with Ollama + Chatbox Knowledge Base Hands-on Practice). This chapter will not repeat the operational details, but rather aims to build on this foundation to further understand the core role of vectors in knowledge-augmented generation, as well as how to optimize and expand them to truly bring the knowledge base to life.
Overall, the core logic of RAG (Retrieval-Augmented Generation) is actually very straightforward:Prepare in advance, find when needed, then generate:
- Prepare in advance: Vectorize the content in the knowledge base through an embedding model and store it in a vector database. The benefit of vectorization is that AI does not need to understand the original text; it only needs to compare coordinates in digital space to determine the similarity between contents.
- Find when needed: When a question is asked, AI does not search through the knowledge base line by line, but instead directly finds the coordinate point in the vector space that is “closest” to the question, which is the most relevant knowledge fragment.
- Then generate: Feed the retrieved content to the generative model to let it output natural, coherent, and context-appropriate answers. This step is like integrating scattered materials into a complete article or recommendation.
To use an everyday analogy: imagine you have already built your own knowledge index in a library, where every article and every paragraph of text is marked with coordinates (vectors):
- When you ask a question, AI doesn't need to flip through the entire book anymore, but instead directly finds the “coordinate point” closest to you in the vector space, which is the most relevant content.
- Afterwards, the generative model integrates the answer based on this content, just like a librarian compiling the most relevant book excerpts and reference materials into a naturally readable recommendation.
It can be understood this way: vectors are like giving each book and paragraph of text a “digital positioning,” allowing AI to quickly find “the point you want” in the ocean of knowledge, while also understanding the relationships between these points to generate logical and organized answers.
2 The practical role of vectors in Chatbox/Ollama knowledge bases
In the previous section, we discussed the core logic of RAG, and the core of all this is vectors. Simply put, vectors are like AI's “compass,” helping it find the most relevant information in the ocean of knowledge. Without vectors, AI is like a librarian without a map, making finding information slow and error-prone.
In the Chatbox and Ollama knowledge base hands-on practice, vectors mainly have several “obvious” roles:
- Helping AI quickly find the most relevant content
- You cut the article into small paragraphs, and generate a vector for each paragraph, just like each paragraph of text has its own coordinates in the knowledge space.
- When you ask a question, AI directly goes to find the nearest coordinate point, which is the most relevant content, without needing to flip through the entire text from beginning to end.
- Determining the precision of the answers
- The dimensions and generation method of vectors affect the matching effect. With higher dimensions, AI can capture more subtle semantics, but the calculation is slightly slower; with lower dimensions, the speed is faster, but some meanings might be missed.
- Just like when you look for a book, if you only remember the broad category (such as “Mathematics”), you might not find the specific chapter; the more detailed you remember (such as “Linear Algebra Vector Section”), the more precise the content you find will be.
- Helping understand the context
- In knowledge base Q&A, user questions are often asked one after another. Vectors can help AI “remember the context,” linking the context together to make the answers more coherent and natural.
- Similar to how a librarian knows which books you borrowed before, they can recommend materials that better fit your needs, rather than starting from scratch every time.
- Easy to expand and optimize
- Vector retrieval makes the knowledge base easy to expand: after adding new documents, generate vectors and put them into the database, and AI can immediately utilize the new materials.
- You can even turn text, images, and tables into vectors and put them into the same “knowledge map” to achieve intelligent retrieval across different content types.
To summarize: the role of vectors in the knowledge base is to give AI a “digital map,” allowing it to quickly locate and find relevant content, and generate natural answers that fit the context. Once you understand the practical role of vectors, you will not only know how to operate the knowledge base, but also understand why it can be so smart.
5 Applications of vectors in more AI scenarios
In the previous chapters, we talked about the role of vectors in text knowledge bases and RAG, enabling AI to understand text, quickly retrieve relevant content, and generate natural answers. In fact, the magic of vectors goes far beyond text; it runs through almost all application scenarios of modern AI.
Image Search: Imagine you are organizing a photo album, and each photo has different features—people, colors, scenes, lighting... AI converts all these features into vectors. For example, if you want to find photos with the sun in the background, AI can directly find these photos in the vector space, without you having to search manually.
Music Recommendation: The melody, rhythm, and style of each song can generate vectors. If you have been listening to light guitar music lately, AI finds other songs with similar rhythms and styles based on vectors to recommend to you, just like when you pick apples at a fruit stand, and the owner handpicks pears or oranges with similar tastes for you.
Video Editing and Recommendation: AI can convert the visuals, actions, and audio track information in videos into vectors. For example, if you want to edit a short video with a cheerful and sunny style, AI will automatically find clips with similar styles and tones in the material library to help you combine them, saving time on manual filtering.
Cross-modal Applications: Text, images, and audio can all be mapped to the same vector space. For example, if you write “I want to listen to a soft piano piece to go with this photo of a seaside sunset,” AI can directly find the most fitting music in the vector space, without the need for manual matching of text and audio.
To understand it in everyday terms, vectors are like putting “digital labels” on every kind of information. Whether it is text, images, or music, AI can quickly find similar things in a multi-dimensional space to make recommendations, generate, or match.
In short, once you understand the applications of vectors beyond text, you will find that they are not only the underlying tool for knowledge retrieval, but also the universal language for AI to make intelligent judgments and recommendations in various scenarios. Its core logic remains unified:Digital Representation → Multi-dimensional Space Calculation → Find Similarity/Matching → Output Results, only the applied materials and scenarios are richer and more vivid.
Perhaps you will have a question reading up to this point:Isn't a vector just a string of numbers? How can it represent human semantics like ‘sun’, ‘rock music’, or ‘funny video'?
The answer is actually very simple—behind this lies model training. Whether it is pixels in images, frequencies in music, or user behavioral habits, AI learns to extract “patterns” from massive amounts of data and contexts. These patterns are ultimately compressed into vectors, so vectors become a kind of “digital semantic label.”
To give a few analogies:
- In images, a certain combination of pixels and colors will be understood by the model as “sun” or “beach”;
- In music, the characteristics of rhythm and melody may correspond to “rock” or “soothing”;
- In videos, the visuals and sound together determine whether it is closer to an “action scene” or a “comedy clip”;
- In recommendations, users“ browsing and selection habits will be abstracted into ”people with a sweet tooth“ or ”viewers who prefer sci-fi movies."
Therefore, vectors do not “know” these things out of thin air, but rather, through learning, compress complex information into a unified digital space. In other words, vectors are the“semantic translators”, which allow AI to build a universal semantic map between text, images, audio, video, and even user preferences.
6 Summary and afterword
Writing up to this point, you can probably feel that:Vectors are not abstract symbols in math books, but a universal language in the AI world。
It translates human text, images, sounds, and even preferences into digital coordinates, allowing computers to find positions, measure distances, and understand relationships in the “semantic map.”
In Chapter 2, we said that vectors are like sections in a supermarket, putting apples and bananas together, and appliances in another; in Chapter 3, we saw that they allow AI to judge semantic similarity through “distance,” thereby answering questions smartly; in Chapter 4's RAG, they become the underlying support of the knowledge base, helping the model quickly find key content from vast amounts of information; Chapter 5 further demonstrates their wide application in various scenarios such as images, music, video, and cross-modality.
So, you only need to remember one sentence:Understanding vectors is almost understanding the underlying operational logic of AI.
When writing this article, I was actually recalling the “I don't get it” feeling I had when I first encountered AI. Many materials are too academic, often filled with formulas and high-dimensional spaces, leaving people in a fog. But if you can think of vectors as “maps,” “labels,” or a “universal language,” you will find that they are actually quite intuitive, and even quite interesting.
In the future, when you see AI recommending your favorite songs, helping you organize your photo albums, or answering questions from a knowledge base in seconds, you might silently say to yourself:Oh, what's running behind this is vectors.
This article written by the master is so good, easy to understand, and a great article for readers.
Good eye! I think so too~
I need to learn this kind of writing style in the future to better face the readers (rather than facing the author). After all, blogs are written for others to read (or even for oneself years later, when one has forgotten everything).
Yes, and I wrote this article because some previous AI-related articles, as well as some future articles, often involve vectors. I can't explain it in every article, so I decided to write a dedicated article to make it clear. In the future, when needed, I can just paste the link to this article.
Thank you, master (^-^), let's communicate more in the future.
You're welcome, I'm no master, and thank you for commenting.