Vectorization
Last Updated: July 29, 2026 | By Mihail Sebastian | AI Dictionary
One word, two meanings: turning raw data into numeric vectors, and rewriting loops as whole-array operations that run in compiled code instead of Python.
What is Vectorization?
Vectorization means one of two things depending on who is talking. To a data scientist preparing inputs, it is the conversion of raw data such as text or categories into numeric vectors a model can consume. To a programmer optimizing code, it is the rewriting of element-by-element loops as operations on whole arrays.
The two senses are unrelated in mechanism and both are standard. Context usually settles it: “vectorize the reviews” is the first sense, “the loop isn’t vectorized” is the second.
The Two Senses of Vectorization
Data into vectors. A model multiplies numbers, so words and categories have to become numbers first. One-hot encoding gives each vocabulary item its own dimension, and TF-IDF weights each term by its frequency in a document against its rarity across the corpus.
Word2Vec and modern embedding models go further, learning dense vectors where distance reflects meaning rather than spelling.
Loops into array operations. In NumPy, a * b on two million-element arrays runs as a single call into compiled C, often using SIMD instructions that apply one operation to several values at once.
The Python loop computing the same result runs one to two orders of magnitude slower, because every iteration pays interpreter overhead. GPU code follows the same principle at larger scale, which is why deep learning frameworks express everything as operations on tensors.
Example of Vectorization
A team builds a duplicate detector for 500,000 support tickets, and both senses appear in the same pipeline.
First, TF-IDF turns each ticket into a sparse vector over a 50,000-word vocabulary. That is vectorization in the data sense: the tickets are now points in a space where shared rare words pull two tickets together.
Then they need the similarity between a new ticket and every stored one. Written as a Python loop over 500,000 stored vectors, one query takes minutes; written as a single sparse matrix multiplication, it returns in well under a second.
Same math, same result, different execution path.
Related AI terms: Word Embedding · One-Hot Encoding · Tensors · NumPy · Tokenization
Did you like the Vectorization gist?
Learn about 250+ need-to-know artificial intelligence terms in the AI Dictionary.
Mihail Sebastian — Writes about AI governance, regulation, and the technology behind them. Placeholder bio — replace with a real credential line. About