<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Javier Aguirre</title>
    <description>The latest articles on DEV Community by Javier Aguirre (@javiagu13).</description>
    <link>https://dev.to/javiagu13</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3953537%2F1b3a95e8-e2ca-4d6d-97ab-a37b5a5e050a.png</url>
      <title>DEV Community: Javier Aguirre</title>
      <link>https://dev.to/javiagu13</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/javiagu13"/>
    <language>en</language>
    <item>
      <title>Bag of Words &amp; TF-IDF: How NLP Turns Text into Numbers</title>
      <dc:creator>Javier Aguirre</dc:creator>
      <pubDate>Mon, 14 Sep 2026 11:00:00 +0000</pubDate>
      <link>https://dev.to/javiagu13/bag-of-words-tf-idf-how-nlp-turns-text-into-numbers-4b65</link>
      <guid>https://dev.to/javiagu13/bag-of-words-tf-idf-how-nlp-turns-text-into-numbers-4b65</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwvnkjop0qav0suswyq3r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwvnkjop0qav0suswyq3r.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’ve been following this series, you’ve already seen NLP do some impressive things with language.&lt;/p&gt;

&lt;p&gt;You’ve seen how tokenization breaks raw text into individual pieces a program can work with. You’ve seen POS tagging assign grammatical labels to words. You’ve seen dependency parsing map the relationships between words in a sentence. And you’ve seen word sense disambiguation use context to determine whether “bank” refers to a financial institution or the side of a river.&lt;/p&gt;

&lt;p&gt;Those techniques are far from academic curiosities. They’re useful in their own right and continue to play important roles in many real-world systems. Search engines, information extraction pipelines, document processing systems, and domain-specific NLP applications often rely on linguistic analysis to improve accuracy and relevance.&lt;/p&gt;

&lt;p&gt;But there is another challenge we haven’t addressed yet.&lt;/p&gt;

&lt;p&gt;Many of the algorithms used for search, ranking, classification, clustering, and machine learning operate on numerical representations rather than words and linguistic labels alone. To compare documents mathematically, measure similarity, train models, or rank search results, we need a way to convert text into vectors of numbers.&lt;/p&gt;

&lt;p&gt;This process is known as &lt;strong&gt;text vectorization&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bag of Words&lt;/strong&gt; and &lt;strong&gt;TF-IDF&lt;/strong&gt; are two of the foundational approaches to solving that problem. They don’t replace tokenization, POS tagging, dependency parsing, or other linguistic techniques. Instead, they provide a numerical representation that can be used alongside them in larger NLP systems.&lt;/p&gt;

&lt;p&gt;These methods are simple enough to understand in an afternoon, powerful enough to have driven production systems for decades, and still widely used today. Modern search engines, retrieval systems, and machine learning pipelines often combine classical techniques such as TF-IDF and BM25 with linguistic analysis and neural models rather than choosing one approach over another.&lt;/p&gt;

&lt;p&gt;In this post, we’ll explore Bag of Words and TF-IDF from first principles: the intuition behind them, the mathematics that makes them work, and practical Python examples you can run yourself.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Core Problem: Computers Can’t Read&amp;nbsp;Text
&lt;/h3&gt;

&lt;p&gt;Imagine you’re building a spam filter. You want your program to look at an email and decide: spam or not spam?&lt;/p&gt;

&lt;p&gt;To do that, you need to compare emails somehow. You need to ask questions like: &lt;em&gt;does this email look more like the spam emails I’ve seen, or more like the legitimate ones?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But you can’t compare raw text directly in any meaningful mathematical way. What would it even mean to subtract one sentence from another? How do you calculate the “distance” between &lt;em&gt;“Win a free prize!”&lt;/em&gt; and &lt;em&gt;“Your invoice is attached”&lt;/em&gt;?&lt;/p&gt;

&lt;p&gt;What you need is a way to represent each document as a set of numbers (a &lt;strong&gt;vector&lt;/strong&gt;) so that you can apply all the usual mathematical tools to them: measuring distance, finding similarities, feeding them into classifiers.&lt;/p&gt;

&lt;p&gt;This transformation from raw text into numerical vectors is called &lt;strong&gt;text vectorization&lt;/strong&gt;. It’s the foundation that everything else in NLP sits on.&lt;/p&gt;

&lt;p&gt;One important thing to set expectations correctly before we dive in: the classical methods we’re covering today (Bag of Words and TF-IDF) capture &lt;strong&gt;shared vocabulary&lt;/strong&gt;, not meaning. Two documents get similar vectors if they use many of the same words, not simply because they express the same idea. A document about “automobiles” and one about “cars” could look quite different to these methods, even though they cover the same subject. That’s one of the limitations we’ll come back to, and a big part of why word embeddings and transformers were developed later.&lt;/p&gt;

&lt;p&gt;Bag of Words and TF-IDF are the two classic approaches to text vectorization.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bag of Words: Counting What’s&amp;nbsp;There
&lt;/h3&gt;

&lt;h3&gt;
  
  
  The Basic&amp;nbsp;Idea
&lt;/h3&gt;

&lt;p&gt;The bag of words model is built on a beautifully simple premise: &lt;em&gt;a document can be represented by the words it contains, and how often they appear.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;That’s it. You throw away sentence structure, word order, grammar: everything except the raw inventory of words and their counts.&lt;/p&gt;

&lt;p&gt;Why “bag”? Because imagine tipping all the words out of a document into a bag and shaking it. The structure is gone. The order is gone. What’s left is just a jumbled collection of words. That jumbled collection is your representation.&lt;/p&gt;

&lt;p&gt;Here’s a concrete example. Suppose you have three short documents:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Document 1:&lt;/em&gt; “The cat sat on the mat” &lt;em&gt;Document 2:&lt;/em&gt;”The cat sat on the hat” &lt;em&gt;Document 3:&lt;/em&gt;”The dog lay on the mat”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The first step is to build a &lt;strong&gt;vocabulary&lt;/strong&gt;: the complete list of unique words across all documents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Vocabulary: [the, cat, sat, on, mat, hat, dog, lay]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you represent each document as a vector of word counts — one number per word in the vocabulary:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm8paiqph698rkqh9h4fj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm8paiqph698rkqh9h4fj.png" width="800" height="116"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each row is now a vector of numbers. Documents 1 and 2 share most of the same words, so their vectors look similar. Document 3 shares fewer words with the others, which shows up in the numbers too.&lt;/p&gt;

&lt;p&gt;You’ve just turned text into maths.&lt;/p&gt;

&lt;p&gt;Notice something about these vectors: most of the entries are zero. Each document only contains a handful of the words in the full vocabulary, so most positions are empty. This is called a &lt;strong&gt;sparse vector&lt;/strong&gt;, and it’s a defining characteristic of both Bag of Words and TF-IDF. In a real corpus with a vocabulary of tens or hundreds of thousands of words, a typical document might use only a few hundred of them, meaning the vast majority of entries in its vector are zero.&lt;/p&gt;

&lt;p&gt;This sparsity has practical consequences. Sparse vectors can be stored and computed with efficiently using specialised data structures, but they’re very high-dimensional, and all those zeros mean the vectors don’t capture much about &lt;em&gt;what words mean&lt;/em&gt;, only &lt;em&gt;which words appear&lt;/em&gt;. Later in this series we’ll look at &lt;strong&gt;dense embeddings&lt;/strong&gt; (compact vectors where every entry carries meaning) which take a fundamentally different approach to representing text. But sparse vectors remain useful and widely deployed, as we’ll see.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frw0tggphc1cjwk4191pk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frw0tggphc1cjwk4191pk.png" alt="Bag of Words (BoW) — Sparse Vector Example" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Bag of Words (BoW) — Sparse Vector&amp;nbsp;Example&lt;/p&gt;

&lt;h3&gt;
  
  
  What Bag of Words Is Actually Good&amp;nbsp;For
&lt;/h3&gt;

&lt;p&gt;Once your documents are vectors, you can do real computation on them. You can measure how similar two documents are by comparing their vectors. You can feed them into a machine learning classifier. You can cluster them, search them, rank them.&lt;/p&gt;

&lt;p&gt;The bag of words model works surprisingly well for many tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Text classification&lt;/strong&gt;: Is this review positive or negative? The presence of words like &lt;em&gt;“great,” “loved,” “excellent”&lt;/em&gt; versus &lt;em&gt;“terrible,” “disappointed,” “broken”&lt;/em&gt; carries a lot of signal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spam detection&lt;/strong&gt;: Certain words and phrases appear much more often in spam than in legitimate email.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document similarity&lt;/strong&gt;: Two documents covering the same topic will tend to use many of the same words.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key insight is that &lt;strong&gt;for a lot of real-world tasks, what matters most is which words are present, not the exact order they appear in.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Obvious Limitations
&lt;/h3&gt;

&lt;p&gt;Bag of words is simple by design, and that simplicity comes with real costs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Word order is lost entirely.&lt;/strong&gt; “The dog bit the man” and “The man bit the dog” produce identical bag of words vectors, even though they mean opposite things.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common words drown out meaningful ones.&lt;/strong&gt; Words like &lt;em&gt;“the,” “a,” “is,” “and”&lt;/em&gt; appear in almost every document. They dominate the word counts but carry almost no useful information. You can partially fix this with a &lt;strong&gt;stop word list&lt;/strong&gt; (a predefined list of common words to ignore) but the underlying problem remains.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Every word is treated as equally important.&lt;/strong&gt; A document about machine learning that mentions “neural” twice gets the same weight as one that mentions it twenty times. And a rare technical term that appears once gets the same weight as &lt;em&gt;“the”&lt;/em&gt; appearing fifty times.&lt;/p&gt;

&lt;p&gt;That last problem is exactly what TF-IDF was designed to solve.&lt;/p&gt;

&lt;h3&gt;
  
  
  TF-IDF: Not All Words Are Created&amp;nbsp;Equal
&lt;/h3&gt;

&lt;h3&gt;
  
  
  The Intuition
&lt;/h3&gt;

&lt;p&gt;Think about the word “machine” in a collection of technology articles. It probably appears in a lot of documents. It’s somewhat useful for identifying tech content, but it’s not very distinctive.&lt;/p&gt;

&lt;p&gt;Now think about the word “backpropagation.” If that word appears in a document, you know a lot about what that document is about. It’s rare in most text, but highly specific and meaningful in context.&lt;/p&gt;

&lt;p&gt;The core intuition behind TF-IDF is: &lt;strong&gt;a word is important if it appears a lot in this specific document, but not in many other documents.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Words that appear everywhere are not very useful for distinguishing one document from another. Words that appear in only a few documents are highly distinctive. A good word representation should reward distinctive words and discount common ones.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TF-IDF&lt;/strong&gt; (Term Frequency-Inverse Document Frequency) formalises this intuition with a simple formula.&lt;/p&gt;

&lt;h3&gt;
  
  
  Term Frequency
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Term frequency&lt;/strong&gt; measures how often a word appears in a document.&lt;/p&gt;

&lt;p&gt;The simplest version is a raw count: if &lt;em&gt;“neural”&lt;/em&gt; appears 4 times in a document, its term frequency is 4. In practice, implementations vary — some use the raw count, some normalise by dividing by the total number of words in the document (so longer documents don’t automatically produce higher scores), and some apply logarithmic scaling to reduce the impact of words that appear very many times. Scikit-learn’s &lt;code&gt;TfidfVectorizer&lt;/code&gt;, for instance, uses a specific variant under the hood. The core idea is the same across all of them: measure how prominent this word is within this document.&lt;/p&gt;

&lt;p&gt;The normalised version looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TF(word, document) = (number of times word appears in document) / (total words in document)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, if &lt;em&gt;“neural”&lt;/em&gt; appears 4 times in a 200-word document:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TF = 4 / 200 = 0.02
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This measures &lt;em&gt;local&lt;/em&gt; importance: how much does this word dominate this particular document?&lt;/p&gt;

&lt;h3&gt;
  
  
  Inverse Document Frequency
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Inverse document frequency&lt;/strong&gt; measures how rare or common a word is across the entire collection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;IDF(word) = log( total number of documents / number of documents containing word )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a word appears in every document, the fraction inside the log becomes 1, and log(1) = 0. The IDF is zero. That word gets no weight at all.&lt;/p&gt;

&lt;p&gt;If a word appears in only 1 out of 1,000 documents, the fraction is 1,000, and log(1,000) is a large number. That word gets a high IDF score: it’s highly distinctive.&lt;/p&gt;

&lt;p&gt;The logarithm is there to compress the scale. Without it, a word appearing in 1 out of 1,000,000 documents would get a weight a thousand times higher than a word appearing in 1 out of 1,000. The log smooths that out.&lt;/p&gt;

&lt;h3&gt;
  
  
  Putting Them&amp;nbsp;Together
&lt;/h3&gt;

&lt;p&gt;The TF-IDF score for a word in a document is simply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TF-IDF(word, document) = TF(word, document) × IDF(word)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Words that are frequent in this document &lt;em&gt;and&lt;/em&gt; rare across the collection get high scores. Words that are common everywhere get scores near zero.&lt;/p&gt;

&lt;p&gt;Let’s work through a simple example. Suppose you have a collection of 1,000 news articles.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fppos8m0imwgi92n9wr8c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fppos8m0imwgi92n9wr8c.png" width="800" height="121"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even though “the” has the highest term frequency, it gets a TF-IDF of zero because it appears in every document. “Candidacy” is rarer and more distinctive, so it gets the highest score despite appearing less often in this specific article.&lt;/p&gt;

&lt;p&gt;This is exactly what you’d want. If you’re trying to understand what makes this article distinct, “the” tells you nothing. “Candidacy” tells you a lot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frvubdc4jiyihuje8or4p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frvubdc4jiyihuje8or4p.png" alt="TF-IDF Scoring VIsualizaion" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;TF-IDF Scoring VIsualizaion&lt;/p&gt;

&lt;h3&gt;
  
  
  The TF-IDF Vectorizer: From Concept to&amp;nbsp;Tool
&lt;/h3&gt;

&lt;p&gt;In practice, you rarely compute TF-IDF by hand. You use a &lt;strong&gt;TF-IDF vectorizer&lt;/strong&gt;: a ready-made tool that takes a collection of documents and transforms each one into a TF-IDF vector automatically.&lt;/p&gt;

&lt;p&gt;The vectorizer handles all the bookkeeping: building the vocabulary, computing term frequencies, calculating IDF scores across the entire corpus, and assembling the final document-term matrix.&lt;/p&gt;

&lt;p&gt;The output is the same shape as a bag of words matrix (rows are documents, columns are words) but now each cell contains a TF-IDF score instead of a raw count.&lt;/p&gt;

&lt;h3&gt;
  
  
  TF-IDF in&amp;nbsp;Python
&lt;/h3&gt;

&lt;p&gt;Python’s scikit-learn library includes a &lt;code&gt;TfidfVectorizer&lt;/code&gt; that makes this trivially easy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from sklearn.feature_extraction.text import TfidfVectorizer  

# Your documents  
documents = [  
    "The cat sat on the mat",  
    "The cat sat on the hat",  
    "The dog lay on the mat"  
]  

# Create and fit the vectorizer  
vectorizer = TfidfVectorizer()  
tfidf_matrix = vectorizer.fit_transform(documents)  

# See the vocabulary  
print(vectorizer.get_feature_names_out())  
# ['cat', 'dog', 'hat', 'lay', 'mat', 'on', 'sat', 'the']  

# See the TF-IDF scores for document 1  
print(tfidf_matrix[0].toarray())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;fit_transform&lt;/code&gt; call does everything at once: it learns the vocabulary and IDF weights from your documents (&lt;code&gt;fit&lt;/code&gt;), then transforms each document into a TF-IDF vector (&lt;code&gt;transform&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;If you later want to transform new documents using the same vocabulary and IDF weights (which you almost always do when building a real system) you call &lt;code&gt;transform&lt;/code&gt; alone:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;new_docs = ["The cat lay on the hat"]  
new_vectors = vectorizer.transform(new_docs)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use &lt;code&gt;CountVectorizer&lt;/code&gt; if you just want raw word counts (the bag of words approach):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from sklearn.feature_extraction.text import CountVectorizer  

bow_vectorizer = CountVectorizer()  
bow_matrix = bow_vectorizer.fit_transform(documents)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both vectorizers support useful parameters for cleaning your text automatically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vectorizer = TfidfVectorizer(  
    stop_words='english',       # Remove common English stop words  
    max_features=10000,         # Only keep the 10,000 most frequent words  
    ngram_range=(1, 2),         # Include both single words and two-word phrases  
    min_df=2                    # Ignore words that appear in fewer than 2 documents  
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  A Practical Example: Finding Similar Documents
&lt;/h3&gt;

&lt;p&gt;Here’s a slightly more realistic use case: using TF-IDF vectors to find which documents are most similar to a query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from sklearn.feature_extraction.text import TfidfVectorizer  
from sklearn.metrics.pairwise import cosine_similarity  
import numpy as np  

# A small collection of descriptions  
documents = [  
    "Machine learning algorithms learn patterns from data",  
    "Deep learning uses neural networks with many layers",  
    "Natural language processing handles text and speech",  
    "Computer vision processes images and video",  
    "Neural networks are inspired by the human brain"  
]  

# Fit and transform  
vectorizer = TfidfVectorizer()  
tfidf_matrix = vectorizer.fit_transform(documents)  

# A search query  
query = ["neural networks and deep learning"]  
query_vector = vectorizer.transform(query)  

# Calculate similarity between query and all documents  
similarities = cosine_similarity(query_vector, tfidf_matrix).flatten()  

# Rank documents by similarity  
ranked = np.argsort(similarities)[::-1]  
print("Most similar documents:")  
for i in ranked:  
    print(f"  {similarities[i]:.3f} — {documents[i]}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Most similar documents:  
  0.712 — Neural networks are inspired by the human brain  
  0.634 — Deep learning uses neural networks with many layers  
  0.000 — Machine learning algorithms learn patterns from data  
  0.000 — Natural language processing handles text and speech  
  0.000 — Computer vision processes images and video
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The query &lt;em&gt;“neural networks and deep learning”&lt;/em&gt; correctly identifies the two most relevant documents. Documents that don’t mention neural networks at all score zero.&lt;/p&gt;

&lt;p&gt;Notice what TF-IDF is actually doing here: it’s matching shared terms, not understanding concepts. It found the right documents because the query and those documents happen to use the same words. If one of our documents had said “artificial neurons arranged in layers” instead of “neural networks,” TF-IDF would have given it a score of zero. The terminology doesn’t overlap, so the vectors don’t either. This is the core limitation of all sparse, vocabulary-based approaches. It works well when related documents use consistent terminology, which is true in many real-world settings. When it breaks down, that’s where dense embeddings and semantic search come in.&lt;/p&gt;

&lt;p&gt;This term-matching approach is essentially how document search worked for decades — and in many systems, it still does.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bag of Words vs TF-IDF: When to Use&amp;nbsp;Which
&lt;/h3&gt;

&lt;p&gt;Both approaches transform text into vectors. The difference is what those numbers mean and how much signal they carry.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Bag of Words (raw counts) when:&lt;/strong&gt; — Your task is simple and you want maximum interpretability — You’re working with very short texts where document length doesn’t vary much — You’re doing a quick baseline before trying something more sophisticated&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use TF-IDF when:&lt;/strong&gt; — Your documents vary in length (longer documents shouldn’t automatically dominate) — You want distinctive terms to be weighted more heavily than ubiquitous ones — You’re doing search, document similarity, or text classification where specificity matters&lt;/p&gt;

&lt;p&gt;In practice, TF-IDF almost always outperforms raw bag of words for text classification and search tasks. It’s the default choice when you want a classical vectorization approach.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where These Methods Fit in Modern&amp;nbsp;NLP
&lt;/h3&gt;

&lt;p&gt;If TF-IDF has been around since the 1970s, you might wonder whether it’s still worth learning.&lt;/p&gt;

&lt;p&gt;The honest answer: yes, absolutely. And not just for historical context.&lt;/p&gt;

&lt;p&gt;Transformer models like BERT and GPT brought &lt;strong&gt;contextual embeddings&lt;/strong&gt; to NLP, which capture meaning, sentence structure, and semantic relationships in ways sparse methods can’t. That was a genuine step forward for many tasks. But it didn’t make sparse retrieval disappear. The story is more nuanced than “new methods replaced old ones.”&lt;/p&gt;

&lt;p&gt;In practice, many production systems today use &lt;strong&gt;hybrid architectures&lt;/strong&gt;: they run a sparse retrieval step (BM25, TF-IDF) alongside a dense neural retrieval step, then combine the results. Each component handles what it’s good at. Sparse methods are fast, interpretable, and excellent at exact keyword matching. Dense methods are better at semantic similarity: finding documents that mean the same thing even when they use different words. Neither has made the other obsolete. Classical NLP techniques — tokenization, lemmatization, POS tagging, dependency parsing, TF-IDF, and the retrieval pipelines built around them — remain important parts of real production systems.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frfo80z2xkqnrqib879us.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frfo80z2xkqnrqib879us.png" alt="NLP Vectoriation Progression" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NLP Vectoriation Progression&lt;/p&gt;

&lt;p&gt;TF-IDF’s direct successor, &lt;strong&gt;BM25&lt;/strong&gt;, is one of the most widely deployed ranking algorithms in the world right now. BM25 takes the core TF-IDF idea and fixes two specific weaknesses: it handles diminishing returns on term frequency (the 50th mention of a word shouldn’t count as much as the 5th), and it normalises more gracefully for document length. Elasticsearch, OpenSearch, and most modern search engines use BM25 as their default relevance model. It’s also the sparse retrieval component in many of those hybrid systems mentioned above. We’ll cover BM25 in the next post. Once you’ve understood TF-IDF, it clicks almost immediately.&lt;/p&gt;

&lt;p&gt;Understanding Bag of Words and TF-IDF gives you the conceptual foundation to understand why every subsequent approach works differently, and what specific problem each one was built to solve. Dense embeddings exist because sparse methods can’t capture meaning across different vocabulary. BM25 exists because raw TF-IDF has specific edge cases in term weighting and length normalisation. Each step in the progression was motivated by a concrete limitation of what came before — not a wholesale replacement of it.&lt;/p&gt;

&lt;p&gt;Every serious NLP practitioner knows these methods. They’re the starting point for a reason.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Comes&amp;nbsp;Next
&lt;/h3&gt;

&lt;p&gt;We’ve now covered how text gets turned into numbers — the prerequisite for almost every NLP task that follows.&lt;/p&gt;

&lt;p&gt;The immediate next step is &lt;strong&gt;BM25&lt;/strong&gt;: the direct evolution of TF-IDF that fixes its two most significant weaknesses and has become the default ranking algorithm inside most modern search engines. If you search anything on Elasticsearch or use a hybrid retrieval system, BM25 is almost certainly involved. Because it builds directly on what you’ve just learned, it’s the natural next post.&lt;/p&gt;

&lt;p&gt;After that, we’ll go deeper into what you can &lt;em&gt;do&lt;/em&gt; with these vectors — the machine learning models that sit on top of text vectorization, and the neural architectures that eventually pushed beyond classical methods altogether. That includes &lt;strong&gt;word embeddings&lt;/strong&gt; like Word2Vec and GloVe, which represent words as dense vectors rather than sparse counts, and eventually the contextual embeddings that power modern AI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn This at Fondra&amp;nbsp;Labs
&lt;/h3&gt;

&lt;p&gt;This post is part of our &lt;a href="https://fondralabs.com/nlp-foundations.html" rel="noopener noreferrer"&gt;NLP Foundations&lt;/a&gt; series, where we build up practical AI knowledge one concept at a time, from text processing basics all the way to the systems powering modern AI.&lt;/p&gt;

&lt;p&gt;At &lt;a href="https://fondralabs.com/" rel="noopener noreferrer"&gt;Fondra Labs&lt;/a&gt;, we teach AI from production reality, not hype. Every topic in this series is here because it genuinely matters when you sit down to build something real.&lt;/p&gt;

&lt;p&gt;If this was useful, explore the rest of the blog. We cover machine learning, deep learning, NLP, and the practical skills that turn understanding into building.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://fondralabs.com/blog/nlp-foundations/bag-of-words-tf-idf-how-nlp-turns-text-into-numbers.html" rel="noopener noreferrer"&gt;&lt;em&gt;https://fondralabs.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>nlp</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Word Sense Disambiguation: How NLP Understands Word Meaning in Context</title>
      <dc:creator>Javier Aguirre</dc:creator>
      <pubDate>Fri, 11 Sep 2026 11:00:00 +0000</pubDate>
      <link>https://dev.to/javiagu13/word-sense-disambiguation-how-nlp-understands-word-meaning-in-context-130m</link>
      <guid>https://dev.to/javiagu13/word-sense-disambiguation-how-nlp-understands-word-meaning-in-context-130m</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr72vnixxlsnnr56nitiv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr72vnixxlsnnr56nitiv.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is a sentence that will break most computers.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“I went to the bank.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Did you go to a financial institution to withdraw money? Or did you sit down by the bank of a river? Both readings are perfectly valid. As a human, you’d resolve this instantly, probably without even noticing there was ambiguity to resolve. You’d use context, common sense, and everything else you know about the world to pick the right meaning without thinking twice.&lt;/p&gt;

&lt;p&gt;For a computer, this is a genuinely hard problem. And it turns out that language is absolutely full of it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Word sense disambiguation (WSD)&lt;/strong&gt; is the NLP term for solving this: given a word that could mean multiple things, figure out which meaning the writer actually intended. As a concept, it sits at the heart of what makes language understanding difficult. As a standalone task with its own dedicated pipeline stage, it has a more specific and nuanced role in modern systems, which we’ll get into shortly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Language Is So Ambiguous
&lt;/h3&gt;

&lt;p&gt;Before diving into how WSD works, it helps to appreciate just how widespread the problem is.&lt;/p&gt;

&lt;p&gt;Most common words in English carry more than one meaning. The word &lt;em&gt;“bank”&lt;/em&gt; has over ten distinct senses in major dictionaries. &lt;em&gt;“Run”&lt;/em&gt; has over thirty. Even simple words like &lt;em&gt;“bright”&lt;/em&gt; (intelligent? luminous? cheerful?) or &lt;em&gt;“cold”&lt;/em&gt; (temperature? illness? emotional distance?) carry multiple meanings that shift depending on context.&lt;/p&gt;

&lt;p&gt;This is called &lt;strong&gt;lexical ambiguity&lt;/strong&gt;: a single word form with multiple possible meanings. It’s not an edge case or a quirk of English. It’s a fundamental property of how human language works. Words evolve over time, get borrowed across domains, and accumulate meanings. The result is a vocabulary where almost every high-frequency word is ambiguous to some degree.&lt;/p&gt;

&lt;p&gt;There’s a related but slightly different phenomenon worth knowing: &lt;strong&gt;semantic ambiguity&lt;/strong&gt;. This is where the ambiguity doesn’t come from a single word but from the structure of a phrase or sentence. &lt;em&gt;“I saw the man with the telescope”&lt;/em&gt; is semantically ambiguous because the phrase “with the telescope” could modify either “saw” or “the man.” Both the word-level and phrase-level forms of ambiguity fall under the broader challenge WSD is designed to address.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbnakh4ka3wygo6ce8bbm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbnakh4ka3wygo6ce8bbm.png" alt="Common words with multiple meanings illustrating lexical ambiguity in natural language" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Common words with multiple meanings illustrating lexical ambiguity in natural&amp;nbsp;language&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is Word Sense Disambiguation?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Word sense disambiguation&lt;/strong&gt; is the task of automatically identifying which sense of a word is being used in a given context.&lt;/p&gt;

&lt;p&gt;In the traditional framing, the inputs are a piece of text and a target word within it. The output is a label identifying which meaning the word carries in that specific context. Those labels typically come from a dictionary or lexical resource like WordNet, which organises words into sets of synonyms (called synsets) and defines each sense separately.&lt;/p&gt;

&lt;p&gt;For the sentence &lt;em&gt;“The surgeon operated on the patient,”&lt;/em&gt; a WSD system would correctly identify that &lt;em&gt;“operated”&lt;/em&gt; refers to performing surgery, not running a machine or managing a business. For &lt;em&gt;“The technician operated the crane,”&lt;/em&gt; it would pick the machinery sense. Same word. Different contexts. Different meanings.&lt;/p&gt;

&lt;p&gt;It’s worth noting that this traditional framing assumes word meaning can be mapped onto a fixed inventory of discrete dictionary senses. That’s a useful engineering abstraction, but it’s not the only way to think about meaning. Modern NLP often represents meaning as continuous vectors in high-dimensional space rather than selecting from a predefined list of senses. Some researchers view dictionary sense inventories as practical tools for structured tasks rather than fundamental representations of how meaning works. Both views have merit, and understanding the distinction helps you choose the right approach for a given problem.&lt;/p&gt;

&lt;p&gt;What makes this genuinely interesting is that humans do it effortlessly and continuously. Every sentence you read contains multiple potentially ambiguous words, and you resolve all of them simultaneously without effort. A computational system has to learn to replicate that, either by selecting from a sense inventory or by building rich contextual representations that capture meaning without explicit labels.&lt;/p&gt;

&lt;h3&gt;
  
  
  How WSD Systems&amp;nbsp;Work
&lt;/h3&gt;

&lt;p&gt;There are several approaches to word sense disambiguation, and they’ve evolved significantly over the decades.&lt;/p&gt;

&lt;p&gt;The earliest systems were &lt;strong&gt;knowledge-based&lt;/strong&gt;: they used structured resources like WordNet to compare the definitions of candidate senses against the surrounding context. If you’re trying to disambiguate &lt;em&gt;“bank”&lt;/em&gt; and the surrounding words include &lt;em&gt;“river,” “water,”&lt;/em&gt; and &lt;em&gt;“fish,”&lt;/em&gt; the riverbank sense scores higher because its definition overlaps more with those words. This approach is interpretable and requires no training data, but it struggles when context is sparse or unusual.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Supervised machine learning&lt;/strong&gt; approaches treat WSD as a classification problem. Given a word and its surrounding context (the words before and after it), a classifier learns to predict the correct sense from labelled training examples. These methods work well when you have enough annotated data for the specific words you care about, which is often the bottleneck. Building a labelled WSD dataset is slow and expensive because it requires human annotators to read each sentence and select the intended sense.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Neural approaches&lt;/strong&gt; using contextual word embeddings changed the game significantly. Models like BERT produce a different vector representation of a word depending on the context it appears in. The word &lt;em&gt;“bank”&lt;/em&gt; in a sentence about finance gets a different embedding than &lt;em&gt;“bank”&lt;/em&gt; in a sentence about rivers, even though the surface form is identical. This means disambiguation happens inside the model’s representations rather than through an explicit sense-selection step.&lt;/p&gt;

&lt;p&gt;This is the key shift in modern NLP. Transformer models and large language models perform sense disambiguation &lt;em&gt;implicitly&lt;/em&gt;, as an emergent property of how they process context, rather than through a dedicated WSD component. When you ask ChatGPT a question containing an ambiguous word, it almost always resolves the ambiguity correctly from context without any explicit disambiguation step. That capability emerged from training on vast amounts of text. There is no separate WSD module running underneath. The disambiguation is baked into the contextual representations the model builds for every word it processes.&lt;/p&gt;

&lt;p&gt;This means that in most modern NLP pipelines, you won’t find a dedicated WSD stage. The problem hasn’t gone away. It’s been absorbed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5nmhm45yore4ttw4btbv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5nmhm45yore4ttw4btbv.png" alt="Three approaches to word sense disambiguation: knowledge-based, supervised, and neural contextual embeddings" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Three approaches to word sense disambiguation: knowledge-based, supervised, and neural contextual embeddings&lt;/p&gt;

&lt;h3&gt;
  
  
  Lexical Semantics: The Bigger&amp;nbsp;Picture
&lt;/h3&gt;

&lt;p&gt;Word sense disambiguation doesn’t exist in isolation. It’s part of a broader field called &lt;strong&gt;lexical semantics&lt;/strong&gt;: the study of word meaning and how words relate to each other.&lt;/p&gt;

&lt;p&gt;Lexical semantics is interested in questions like: what does it mean for two words to be synonyms? How do words like &lt;em&gt;“dog”&lt;/em&gt; and &lt;em&gt;“animal”&lt;/em&gt; relate (one is a type of the other)? Why do &lt;em&gt;“hot”&lt;/em&gt; and &lt;em&gt;“cold”&lt;/em&gt; feel like opposites while &lt;em&gt;“hot”&lt;/em&gt; and &lt;em&gt;“warm”&lt;/em&gt; feel like a scale?&lt;/p&gt;

&lt;p&gt;These relationships between words are encoded in resources like &lt;strong&gt;WordNet&lt;/strong&gt;, a large lexical database where words are organised into synonym sets and connected by semantic relationships: synonymy (same meaning), antonymy (opposite meaning), hypernymy (broader category), and hyponymy (narrower category). &lt;em&gt;“Dog”&lt;/em&gt; is a hyponym of &lt;em&gt;“animal.”&lt;/em&gt; &lt;em&gt;“Animal”&lt;/em&gt; is a hypernym of &lt;em&gt;“dog.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Understanding these relationships matters because WSD is not just about picking the right dictionary entry. It’s about understanding how word meaning is structured in language. A system that understands that &lt;em&gt;“operated”&lt;/em&gt; in a medical context belongs to the same semantic neighbourhood as &lt;em&gt;“surgery,” “incision,”&lt;/em&gt; and &lt;em&gt;“patient”&lt;/em&gt; is doing something more interesting than lookup. It’s reasoning about meaning.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where Explicit WSD Still Has a&amp;nbsp;Role
&lt;/h3&gt;

&lt;p&gt;Most modern NLP systems don’t include a dedicated WSD stage. But that doesn’t mean the problem is solved or that explicit disambiguation is never useful. There are specific settings where it still earns its place, and understanding them helps you know when to reach for it.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;biomedical NLP&lt;/strong&gt;, the word &lt;em&gt;“discharge”&lt;/em&gt; can mean a patient leaving hospital, a fluid emission, or an electrical release. For systems that extract structured information from clinical notes and feed it into downstream databases or alerts, explicit WSD with a domain-specific sense inventory gives teams control and auditability that a black-box language model doesn’t. When a decision needs to be explainable and traceable, knowing exactly which sense was assigned and why matters.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;legal document analysis&lt;/strong&gt;, words like &lt;em&gt;“party,” “consideration,”&lt;/em&gt; and &lt;em&gt;“execution”&lt;/em&gt; carry technical legal senses that differ sharply from their everyday meanings. Explicit terminology mapping using legal ontologies and controlled vocabularies is a common pattern in legal NLP, and WSD is the mechanism that connects surface word forms to those structured definitions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Knowledge graph construction and ontology mapping&lt;/strong&gt; are probably where explicit WSD remains most actively used in practice. When you’re building a structured knowledge base from unstructured text, you need to map entity mentions and relation phrases to specific nodes in a taxonomy. That requires knowing exactly which sense of a word is intended, and the output needs to be a discrete label, not a vector. Contextual embeddings alone don’t give you that.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;machine translation&lt;/strong&gt;, it’s worth being accurate about what’s changed. Explicit WSD was historically important in rule-based and early statistical translation systems, where the correct translation of a word genuinely depended on resolving its sense first. Modern neural machine translation systems handle disambiguation implicitly through contextual modelling, just as LLMs do, so dedicated WSD modules are not a standard part of current MT pipelines.&lt;/p&gt;

&lt;p&gt;The honest summary: explicit WSD survives in specialised settings where you need structured, auditable, ontology-aligned outputs. For general language understanding in most production systems, transformer models and LLMs have absorbed the disambiguation problem into their contextual representations, making a dedicated WSD stage unnecessary.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Language models don’t read words. They read words in context, and context is everything.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  The State of WSD&amp;nbsp;Today
&lt;/h3&gt;

&lt;p&gt;It’s worth stepping back and being clear about where this all stands.&lt;/p&gt;

&lt;p&gt;Resolving the meaning of words from context is not optional in language understanding. It’s fundamental. Every NLP system that processes real text is dealing with ambiguity constantly, whether it acknowledges it explicitly or not.&lt;/p&gt;

&lt;p&gt;What has changed is &lt;em&gt;how&lt;/em&gt; that disambiguation happens. Explicit WSD, where a system selects from a fixed sense inventory using rules or a dedicated classifier, was the dominant approach before transformer models arrived. Today it’s a specialist tool. Most production NLP systems, from search engines to document classifiers to LLM-powered assistants, perform disambiguation implicitly through the contextual representations learned by transformer models. There is no dedicated WSD stage. The problem is handled as a side effect of how modern models process language.&lt;/p&gt;

&lt;p&gt;Explicit WSD survives where structured outputs are required: ontology mapping, knowledge graph construction, terminology alignment in biomedical and legal domains. In those settings, the ability to produce a named, auditable sense label still has genuine value.&lt;/p&gt;

&lt;p&gt;For everyone else, understanding WSD is valuable not because you’ll necessarily build a WSD system, but because it helps you understand what language models are actually doing and why context matters so deeply to how language works.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Comes&amp;nbsp;Next
&lt;/h3&gt;

&lt;p&gt;Word sense disambiguation is the point in this series where we move from structure to meaning. We’ve covered how text is broken into tokens, how words get grammatical labels, and how sentences get mapped into dependency trees. Now we understand how the meaning of individual words gets resolved from context.&lt;/p&gt;

&lt;p&gt;The next step is understanding how that meaning gets represented as numbers that computers can actually work with. That leads us to &lt;strong&gt;Bag of Words and TF-IDF&lt;/strong&gt;: the foundational techniques for turning text into numerical representations, and the starting point for almost every classical NLP system ever built.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn This at Fondra&amp;nbsp;Labs
&lt;/h3&gt;

&lt;p&gt;This post is part of our &lt;a href="https://fondralabs.com/nlp-foundations.html" rel="noopener noreferrer"&gt;NLP Foundations&lt;/a&gt; series, where we build up practical AI knowledge one concept at a time, from text processing basics all the way to the systems powering modern AI.&lt;/p&gt;

&lt;p&gt;At &lt;a href="https://fondralabs.com/" rel="noopener noreferrer"&gt;Fondra Labs&lt;/a&gt;, we teach AI from production reality, not hype. Every topic in this series is here because it genuinely matters when you sit down to build something real.&lt;/p&gt;

&lt;p&gt;If this was useful, explore the rest of the blog. We cover machine learning, deep learning, NLP, and the practical skills that turn understanding into building.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://fondralabs.com/blog/nlp-foundations/word-sense-disambiguation-how-nlp-understands-word-meaning-in-context.html" rel="noopener noreferrer"&gt;&lt;em&gt;https://fondralabs.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>nlp</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Dependency Parsing: How NLP Understands Sentence Structure</title>
      <dc:creator>Javier Aguirre</dc:creator>
      <pubDate>Wed, 09 Sep 2026 11:00:00 +0000</pubDate>
      <link>https://dev.to/javiagu13/dependency-parsing-how-nlp-understands-sentence-structure-4mmd</link>
      <guid>https://dev.to/javiagu13/dependency-parsing-how-nlp-understands-sentence-structure-4mmd</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F629pqwfw2jlvfiyfikig.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F629pqwfw2jlvfiyfikig.png" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You now know what each word is. But do you know what each word &lt;em&gt;does&lt;/em&gt;?&lt;/p&gt;

&lt;p&gt;In the previous post, we covered Part of Speech Tagging: the process of labelling each word as a noun, verb, adjective, and so on. That tells you the category of every word in a sentence. But it doesn’t tell you how those words connect to each other.&lt;/p&gt;

&lt;p&gt;Take this sentence: &lt;em&gt;“The dog bit the man.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;POS tagging tells you that “dog” is a noun and “bit” is a verb. But it doesn’t tell you that “dog” is the one doing the biting, or that “man” is the one receiving it. For a lot of NLP tasks, that distinction matters enormously.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependency parsing&lt;/strong&gt; is how NLP systems figure out those relationships. It maps the grammatical connections between words, revealing who did what to whom and how every part of a sentence fits together.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is dependency parsing?
&lt;/h3&gt;

&lt;p&gt;Before we get into how computers do this, it helps to understand the underlying idea.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependency grammar&lt;/strong&gt; is a theory of language structure that describes sentences as networks of relationships between words. Instead of breaking a sentence into nested phrases (like traditional grammar diagrams), dependency grammar draws direct links between individual words.&lt;/p&gt;

&lt;p&gt;Every word in a sentence (except one) depends on another word. The word it depends on is called its &lt;strong&gt;head&lt;/strong&gt;. The relationship between them is called a &lt;strong&gt;dependency relation&lt;/strong&gt;, and these relations have names that describe the grammatical role: subject, object, modifier, determiner, and so on. The one word that depends on nothing is the root of the sentence, usually the main verb.&lt;/p&gt;

&lt;p&gt;In &lt;em&gt;“The dog bit the man,”&lt;/em&gt; the structure looks like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;“bit”&lt;/em&gt; is the root (nothing governs it)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;“dog”&lt;/em&gt; depends on &lt;em&gt;“bit”&lt;/em&gt; as the subject (&lt;code&gt;nsubj&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;“man”&lt;/em&gt; depends on &lt;em&gt;“bit”&lt;/em&gt; as the object (&lt;code&gt;obj&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;“The”&lt;/em&gt; (first one) depends on &lt;em&gt;“dog”&lt;/em&gt; as a determiner (&lt;code&gt;det&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;“the”&lt;/em&gt; (second one) depends on &lt;em&gt;“man”&lt;/em&gt; as a determiner (&lt;code&gt;det&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every word is accounted for. Every relationship is named. The sentence has been turned into a map.&lt;/p&gt;

&lt;p&gt;When you draw out all those relationships visually, you get what’s called a &lt;strong&gt;dependency tree&lt;/strong&gt;. It’s called a tree because the structure branches outward from a single root, just like a real tree. The main verb sits at the top. Subjects, objects, and modifiers hang below it. Determiners and other function words hang below those. Every node is a word, every edge is a labelled relationship, and every word appears exactly once with no circular chains.&lt;/p&gt;

&lt;p&gt;Here’s what the dependency tree for &lt;em&gt;“The quick brown fox jumped over the fence”&lt;/em&gt; looks like conceptually:&lt;/p&gt;

&lt;p&gt;The tree makes the structure of the sentence explicit and machine-readable. A system can now navigate it programmatically: find the subject of the main verb, find all modifiers of a given noun, find the object of any action.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbdfcro3ju0wmqs83kjua.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbdfcro3ju0wmqs83kjua.png" alt="Dependency grammar maps every word to its head with a named relationship label" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dependency grammar maps every word to its head with a named relationship label&lt;/p&gt;

&lt;h3&gt;
  
  
  Parse Trees: Two&amp;nbsp;Flavours
&lt;/h3&gt;

&lt;p&gt;You’ll often hear the term &lt;strong&gt;parse tree&lt;/strong&gt; used when people talk about dependency parsing, and it’s worth understanding what it means and how it relates to what we’ve just described.&lt;/p&gt;

&lt;p&gt;A dependency parse tree (what we’ve been describing) connects individual words to each other with typed relationship labels. The structure is flat in the sense that it connects words directly, without grouping them into phrases.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;constituency parse tree&lt;/strong&gt; (also called a phrase structure tree) takes a different approach. Instead of connecting words to words, it groups words into nested phrases. A noun phrase contains a determiner and a noun. A verb phrase contains a verb and its noun phrase. Those phrases nest inside a sentence node at the top. The two approaches reveal the same underlying sentence structure but from different angles.&lt;/p&gt;

&lt;p&gt;In practice the choice between them comes down to the task:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dependency trees&lt;/strong&gt; are word-to-word. Better for tasks that need to know relationships between specific words: who did what to whom.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Constituency trees&lt;/strong&gt; are phrase-based. Better for tasks that need to understand the hierarchical structure of a sentence: how clauses nest inside each other.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In modern NLP, dependency parsing is more widely used in production systems. It’s faster to compute, easier to work with programmatically, and sufficient for most downstream tasks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnlc4l4crf7wfb4duet9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnlc4l4crf7wfb4duet9t.png" alt="Constituency parse tree vs dependency parse tree for the same sentence showing the structural difference" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Constituency parse tree vs dependency parse tree for the same sentence showing the structural difference&lt;/p&gt;

&lt;p&gt;Both dependency parsing and constituency parsing are forms of &lt;strong&gt;syntactic analysis&lt;/strong&gt;: the broader process of examining the grammatical structure of a sentence. POS tagging is also a form of syntactic analysis. They’re all part of the same family of techniques, each revealing a different layer of grammatical structure. In NLP pipelines, syntactic analysis typically sits between basic text processing (tokenization, POS tagging) and higher-level understanding (semantic analysis, information extraction). It provides the structural backbone that makes deeper analysis possible.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Dependency Parsing&amp;nbsp;Works
&lt;/h3&gt;

&lt;p&gt;Modern dependency parsers use neural networks, but the core task is always the same: for each word in a sentence, find its head and label the relationship.&lt;/p&gt;

&lt;p&gt;There are two main algorithmic approaches. &lt;strong&gt;Transition-based parsing&lt;/strong&gt; works through the sentence from left to right, maintaining a stack of words currently being processed. At each step, a classifier decides between a small set of actions: shift the next word onto the stack, create a dependency between two words, or move on. Because decisions are made one step at a time, this approach runs in linear time and is fast enough for production use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Graph-based parsing&lt;/strong&gt; takes a different route. Instead of building the tree step by step, it scores all possible edges between all pairs of words and then finds the tree that maximises the total score. This is slower but tends to be more accurate, especially for longer sentences with complex structure. Most state-of-the-art parsers today combine neural networks with graph-based approaches, using Transformer-based representations to score edges with rich contextual information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why It Matters in&amp;nbsp;Practice
&lt;/h3&gt;

&lt;p&gt;Like POS tagging, dependency parsing is rarely the end goal. It’s a layer in a pipeline that makes other things possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Information extraction&lt;/strong&gt; uses dependency trees to find subject-verb-object triples at scale. Given a corpus of news articles, you can extract every event of the form “company acquired company” or “person said statement” by querying the parse tree structure. This is faster and more precise than hoping a language model happens to extract the right thing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Question answering&lt;/strong&gt; systems use dependency parsing to understand what a question is actually asking. &lt;em&gt;“Who did the dog bite?”&lt;/em&gt; and &lt;em&gt;“Who bit the dog?”&lt;/em&gt; have identical words but opposite meanings. The dependency tree makes that difference explicit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Machine translation&lt;/strong&gt; relies on syntactic structure to produce grammatically correct output in the target language. Word order differs between languages, and dependency relations provide language-agnostic structure that translation systems can map across.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clinical NLP&lt;/strong&gt; uses dependency parsing to extract medication dosages, symptoms, and diagnoses from clinical notes. A rule like “find the noun that is the object of the verb ‘prescribed’” is far more reliable than keyword matching when clinical language is ambiguous and variable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Coreference resolution&lt;/strong&gt; (figuring out that “he” in one sentence refers to “John” in a previous one) uses dependency structure to track entities across sentences. The grammatical role of a pronoun is a strong signal for what it refers to.&lt;/p&gt;

&lt;p&gt;The honest take on modern NLP: large language models have reduced how much explicit dependency parsing is done in cutting-edge research. But in production systems where interpretability, speed, and precision matter, dependency parsing remains a practical and widely used tool. spaCy runs a dependency parser by default on every document you process. You might not use the output directly, but it’s there, and the components that do use it quietly improve everything downstream.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The structure of a sentence is not decoration. It is the scaffolding that holds meaning together.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Dependency Parsing in Python with&amp;nbsp;spaCy
&lt;/h3&gt;

&lt;p&gt;spaCy makes dependency parsing straightforward. It runs automatically when you process text:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;spacy&lt;/span&gt;

&lt;span class="n"&gt;nlp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;spacy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;en_core_web_sm&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;nlp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The dog bit the man.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; --[&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dep_&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;]--&amp;gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The --[det]--&amp;gt; dog
dog --[nsubj]--&amp;gt; bit
bit --[ROOT]--&amp;gt; bit
the --[det]--&amp;gt; man
man --[dobj]--&amp;gt; bit
. --[punct]--&amp;gt; bit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every token shows its dependency label and the head it points to. The root points to itself. From this output, a downstream system can immediately answer: what is the subject of “bit”? Dog. What is the object? Man.&lt;/p&gt;

&lt;p&gt;You can also visualise the tree directly in spaCy using its built-in displaCy renderer, which produces a clean arc diagram in the browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7kko90zbtam3ch47eouo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7kko90zbtam3ch47eouo.png" alt="A dependency tree visualised as an arc diagram showing labelled relationships between words" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A dependency tree visualised as an arc diagram showing labelled relationships between&amp;nbsp;words&lt;/p&gt;

&lt;h3&gt;
  
  
  Is Dependency Parsing Still Relevant?
&lt;/h3&gt;

&lt;p&gt;Short answer: yes, especially in production.&lt;/p&gt;

&lt;p&gt;Large language models are impressive at understanding language holistically, but they’re opaque. You can’t inspect why they interpreted a sentence a certain way. Dependency parsing gives you an explicit, interpretable representation of sentence structure that you can query, validate, and debug.&lt;/p&gt;

&lt;p&gt;For teams building NLP pipelines in healthcare, legal tech, or finance, where decisions need to be explainable and auditable, dependency parsing is not a relic of the past. It’s a practical engineering choice that trades some accuracy for a lot of transparency and control.&lt;/p&gt;

&lt;p&gt;Even in LLM-powered systems, dependency parsing often runs in the preprocessing layer: cleaning up the input, extracting structured signals, or filtering out irrelevant sentences before the expensive model ever sees them. It earns its place not by being the most powerful tool, but by being fast, reliable, and interpretable in a world where those qualities are often more valuable than raw performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Comes&amp;nbsp;Next
&lt;/h3&gt;

&lt;p&gt;Dependency parsing gives you the grammatical structure of a sentence. You now know what each word is (POS tags) and how each word connects to the others (dependency relations).&lt;/p&gt;

&lt;p&gt;The next step is moving from structure to meaning. That’s where &lt;strong&gt;Word Sense Disambiguation&lt;/strong&gt; comes in: the process of figuring out which meaning a word carries when it could mean several different things. It’s where NLP starts crossing from grammar into genuine language understanding.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn This at Fondra&amp;nbsp;Labs
&lt;/h3&gt;

&lt;p&gt;This post is part of our &lt;a href="https://fondralabs.com/nlp-foundations.html" rel="noopener noreferrer"&gt;NLP Foundations&lt;/a&gt; series, where we build up practical AI knowledge one concept at a time, from tokenization and POS tagging all the way to retrieval systems and production pipelines.&lt;/p&gt;

&lt;p&gt;At &lt;a href="https://fondralabs.com/" rel="noopener noreferrer"&gt;Fondra Labs&lt;/a&gt;, we teach AI from production reality, not hype. Every topic in this series is here because it genuinely matters when you sit down to build something real.&lt;/p&gt;

&lt;p&gt;If this was useful, explore the rest of the blog. We cover machine learning, deep learning, NLP, and the practical skills that turn understanding into building.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://fondralabs.com/blog/nlp-foundations/dependency-parsing-how-nlp-understands-sentence-structure.html" rel="noopener noreferrer"&gt;&lt;em&gt;https://fondralabs.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>nlp</category>
    </item>
    <item>
      <title>Part of Speech Tagging: How NLP Understands Grammar</title>
      <dc:creator>Javier Aguirre</dc:creator>
      <pubDate>Mon, 07 Sep 2026 11:00:00 +0000</pubDate>
      <link>https://dev.to/javiagu13/part-of-speech-tagging-how-nlp-understands-grammar-2if5</link>
      <guid>https://dev.to/javiagu13/part-of-speech-tagging-how-nlp-understands-grammar-2if5</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu8qwdq6lpausth5w3b9x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu8qwdq6lpausth5w3b9x.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You learned this in school, even if you’ve forgotten most of it.&lt;/p&gt;

&lt;p&gt;Nouns are things. Verbs are actions. Adjectives describe. Adverbs modify. At some point a teacher made you underline the subject of a sentence or circle the verb, and then you moved on with your life.&lt;/p&gt;

&lt;p&gt;But here’s the thing: that grammatical knowledge you picked up in school is exactly what NLP systems need to understand language. Before a model can extract meaning from text, it needs to know what role each word is playing. Is “bank” a noun or a verb? Is “fast” an adjective or an adverb? The same word can be both, depending on context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part of speech tagging&lt;/strong&gt; is how NLP systems figure that out. It’s one of the foundational steps in language understanding, and it quietly powers a huge number of the NLP applications you use every day.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is Part of&amp;nbsp;Speech?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;part of speech&lt;/strong&gt; is a grammatical category that tells you what role a word plays in a sentence.&lt;/p&gt;

&lt;p&gt;Every word in a sentence belongs to at least one category. The main ones you’ll encounter in NLP are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Noun (NN):&lt;/strong&gt; a person, place, thing, or concept. &lt;em&gt;“dog,” “London,” “happiness”&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verb (VB):&lt;/strong&gt; an action or state. &lt;em&gt;“run,” “is,” “understand”&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adjective (JJ):&lt;/strong&gt; describes a noun. &lt;em&gt;“fast,” “blue,” “complicated”&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adverb (RB):&lt;/strong&gt; modifies a verb, adjective, or other adverb. &lt;em&gt;“quickly,” “very,” “not”&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pronoun (PRP):&lt;/strong&gt; replaces a noun. &lt;em&gt;“he,” “she,” “it,” “they”&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preposition (IN):&lt;/strong&gt; shows relationships between words. &lt;em&gt;“in,” “on,” “at,” “between”&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conjunction (CC):&lt;/strong&gt; connects words or clauses. &lt;em&gt;“and,” “but,” “or”&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Determiner (DT):&lt;/strong&gt; introduces a noun. &lt;em&gt;“the,” “a,” “this,” “some”&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In NLP, these categories are assigned short codes called &lt;strong&gt;Penn Treebank tags&lt;/strong&gt;, which is why you’ll often see labels like &lt;code&gt;NN&lt;/code&gt;, &lt;code&gt;VBZ&lt;/code&gt;, or &lt;code&gt;JJ&lt;/code&gt; rather than full words. Different frameworks use slightly different tag sets, but the underlying categories are consistent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4qal9irvdktwvv45j3mx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4qal9irvdktwvv45j3mx.png" alt="Common part of speech tags used in NLP with their Penn Treebank codes and examples"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Common part of speech tags used in NLP with their Penn Treebank codes and&amp;nbsp;examples&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is Part of Speech&amp;nbsp;Tagging?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Part of speech tagging&lt;/strong&gt; (also called POS tagging) is the process of automatically assigning a grammatical label to every word in a sentence.&lt;/p&gt;

&lt;p&gt;Given the sentence:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“The quick brown fox jumps over the lazy dog.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A POS tagger produces:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;The/DT quick/JJ brown/JJ fox/NN jumps/VBZ over/IN the/DT lazy/JJ dog/NN&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Every word gets its tag. The model has now turned an unstructured sentence into structured grammatical information that downstream systems can reason about.&lt;/p&gt;

&lt;p&gt;This sounds straightforward, but the hard part is ambiguity. The same word can be different parts of speech depending on context, and it happens constantly in real language.&lt;/p&gt;

&lt;p&gt;Take the word &lt;em&gt;“run”&lt;/em&gt;:&lt;/p&gt;

&lt;p&gt;A POS tagger has to resolve this ambiguity correctly, using the surrounding words as context. That’s where the actual intelligence lies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Does POS Tagging&amp;nbsp;Matter?
&lt;/h3&gt;

&lt;p&gt;On its own, knowing that a word is a noun or a verb might seem like a small thing. But POS tags unlock a surprisingly wide range of downstream capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Named Entity Recognition&lt;/strong&gt; relies on POS tags to know where to look. Proper nouns (NNP) are strong signals for names of people, places, and organisations. A system that already knows which tokens are proper nouns has a massive head start on finding entities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependency parsing&lt;/strong&gt; (figuring out the grammatical relationships between words) depends on POS tags. You can’t determine whether a word is the subject or object of a verb without first knowing which words are verbs and which are nouns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Word sense disambiguation&lt;/strong&gt; uses POS tags to narrow down meaning. &lt;em&gt;“Bank”&lt;/em&gt; as a noun has different senses than &lt;em&gt;“bank”&lt;/em&gt; as a verb. Knowing the part of speech cuts the ambiguity in half before any deeper analysis begins.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Information extraction&lt;/strong&gt; uses POS patterns to find specific structures. A rule like “find all noun phrases followed by a verb” can extract subject-action pairs from text at scale. POS tags make those patterns possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Search and indexing&lt;/strong&gt; systems use POS tags to focus on content words (nouns, verbs, adjectives) and skip function words (the, a, in, of) that carry little meaning on their own.&lt;/p&gt;

&lt;h3&gt;
  
  
  How POS Tagging&amp;nbsp;Works
&lt;/h3&gt;

&lt;p&gt;Modern POS taggers use machine learning, but it helps to understand the intuition first.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Rule-Based Approach
&lt;/h3&gt;

&lt;p&gt;Early POS taggers were rule-based. Linguists wrote explicit rules: &lt;em&gt;if a word ends in “-ing” and follows a modal verb like “will” or “can,” tag it as a verb.&lt;/em&gt; These rules worked surprisingly well for formal text but broke down on informal language, new vocabulary, and edge cases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Statistical Approaches
&lt;/h3&gt;

&lt;p&gt;Statistical taggers replaced hand-written rules with probabilities learned from annotated data. Given a large corpus of text where humans have manually tagged every word, the model learns: &lt;em&gt;how likely is this word to be a verb? Given the previous word was a determiner, how likely is the next word to be a noun?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hidden Markov Models (HMMs) were the dominant approach for years. They model POS tagging as a sequence problem: what’s the most likely sequence of tags given this sequence of words?&lt;/p&gt;

&lt;h3&gt;
  
  
  Neural Approaches
&lt;/h3&gt;

&lt;p&gt;Today, most production POS taggers use neural networks, typically the same Transformer-based models used for other NLP tasks. These models learn rich contextual representations of each word and can resolve ambiguity that simpler models miss.&lt;/p&gt;

&lt;p&gt;The key advantage is context. A neural tagger doesn’t just look at a word and its immediate neighbours. It considers the entire sentence, which is exactly what’s needed to correctly tag words like &lt;em&gt;“run”&lt;/em&gt; or &lt;em&gt;“fast”&lt;/em&gt; that change meaning depending on what surrounds them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3hra1n5yq4gcm3212fgv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3hra1n5yq4gcm3212fgv.png" alt="How a POS tagger processes a sentence from raw text to tagged output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How a POS tagger processes a sentence from raw text to tagged&amp;nbsp;output&lt;/p&gt;

&lt;h3&gt;
  
  
  Syntactic Parsing: The Next&amp;nbsp;Level
&lt;/h3&gt;

&lt;p&gt;POS tagging tells you what each word is. &lt;strong&gt;Syntactic parsing&lt;/strong&gt; goes a step further and tells you how the words relate to each other.&lt;/p&gt;

&lt;p&gt;In the sentence &lt;em&gt;“The cat chased the mouse,”&lt;/em&gt; POS tagging tells you that &lt;em&gt;“cat”&lt;/em&gt; is a noun and &lt;em&gt;“chased”&lt;/em&gt; is a verb. Syntactic parsing tells you that &lt;em&gt;“cat”&lt;/em&gt; is the subject of &lt;em&gt;“chased”&lt;/em&gt; and &lt;em&gt;“mouse”&lt;/em&gt; is the object.&lt;/p&gt;

&lt;p&gt;There are two main types of syntactic parsing:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependency parsing&lt;/strong&gt; maps out the grammatical relationships between individual words. Each word gets connected to a “head” word that it depends on, with a label describing the relationship: subject, object, modifier, and so on. This produces a tree structure called a dependency tree.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Constituency parsing&lt;/strong&gt; breaks a sentence into nested phrases: a noun phrase, a verb phrase, a prepositional phrase. Each phrase can contain smaller phrases, producing a hierarchical tree that represents the full grammatical structure of the sentence.&lt;/p&gt;

&lt;p&gt;Both forms of parsing build directly on POS tags. They’re the next layer of structural understanding above tagging, and they’re used in more complex NLP tasks like question answering, machine translation, and relation extraction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdmiqo6ro6jubrg0fnm0g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdmiqo6ro6jubrg0fnm0g.png" alt="Dependency parsing and constituency parsing both build on POS tags to reveal sentence structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dependency parsing and constituency parsing both build on POS tags to reveal sentence structure&lt;/p&gt;

&lt;h3&gt;
  
  
  POS Tagging in Practice with&amp;nbsp;NLTK
&lt;/h3&gt;

&lt;p&gt;If you want to try POS tagging yourself, NLTK is the easiest starting point in Python.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;nltk&lt;/span&gt;  
&lt;span class="n"&gt;nltk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;averaged_perceptron_tagger&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  
&lt;span class="n"&gt;nltk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;punkt&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  

&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;nltk.tokenize&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;word_tokenize&lt;/span&gt;  
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;nltk&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pos_tag&lt;/span&gt;  

&lt;span class="n"&gt;sentence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The quick brown fox jumps over the lazy dog.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;  
&lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;word_tokenize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sentence&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  
&lt;span class="n"&gt;tags&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;pos_tag&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tokens&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  
&lt;span class="c1"&gt;# [('The', 'DT'), ('quick', 'JJ'), ('brown', 'JJ'), ('fox', 'NN'),  
#  ('jumps', 'VBZ'), ('over', 'IN'), ('the', 'DT'), ('lazy', 'JJ'), ('dog', 'NN'), ('.', '.')]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Four lines of meaningful code. Every token gets its tag.&lt;/p&gt;

&lt;p&gt;For production use, spaCy is the better choice. It’s faster, more accurate, and built for real-world text:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;spacy&lt;/span&gt;  

&lt;span class="n"&gt;nlp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;spacy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;en_core_web_sm&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  
&lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;nlp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The quick brown fox jumps over the lazy dog.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pos_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tag_&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;spaCy gives you two tag levels: &lt;code&gt;pos&lt;/code&gt; is a simplified universal tag (NOUN, VERB, ADJ), and &lt;code&gt;tag&lt;/code&gt; is the fine-grained Penn Treebank tag (NN, VBZ, JJ). For most applications, the simplified tags are enough.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is POS Tagging Still Used&amp;nbsp;Today?
&lt;/h3&gt;

&lt;p&gt;It’s a fair question. With large language models able to understand language end-to-end, does anyone still bother with POS tagging?&lt;/p&gt;

&lt;p&gt;The answer is yes, and more than you might expect.&lt;/p&gt;

&lt;p&gt;In production NLP systems, POS tagging is rarely the star of the show. But it quietly sits inside many of the pipelines that power real applications. Here’s where it still earns its place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clinical and legal NLP&lt;/strong&gt; relies heavily on POS tagging. These domains often use rule-based extraction pipelines alongside machine learning, because rules are auditable and explainable in ways that a neural network isn’t. When a hospital system needs to extract medication names and dosages from clinical notes, a pipeline that uses POS tags to identify noun phrases and filter by surrounding context is fast, transparent, and reliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Information extraction at scale&lt;/strong&gt; still uses POS-based patterns extensively. If you need to extract all “company acquired company” events from a corpus of ten million news articles, a POS-aware pattern matcher is often faster and more controllable than a fine-tuned language model, especially when your compute budget is limited.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lightweight NLP on constrained hardware&lt;/strong&gt; uses POS tagging as a preprocessing step to reduce the amount of text that needs to go through expensive models. Filter out irrelevant sentences using POS patterns first, then run your heavy model only on what’s left.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;spaCy pipelines&lt;/strong&gt; in production almost always include a POS tagger as a standard component. When you load a spaCy model, POS tagging happens automatically as part of the pipeline. Even if you never explicitly use the tags yourself, the downstream components like the dependency parser and named entity recogniser depend on them under the hood.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multilingual systems&lt;/strong&gt; often lean on POS tagging more heavily than English-only ones. For languages with complex morphology or less training data available for large models, grammatical structure provides signal that pure statistical learning can miss.&lt;/p&gt;

&lt;p&gt;The broader point: POS tagging is a foundational layer, not a product in itself. It doesn’t do anything impressive on its own. But remove it from a serious NLP pipeline and you’ll quickly feel the gaps it was quietly filling.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The best NLP systems are not built from one powerful model. They are built from layers of structured understanding, each one making the next more accurate.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What Comes&amp;nbsp;Next
&lt;/h3&gt;

&lt;p&gt;POS tagging gives you the grammatical skeleton of a sentence. But grammar alone doesn’t tell you what a sentence means.&lt;/p&gt;

&lt;p&gt;The next step is understanding how words relate to each other in terms of meaning, not just structure. That leads us to &lt;strong&gt;Dependency Parsing&lt;/strong&gt;, where we look at how NLP models map out the relationships between words: who did what to whom, what modifies what, and how the parts of a sentence connect into a coherent whole.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn This at Fondra&amp;nbsp;Labs
&lt;/h3&gt;

&lt;p&gt;This post is part of our &lt;a href="https://fondralabs.com/blogs.html" rel="noopener noreferrer"&gt;NLP Foundations series&lt;/a&gt;, where we build up practical AI knowledge one concept at a time, starting from the basics and going all the way to production-grade systems.&lt;/p&gt;

&lt;p&gt;At &lt;a href="https://fondralabs.com/" rel="noopener noreferrer"&gt;Fondra Labs&lt;/a&gt;, we teach AI from production reality, not hype. Every topic in this series is chosen because it genuinely matters when you sit down to build something real.&lt;/p&gt;

&lt;p&gt;If this was useful, explore the rest of the blog. We cover everything from machine learning fundamentals to deep learning architectures, NLP pipelines, and the practical skills that turn understanding into building.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://fondralabs.com/blog/nlp-foundations/part-of-speech-tagging-how-nlp-understands-grammar.html" rel="noopener noreferrer"&gt;&lt;em&gt;https://fondralabs.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>nlp</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Tokenization in NLP: How Machines Break Down Text</title>
      <dc:creator>Javier Aguirre</dc:creator>
      <pubDate>Fri, 04 Sep 2026 11:00:00 +0000</pubDate>
      <link>https://dev.to/javiagu13/tokenization-in-nlp-how-machines-break-down-text-5hej</link>
      <guid>https://dev.to/javiagu13/tokenization-in-nlp-how-machines-break-down-text-5hej</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkz3an4nvgl0hxtvul5fm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkz3an4nvgl0hxtvul5fm.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before a computer can understand a single word you write, it has to do something much more basic.&lt;/p&gt;

&lt;p&gt;It has to figure out where one piece of text ends and the next begins.&lt;/p&gt;

&lt;p&gt;That process is called &lt;strong&gt;tokenization&lt;/strong&gt;, and it’s the first step in almost every NLP system ever built. Whether you’re using a spam filter, a search engine, or ChatGPT, tokenization happened before anything else. It’s the foundation everything else is built on.&lt;/p&gt;

&lt;p&gt;This post explains what tokenization is, why it matters, and how it has evolved from simple word splitting into the sophisticated subword methods that power modern AI. Along the way, we’ll also cover the related concepts you’ll encounter whenever you work with text: stemming, lemmatization, and n-grams.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is Tokenization?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Tokenization&lt;/strong&gt; is the process of breaking text into smaller units called tokens.&lt;/p&gt;

&lt;p&gt;A token is just a piece of text. It might be a word, a punctuation mark, a part of a word, or even a single character. The important thing is that tokens are the units a model actually works with. Before any analysis, translation, or generation can happen, the raw text needs to be split into these pieces.&lt;/p&gt;

&lt;p&gt;Take this sentence:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“NLP is surprisingly powerful.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After word tokenization, it becomes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[“NLP”, “is”, “surprisingly”, “powerful”, “.”]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That’s it. Five tokens. The model now has something it can process.&lt;/p&gt;

&lt;p&gt;Simple in concept. But the details turn out to matter enormously.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcnxa5cegszjmoet3jrfk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcnxa5cegszjmoet3jrfk.png" alt="Word tokenization splits a sentence into individual tokens including punctuation" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Word tokenization splits a sentence into individual tokens including punctuation&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Tokenization Is Harder Than It&amp;nbsp;Looks
&lt;/h3&gt;

&lt;p&gt;You might be thinking: can’t you just split on spaces?&lt;/p&gt;

&lt;p&gt;For English, that gets you most of the way there. But language is messier than that.&lt;/p&gt;

&lt;p&gt;What do you do with &lt;em&gt;“don’t”&lt;/em&gt;? Is it one token or two (&lt;em&gt;“do”&lt;/em&gt; and &lt;em&gt;“n’t”&lt;/em&gt;)? What about &lt;em&gt;“New York”&lt;/em&gt;? Splitting on spaces gives you two tokens, but it’s one concept. What about emojis, URLs, email addresses, or code snippets mixed into text?&lt;/p&gt;

&lt;p&gt;And that’s just English. Languages like Chinese and Japanese have no spaces between words at all. Arabic and Hebrew write without vowels. German creates long compound words that are really several concepts joined together.&lt;/p&gt;

&lt;p&gt;Tokenization that works well across all of these is a genuinely hard problem. And how you solve it has downstream consequences for everything the model learns.&lt;/p&gt;

&lt;h3&gt;
  
  
  Word Tokenization
&lt;/h3&gt;

&lt;p&gt;The most intuitive approach is &lt;strong&gt;word tokenization&lt;/strong&gt;: split the text into individual words.&lt;/p&gt;

&lt;p&gt;This works well for clean, formal text. It’s fast, easy to understand, and produces tokens that map directly to human intuitions about language.&lt;/p&gt;

&lt;p&gt;The limitation is vocabulary size. If you train a model on word tokens, it can only handle words it has seen before. Give it &lt;em&gt;“unimaginably”&lt;/em&gt; when it’s only ever seen &lt;em&gt;“imagine”&lt;/em&gt; and &lt;em&gt;“imaginable”&lt;/em&gt;, and it’s stuck. This is called the &lt;strong&gt;out-of-vocabulary (OOV) problem&lt;/strong&gt;, and it’s one of the main reasons word tokenization has been largely superseded for modern AI systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stemming and Lemmatization: Reducing Words to Their&amp;nbsp;Core
&lt;/h3&gt;

&lt;p&gt;Before diving into more advanced tokenization, it’s worth understanding two related text processing techniques you’ll encounter constantly: stemming and lemmatization.&lt;/p&gt;

&lt;p&gt;Both answer the same question: when should &lt;em&gt;“running”&lt;/em&gt;, &lt;em&gt;“runs”&lt;/em&gt;, and &lt;em&gt;“ran”&lt;/em&gt; be treated as the same word?&lt;/p&gt;

&lt;h3&gt;
  
  
  Stemming
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Stemming&lt;/strong&gt; is the blunter approach. It chops off the ends of words using simple rules until you’re left with a root form called a stem.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Running”&lt;/em&gt; becomes &lt;em&gt;“run”&lt;/em&gt;. &lt;em&gt;“Fishing”&lt;/em&gt; becomes &lt;em&gt;“fish”&lt;/em&gt;. &lt;em&gt;“Better”&lt;/em&gt; becomes &lt;em&gt;“better”&lt;/em&gt; (stemming can’t handle irregular forms).&lt;/p&gt;

&lt;p&gt;It’s fast and simple, but it’s crude. The stem doesn’t have to be a real word. &lt;em&gt;“Arguing”&lt;/em&gt; might become &lt;em&gt;“argu”&lt;/em&gt;. &lt;em&gt;“Studies”&lt;/em&gt; might become &lt;em&gt;“studi”&lt;/em&gt;. That’s fine for some applications, like topic modelling or search indexing, where you just need to group related words together. It falls apart when you need the actual meaning of a word.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lemmatization
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Lemmatization&lt;/strong&gt; is the smarter approach. Instead of blindly chopping characters, it uses vocabulary and grammar rules to find the true base form of a word, called the lemma.&lt;/p&gt;

&lt;p&gt;Lemmatization understands that &lt;em&gt;“better”&lt;/em&gt; is a form of &lt;em&gt;“good”&lt;/em&gt;, something stemming can never figure out. It’s slower and requires more linguistic knowledge, but the output is always a real, meaningful word.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The Key Difference:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Stemming is fast and crude. Lemmatization is slower and correct. Choose based on what your task actually needs.”&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When to use each:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stemming:&lt;/strong&gt; search indexing, topic modelling, situations where speed matters and rough grouping is enough&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lemmatization:&lt;/strong&gt; sentiment analysis, question answering, any task where word meaning matters&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Subword Tokenization: The Modern&amp;nbsp;Solution
&lt;/h3&gt;

&lt;p&gt;Neither word tokenization nor character tokenization is quite right for modern AI. Word tokenization has the OOV problem. Character tokenization produces sequences so long they’re computationally impractical.&lt;/p&gt;

&lt;p&gt;The solution the field landed on is &lt;strong&gt;subword tokenization&lt;/strong&gt;: split words into pieces, but not all the way down to individual characters.&lt;/p&gt;

&lt;p&gt;The idea is elegant. Common words stay as single tokens. Rare or unknown words get split into recognisable subword pieces. &lt;em&gt;“Tokenization”&lt;/em&gt; might become &lt;em&gt;“token”&lt;/em&gt; + &lt;em&gt;“ization”&lt;/em&gt;. &lt;em&gt;“Unbelievable”&lt;/em&gt; might become &lt;em&gt;“un”&lt;/em&gt; + &lt;em&gt;“believ”&lt;/em&gt; + &lt;em&gt;“able”&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This gives the model the best of both worlds. It can handle any word, including ones it has never seen, because it can always fall back to subword pieces. And it keeps vocabulary size manageable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2dv1rv0h0on5kisawqtq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2dv1rv0h0on5kisawqtq.png" alt="Subword tokenization splits rare words into recognisable pieces while keeping common words intact" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Subword tokenization splits rare words into recognisable pieces while keeping common words&amp;nbsp;intact&lt;/p&gt;

&lt;h3&gt;
  
  
  Byte Pair Encoding&amp;nbsp;(BPE)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Byte Pair Encoding (BPE)&lt;/strong&gt; is the most widely used subword tokenization algorithm. It powers GPT, GPT-2, GPT-3, GPT-4, and many other major models.&lt;/p&gt;

&lt;p&gt;The algorithm works like this:&lt;/p&gt;

&lt;p&gt;Start with every character as its own token. Then repeatedly find the most common pair of adjacent tokens and merge them into a single new token. Repeat until you reach your desired vocabulary size.&lt;/p&gt;

&lt;p&gt;So if &lt;em&gt;“lo”&lt;/em&gt; and &lt;em&gt;“w”&lt;/em&gt; appear together constantly, they get merged into &lt;em&gt;“low”&lt;/em&gt;. If &lt;em&gt;“low”&lt;/em&gt; and &lt;em&gt;“er”&lt;/em&gt; appear together constantly, they get merged into &lt;em&gt;“lower”&lt;/em&gt;. The algorithm keeps building up frequent sequences into single tokens.&lt;/p&gt;

&lt;p&gt;The result is a vocabulary that naturally captures common words and common word fragments, while still being able to handle anything new by falling back to shorter pieces.&lt;/p&gt;

&lt;h3&gt;
  
  
  WordPiece
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;WordPiece&lt;/strong&gt; is a similar approach used by BERT and many Google models. The main difference is in how it decides what to merge. BPE merges the most frequent pairs. WordPiece merges the pairs that increase the likelihood of the training data the most.&lt;/p&gt;

&lt;p&gt;In practice, the results look similar. Subword pieces in WordPiece are often prefixed with &lt;code&gt;##&lt;/code&gt; to indicate they’re continuations of a word. &lt;em&gt;“playing”&lt;/em&gt; might become &lt;em&gt;“play”&lt;/em&gt; + &lt;em&gt;“##ing”&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  SentencePiece
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;SentencePiece&lt;/strong&gt; takes a slightly different approach: it treats the input as a raw stream of characters (including spaces) rather than pre-tokenized words. This makes it language-agnostic. It works equally well on English, Japanese, Chinese, or any other language without needing language-specific rules. It’s used in models like T5 and many multilingual systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  N-grams: Capturing Context Between&amp;nbsp;Tokens
&lt;/h3&gt;

&lt;p&gt;Once you have tokens, a natural next question is: does the order matter?&lt;/p&gt;

&lt;p&gt;Almost always, yes. &lt;em&gt;“Not good”&lt;/em&gt; means something very different from &lt;em&gt;“good”&lt;/em&gt;. &lt;em&gt;“Bank robbery”&lt;/em&gt; means something different from &lt;em&gt;“robbery bank”&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;N-grams&lt;/strong&gt; are a simple way to capture this. An n-gram is a sequence of n consecutive tokens.&lt;/p&gt;

&lt;p&gt;By looking at n-grams instead of individual tokens, models can capture short-range context. &lt;em&gt;“New York”&lt;/em&gt; as a bigram carries different meaning than &lt;em&gt;“New”&lt;/em&gt; and &lt;em&gt;“York”&lt;/em&gt; separately.&lt;/p&gt;

&lt;p&gt;N-grams were the backbone of language modelling before neural networks. They’re still used in text classification, spam detection, and search systems where simplicity and speed matter more than capturing long-range context.&lt;/p&gt;

&lt;p&gt;The limitation is obvious: n-grams only capture context within a short window. A trigram can’t know that the word at the start of a paragraph shapes the meaning of a word at the end. That’s what neural networks, and ultimately the Transformer, were built to solve.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg5yfcnidas5ohmuh601y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg5yfcnidas5ohmuh601y.png" alt="N-grams capture sequences of consecutive tokens: unigrams, bigrams, and trigrams" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;N-grams capture sequences of consecutive tokens: unigrams, bigrams, and&amp;nbsp;trigrams&lt;/p&gt;

&lt;h3&gt;
  
  
  How Modern LLMs Tokenize&amp;nbsp;Text
&lt;/h3&gt;

&lt;p&gt;If you’ve ever used ChatGPT or Claude and noticed that pricing is measured in “tokens,” this is where that comes from.&lt;/p&gt;

&lt;p&gt;Modern large language models use BPE or similar subword methods. Every piece of text you send gets broken into tokens before the model ever sees it. The model generates its response one token at a time.&lt;/p&gt;

&lt;p&gt;On average, one token is roughly four characters in English, or about three-quarters of a word. &lt;em&gt;“Tokenization”&lt;/em&gt; is two tokens. &lt;em&gt;“Hello”&lt;/em&gt; is one. A typical paragraph is around 100 tokens.&lt;/p&gt;

&lt;p&gt;This is also why LLMs sometimes handle unusual words or names strangely. If a word gets split into many subword pieces, the model has to work harder to reason about it as a coherent unit. The tokenization shapes what the model finds easy or difficult.&lt;/p&gt;

&lt;h3&gt;
  
  
  Putting It&amp;nbsp;Together
&lt;/h3&gt;

&lt;p&gt;Here’s a quick summary of the landscape:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Word tokenization:&lt;/strong&gt; simple, intuitive, but can’t handle unknown words&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stemming:&lt;/strong&gt; fast root-finding, crude, sometimes produces non-words&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lemmatization:&lt;/strong&gt; accurate root-finding, slower, always produces real words&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subword tokenization (BPE, WordPiece, SentencePiece):&lt;/strong&gt; the modern standard, handles any word, used in all major LLMs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;N-grams:&lt;/strong&gt; sequences of tokens that capture short-range context, still used in classical NLP&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each approach has its place. For production NLP systems today, subword tokenization is almost always the right choice. For understanding older systems or building lightweight classifiers, word tokens and n-grams still have their role.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Comes&amp;nbsp;Next
&lt;/h3&gt;

&lt;p&gt;Tokenization turns raw text into something a model can process. But once you have tokens, the next question is: what role does each one play in the sentence?&lt;/p&gt;

&lt;p&gt;That’s what &lt;strong&gt;Part of Speech Tagging&lt;/strong&gt; covers. It’s the process of labelling each token with its grammatical role: noun, verb, adjective, and so on. It sounds simple, but it’s one of the foundational steps that allows NLP systems to understand the structure of language, not just the words themselves.&lt;/p&gt;

&lt;p&gt;In the next post in this series, we’ll break down how POS tagging works, why it matters, and where it shows up in real NLP pipelines.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learn This at Fondra&amp;nbsp;Labs
&lt;/h3&gt;

&lt;p&gt;This post is part of our &lt;a href="https://fondralabs.com/nlp-foundations.html" rel="noopener noreferrer"&gt;NLP Foundations series&lt;/a&gt;, where we cover everything from the basics of text processing to the architectures powering modern AI systems.&lt;/p&gt;

&lt;p&gt;At &lt;a href="http://fondralabs.com" rel="noopener noreferrer"&gt;Fondra Labs&lt;/a&gt;, we teach AI from production reality, not hype. Every concept in this series is chosen because it matters in practice, not just in theory. Tokenization, embeddings, retrieval, evaluation: these are the building blocks that engineers actually use when they build real systems.&lt;/p&gt;

&lt;p&gt;If you found this useful, explore the rest of the blog. We cover machine learning, deep learning, NLP, and the practical skills that bridge the gap between understanding AI and building with it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://fondralabs.com/blog/nlp-foundations/tokenization-in-nlp-how-machines-break-down-text.html" rel="noopener noreferrer"&gt;&lt;em&gt;https://fondralabs.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>nlp</category>
    </item>
    <item>
      <title>NLP Meaning: What is Natural Language Processing &amp; How Does It Work?</title>
      <dc:creator>Javier Aguirre</dc:creator>
      <pubDate>Wed, 02 Sep 2026 06:07:02 +0000</pubDate>
      <link>https://dev.to/javiagu13/nlp-meaning-what-is-natural-language-processing-how-does-it-work-13ej</link>
      <guid>https://dev.to/javiagu13/nlp-meaning-what-is-natural-language-processing-how-does-it-work-13ej</guid>
      <description>&lt;h3&gt;
  
  
  NLP Meaning: What is Natural Language Processing &amp;amp; How Does It&amp;nbsp;Work?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl07jew2t6dxehbch0si9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fl07jew2t6dxehbch0si9.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You’ve used it today. Probably without noticing.&lt;/p&gt;

&lt;p&gt;Every time your phone autocompletes a sentence, every time Gmail moves a suspicious email to spam, every time you ask Google a question and it actually understands what you meant: that’s natural language processing at work.&lt;/p&gt;

&lt;p&gt;And yet most people couldn’t explain what it actually is.&lt;/p&gt;

&lt;p&gt;This post fixes that. By the end, you’ll have a clear, honest understanding of what NLP is, how it works, where it shows up in the real world, and how to get started with it. No jargon. No unnecessary complexity. Just the real thing, explained so it actually makes sense.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is&amp;nbsp;NLP?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Natural language processing (NLP)&lt;/strong&gt; is the field of AI that teaches computers to understand human language.&lt;/p&gt;

&lt;p&gt;That’s it at its core. But let’s unpack why that’s harder than it sounds.&lt;/p&gt;

&lt;p&gt;Computers are designed for precision. They’re comfortable with numbers, rules, and structured data. Tell a computer that 2 + 2 = 4 and it will never be confused. But human language is the opposite of precise. It’s full of ambiguity, context, and meaning that shifts depending on who’s speaking, how they’re saying it, and what came before.&lt;/p&gt;

&lt;p&gt;Take this sentence: &lt;em&gt;“I saw the man with the telescope.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftfqyqsfpwuf88x322per.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftfqyqsfpwuf88x322per.png" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Did you use a telescope to see the man? Or did you see a man who was holding a telescope? Both are valid readings of the exact same sentence. A human picks the right one instantly using context. A computer has to be taught how to do that.&lt;/p&gt;

&lt;p&gt;Or take the word “sick.” Depending on who says it and where, it can mean ill, disgusting, or (if you’re under 30) genuinely impressive.&lt;/p&gt;

&lt;p&gt;NLP is the field dedicated to teaching computers to navigate all of that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Does This&amp;nbsp;Matter?
&lt;/h3&gt;

&lt;p&gt;Think about how much of the world runs on language.&lt;/p&gt;

&lt;p&gt;Emails. Contracts. Medical records. Customer reviews. News articles. Social media. Search queries. Support tickets. Code documentation.&lt;/p&gt;

&lt;p&gt;Most of the information that matters to businesses, governments, hospitals, and individuals exists as unstructured text. Nobody sat down and put it into tidy rows and columns. It’s just words.&lt;/p&gt;

&lt;p&gt;For decades, this information was largely unprocessable at scale. You couldn’t automatically read a million customer reviews to understand what people loved or hated about your product. You couldn’t scan thousands of legal contracts to flag the risky ones. You couldn’t build a system that actually understood what a user was asking for.&lt;/p&gt;

&lt;p&gt;NLP changed that. It turned language into something computers can work with.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Does NLP&amp;nbsp;Work?
&lt;/h3&gt;

&lt;p&gt;Here’s the honest answer: NLP works by converting text into numbers, finding patterns in those numbers, and using those patterns to make predictions or generate new text.&lt;/p&gt;

&lt;p&gt;Let’s break that down into something concrete.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Breaking Text&amp;nbsp;Apart
&lt;/h3&gt;

&lt;p&gt;Before a computer can understand a sentence, it needs to split it into manageable pieces. This is called &lt;strong&gt;tokenization&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The sentence &lt;em&gt;“NLP is fascinating”&lt;/em&gt; becomes something like: &lt;code&gt;[“NLP”, “is”, “fascinating”]&lt;/code&gt;. These pieces (tokens) are the units the model actually works with.&lt;/p&gt;

&lt;p&gt;Simple enough. But tokenization gets interesting fast. Modern AI models don’t always split on words. They often split on parts of words. The word “fascinating” might become &lt;code&gt;[“fascin”, “ating”]&lt;/code&gt;. This is called subword tokenization, and it’s one of the reasons modern language models can handle words they’ve never seen before.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv52zwdewwds1auc8rgt0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv52zwdewwds1auc8rgt0.png" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Turning Words into&amp;nbsp;Numbers
&lt;/h3&gt;

&lt;p&gt;Computers can’t process words directly. Everything needs to become a number.&lt;/p&gt;

&lt;p&gt;The clever solution NLP researchers found is called &lt;strong&gt;word embeddings&lt;/strong&gt;. Each word gets converted into a list of numbers (a vector) that captures its meaning. Words with similar meanings end up with similar vectors. “Dog” and “puppy” are close together. “Dog” and “aeroplane” are far apart.&lt;/p&gt;

&lt;p&gt;This is how meaning gets encoded into something a computer can actually compute with.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F96v5z1fl9cssm10z8fde.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F96v5z1fl9cssm10z8fde.png" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Finding&amp;nbsp;Patterns
&lt;/h3&gt;

&lt;p&gt;Once text is in numerical form, machine learning models can find patterns in it.&lt;/p&gt;

&lt;p&gt;Think of it like this: if you show a model millions of sentences and tell it which ones are positive and which are negative, it learns to recognize the patterns that signal each. It starts noticing that words like “love,” “amazing,” and “perfect” tend to appear in positive sentences. Words like “terrible,” “waste,” and “broken” tend to appear in negative ones.&lt;/p&gt;

&lt;p&gt;That’s sentiment analysis, one of the most widely used NLP tasks, and it works through the same basic loop: show the model many examples, let it find the patterns, use those patterns to make predictions on new text.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Transformer: Why Modern NLP Is So&amp;nbsp;Powerful
&lt;/h3&gt;

&lt;p&gt;For a long time, NLP models had a fundamental limitation: they processed language one word at a time, left to right. They’d often “forget” what was said at the start of a long sentence by the time they reached the end.&lt;/p&gt;

&lt;p&gt;In 2017, a team at Google introduced a new architecture called the &lt;strong&gt;Transformer&lt;/strong&gt;. The key idea was simple but powerful: instead of reading words one by one, process all of them at once, and let every word pay attention to every other word simultaneously.&lt;/p&gt;

&lt;p&gt;This meant the model could understand that the word “it” at the end of a paragraph referred to something mentioned at the beginning. It could track relationships across long stretches of text without losing track.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;“Attention is all you need.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;- Vaswani et al., Google Brain, 2017&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every major AI language system you’ve heard of (ChatGPT, Claude, Gemini, BERT) is built on the Transformer. It was the breakthrough that made modern NLP possible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgmokd401fykkqikymf2s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgmokd401fykkqikymf2s.png" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  NLP in Artificial Intelligence: Where It&amp;nbsp;Fits
&lt;/h3&gt;

&lt;p&gt;If you’re trying to understand how NLP relates to AI more broadly, here’s a simple way to think about it.&lt;/p&gt;

&lt;p&gt;Artificial intelligence is the big umbrella. It’s the general goal of making machines that can do things that normally require human intelligence.&lt;/p&gt;

&lt;p&gt;Under that umbrella, there are different areas depending on what type of intelligence you’re trying to replicate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Computer Vision:&lt;/strong&gt; understanding images and video (what’s in this photo?)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Speech Recognition:&lt;/strong&gt; understanding spoken audio (what did that person just say?)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Natural Language Processing:&lt;/strong&gt; understanding and generating text (what does this sentence mean?)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NLP is the branch of AI focused specifically on language. And increasingly, these areas are merging. Modern AI systems handle text, images, and audio together. But NLP remains the backbone. Even in multimodal systems, language is how instructions are given and how outputs are delivered.&lt;/p&gt;

&lt;h3&gt;
  
  
  NLP and Machine Learning: What’s the Relationship?
&lt;/h3&gt;

&lt;p&gt;This trips a lot of beginners up, so let’s clear it up once and for all.&lt;/p&gt;

&lt;p&gt;Think of it as nested circles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Artificial Intelligence&lt;/strong&gt; is the outermost circle: the broad goal of intelligent machines&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Machine Learning&lt;/strong&gt; sits inside AI: it’s the approach of teaching machines by showing them data rather than writing explicit rules&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deep Learning&lt;/strong&gt; sits inside ML: it’s machine learning using large neural networks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NLP&lt;/strong&gt; is an application: it’s ML and deep learning applied to the specific problem of language&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So NLP isn’t a competitor to machine learning or deep learning. It uses them. It’s what you get when you take those tools and point them at language.&lt;/p&gt;

&lt;h3&gt;
  
  
  NLP Examples: Where You’ve Already Seen&amp;nbsp;It
&lt;/h3&gt;

&lt;p&gt;The best way to make NLP concrete is to look at where you already use it every day.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spam filters&lt;/strong&gt; read your incoming email and decide whether it’s legitimate or junk. They learned to do this from millions of examples of spam and non-spam emails. Now they make that judgment in milliseconds, invisibly, on every email you receive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Search engines&lt;/strong&gt; don’t just match keywords anymore. When you type “best way to cook chicken without drying it out,” Google doesn’t look for pages containing those exact words. It understands the intent (you want a moist chicken) and surfaces pages that address that, even if they use completely different words.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Virtual assistants&lt;/strong&gt; (Siri, Alexa, Google Assistant) listen to your voice, convert it to text, figure out what you’re asking for, retrieve the answer, and speak it back to you. NLP is running at every single step of that process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Machine translation&lt;/strong&gt; tools like Google Translate take text in one language and produce text in another, handling grammar, idioms, and context that would have seemed like science fiction twenty years ago.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Autocomplete on your phone&lt;/strong&gt; has learned from how you type. It predicts what you’re about to say based on patterns it has observed across millions of conversations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ChatGPT, Claude, Gemini&lt;/strong&gt; (the AI assistants you may already use) are the most advanced NLP systems in existence. They can write, explain, summarise, translate, code, and reason in natural language.&lt;/p&gt;

&lt;h3&gt;
  
  
  NLP Applications Across Industries
&lt;/h3&gt;

&lt;p&gt;NLP isn’t just for consumer apps. It’s quietly transforming how whole industries operate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Healthcare:&lt;/strong&gt; Doctors write clinical notes in natural language, unstructured text that’s hard to search or analyse. NLP systems can read these notes and extract structured information: what diagnosis was made, what medication was prescribed, what symptoms were mentioned. This makes patient records usable in ways they previously weren’t.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Finance:&lt;/strong&gt; Analysts use NLP to monitor news and earnings call transcripts for signals. When a CEO says “we’re cautiously optimistic” versus “we’re very confident,” the difference matters. NLP systems can track these signals across thousands of documents simultaneously.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Legal:&lt;/strong&gt; Lawyers spend enormous amounts of time reading contracts. NLP tools can scan a contract, flag unusual clauses, compare it against standard templates, and summarise the key terms. Tasks that previously took hours now take minutes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Customer service:&lt;/strong&gt; When you submit a support ticket or chat with a bot, NLP is classifying your request, routing it to the right team, and often generating the first response. The better the NLP, the less you notice you’re not talking to a human.&lt;/p&gt;

&lt;p&gt;The common thread: wherever there’s unstructured text that matters, NLP creates value.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Started with NLP in&amp;nbsp;Python
&lt;/h3&gt;

&lt;p&gt;If you want to go beyond understanding NLP and actually start building with it, Python is where you start. It’s the language the entire NLP community uses, and the tools are excellent.&lt;/p&gt;

&lt;p&gt;Three libraries worth knowing about:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NLTK&lt;/strong&gt; (Natural Language Toolkit) is the classic beginner library. It’s great for learning the basics: tokenization, stemming, simple text analysis. Not what you’d use in production, but a solid starting point for understanding concepts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;spaCy&lt;/strong&gt; is the professional-grade library. Fast, reliable, and built for real-world use. If you’re building something that needs to run in production, spaCy is usually where you land.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hugging Face Transformers&lt;/strong&gt; is where modern NLP lives. It gives you access to thousands of pretrained models (including the same architectures behind ChatGPT and BERT) with just a few lines of code.&lt;/p&gt;

&lt;p&gt;Here’s what that looks like in practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;transformers&lt;/span&gt; 
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pipeline&lt;/span&gt; 
&lt;span class="n"&gt;classifier&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;pipeline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sentiment-analysis&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;classifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;I absolutely loved this product.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# [{'label': 'POSITIVE', 'score': 0.9998}]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Four lines of code. State-of-the-art sentiment analysis. That’s the power of the current ecosystem.&lt;/p&gt;

&lt;p&gt;A sensible learning path:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start with NLTK to get comfortable with the basics&lt;/li&gt;
&lt;li&gt;Move to spaCy when you want to build something real&lt;/li&gt;
&lt;li&gt;Learn the concepts (tokens, embeddings, attention) before jumping to Hugging Face&lt;/li&gt;
&lt;li&gt;Use Hugging Face to fine-tune pretrained models on your own data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The concepts are more important than the tools. Tools change. The ideas behind them don’t.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Comes&amp;nbsp;Next
&lt;/h3&gt;

&lt;p&gt;You now understand what NLP is, why it matters, how it works at a high level, and where it shows up in the world.&lt;/p&gt;

&lt;p&gt;This is the foundation. The rest of this series builds on it, one concept at a time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tokenization:&lt;/strong&gt; how text gets split into the pieces models actually process, including the subword methods that power every modern LLM&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Word Embeddings:&lt;/strong&gt; how words become numbers that carry meaning, from Word2Vec to BERT&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Named Entity Recognition:&lt;/strong&gt; teaching models to find people, places, and organisations in text&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sentiment Analysis:&lt;/strong&gt; detecting opinion and emotion at scale&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic Search &amp;amp; RAG:&lt;/strong&gt; how NLP powers modern search and AI assistants&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each post goes deeper on one piece of the picture. If you follow the series in order, you’ll build a solid, practical understanding of NLP from the ground up, the kind that actually helps when you sit down to build something.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://fondralabs.com/blog/nlp-foundations/nlp-meaning-what-is-natural-language-processing-how-does-it-work.html" rel="noopener noreferrer"&gt;&lt;em&gt;https://fondralabs.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>nlp</category>
    </item>
    <item>
      <title>Deep Learning for Beginners: A Complete Guide</title>
      <dc:creator>Javier Aguirre</dc:creator>
      <pubDate>Fri, 29 May 2026 03:31:41 +0000</pubDate>
      <link>https://dev.to/javiagu13/deep-learning-for-beginners-a-complete-guide-2h54</link>
      <guid>https://dev.to/javiagu13/deep-learning-for-beginners-a-complete-guide-2h54</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb4ueowvyl0c7ld9hghfw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb4ueowvyl0c7ld9hghfw.jpg" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You've heard the words. Neural networks. Deep learning AI. Transformers. Maybe you've even heard that deep learning is what powers ChatGPT, image generators, voice assistants, and self-driving cars. And now you're wondering: what actually &lt;em&gt;is&lt;/em&gt; it?&lt;/p&gt;

&lt;p&gt;This guide is the honest, comprehensive answer. Not watered down. Not padded with fluff. Just the core ideas, the key architectures, and the intuition you need to actually understand what's going on under the hood, explained clearly enough that a beginner can follow it, and thoroughly enough that it stays useful as you go deeper.&lt;/p&gt;

&lt;p&gt;If you haven't read our post on machine learning basics yet, I'd recommend starting there. Deep learning builds directly on top of machine learning, and a few concepts from that post will make this one click much faster. That said, let's get into it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Deep Learning?
&lt;/h2&gt;

&lt;p&gt;Deep learning is a branch of machine learning that uses &lt;strong&gt;artificial neural networks&lt;/strong&gt; (systems loosely inspired by the structure of the human brain) to learn patterns from data.&lt;/p&gt;

&lt;p&gt;The word "deep" refers to &lt;em&gt;depth&lt;/em&gt;: the number of layers stacked inside the network. A shallow network might have one or two layers. A deep network might have dozens, hundreds, or in the case of modern large language models, thousands. Each layer transforms the data slightly, learning increasingly abstract representations as you move through the stack.&lt;/p&gt;

&lt;p&gt;Here's the key insight that separates deep learning from classical machine learning: traditional ML algorithms need humans to engineer features manually. You decide what inputs matter. In deep learning, the network learns its own features directly from raw data, pixels, waveforms, text characters, without being told what to look for.&lt;/p&gt;

&lt;p&gt;That's what makes it so powerful. And that's what makes it so data-hungry.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Deep learning is not magic. It's a very large function with millions of parameters, trained on enormous amounts of data, that has learned to approximate patterns no human could write by hand."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What Is Deep Learning vs Machine Learning?
&lt;/h2&gt;

&lt;p&gt;It's a nested relationship, not a competition. All deep learning is machine learning, but not all machine learning is deep learning.&lt;/p&gt;

&lt;p&gt;Classical machine learning (decision trees, random forests, gradient boosting) works well on structured, tabular data. It's interpretable, efficient, and still dominant across most real-world business applications.&lt;/p&gt;

&lt;p&gt;Deep learning takes over when the data is &lt;em&gt;unstructured&lt;/em&gt;: images, audio, video, raw text. These formats have too many dimensions and too much complexity for traditional algorithms to handle well. Neural networks, with their layered feature learning, are built exactly for this.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use classical ML&lt;/strong&gt; for credit scoring, demand forecasting, fraud detection, churn prediction: structured tables, interpretability required&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use deep learning&lt;/strong&gt; for image recognition, speech, language understanding, video: unstructured data, pattern complexity at scale&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The honest take: deep learning is not always better. It requires significantly more data and compute. When you have a clean tabular dataset and a clear prediction task, XGBoost will often beat a neural network and train in seconds rather than hours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Neural Network Basics
&lt;/h2&gt;

&lt;p&gt;Before we get into specific architectures, you need to understand the building blocks. Every deep learning model, regardless of how complex, is built from the same core components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Neurons, Layers, and Activation Functions
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;neuron&lt;/strong&gt; is the basic unit. It takes a set of inputs, multiplies each by a learned weight, sums everything up, and passes the result through an &lt;strong&gt;activation function&lt;/strong&gt;. That output feeds into the next layer.&lt;/p&gt;

&lt;p&gt;Here I attach an image of the comparison of a real neural network and an artificial one (on the right). You do not need to understand the formula, but just understand the following: 3 weights are coming to the neuron (these are the values of the previous neurons of a neural network). Inside there is a scary formula. However, trust me, is not that scary, it is basically is a fancy way of saying... Let's sum them all up! and just a little thing more I will describe soon, which is, we add an activation function to it. &lt;/p&gt;

&lt;p&gt;That's all!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh62io11386ze8z3259ty.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh62io11386ze8z3259ty.png" alt="real neural network vs artificial neural network" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So... what is an activation function? the activation function is what gives neural networks their power. Without it, stacking layers would be mathematically equivalent to having just one layer: you'd just be doing linear transformations. Activation functions introduce &lt;em&gt;non-linearity&lt;/em&gt;, which is what allows the network to learn complex patterns. If you did not completely get it, it is okay, this is the biggest mathematical part of the explanation!&lt;/p&gt;

&lt;p&gt;The three you'll see everywhere:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ReLU (Rectified Linear Unit):&lt;/strong&gt; outputs zero for negative inputs, passes positive inputs through unchanged. Simple, fast, and the default choice for hidden layers in most networks. The fact that something this simple works so well is one of the quiet surprises of deep learning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sigmoid:&lt;/strong&gt; squashes output to a value between 0 and 1. Used in binary classification output layers where you want a probability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Softmax:&lt;/strong&gt; extends sigmoid to multiple classes. Takes a vector of raw scores and converts them into probabilities that sum to 1. Used in the final layer of any multi-class classifier.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So basically, you can see the activation functions as a filter to decide what value will the neuron have after we summed up previous neurons values. And we can do it in different ways. If you want to understand it a bit deeper here is a deconstruction on how it exactly works:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftth9i4w8o7uu0zh4om5h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftth9i4w8o7uu0zh4om5h.png" alt="artificial neuron - deconstructed" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Feedforward Networks: How Information Flows
&lt;/h3&gt;

&lt;p&gt;Now you know how an artificial neural netwok works, great! The next step is stacking them up and we would get a neural network. Feedforward neural networks are the simplest neural network, information travels in one direction only: input → hidden layers → output. No loops, no memory, no feedback. Each layer is &lt;em&gt;fully connected&lt;/em&gt; to the next, every neuron in layer N connects to every neuron in layer N+1.&lt;/p&gt;

&lt;p&gt;This is called a &lt;strong&gt;feedforward network&lt;/strong&gt;, and it's the foundation that every other architecture builds on top of or departs from. (yes, including chatGPT, Claude and other transformer based models, here is where it all starts.)&lt;/p&gt;

&lt;h3&gt;
  
  
  Backpropagation: How the Network Actually Learns
&lt;/h3&gt;

&lt;p&gt;Training a neural network means finding the right weights. You do this by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Making a prediction with the current weights&lt;/li&gt;
&lt;li&gt;Measuring how wrong it was (the &lt;em&gt;loss&lt;/em&gt;, &lt;strong&gt;remember this term&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;Computing how much each weight contributed to that error&lt;/li&gt;
&lt;li&gt;Nudging every weight slightly in the direction that reduces the loss&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Step 3 is backpropagation, the algorithm that efficiently computes the gradient of the loss with respect to every weight in the network, propagating the error signal backward from the output layer to the input. Step 4 is &lt;strong&gt;gradient descent&lt;/strong&gt;, the optimiser that uses those gradients to update the weights.&lt;/p&gt;

&lt;p&gt;This loop (forward pass, compute loss, backward pass, update weights) repeats for millions or billions of iterations during training. That's how a network goes from random noise to something that can recognise faces, translate languages, or generate code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important note:&lt;/strong&gt; How the neuron, backpropagation, gradient descent, losses work is important to understand. You will not need to perform any math in practice but this theory can help you grasp what you are doing better. Do not get stuck on it, but if you can learn it, I highly recommend it. &lt;/p&gt;

&lt;p&gt;I decided to write it in this blog so you know it exists but this part and the next two (weight initialisation and batch normalization) could be skipped since they are not that much oriented towards the practice but more towards foundational knowledge.&lt;/p&gt;

&lt;p&gt;Give it a quick read, if you do not fully get it, keep on going and dont worry!&lt;/p&gt;

&lt;h3&gt;
  
  
  Weight Initialisation
&lt;/h3&gt;

&lt;p&gt;How you set the initial weights before training matters more than most tutorials admit. Start them all at zero and the network won't learn: every neuron computes the same thing and the gradients are identical. Start them too large and training becomes unstable. Smart initialisation schemes (Xavier, He initialisation) are designed to keep signal flowing cleanly through the network from the start.&lt;/p&gt;

&lt;h3&gt;
  
  
  Batch Normalisation
&lt;/h3&gt;

&lt;p&gt;As networks get deeper, a problem emerges: the distribution of activations shifts during training, making learning unstable and slow. Batch normalisation addresses this by normalising the inputs to each layer across a mini-batch, keeping activations in a stable range. It's one of those techniques that felt like a trick when it was introduced and turned out to be foundational, it's now standard in almost every deep architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Architectures
&lt;/h2&gt;

&lt;p&gt;Now for the interesting part. If you made it till here, congratulations! now its the fun part, so, keep on reading! &lt;/p&gt;

&lt;p&gt;Deep learning is not one thing, it's a family of architectures, each designed for a different kind of data and a different kind of problem. Here are the ones worth knowing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Feedforward Neural Networks (FFNN)
&lt;/h3&gt;

&lt;p&gt;The simplest deep network. Fully connected layers, information flows in one direction, no special structure. This is the architecture that introduces every concept (neurons, activations, backpropagation) in its clearest form.&lt;/p&gt;

&lt;p&gt;In practice, pure FFNNs are rarely used for complex tasks. Images have spatial structure that FFNNs ignore. Sequences have temporal dependencies that FFNNs can't capture. But understanding the FFNN deeply is non-negotiable before moving to anything else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When you'd use it:&lt;/strong&gt; tabular data, simple classification and regression tasks, as a component inside larger architectures.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdwic3xwcta571u1eh9nm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdwic3xwcta571u1eh9nm.png" alt="feed forward neural network ffnn" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Convolutional Neural Networks (CNNs)
&lt;/h3&gt;

&lt;p&gt;CNNs are the architecture that put deep learning on the map. In 2012, a CNN called AlexNet won the ImageNet competition by a margin so large it ended the debate about whether deep learning worked. It did.&lt;/p&gt;

&lt;p&gt;The key idea: instead of connecting every neuron to every pixel (computationally insane for large images), CNNs apply small &lt;strong&gt;filters&lt;/strong&gt; that slide across the input, detecting local patterns. Early layers learn to detect edges and textures. Later layers combine those into shapes, objects, faces.&lt;/p&gt;

&lt;p&gt;This design is efficient, spatially aware, and extraordinarily effective on anything that has grid-like structure: images, video frames, certain kinds of audio.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When you'd use it:&lt;/strong&gt; image classification, object detection, medical imaging, video analysis, any problem where spatial patterns matter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpnp253lb0w54dz6awsea.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpnp253lb0w54dz6awsea.png" alt="convolutional neural network - CNN" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Recurrent Neural Networks (RNNs) and LSTMs
&lt;/h3&gt;

&lt;p&gt;What if your data is a &lt;em&gt;sequence&lt;/em&gt; (a sentence, a time series, an audio clip) where the order of elements matters?&lt;/p&gt;

&lt;p&gt;FFNNs and CNNs don't have memory. They process each input independently. RNNs fix this by feeding the hidden state from the previous step into the current step, giving the network a form of short-term memory.&lt;/p&gt;

&lt;p&gt;In theory, this lets RNNs capture long-range dependencies. In practice, they struggle: gradients either explode or vanish as they travel through many time steps, making it hard to learn patterns that span long sequences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LSTMs (Long Short-Term Memory networks)&lt;/strong&gt; solve this with a more sophisticated memory mechanism, gates that control what information to keep, what to forget, and what to output. LSTMs were the state of the art for language and sequence tasks for years before Transformers arrived.&lt;/p&gt;

&lt;p&gt;The following is a illustration of its internal construction, this is how one LSTM cell looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fttk4w8n35tv5cv0so8f5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fttk4w8n35tv5cv0so8f5.png" alt="LSTM cell" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do not worry as you will never have implement this from scratch :)&lt;/p&gt;

&lt;p&gt;Again, is just good to know this exists for the future usage.&lt;/p&gt;

&lt;p&gt;They're not obsolete, they're still used in production systems where efficiency matters and sequences are modest in length. But for most language tasks, Transformers have superseded them.&lt;/p&gt;

&lt;p&gt;The following is an illustration of how an entire LSTM looks like:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When you'd use them:&lt;/strong&gt; time series forecasting, speech recognition (in resource-constrained settings), sensor data, any ordered sequence where Transformers would be overkill.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgb2ksqfagvypp5xpyt7g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgb2ksqfagvypp5xpyt7g.png" alt="long short term memory neural network lstm nn" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Autoencoders and VAEs
&lt;/h3&gt;

&lt;p&gt;An &lt;strong&gt;autoencoder&lt;/strong&gt; is trained to compress an input into a smaller representation (the &lt;em&gt;latent space&lt;/em&gt;) and then reconstruct it back to the original. The bottleneck forces the network to learn the most essential features of the data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Variational Autoencoders (VAEs)&lt;/strong&gt; extend this by learning a &lt;em&gt;probability distribution&lt;/em&gt; over the latent space rather than a fixed point. This makes the latent space continuous and structured, which means you can sample from it to generate new data, not just reconstruct existing inputs.&lt;/p&gt;

&lt;p&gt;VAEs were an early serious approach to generative modelling and introduced ideas (latent space, encoder-decoder structure) that appear throughout modern AI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When you'd use them:&lt;/strong&gt; anomaly detection, data compression, generative modelling, representation learning, synthetic data generation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4mmumrxsstjn2m1t9bkp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4mmumrxsstjn2m1t9bkp.png" alt="variational autoencoder diagram - VAE diagram" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  GANs (Generative Adversarial Networks)
&lt;/h3&gt;

&lt;p&gt;GANs are one of the most creative ideas in all of deep learning. The setup: two networks trained in opposition.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;generator&lt;/strong&gt; produces fake data (images, audio, whatever the domain). The &lt;strong&gt;discriminator&lt;/strong&gt; tries to tell real from fake. As training progresses, the generator gets better at fooling the discriminator, and the discriminator gets better at detecting fakes. Each improves in response to the other.&lt;/p&gt;

&lt;p&gt;When it works, GANs produce extraordinarily realistic outputs. They dominated image synthesis for years and the photorealistic faces you may have seen on sites like "This Person Does Not Exist" are GAN-generated.&lt;/p&gt;

&lt;p&gt;They're notoriously difficult to train, mode collapse, training instability, and sensitivity to hyperparameters make them frustrating in practice. Diffusion models have largely superseded them for image generation, but the adversarial training concept remains influential.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When you'd use them:&lt;/strong&gt; image synthesis, data augmentation, style transfer, domain adaptation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiv0xrxghwv4sh1dnn2sh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiv0xrxghwv4sh1dnn2sh.png" alt="generative adversarial networks - GANs" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Diffusion Models
&lt;/h3&gt;

&lt;p&gt;Diffusion models are the architecture behind Stable Diffusion, DALL-E, and most of the state-of-the-art image generators you've seen. The idea is elegant and counterintuitive.&lt;/p&gt;

&lt;p&gt;Training: take real images and gradually add Gaussian noise until they're pure static. Teach the network to &lt;em&gt;reverse&lt;/em&gt; this process, to predict and remove the noise at each step.&lt;/p&gt;

&lt;p&gt;Generation: start with pure random noise and run the learned denoising process repeatedly until a coherent image emerges.&lt;/p&gt;

&lt;p&gt;Diffusion models produce higher quality, more diverse outputs than GANs and train more stably. They're computationally heavier at inference time (many denoising steps required), but the quality improvement has made the trade-off worth it for most applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When you'd use them:&lt;/strong&gt; image generation, video generation, audio synthesis, any high-quality generative task.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0r6xpggi3ff5y7fr06q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0r6xpggi3ff5y7fr06q.png" alt="Diffusion Model" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Personal Note
&lt;/h3&gt;

&lt;p&gt;The latest three (VAEs, GANs and Difussion Models) are great for generative related tasks including synthetic data generation. Currently diffusion models have taken the space due to their high accuracy, efficiency and deployability. &lt;/p&gt;

&lt;p&gt;We published in 2023 a research between Samsung Advanced Institute of Health Science and Technology (SAIHST), Samsung Medical Center (SMC), Yonsei Severance Hospital and Google Cloud (USA) comparing the use of the three of them for synthetic data generation on healthcare settings. If you are interested in the topic &lt;a href="https://pfmjournal.org/journal/view.php?number=171" rel="noopener noreferrer"&gt;click here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Transformer
&lt;/h3&gt;

&lt;p&gt;Everything changed in 2017 when a Google paper titled &lt;em&gt;"Attention Is All You Need"&lt;/em&gt; introduced the Transformer architecture. GPT, BERT, DALL-E, Whisper, Stable Diffusion, every major model of the last several years is built on top of it or derives from it directly.&lt;/p&gt;

&lt;p&gt;The core innovation: &lt;strong&gt;self-attention&lt;/strong&gt;. Instead of processing a sequence step by step (like an RNN), the Transformer processes all positions simultaneously and lets each position directly attend to every other position. This solves the long-range dependency problem completely, and critically, allows full parallelisation during training.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fytp521iq0feknpc3o2kd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fytp521iq0feknpc3o2kd.png" alt="transformer model" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Self-Attention and Multi-Head Attention
&lt;/h4&gt;

&lt;p&gt;Self-attention allows the model to weigh how relevant each word (or token) is to every other word when building a representation. In the sentence "The bank by the river was steep," the word "bank" needs to attend strongly to "river" to resolve its meaning correctly. Self-attention learns to do this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multi-head attention&lt;/strong&gt; runs several self-attention operations in parallel, each learning to attend to different kinds of relationships simultaneously. One head might track syntactic structure; another might track semantic similarity. The outputs are combined and projected forward.&lt;/p&gt;

&lt;h4&gt;
  
  
  Positional Encoding
&lt;/h4&gt;

&lt;p&gt;Transformers have no built-in sense of order, self-attention is permutation-invariant. Positional encoding fixes this by adding information about each token's position in the sequence before it enters the network. The model learns to use this position signal to understand order, proximity, and structure.&lt;/p&gt;

&lt;h4&gt;
  
  
  Encoder vs. Decoder vs. Encoder-Decoder
&lt;/h4&gt;

&lt;p&gt;Not all Transformers are the same. There are three architectural variants:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Encoder-only (e.g. BERT):&lt;/strong&gt; reads the full sequence bidirectionally, building rich contextual representations. Best for tasks that require understanding: classification, named entity recognition, semantic search.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decoder-only (e.g. GPT):&lt;/strong&gt; generates tokens one at a time, each attending only to previous tokens. Best for generation: writing, code, conversation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Encoder-decoder (e.g. T5, original Transformer):&lt;/strong&gt; encodes an input sequence, then decodes an output sequence. Best for transformation tasks: translation, summarisation, question answering.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding which variant you're working with (and why it was chosen) is one of the most practically useful things you can know when working with modern AI.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Comes Next
&lt;/h2&gt;

&lt;p&gt;You now have a map of the deep learning landscape: the building blocks, the key architectures, when to use each, and why they exist. That's the conceptual foundation.&lt;/p&gt;

&lt;p&gt;The practical path from here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Get hands-on with PyTorch or TensorFlow:&lt;/strong&gt; implement a simple FFNN, then a CNN on image data. Seeing the training loop in code cements everything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Work through a sequence task:&lt;/strong&gt; build or use an LSTM on a real time series dataset.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Study the Transformer in depth:&lt;/strong&gt; read &lt;em&gt;"Attention Is All You Need"&lt;/em&gt; after you've built intuition. It will make sense now in a way it wouldn't have before.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explore modern applications:&lt;/strong&gt; fine-tune a pretrained model, experiment with diffusion pipelines, build something that uses what you've learned.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're wondering where deep learning fits in the bigger picture (how it relates to machine learning and where Generative AI comes in) check out our &lt;a href="https://fondralabs.com/blog/ai-foundation-roadmaps/ai-learning-roadmap-where-to-start-if-you-re-a-complete-beginner.html" rel="noopener noreferrer"&gt;AI learning roadmap&lt;/a&gt; for the full view.&lt;/p&gt;

&lt;p&gt;The architecture names will start feeling familiar quickly. Build things. Break them. Figure out why. That's the actual learning.&lt;/p&gt;

&lt;p&gt;If you want to learn more, we have more content in our &lt;a href="//fondralabs.com"&gt;blog here&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>deeplearning</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Machine Learning Basics: Core Concepts Explained Simply</title>
      <dc:creator>Javier Aguirre</dc:creator>
      <pubDate>Fri, 29 May 2026 03:22:57 +0000</pubDate>
      <link>https://dev.to/javiagu13/machine-learning-basics-core-concepts-explained-simply-49me</link>
      <guid>https://dev.to/javiagu13/machine-learning-basics-core-concepts-explained-simply-49me</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fssi64x7efbyu1s3k2ofn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fssi64x7efbyu1s3k2ofn.jpg" alt="Machine Learning" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you've heard the term "machine learning" thrown around but still aren't sure what it actually means, you're in the right place. This isn't a roadmap for learning machine learning (we covered that here). This is the conceptual foundation: the ideas, the vocabulary, and the mental models you need so that everything else clicks.&lt;/p&gt;

&lt;p&gt;Think of it as the "what" before the "how."&lt;/p&gt;

&lt;p&gt;Let's get into it!&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Machine Learning?
&lt;/h2&gt;

&lt;p&gt;Machine learning is a way of building systems that learns from data rather than following hand-written rules.&lt;/p&gt;

&lt;p&gt;In traditional programming, a developer writes explicit instructions: &lt;em&gt;if X, do Y&lt;/em&gt;. Every scenario must be anticipated and coded manually. Machine learning flips this model entirely. Instead of writing the rules yourself, you feed the system a large collection of examples  (data where you already know the outcome) and the algorithm figures out the rules on its own.&lt;/p&gt;

&lt;p&gt;A concrete way to think about it: imagine you want a computer to recognise photos of cats. You could try to write rules: "look for pointy ears, whiskers, fur." But edge cases multiply fast. What about a cartoon cat? A sleeping cat? A hairless breed?&lt;/p&gt;

&lt;p&gt;Machine learning sidesteps the rule-writing problem entirely. You show the model thousands of labelled photos ("cat" / "not a cat"), it extracts the underlying patterns, and it generalises that knowledge to photos it's never seen before.&lt;/p&gt;

&lt;p&gt;That pattern-recognition loop (examples in, predictions out) is what machine learning &lt;em&gt;is&lt;/em&gt;, at its core.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Machine learning, in simple words:&lt;br&gt;
"a system that gets smarter the more data it sees, rather than following a fixed set of rules."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What Is Machine Learning Used For?
&lt;/h2&gt;

&lt;p&gt;Machine learning is already embedded in most of the software you use daily, though the reality is more layered than the usual list of examples suggests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Credit risk and underwriting:&lt;/strong&gt; banks use gradient boosted trees and logistic regression to assess lending decisions, because income, debt, history, and geography interact in ways too complex for manual rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fraud detection:&lt;/strong&gt; modern fraud systems combine anomaly detection, graph ML (to surface fraud rings across networks), and rule-based filters working in tandem. Patterns are adversarial and constantly shifting, which is exactly where ML earns its place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Search ranking:&lt;/strong&gt; retrieval uses indexing and heuristics, but &lt;em&gt;ranking&lt;/em&gt; is heavily learned. Models predict which result a specific user is most likely to find useful based on signals from billions of past interactions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advertising and recommendations:&lt;/strong&gt; arguably the largest economic application of ML on earth. Predicting click-through rate, conversion probability, and long-term user value drives enormous commercial value across every major platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demand forecasting:&lt;/strong&gt; retailers, energy grids, and supply chains use ML to predict inventory needs, consumption patterns, and logistics requirements. Gradient boosted trees and hybrid statistical models dominate here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Anomaly detection:&lt;/strong&gt; server monitoring, cybersecurity logs, and industrial sensors all use ML to flag behaviour that deviates from learned baselines. Isolation forests and autoencoders are workhorses in this space.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Marketplace matching:&lt;/strong&gt; job platforms, dating platforms, ride-sharing, and marketplaces use ML to predict compatibility between two entities: driver and rider, candidate and role, buyer and listing.&lt;/p&gt;

&lt;p&gt;The common thread: ML works best when the rules are too complex to write by hand, the environment shifts over time, and there's feedback data at scale to learn from.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmlfok8t3zbxp9571n1qw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmlfok8t3zbxp9571n1qw.png" alt="Real-world machine learning use cases across industries including finance, fraud detection, search ranking and demand forecasting" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Three Types of Machine Learning
&lt;/h2&gt;

&lt;p&gt;Not all machine learning works the same way. Understanding the three core categories is fundamental to understanding machine learning properly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Supervised Learning
&lt;/h3&gt;

&lt;p&gt;Supervised learning is the most common type and the best starting point for beginners.&lt;/p&gt;

&lt;p&gt;The model trains on &lt;strong&gt;labelled data&lt;/strong&gt;,  every example in the training set comes with the correct answer attached. A spam filter trains on emails labelled "spam" or "not spam." A house price model trains on historical sales records where the price is already known.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is supervised learning in practice?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The model makes predictions, compares them to the correct labels, measures the error, and adjusts. Repeat this millions of times across thousands of examples and the model gradually gets accurate. At inference time (when it sees new, unlabelled data) it applies everything it learned.&lt;/p&gt;

&lt;p&gt;Supervised learning covers two main tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Classification:&lt;/strong&gt; predicting a category (spam/not spam, disease/no disease, churn/retain)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regression:&lt;/strong&gt; predicting a number (house price, temperature, revenue)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Unsupervised Learning
&lt;/h3&gt;

&lt;p&gt;With unsupervised learning, there are no labels. The model receives raw data and must discover structure on its own.&lt;/p&gt;

&lt;p&gt;The most common application is &lt;strong&gt;clustering&lt;/strong&gt;. Grouping data points that are similar to each other. Customer segmentation works this way: you feed the model purchase history, browsing behaviour, and demographics, and it discovers natural groupings without anyone telling it what those groups should be.&lt;/p&gt;

&lt;p&gt;Other unsupervised applications include anomaly detection (spotting data points that don't fit the pattern) and dimensionality reduction (compressing complex data into simpler representations without losing key information).&lt;/p&gt;

&lt;h3&gt;
  
  
  Reinforcement Learning
&lt;/h3&gt;

&lt;p&gt;Reinforcement learning is the odd one out. It doesn't learn from a fixed dataset at all.&lt;/p&gt;

&lt;p&gt;Instead, an &lt;strong&gt;agent&lt;/strong&gt; takes actions in an environment and receives feedback: rewards for good outcomes, penalties for bad ones. Over time, through trial and error, it learns the strategy that maximises reward.&lt;/p&gt;

&lt;p&gt;This is how DeepMind's AlphaGo mastered the game of Go, how robotics systems learn to walk, and how recommendation engines learn to keep users engaged. It's one of the most exciting areas in machine learning today and also the one of the most complex.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3cnqw921wsywfy4w4pta.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3cnqw921wsywfy4w4pta.png" alt="Visual comparison of supervised learning, unsupervised learning and reinforcement learning showing labelled data, unlabelled clusters and agent-environment loop" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is the Difference Between Machine Learning and Deep Learning?
&lt;/h2&gt;

&lt;p&gt;This trips up a lot of people new to the field. The short answer: &lt;strong&gt;deep learning is a subset of machine learning.&lt;/strong&gt; Some of my AI engineering collegues would disagree, saying it is another field on its own that comes after machine learning. However, the exact relationship doesnt matter, either is the parent or sibling of machine learning it definitely is a close relative.&lt;/p&gt;

&lt;p&gt;Then... what is that relationship? Well, classic machine learning algorithms (linear regression, decision trees, random forests...) work by finding mathematical relationships in structured data. They're transparent, fast, and still dominant in most real-world business applications.&lt;/p&gt;

&lt;p&gt;Deep learning uses artificial neural networks with many layers (hence "deep"). Each layer learns increasingly abstract representations: an early layer of an image model might learn to detect edges; a later layer might learn to detect faces. This layered abstraction is what gives deep learning its power on complex, unstructured data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The bottom line:&lt;/strong&gt; when someone says "we use machine learning," they may or may not mean deep learning. When someone says "we use deep learning," that's always a subset of machine learning.&lt;/p&gt;

&lt;p&gt;So, what you should remember is that both have the same purpose: &lt;strong&gt;a system that gets smarter the more data it sees rather than following a fixed set of rules&lt;/strong&gt;. However, in the case of deep learning, it tends to require more compute, less efficient but can be smarter for harder cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Terms You'll Keep Seeing
&lt;/h2&gt;

&lt;p&gt;Understanding machine learning means getting comfortable with a core vocabulary. Here are the terms that come up constantly:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Training data:&lt;/strong&gt; the dataset the model learns from. The quality and size of this data is the single biggest factor in model performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model:&lt;/strong&gt; the mathematical function that maps inputs to outputs after training. When people say "we trained a model," this is what they mean.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features:&lt;/strong&gt; the input variables the model uses to make predictions. In a house price model, features might include square footage, number of bedrooms, and postcode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Labels:&lt;/strong&gt; the correct output values in supervised learning. The "answers" in the training data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Training:&lt;/strong&gt; the process of exposing a model to data and letting it adjust its internal parameters to minimise error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overfitting:&lt;/strong&gt; when a model learns the training data &lt;em&gt;too well&lt;/em&gt;, including its noise and quirks, and fails to generalise to new data. A model that scores 99% on training data and 60% on real data has overfit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Underfitting:&lt;/strong&gt; the opposite problem. The model is too simple to capture the real patterns in the data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hyperparameters:&lt;/strong&gt; settings you choose before training begins (number of trees in a forest, learning rate, number of layers). Distinct from parameters, which the model learns during training.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Machine Learning Works (The Intuition)
&lt;/h2&gt;

&lt;p&gt;At the heart of basic machine learning is a deceptively simple idea: &lt;strong&gt;generalisation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A model that just memorised its training data would be useless, you'd already have that data. What you want is a model that has learned something &lt;em&gt;general&lt;/em&gt; enough to make accurate predictions on data it has never encountered.&lt;/p&gt;

&lt;p&gt;The way models achieve this is by minimising a &lt;strong&gt;loss function&lt;/strong&gt;, a mathematical measure of how wrong their predictions are. During training, the algorithm repeatedly adjusts the model's internal parameters in the direction that reduces loss. After enough iterations across enough data, the model has found a set of parameters that capture the underlying structure of the problem.&lt;/p&gt;

&lt;p&gt;This is why data quality matters so much. Garbage in, garbage out. if the training data is biased, incomplete, or mislabelled, the patterns the model learns will reflect those flaws, no matter how sophisticated the algorithm.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Note on Maths
&lt;/h2&gt;

&lt;p&gt;I personally like to bring this one frequently. As we covered in the previous blog, one of the most common questions when people start understanding machine learning: &lt;em&gt;do I need to be good at maths?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The honest answer is: not to start, and not as much as you'd think to go deep.&lt;/p&gt;

&lt;p&gt;The mathematical foundations are there (linear algebra, probability, calculus) but they describe what's happening inside the algorithms, not how to use them. Most engineers use libraries like Scikit-learn that handle the implementation entirely. The maths becomes valuable when you want to understand &lt;em&gt;why&lt;/em&gt; a model behaves a certain way, not to run it.&lt;/p&gt;

&lt;p&gt;Start with intuition. Pick up the maths when a specific question pulls you toward it. That order works far better than studying maths in a vacuum before you've built anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Comes Next
&lt;/h2&gt;

&lt;p&gt;Now that you have the conceptual foundation, the natural next step is getting hands-on. The core skills to tackle in order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exploratory Data Analysis (EDA):&lt;/strong&gt; understand your data before you model it&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data preparation:&lt;/strong&gt; clean, transform, and structure data for training&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model training:&lt;/strong&gt; apply the right algorithm for the task&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model evaluation:&lt;/strong&gt; measure performance properly (accuracy alone isn't enough)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iteration:&lt;/strong&gt; improve, tune, and deploy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want the full practical path (tools, libraries, timeline, and projects) check out our guide on &lt;a href="https://fondralabs.com/blog/ai-foundation-roadmaps/how-to-learn-machine-learning-from-scratch.html" rel="noopener noreferrer"&gt;how to learn machine learning from scratch&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want to read our full blog, visit our &lt;a href="//fondralabs.com"&gt;blog here&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>machinelearning</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Learn Machine Learning from Scratch</title>
      <dc:creator>Javier Aguirre</dc:creator>
      <pubDate>Fri, 29 May 2026 03:18:26 +0000</pubDate>
      <link>https://dev.to/javiagu13/how-to-learn-machine-learning-from-scratch-3j7n</link>
      <guid>https://dev.to/javiagu13/how-to-learn-machine-learning-from-scratch-3j7n</guid>
      <description>&lt;p&gt;You want to  learn machine learning. Great! Now you are staring at a screen full of courses, YouTube videos, Reddit threads, and bootcamp ads, and you have absolutely no idea where to begin.&lt;/p&gt;

&lt;p&gt;After being over 10 years in the AI field, I have seen brilliant people give up on machine learning not because it was too hard, but because they started in the wrong place, hit a wall they did not expect, and concluded the whole thing was not for them.&lt;/p&gt;

&lt;p&gt;This post is the guide I wish someone had handed me at the beginning. The honest, practical path to go from complete beginner to someone who can actually build and deploy machine learning models. And let me tell you one last thing, it is definitely not as hard as it seems. Trust me :)&lt;/p&gt;

&lt;p&gt;Let's get into it.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, Let's Clear Something Up
&lt;/h2&gt;

&lt;p&gt;When people ask &lt;em&gt;"how do I start machine learning?"&lt;/em&gt;, they usually follow it up with something like: &lt;em&gt;"do I need a PhD? Do I need to be amazing at math? Do I need to already know how to code?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The answer to all three is clearly no.&lt;/p&gt;

&lt;p&gt;Machine learning for beginners has never been more accessible. The tools are better, the libraries do most of the heavy lifting, and the community has produced genuinely good learning resources. What you need is not genius but a clear path and the willingness to follow it.&lt;/p&gt;

&lt;p&gt;Here is that path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Python First, But Not Too Much Python!
&lt;/h2&gt;

&lt;p&gt;Before you touch a single machine learning concept, you need to be able to write basic Python. Not software-engineer-level Python. Just enough to load data, write a function, and run a script.&lt;/p&gt;

&lt;p&gt;What you actually need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Variables and data types&lt;/li&gt;
&lt;li&gt;Loops and conditionals&lt;/li&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;li&gt;Lists and dictionaries&lt;/li&gt;
&lt;li&gt;Importing libraries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is it. A few weeks of consistent practice will get you there. Do not disappear into a six-month Python deep dive, that is procrastination dressed up as preparation. Ask your best friends (I mean Claude, Gemini, ChatGPT... They are amazing) for help, they really know how to code and teach coding.&lt;/p&gt;

&lt;p&gt;Once you can write simple scripts without completely panicking, you are ready.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: What Is Machine Learning, Actually?
&lt;/h2&gt;

&lt;p&gt;Here is the simplest way to think about it: normally, when you write a code, you write the rules. You tell the computer exactly what to do in every situation. Machine learning flips that around. Instead of writing the rules, you give the algorithm a pile of examples (historical data where you already know the outcome) and it figures out the rules itself. Sounds pretty cool, doesn't it?&lt;/p&gt;

&lt;p&gt;That is genuinely it. A machine learning model is just a pattern-finding machine. You feed it enough examples, it learns what those examples have in common, and then it uses that knowledge to make predictions on data it has never seen before. The more examples, the better the patterns. The better the patterns, the more accurate the predictions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: The Core Skills of Machine Learning
&lt;/h2&gt;

&lt;p&gt;Pay attention!! &lt;strong&gt;This is where most people get it wrong&lt;/strong&gt; and go lost. However, it is not hard if you know the path. People think machine learning is about knowing a long list of algorithms. It is not. Others, that they need a math background for it. That is simply not true. It is about mastering a set of core skills that every project requires, in roughly the same order, every single time.&lt;/p&gt;

&lt;p&gt;Here is what that actually looks like.&lt;/p&gt;

&lt;h3&gt;
  
  
  Exploratory Data Analysis (EDA)
&lt;/h3&gt;

&lt;p&gt;Before you build anything you need to understand what you are working with. As an example, you may want to predict who will pay future mortgages based on past data. At that point you should ask yourself: Where does the data come from? What do the columns actually mean? What is missing? What looks suspicious? EDA is the skill that separates people who build models that work from people who build models that silently fail. It is also the step that is least taught and most skipped. Same as with python, do not spend 6 months on learning EDA, spend a few weeks and move next.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Preparation
&lt;/h3&gt;

&lt;p&gt;Real-world data is a mess. Missing values, inconsistent formats, outliers that make no sense, categorical variables that need to be converted into numbers. The prior step prepares you to understand all of it, on this step you will focus on how to prepare it for training. Data preparation is where you spend most of your time on any real project. Learn to clean data well, and everything downstream becomes easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Model Training
&lt;/h3&gt;

&lt;p&gt;This is the step everyone takes it wrong. People think is the big one. It is not. In practice, once your data is clean, training often takes a few lines of code and you are ready to go. The two previous steps are where the magic of machine learning occurs, on having and preparing good data. However, I have to make a disclaimer, I recommend understanding about the different models so that you know when to use one or another. Hearing a short class on how they work will highly benefit you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Model Evaluation
&lt;/h3&gt;

&lt;p&gt;This is an important one, it is not a hard one, but can be slightly confusing. Many beginners make mistakes without realizing. Accuracy alone is a terrible metric for most projects. Learn precision, recall, F1-score, ROC-AUC. Understand the difference between overfitting (your model memorised the training data and fails on anything new) and underfitting (your model is too simple to capture the real patterns). Know the difference between your training set, validation set, and test set, and never, ever mix them up.&lt;/p&gt;

&lt;h3&gt;
  
  
  Model Improvement (optional)
&lt;/h3&gt;

&lt;p&gt;Once you have a baseline model, you can make it better. This means tuning hyperparameters, trying different algorithms, engineering better features from your raw data. This is where craft comes in and where the interesting problem-solving happens.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deployment (optional)
&lt;/h3&gt;

&lt;p&gt;A model sitting on your laptop is not useful. Learn to put it somewhere that actually does something, an API, a simple web app, a scheduled job. You do not need to become a software engineer to do this, but you need to know the basics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: The Algorithms Worth Knowing
&lt;/h2&gt;

&lt;p&gt;Once you understand the core skills, algorithms start to make sense. Now you know &lt;em&gt;what problem they are solving&lt;/em&gt;. You do not need to memorise fifty of them. You need to understand a core set deeply.&lt;/p&gt;

&lt;h3&gt;
  
  
  Linear Regression
&lt;/h3&gt;

&lt;p&gt;Predicting a continuous number (price, temperature, revenue). The simplest model you will build and, by far, the most educational. Understand this one fully before you move on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Logistic Regression
&lt;/h3&gt;

&lt;p&gt;Despite the name, this is a classification algorithm. Will this customer churn? Is this email spam? Binary decisions. This is your first taste of classification.&lt;/p&gt;

&lt;h3&gt;
  
  
  K-Nearest Neighbours (KNN)
&lt;/h3&gt;

&lt;p&gt;The most intuitive classifier in ML. To predict something, it looks at the K closest examples in your training data and goes with the majority. No real "training" happens. It just memorises the data and reasons from it at prediction time. A great first algorithm to understand because the logic is completely transparent.&lt;/p&gt;

&lt;h3&gt;
  
  
  K-Means Clustering
&lt;/h3&gt;

&lt;p&gt;Your entry point into a different kind of ML: unsupervised learning, where you have no labels and let the algorithm find structure on its own. K-Means groups your data points into K clusters based on similarity. Used everywhere from customer segmentation to anomaly detection.&lt;/p&gt;

&lt;h3&gt;
  
  
  Decision Trees
&lt;/h3&gt;

&lt;p&gt;One of the most intuitive models in all of ML. You can actually visualise how a tree makes decisions, which is invaluable for building intuition.&lt;/p&gt;

&lt;h3&gt;
  
  
  Random Forests
&lt;/h3&gt;

&lt;p&gt;A collection of decision trees working together. One of the most reliable, robust algorithms in practice. If you are ever in doubt about which model to try first, try Random Forest.&lt;/p&gt;

&lt;h3&gt;
  
  
  Support Vector Machines (SVM)
&lt;/h3&gt;

&lt;p&gt;Finds the boundary that best separates two classes, with as much margin between them as possible. Works particularly well with smaller datasets and high-dimensional data like text. The intuition behind "maximum margin separation" is one of the most elegant ideas in all of ML.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gradient Boosting (XGBoost, LightGBM)
&lt;/h3&gt;

&lt;p&gt;The go-to for structured/tabular data in production. These models win Kaggle competitions constantly. Learn them and you will be dangerous on real business problems.&lt;/p&gt;

&lt;p&gt;You do not need to implement these from scratch. What you need is to understand: &lt;em&gt;why does this algorithm work? When should I use it? What does it assume about the data?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: The Libraries You Will Actually Use
&lt;/h2&gt;

&lt;p&gt;Python for machine learning means a short list of libraries that you will use over and over again:&lt;/p&gt;

&lt;h3&gt;
  
  
  NumPy
&lt;/h3&gt;

&lt;p&gt;Numerical computing. Arrays, matrix operations. Under the hood of almost everything.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pandas
&lt;/h3&gt;

&lt;p&gt;Your data manipulation workhorse. Load CSVs, clean data, merge tables, explore distributions. You will use this constantly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Matplotlib / Seaborn
&lt;/h3&gt;

&lt;p&gt;Visualise your data. Plot distributions, spot outliers, understand what you are working with.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scikit-learn
&lt;/h3&gt;

&lt;p&gt;The gold standard ML library. Every classical algorithm you need, with a consistent API that is genuinely well-designed. This is where you will spend most of your time as a beginner.&lt;/p&gt;

&lt;h3&gt;
  
  
  XGBoost / LightGBM
&lt;/h3&gt;

&lt;p&gt;Once you are comfortable with Scikit-learn, add these to your toolkit. They are industry workhorses.&lt;/p&gt;

&lt;p&gt;Do not chase every new library. Master these first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Build Things That Are Slightly Uncomfortable
&lt;/h2&gt;

&lt;p&gt;Reading is not learning machine learning. Building is learning machine learning.&lt;/p&gt;

&lt;p&gt;After each concept, build something. It does not need to be impressive — it needs to be real. Some ideas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Predict housing prices with linear regression on a public dataset&lt;/li&gt;
&lt;li&gt;Build a spam classifier with logistic regression on email data&lt;/li&gt;
&lt;li&gt;Predict customer churn with a Random Forest&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Go to Kaggle. Find a beginner competition. Download the data. Make a terrible first submission. Then make a slightly less terrible second one. That process teaches you more than any course.&lt;/p&gt;

&lt;p&gt;The discomfort of working with messy, real data and not knowing exactly what to do is not a sign that you are doing something wrong. It is the actual learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  On Math: Stop Worrying About It
&lt;/h2&gt;

&lt;p&gt;Yes, machine learning has mathematical foundations. Linear algebra, probability, calculus, statistics. They are all in there.&lt;/p&gt;

&lt;p&gt;Here is the truth: you do not need to master any of that. Most of that is for people who will create the algorithms of the future, but not for building AI. You need enough statistics to understand what a mean and variance are. That is genuinely it.&lt;/p&gt;

&lt;p&gt;Now, As you go deeper and start wondering &lt;em&gt;why&lt;/em&gt; certain algorithms behave the way they do, you will naturally find yourself reading about the math behind them, but no need to master it. That is when it clicks, because you have context. Learning math in isolation, before you have built anything, is like studying the grammar of a language you have never spoken.&lt;/p&gt;

&lt;p&gt;Pick up the math as you need it. Not before.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Realistic Timeline
&lt;/h2&gt;

&lt;p&gt;For someone starting from scratch and putting in consistent time:&lt;/p&gt;

&lt;h3&gt;
  
  
  Weeks 1–4
&lt;/h3&gt;

&lt;p&gt;Python basics. Get comfortable with the language.&lt;/p&gt;

&lt;h3&gt;
  
  
  Months 2–3
&lt;/h3&gt;

&lt;p&gt;Core ML skills and concepts: EDA, data prep, training, evaluation, the main algorithms, Scikit-learn. Build small projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Months 4–5
&lt;/h3&gt;

&lt;p&gt;Go deeper. Tackle a real Kaggle dataset. Handle genuinely messy data. Deploy something small.&lt;/p&gt;

&lt;h3&gt;
  
  
  Months 6+
&lt;/h3&gt;

&lt;p&gt;Expand: gradient boosting, feature engineering, model evaluation at depth.&lt;/p&gt;

&lt;p&gt;This assumes a few focused hours per week, not full-time immersion. If you go full-time, compress everything. Consistency matters far more than intensity.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Summary
&lt;/h2&gt;

&lt;p&gt;Start with Python basics. Learn what machine learning actually is: pattern recognition from data, not magic. Then master the core skills in order: understand your data, prepare it, train a model, evaluate it properly, improve it, and deploy it. Learn the key algorithms well rather than every algorithm superficially. Build real things with real data. Pick up math as you need it, not before. That is how you learn machine learning from scratch.&lt;/p&gt;

&lt;p&gt;At &lt;strong&gt;Fondra Labs&lt;/strong&gt;, we are building the step-by-step resources to walk you through exactly this journey. Stay tuned.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  How to learn machine learning?
&lt;/h3&gt;

&lt;p&gt;Start with Python basics, then work through the core ML skills in order: exploratory data analysis, data preparation, model training, evaluation, and deployment. Use Scikit-learn. Build real projects with real data.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to get into machine learning?
&lt;/h3&gt;

&lt;p&gt;You do not need a degree or math expertise to start. Pick up Python, learn the fundamentals, and build a portfolio of projects using public datasets. Kaggle is a great place to start.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to start machine learning?
&lt;/h3&gt;

&lt;p&gt;Write Python first — just the basics. Then pick one beginner dataset and try to build a prediction model with Scikit-learn. That first project, however messy, teaches you more than any course.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I start learning machine learning?
&lt;/h3&gt;

&lt;p&gt;Pick one clear resource, follow it from start to finish, and build something at every stage. The most common mistake is jumping between resources constantly instead of going deep on one path.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to become a machine learning engineer?
&lt;/h3&gt;

&lt;p&gt;Learn the fundamentals, build a public portfolio of projects on GitHub, document what you built and why, and start applying. You do not need a perfect CV, you need demonstrated ability to work with real data and ship real models.&lt;/p&gt;

&lt;p&gt;For more content you can visit our &lt;a href="//fondralabs.com"&gt;blog here!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>learning</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>AI Learning Roadmap: Where to Start if You're a Complete Beginner</title>
      <dc:creator>Javier Aguirre</dc:creator>
      <pubDate>Wed, 27 May 2026 04:41:24 +0000</pubDate>
      <link>https://dev.to/javiagu13/ai-learning-roadmap-where-to-start-if-youre-a-complete-beginner-34bo</link>
      <guid>https://dev.to/javiagu13/ai-learning-roadmap-where-to-start-if-youre-a-complete-beginner-34bo</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnr0ejnea6esc4x2wyent.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnr0ejnea6esc4x2wyent.png" alt="AI learning roadmap diagram showing the relationship between AI, machine learning, deep learning, and Generative AI" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nowadays, AI is everywhere. More than ever, people want to learn but being the internet flooded with resources makes it incredibly hard to know where to start. It feels like there is too much information, pointing in too many directions. I have been over 10 years in the AI field, and this blog is what you will actually need to understand the dos and don'ts of an effective AI learning roadmap. Keep on reading :)&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Everyone starts in the wrong place
&lt;/h3&gt;

&lt;p&gt;Everyone has heard of ChatGPT. Everyone has heard of LLMs, image generators, voice assistants. And so, naturally, everyone starts there because that's what's visible, exciting and all over the news.&lt;/p&gt;

&lt;p&gt;Here's the thing: that is the biggest mistake you can make. What you see in ChatGPT is the latest and most complex technology in the entire AI field. Starting there is like deciding you want to become a chef and showing up to a three-Michelin-star kitchen on day one. It looks great from the outside. Inside, you will be completely lost.&lt;/p&gt;

&lt;p&gt;But, don't panic! There is a right way to learn AI. It is not as hard as you think. But it requires starting at the foundation and I am going to show you exactly what that looks like for anyone wondering how to start learning AI.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The golden rule:&lt;br&gt;
"Don't chase the latest. Master the foundations first, and the latest will start making sense on its own."&lt;br&gt;
Javier Aguirre&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Before diving in: learn basic Python
&lt;/h2&gt;

&lt;p&gt;Before we talk about AI concepts at all, there is one practical thing to do first: learn the basics of Python. It is the language of AI, and you do not need to become a software engineer — you just need enough to write simple scripts, load data, and run models.&lt;/p&gt;

&lt;p&gt;A few weeks of basics is more than enough to get started. Variables, loops, functions, lists. That's it for now. This is why so many people begin with Python for AI beginners courses before moving deeper into machine learning. And here's good news that will surprise most beginners:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;On math:&lt;br&gt;
"You do not need math to get into AI. Full stop. You may eventually bump into a concept here and there (a few statistics ideas, basic linear algebra) but those are easy to pick up when the moment comes. Don't let math be the reason you don't start."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The AI Learning Roadmap
&lt;/h2&gt;

&lt;h3&gt;
  
  
  How the AI world is actually structured
&lt;/h3&gt;

&lt;p&gt;Before going straight in, you need to understand the landscape. That thing you've heard of — Generative AI — is not the beginning of the story. It is the current top of a much bigger structure. Think of it like a house: Generative AI is the roof. And nobody builds a house starting from the roof.&lt;/p&gt;

&lt;p&gt;Let's look at how the AI house actually looks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnr0ejnea6esc4x2wyent.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnr0ejnea6esc4x2wyent.png" title="GenAI lives inside Deep Learning, which lives inside ML, which lives inside AI" alt="AI learning roadmap diagram showing the relationship between AI, machine learning, deep learning, and Generative AI" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This diagram tells you everything you need to know about why most beginners struggle. Generative AI (ChatGPT, Midjourney, and the tools making headlines) sits at the centre of these nested layers. Every concept that powers it comes from the layers around it. Skip those layers and you are building your understanding on nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  My personal recommendations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Start with Machine Learning
&lt;/h3&gt;

&lt;p&gt;Machine Learning is the oldest and most foundational part of modern AI. It is also, in many ways, the most powerful. It is driving enormous amounts of revenue across industries right now, from fraud detection to demand forecasting to personalisation engines. Companies are not running it because it's trendy. They're running it because it works.&lt;/p&gt;

&lt;p&gt;If you are following a machine learning engineer roadmap, this is where your real understanding begins.&lt;/p&gt;

&lt;p&gt;Will it generate text like ChatGPT? No. But here is what it will let you do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;*&lt;em&gt;Predict outcomes: *&lt;/em&gt;  Will this customer churn? What will sales be next quarter? Which loan applicant is high risk? ML answers these questions with high accuracy, using nothing more than historical data and a well-chosen model.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Classify anything:&lt;/strong&gt;  Is this email spam or not? Is this transaction fraudulent? Does this medical scan show an anomaly? Classification is one of the most commercially valuable things in AI, and ML is the gold standard for it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deploy cheap and fast:&lt;/strong&gt;  ML models are lightweight. They run on a basic server, cost little to host, and can be put into production in days. This is the opposite of the expensive GPU-hungry infrastructure that Generative AI requires.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Build real AI intuition:&lt;/strong&gt;  Understanding how a Random Forest learns, why a model overfits, what a training set versus a test set means — these concepts transfer directly to every other area of AI. This is where you grow actual understanding, not just surface-level familiarity.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The core ideas in Machine Learning are: supervised learning (teaching a model with labelled examples), unsupervised learning (finding patterns without labels), and the full process of training, evaluating, and deploying a model. Get comfortable with these, and the rest of AI opens up. If you have ever asked yourself &lt;em&gt;what is machine learning?&lt;/em&gt;, this is the practical answer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Then move to Deep Learning
&lt;/h3&gt;

&lt;p&gt;Have you heard the words neural networks? Backpropagation? Deep learning? If so, this is what those words refer to. Deep learning is the natural evolution of classical machine learning and understanding ML first means you will actually grasp why deep learning exists, not just how to use it.&lt;/p&gt;

&lt;p&gt;Instead of traditional algorithms, deep learning uses networks of artificial neurons (layers upon layers of them) that learn extremely complex patterns from data. The results are more powerful for many tasks, and more flexible, but they require significantly more data and computing resources to train.&lt;/p&gt;

&lt;p&gt;If you are building your own deep learning roadmap, this is the stage where AI starts becoming truly powerful.&lt;/p&gt;

&lt;p&gt;Here is where deep learning truly shines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Images and computer vision&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Deep learning powers every modern image recognition system — from the Face ID on your phone to the quality control cameras in a factory to self-driving car perception. Classical ML simply cannot match its accuracy on visual tasks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Audio and speech&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Voice assistants, real-time transcription, music generation, sound classification — all deep learning. The architecture that understands spoken language is built entirely on neural network layers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Complex pattern recognition&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Anything where the relationship between input and output is extremely non-linear and hard to express as rules, deep learning tends to be the right tool. Drug discovery, genomics, anomaly detection at scale.&lt;/p&gt;

&lt;p&gt;Deep learning is also where you start encountering architectures with names such as : CNNs for images, RNNs for sequences, and (most importantly) the Transformer. Remember that name. It is what everything else is built on. This is also the point where people finally understand &lt;em&gt;what is deep learning?&lt;/em&gt; in a meaningful way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2t1g93x3b44kwonxcynj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2t1g93x3b44kwonxcynj.png" title="Neural networks powering deep learning" alt="Deep learning neural network illustration with CNNs and RNNs powering AI systems" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Finally, Generative AI (only after ML and DL!!!)
&lt;/h3&gt;

&lt;p&gt;Now (and only now) does Generative AI make sense. Because once you understand ML and deep learning, you understand where GenAI comes from. The Transformer architecture at the heart of every modern large language model is a deep learning architecture. The training techniques are derived from everything you have already learned. The intuition transfers.&lt;/p&gt;

&lt;p&gt;Generative AI is extraordinary. It can write, code, reason, create images, generate music, and hold conversations. The commercial excitement around it is real and justified. But here is something most people entering the field do not know:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Important Reality Check:&lt;br&gt;
Most problems companies actually have can be solved with ML or DL — not GenAI. GenAI is incredibly expensive to run, hard to scale reliably, and often complete overkill for the task at hand. Jumping to GenAI head-on, without foundations, is a mistake that costs time, money, and understanding. Do not do it.&lt;br&gt;
Javier Aguirre&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;GenAI is the mix of everything learned before. Understanding it properly — knowing when to use it, when not to, how to build on top of it rather than just prompting it — requires the foundations you built in steps 1 and 2. That is what separates someone who truly works in AI from someone who just uses it.&lt;/p&gt;

&lt;p&gt;If you are wondering &lt;em&gt;how does an AI learn?&lt;/em&gt;, the answer starts with these foundations in machine learning and deep learning long before Generative AI enters the picture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmt7u5h11kgq099nhf0v2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmt7u5h11kgq099nhf0v2.png" title="Modern Generative AI systems" alt="Generative AI systems illustration with large language models and AI tools" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More times than I remember projects fail and get stuck because managers and higher up people ask for genAI when a decision tree would have solved the problem. I am not saying generative AI is not marvelous, but, learning when to use is one of the best favours you can do yourself as a developer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The right order, at a glance
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;1st: Python basics:&lt;/strong&gt; Just enough to write scripts and work with data. No advanced engineering needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;2nd Machine Learning:&lt;/strong&gt; The oldest, most practical, most deployable, and most foundational layer of modern AI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;3rd Deep Learning:&lt;/strong&gt; Neural networks, images, audio, the Transformer. The powerful evolution that enables everything modern.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;4th Generative AI:&lt;/strong&gt; The exciting frontier, but only makes sense once the foundations are solid.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  One last thing
&lt;/h2&gt;

&lt;p&gt;You do not need math. You do not need to be a genius. You do not need expensive bootcamps. You need consistency, the right order, and a willingness to build things even when they break.&lt;/p&gt;

&lt;p&gt;At &lt;strong&gt;&lt;a href="https://fondralabs.com/" rel="noopener noreferrer"&gt;Fondra Labs&lt;/a&gt;&lt;/strong&gt;, we are building the resources to walk you through every step of this journey in depth. Stay tuned, the real learning starts now.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>learning</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
