<?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: Marie Claire NIYOMUGENGA</title>
    <description>The latest articles on DEV Community by Marie Claire NIYOMUGENGA (@claire_123).</description>
    <link>https://dev.to/claire_123</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%2F4151834%2Fdc831286-bf6b-43e9-b6b5-734b5a0e3c3c.jpg</url>
      <title>DEV Community: Marie Claire NIYOMUGENGA</title>
      <link>https://dev.to/claire_123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/claire_123"/>
    <language>en</language>
    <item>
      <title>Fixing the Extra-Ingredient Problem in MiniChefGPT: Which Model Should We Use?</title>
      <dc:creator>Marie Claire NIYOMUGENGA</dc:creator>
      <pubDate>Mon, 26 Oct 2026 12:25:25 +0000</pubDate>
      <link>https://dev.to/claire_123/fixing-the-extra-ingredient-problem-in-minichefgpt-which-model-should-we-use-2051</link>
      <guid>https://dev.to/claire_123/fixing-the-extra-ingredient-problem-in-minichefgpt-which-model-should-we-use-2051</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%2Fa7exkr2tqwc096567678.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%2Fa7exkr2tqwc096567678.png" alt=" " width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In our NLP course we built MiniChefGPT, a small GPT-style model that turns a list of ingredients into a recipe title and steps. It works, but it has one clear flaw: it uses ingredients nobody gave it. This post looks at models and techniques that could fix that, and explains which one I would choose and why.&lt;/p&gt;

&lt;h2&gt;
  
  
  The project in numbers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A decoder-only Transformer with 3 blocks, 4 attention heads, 128-dimensional embeddings and a 256-token context.&lt;/li&gt;
&lt;li&gt;A byte-level BPE tokenizer with a 4,096-token vocabulary.&lt;/li&gt;
&lt;li&gt;1,053,440 parameters, trained from scratch on a CPU within a 30-minute budget.&lt;/li&gt;
&lt;li&gt;9,979 cleaned Food.com recipes, split into 8,983 for training, 502 for validation and 494 for testing.&lt;/li&gt;
&lt;li&gt;Test perplexity of 16.68.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My part of the team project was the residual connections around the attention and feed-forward blocks.&lt;/p&gt;

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

&lt;p&gt;We gave the app four ingredients: chicken, garlic, onion and tomato. It returned a recipe titled "chicken soup" whose steps use broccoli, rice, chicken broth and noodles. None of those were requested, and tomato was never used.&lt;/p&gt;

&lt;p&gt;Our own notebook check agrees. On four custom ingredient lists, the generated recipes mention 56% of the requested ingredients on average. On 12 held-out ingredient lists the figure is 27%.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it happens
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A tiny model with little data.&lt;/strong&gt; One million parameters trained from scratch on about 9,000 recipes learn how recipes sound. They do not learn a rule like "use only these ingredients".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Noisy training data.&lt;/strong&gt; Our notebook notes that the source recipes sometimes mention ingredients that are missing from their own ingredient list. The model learns that extra ingredients are normal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No rule against extras when generating.&lt;/strong&gt; We rank several candidate recipes by how many requested ingredients they mention, but nothing penalises ingredients that were not requested.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How we should measure the fix
&lt;/h2&gt;

&lt;p&gt;Our coverage score only counts requested ingredients that appear. It cannot see extras. I would add an &lt;strong&gt;extra-ingredient rate&lt;/strong&gt;: the share of food words in the generated recipe that are not in the input list, allowing a few pantry staples such as salt, pepper, water and oil. A good fix raises coverage and lowers this rate on the same held-out lists.&lt;/p&gt;

&lt;h2&gt;
  
  
  Candidate models and techniques
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;th&gt;Does it help with extras?&lt;/th&gt;
&lt;th&gt;Catch&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Constrained decoding&lt;/td&gt;
&lt;td&gt;Rules applied while generating, such as &lt;code&gt;bad_words_ids&lt;/code&gt; to ban tokens and &lt;code&gt;prefix_allowed_tokens_fn&lt;/code&gt; to allow only some&lt;/td&gt;
&lt;td&gt;Yes, directly: banned food words cannot appear&lt;/td&gt;
&lt;td&gt;Needs a food word list. Forcing words with constrained beam search needs &lt;code&gt;do_sample=False&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chef Transformer (T5)&lt;/td&gt;
&lt;td&gt;A T5 text-to-text model trained on RecipeNLG, a dataset of 2,231,142 recipes, with an ingredient list as input&lt;/td&gt;
&lt;td&gt;Maybe: far more data than our 10,000 recipes&lt;/td&gt;
&lt;td&gt;Different data and architecture, so it is hard to compare with our model, and it can still add ingredients&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Small pretrained decoder with LoRA&lt;/td&gt;
&lt;td&gt;Start from SmolLM2 (135M, 360M or 1.7B parameters) or Qwen3 (0.6B or 1.7B), both Apache 2.0, and fine-tune on our recipes&lt;/td&gt;
&lt;td&gt;Likely: it already knows language, and Instruct versions are trained to follow instructions&lt;/td&gt;
&lt;td&gt;Not guaranteed. Needs a GPU, but the free Colab T4 is enough&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retrieval with all-MiniLM-L6-v2&lt;/td&gt;
&lt;td&gt;A 22.7M-parameter embedding model that turns text into 384 numbers, used to find real recipes with similar ingredients&lt;/td&gt;
&lt;td&gt;Yes, real recipes are consistent&lt;/td&gt;
&lt;td&gt;The app copies existing recipes instead of creating new ones&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ingredient checker&lt;/td&gt;
&lt;td&gt;A model that finds food words in the output, for example an NER model trained on TASTEset (700 recipes, more than 13,000 labelled entities)&lt;/td&gt;
&lt;td&gt;Catches extras after generation&lt;/td&gt;
&lt;td&gt;It checks but does not generate, and a simple word list built from our data may do the same job&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  My choice: SmolLM2-360M-Instruct, fine-tuned with LoRA
&lt;/h2&gt;

&lt;p&gt;I would replace our from-scratch model with &lt;strong&gt;SmolLM2-360M-Instruct&lt;/strong&gt;, fine-tuned on our recipes with LoRA. LoRA trains small adapter matrices instead of every weight, so training is light. My reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Same design, much more knowledge.&lt;/strong&gt; It is a decoder-only Transformer like MiniChefGPT, so our pipeline of ingredients in and recipe out barely changes. It has about 340 times more parameters (360 million against 1.05 million) and is already pretrained, so it starts with language knowledge instead of learning from 9,979 recipes alone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It can follow an instruction.&lt;/strong&gt; We can write the task as "use only these ingredients", which our scratch model cannot understand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It is cheap to run.&lt;/strong&gt; In fp16, 360 million parameters take about 0.7 GB (parameters times 2 bytes), which fits easily on a free Colab T4 with 16 GB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The licence is Apache 2.0&lt;/strong&gt;, so there is no gate or paid API.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why not the others? Chef Transformer uses a different dataset and architecture, which makes it hard to compare with our results. Qwen3-1.7B is probably stronger, but it is almost five times bigger and has a thinking mode to switch off, so I would keep it as a stretch goal. Retrieval gives consistent recipes but copies them. Constrained decoding and an ingredient checker are not alternative models, so I would add them on top of my choice.&lt;/p&gt;

&lt;p&gt;I have not run this yet. A bigger model can still invent ingredients, so I would not claim success until the extra-ingredient rate drops on held-out lists.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the model card tells us about SmolLM2-360M-Instruct
&lt;/h2&gt;

&lt;p&gt;I read the &lt;a href="https://huggingface.co/HuggingFaceTB/SmolLM2-360M-Instruct" rel="noopener noreferrer"&gt;model card on Hugging Face&lt;/a&gt; and the paper it links to, "SmolLM2: When Smol Goes Big - Data-Centric Training of a Small Language Model" (&lt;a href="https://arxiv.org/abs/2502.02737" rel="noopener noreferrer"&gt;arXiv 2502.02737&lt;/a&gt;), so my choice rests on more than model size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What it is.&lt;/strong&gt; SmolLM2 is a family of compact language models with 135M, 360M and 1.7B parameters. The card says they are light enough to run on-device. The 360M model is a Transformer decoder, the same design as MiniChefGPT.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it was trained, in simple words.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pretraining.&lt;/strong&gt; The 360M model learned from 4 trillion tokens of text from FineWeb-Edu (educational web pages), DCLM (web text) and The Stack (code), plus new filtered datasets. MiniChefGPT only ever saw about 9,000 recipes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instruction tuning.&lt;/strong&gt; The Instruct version was then fine-tuned on public and curated datasets of instructions and answers (supervised fine-tuning, or SFT), so it answers a request instead of just continuing the text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preference tuning.&lt;/strong&gt; After that, the card says Direct Preference Optimization (DPO) was applied using UltraFeedback, which teaches the model to prefer the kind of answers people rated higher.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Training used 64 H100 GPUs and bfloat16 precision.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What the benchmarks say.&lt;/strong&gt; The card reports zero-shot results for the instruct models, compared with Qwen2.5-0.5B-Instruct and the previous SmolLM-360M-Instruct (higher is better):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;SmolLM2-360M-Instruct&lt;/th&gt;
&lt;th&gt;Qwen2.5-0.5B-Instruct&lt;/th&gt;
&lt;th&gt;SmolLM-360M-Instruct&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;IFEval (average)&lt;/td&gt;
&lt;td&gt;41.0&lt;/td&gt;
&lt;td&gt;31.6&lt;/td&gt;
&lt;td&gt;19.8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HellaSwag&lt;/td&gt;
&lt;td&gt;52.1&lt;/td&gt;
&lt;td&gt;48.0&lt;/td&gt;
&lt;td&gt;47.9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ARC (average)&lt;/td&gt;
&lt;td&gt;43.7&lt;/td&gt;
&lt;td&gt;37.3&lt;/td&gt;
&lt;td&gt;38.8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PIQA&lt;/td&gt;
&lt;td&gt;70.8&lt;/td&gt;
&lt;td&gt;67.2&lt;/td&gt;
&lt;td&gt;69.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MMLU (cloze)&lt;/td&gt;
&lt;td&gt;32.8&lt;/td&gt;
&lt;td&gt;31.7&lt;/td&gt;
&lt;td&gt;30.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MT-Bench&lt;/td&gt;
&lt;td&gt;3.66&lt;/td&gt;
&lt;td&gt;4.16&lt;/td&gt;
&lt;td&gt;3.37&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;BBH (3-shot)&lt;/td&gt;
&lt;td&gt;27.3&lt;/td&gt;
&lt;td&gt;30.7&lt;/td&gt;
&lt;td&gt;24.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GSM8K (5-shot)&lt;/td&gt;
&lt;td&gt;7.43&lt;/td&gt;
&lt;td&gt;26.8&lt;/td&gt;
&lt;td&gt;1.36&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;How I read it: IFEval measures how well a model follows instructions that can be checked, such as format or length rules. It matters most for us, because we want "use only these ingredients" to be obeyed, and SmolLM2-360M-Instruct scores highest there. It is weaker than Qwen2.5-0.5B-Instruct at math and reasoning (GSM8K, BBH) and in MT-Bench, which matters little for recipes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What these numbers do not prove.&lt;/strong&gt; They are the authors' own results on general tasks, not on recipes. They compare against Qwen2.5-0.5B-Instruct, not against Qwen3. And IFEval tests format instructions, not "do not add ingredients". So the benchmarks support my choice but do not prove it. My own extra-ingredient test will.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Limits the card states.&lt;/strong&gt; The models mainly understand English, and their output may not always be factually accurate, logically consistent or free from bias, so they should be used as assistive tools. For recipes this means a person should check cooking times and temperatures before anyone cooks from a generated recipe.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A practical detail.&lt;/strong&gt; The model was trained in bfloat16, which a free Colab T4 GPU does not support natively. On a T4 I would load it in float16 or float32. In float32, 360 million parameters take about 1.4 GB (parameters times 4 bytes), which still fits easily.&lt;/p&gt;

&lt;h2&gt;
  
  
  First experiment
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Turn &lt;code&gt;recipe_10000.csv&lt;/code&gt; into instruction examples such as "Use only these ingredients: chicken, garlic, onion, tomato. Write a title and steps."&lt;/li&gt;
&lt;li&gt;Fine-tune SmolLM2-360M-Instruct with LoRA on the same training split, and keep our validation and test splits so results stay comparable.&lt;/li&gt;
&lt;li&gt;Generate with a banned-word list (sketch below, not tested).&lt;/li&gt;
&lt;li&gt;Compare coverage and extra-ingredient rate on the same 12 held-out lists and 4 custom tests.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Food words seen in the training recipes (ingredient names only)
&lt;/span&gt;&lt;span class="n"&gt;food_words&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;train_rows&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;ing&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ingredients&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;w&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;ing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt;

&lt;span class="c1"&gt;# Words the user gave, plus pantry staples we allow
&lt;/span&gt;&lt;span class="n"&gt;allowed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;ing&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;user_ingredients&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;ing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()}&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;salt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pepper&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;water&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;oil&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Ban every other food word while generating
&lt;/span&gt;&lt;span class="n"&gt;banned&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;tok&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;add_special_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;input_ids&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;food_words&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bad_words_ids&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;banned&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;do_sample&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                     &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;top_p&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_new_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sketch ignores plural forms and capital letters, so a real version needs word variants.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I took away
&lt;/h2&gt;

&lt;p&gt;A bigger model is only part of the answer. The extra ingredients come from the data, the model size and the decoding, and each one needs its own fix. Measuring extras, not only coverage, is what tells us whether a change really helped.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/flax-community/t5-recipe-generation" rel="noopener noreferrer"&gt;Chef Transformer (flax-community/t5-recipe-generation)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/HuggingFaceTB/SmolLM2-360M-Instruct" rel="noopener noreferrer"&gt;SmolLM2-360M-Instruct&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/Qwen/Qwen3-1.7B" rel="noopener noreferrer"&gt;Qwen3-1.7B&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2" rel="noopener noreferrer"&gt;all-MiniLM-L6-v2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2204.07775" rel="noopener noreferrer"&gt;TASTEset: Recipe Dataset and Food Entities Recognition Benchmark&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/docs/transformers/main_classes/text_generation" rel="noopener noreferrer"&gt;Transformers text generation documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>nlp</category>
      <category>python</category>
    </item>
    <item>
      <title>Computer Vision for Beginners: From Pixels to Predictions</title>
      <dc:creator>Marie Claire NIYOMUGENGA</dc:creator>
      <pubDate>Tue, 13 Oct 2026 14:50:18 +0000</pubDate>
      <link>https://dev.to/claire_123/computer-vision-for-beginners-from-pixels-to-predictions-3lm0</link>
      <guid>https://dev.to/claire_123/computer-vision-for-beginners-from-pixels-to-predictions-3lm0</guid>
      <description>&lt;p&gt;What I learned in my first computer vision : how images become numbers, how filters find edges, and how classification, detection and segmentation differ. With my own results, including where the models failed.&lt;/p&gt;

&lt;p&gt;I used to think computer vision meant a computer "seeing" a picture the way I do. It doesn't. After my first hands-on session in the kLab TekHer AI Program (Cohort 2), I understand why, and I learned it best by running the code and testing my own photos.&lt;/p&gt;

&lt;p&gt;This post follows the same path as the session: pixels → filters → classification → detection → segmentation → failure cases. Everything here comes from a Python notebook I ran in VS Code, with the "Try it yourself" exercises done by hand.&lt;/p&gt;

&lt;p&gt;What you will learn&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How a computer stores an image&lt;/li&gt;
&lt;li&gt;How a filter finds edges, and why that matters for CNNs&lt;/li&gt;
&lt;li&gt;The difference between classification, detection and segmentation&lt;/li&gt;
&lt;li&gt;Where pretrained models fail, with my own results&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What is computer vision?&lt;/p&gt;

&lt;p&gt;Computer vision lets computers get meaning from images and video. Almost every vision system answers one or more of three questions:&lt;/p&gt;

&lt;p&gt;Question                        Example &lt;br&gt;
 What is in the image?             A cat, a cassava leaf &lt;br&gt;
 Where is it?                      Which pixels, which part &lt;br&gt;
 What is happening?                A person crossing the road &lt;/p&gt;

&lt;p&gt;Humans and computers are good at different things. We learn from years of seeing and need few examples. A computer needs millions of labelled images, but it then works at huge speed and scale. Its main weakness is anything unlike its training data, and we will see that later.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;An image is a grid of numbers&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A computer never sees "a bus". It receives a grid of rows × columns × 3 colour values (red, green, blue), each from 0 to 255. Why 255? Each value uses 8 bits, and 8 bits give 2⁸ = 256 possible values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python
import numpy as np
from PIL import Image

img = np.array(Image.open("photo.jpg").convert("RGB"))
print(img.shape)       # (height, width, 3): height first, then width
print(img.dtype)       # uint8: whole numbers from 0 to 255
print(img[100, 400])   # one pixel: [R, G, B]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;markdown&lt;br&gt;
A small 400 × 600 photo holds 400 × 600 × 3 = &lt;strong&gt;720,000 numbers&lt;/strong&gt;. A phone photo holds more than 30 million. The core challenge of computer vision is going from these numbers to meaning.&lt;/p&gt;

&lt;p&gt;A colour image is three grids&lt;/p&gt;

&lt;p&gt;Each pixel has a red, a green and a blue value. Showing each channel on its own makes this visible:&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%2Fcw5x56e6fr4xsxqcoayy.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%2Fcw5x56e6fr4xsxqcoayy.png" alt=" " width="785" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Strong colour means a high value (near 255) and pale means a low value (near 0).&lt;/p&gt;

&lt;p&gt;I also removed the red channel to see what happens:&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="n"&gt;no_red&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;      &lt;span class="c1"&gt;# copy, so the original is not damaged
&lt;/span&gt;&lt;span class="n"&gt;no_red&lt;/span&gt;&lt;span class="p"&gt;[:,&lt;/span&gt; &lt;span class="p"&gt;:,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;      &lt;span class="c1"&gt;# set every red value to 0
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2F00fc9ve6vnr3rmc6aawb.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%2F00fc9ve6vnr3rmc6aawb.png" alt=" " width="325" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pure red areas became black, because (255, 0, 0) turns into (0, 0, 0). White areas became cyan, because white without red is green plus blue.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Filters: finding edges by hand&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A filter(or kernel) is a small grid of weights. For every pixel, you multiply it and its neighbours by the weights and add the results. That sum is the new pixel value. Then the filter slides across the whole image.&lt;/p&gt;

&lt;p&gt;Here are three filters:&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="n"&gt;blur&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ones&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;                              &lt;span class="c1"&gt;# average of 25 neighbours
&lt;/span&gt;&lt;span class="n"&gt;sobel_x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt;    &lt;span class="c1"&gt;# right minus left: vertical edges
&lt;/span&gt;&lt;span class="n"&gt;sobel_y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sobel_x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;                                         &lt;span class="c1"&gt;# bottom minus top: horizontal edges
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why does &lt;code&gt;sobel_x&lt;/code&gt; find vertical edges? Look at two 3×3 patches:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Patch&lt;/th&gt;
&lt;th&gt;Left side&lt;/th&gt;
&lt;th&gt;Right side&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Flat: every pixel is 100&lt;/td&gt;
&lt;td&gt;100 × (−1 −2 −1) = −400&lt;/td&gt;
&lt;td&gt;100 × (1 + 2 + 1) = +400&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;0&lt;/strong&gt;, no edge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Edge: left is 0, right is 200&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;200 × 4 = +800&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;800&lt;/strong&gt;, an edge&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So flat areas become black and edges become bright. The weights of a Sobel filter add up to 0, which is why flat areas disappear. Blur and sharpen weights add up to 1, so the overall brightness stays the same.&lt;/p&gt;

&lt;p&gt;I also tried my own kernels. My first sharpen result looked flat grey because the values went outside 0–255. Clipping them with &lt;code&gt;np.clip(result, 0, 255)&lt;/code&gt; fixed it.&lt;/p&gt;

&lt;p&gt;The big idea: a CNN learns its own filters&lt;/p&gt;

&lt;p&gt;A convolutional neural network (CNN) does exactly this multiply-and-add. The only difference is that nobody chooses the weights. Training learns them from labelled data. Researchers who visualise trained CNNs find a clear pattern:&lt;/p&gt;

&lt;p&gt;Pixels → edges → textures → objects&lt;/p&gt;

&lt;p&gt;Early layers learn edges and colours, middle layers learn textures and parts like eyes or wheels, and the last layers respond to whole objects.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Classification: one label for the whole image&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I loaded a small pretrained model that picks from 1,000 ImageNet classes and returns a confidence for each.&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;ultralytics&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;YOLO&lt;/span&gt;

&lt;span class="n"&gt;classifier&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;YOLO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yolo11n-cls.pt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;r&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;photo.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&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;idx&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;probs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;top5&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;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;idx&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;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;probs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;idx&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;item&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;%&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;I tested it on photos from my own context in Rwanda, and the results taught me more than the sample images did:&lt;/p&gt;

&lt;p&gt;Photo                        Top label        Confidence &lt;br&gt;
agaseke(woven basket)             vase         35.1% &lt;br&gt;
 umukenyero (wrapped cloth)       sarong       78.7% &lt;br&gt;
A photo of me next to a car   maillot (tights  17.3% &lt;/p&gt;

&lt;p&gt;Three lessons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The model always picks something. Its final step, softmax, forces the 1,000 probabilities to add up to 100%, so it can never say "I don't know."
2.High confidence is not correctness. The sarong answer was 78.7% sure and only roughly right. The model does not know the Rwandan name or meaning.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;There is no "person" class in ImageNet.** On my photo, the model looked at the dress and returned clothing labels.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Object detection: what and where&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A classifier gives one label. A &lt;strong&gt;detector&lt;/strong&gt; draws a box around each object it knows (80 everyday categories from the COCO dataset) and gives a confidence for each.&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="n"&gt;detector&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;YOLO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yolo11n.pt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;detector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;photo.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;conf&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&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;box&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;boxes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;x1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;box&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xyxy&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;tolist&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;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;box&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cls&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="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;box&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;conf&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&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;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y1&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y2&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each box has a corner position, where x counts from the left and y counts from the top.&lt;br&gt;
Detection on the sample bus photo: a box, a label and a confidence for each object.&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%2Fl767emurc6ue4trq15ht.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%2Fl767emurc6ue4trq15ht.png" alt=" " width="473" height="716"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On my own photo the detector found person (94%) and car (70%). The car was less certain because I was standing in front of it and hiding part of it.&lt;/p&gt;

&lt;p&gt;The confidence threshold is a choice you make&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;conf&lt;/code&gt; setting is the minimum confidence a box needs to be shown.&lt;/p&gt;

&lt;p&gt;Threshold         Misses real objects           False alarms &lt;/p&gt;

&lt;p&gt;Low (0.1)            fewer                         more &lt;br&gt;
 High (0.9)            more                         fewer &lt;/p&gt;

&lt;p&gt;This is the same trade-off as in medical screening: a low threshold misses fewer real cases but raises more false alarms.&lt;/p&gt;

&lt;p&gt;Why is YOLO fast?&lt;/p&gt;

&lt;p&gt;YOLO stands for You Only Look Once. Older detectors first proposed many regions and then classified each one, which was accurate but slow. YOLO looks at the whole imag once and predicts every box, label and confidence in a single pass. That makes it fast enough for live video and small devices.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Segmentation: which pixels belong to which object&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Segmentation goes one step further and gives every object a &lt;strong&gt;mask&lt;/strong&gt;, a grid of 0s and 1s where 1 means "this pixel belongs to the object."&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="n"&gt;segmenter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;YOLO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;yolo11n-seg.pt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;segmenter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;photo.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;conf&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;verbose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&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;mask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;masks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;boxes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cls&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;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)],&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pixels&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;&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%2Fso3qjpya95al4huammrx.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%2Fso3qjpya95al4huammrx.png" alt=" " width="799" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every pixel of each object is labelled, not just a box around it.&lt;/p&gt;

&lt;p&gt;There is a neat trick here: &lt;strong&gt;the mean of a grid of 0s and 1s is the fraction of 1s.&lt;/strong&gt; One line of code tells you what share of the image an object covers. The same idea measures building areas in satellite images, or a tumour in a scan.&lt;/p&gt;

&lt;p&gt;One photo, three tasks&lt;/p&gt;

&lt;p&gt;Task              Question it answers              Output &lt;/p&gt;

&lt;p&gt;Classification     What is this picture about?       One label &lt;br&gt;
 Detection          What is here, and where?          A box per object &lt;br&gt;
 Segmentation       Which exact pixels?                A mask per object &lt;/p&gt;

&lt;p&gt;More detailed outputs need more detailed training labels, and those cost more to create.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When models fail&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This was my favourite part. A model only knows what it was trained on, so I made harder versions of my photo and ran the detector on each.&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%2Flt72voslm3ghbcqrffnf.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%2Flt72voslm3ghbcqrffnf.png" alt=" " width="799" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are my own results on my photo:&lt;/p&gt;

&lt;p&gt;Version             Objects found                           What happened&lt;br&gt;
 Original            2  person 94%, car 70% &lt;br&gt;
 Very dark          2  person 95%, car 80%:                    no damage &lt;br&gt;
 Upside down         1  person 86%,                            car lost &lt;br&gt;
 Low resolution (48 px wide)  0                              found nothing &lt;br&gt;
 Blurry              2  person 94%, car 69%               almost no damage&lt;/p&gt;

&lt;p&gt;What stood out:&lt;br&gt;
Low resolution broke the detector completely. The tiny, blocky image removed almost all detail.&lt;br&gt;
The dark photo did not hurt the detector, but the classifier on the same dark photo changed its top answer to "crutch" (11.9%). Different models cope with different problems.&lt;br&gt;
Rotation hurt. When I turned the photo sideways, confidence fell, the same person appeared in two boxes, and the more confident box was the less accurate one.&lt;/p&gt;

&lt;p&gt;The pattern is simple: models fail on conditions they rarely saw in training.&lt;/p&gt;

&lt;p&gt;Why this matters in Africa&lt;/p&gt;

&lt;p&gt;These models were trained mostly on photos from Europe, North America and Asia. My agaseke became a "vase". Other risks I would check are local clothing, unpaved roads, moto-taxis, strong sunlight and low-quality phone photos. I have not tested all of these, so I treat them as risks, not proven results.&lt;/p&gt;

&lt;p&gt;The same technology is already used across the continent. The session slides listed examples such as:&lt;/p&gt;

&lt;p&gt;Agriculture: a farmer photographs a cassava leaf and an app names the disease, even offline&lt;br&gt;
-Health: software scores chest X-rays to decide who gets a TB lab test&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Conservation:** smart camera traps alert rangers within minutes&lt;/li&gt;
&lt;li&gt;Mapping: models outline every building from satellite images
-Accessibility:a wearable vision assistant built in Kigali that describes      objects and text&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The fix for the failures above is local data plus transfer learning: start from a pretrained model and train it a little more on local images, so it can learn to say "agaseke" instead of "vase".&lt;/p&gt;

&lt;p&gt;Key takeaways&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;An image is numbers: height × width × 3.&lt;/li&gt;
&lt;li&gt;Filters find patterns, and CNNs learn the filters themselves.&lt;/li&gt;
&lt;li&gt;Classification gives one label, detection adds location, and segmentation labels every pixel.&lt;/li&gt;
&lt;li&gt;Confidence is not correctness.&lt;/li&gt;
&lt;li&gt;Models fail on what they have not seen, so local data matters.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What is next for me: building my own image classifier on local data, with an honest test set.&lt;/p&gt;

&lt;p&gt;If you are learning computer vision too, try the exercises yourself. Predicting the result before running the code taught me the most. Thanks for reading!&lt;/p&gt;

</description>
      <category>computervision</category>
      <category>python</category>
      <category>machinelearning</category>
      <category>beginners</category>
    </item>
    <item>
      <title>The Ultimate Guide to Word Embeddings &amp; Word2Vec</title>
      <dc:creator>Marie Claire NIYOMUGENGA</dc:creator>
      <pubDate>Wed, 30 Sep 2026 14:32:14 +0000</pubDate>
      <link>https://dev.to/claire_123/the-ultimate-guide-to-word-embeddings-word2vec-1lpp</link>
      <guid>https://dev.to/claire_123/the-ultimate-guide-to-word-embeddings-word2vec-1lpp</guid>
      <description>&lt;p&gt;In modern Natural Language Processing (NLP), translating human language into numerical formats that machine learning&lt;br&gt;
models can process is foundational. Historically, text processing relied on One-Hot Encoding representing each word as&lt;br&gt;
a sparse vector of size |V| (vocabulary size) with a single 1 and zeros elsewhere&lt;/p&gt;

&lt;p&gt;One-Hot Encoding has two major drawbacks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;High Dimensionality &amp;amp; Sparsity: A vocabulary of 100,000 words requires 100,000-dimensional vectors.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lack of Semantic Connection: The dot product between any two one-hot vectors is always 0, meaning the model&lt;br&gt;
cannot infer that 'cat' and 'feline' share similar contexts.&lt;br&gt;
Word Embeddings solve this by mapping words into dense, continuous vector spaces Rd (d ˛ [50, 300]). Words appearing&lt;br&gt;
in similar contexts cluster closely together in space&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Core Problem &amp;amp; Visual Intuition&lt;br&gt;
In dense vector spaces, semantic similarity corresponds to geometric proximity, evaluated using Cosine Similarity&lt;/p&gt;&lt;/li&gt;
&lt;/ol&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%2Fde0j12d5dcaao1glity3.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%2Fde0j12d5dcaao1glity3.png" alt=" " width="745" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Vector Arithmetic &amp;amp; Semantic Analogies: Word embeddings preserve linear relational structures. As visualised in Jay&lt;br&gt;
Alammar's The Illustrated Word2vec and StatQuest, semantic operations correspond to consistent spatial directions:&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%2Fu9a0erafs4ztmyk4o24f.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%2Fu9a0erafs4ztmyk4o24f.png" alt=" " width="721" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Real-World Applications: 'Item2Vec'&lt;br&gt;
As Jay Alammar notes, Word2vec principles extend far beyond text. Companies like Spotify, Airbnb, and Alibaba treat&lt;br&gt;
user interaction sequences as 'sentences' and items as 'words' to build high-performance recommendation engines&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Under the Hood: Neural Architecture &amp;amp; Math&lt;br&gt;
Sliding Context Windows: Word2vec generates training data automatically from unlabelled text corpora using a sliding&lt;br&gt;
context window of size c. Accounting for bi-directional context (looking left and right) provides richer semantic signals.&lt;br&gt;
Word2vec introduces two primary architectures:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Continuous Bag-of-Words (CBOW): Predicts the target center word given its context words.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Skip-gram: Predicts surrounding context words given a single input center word.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&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%2F6acacu9j3rla1hsafck3.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%2F6acacu9j3rla1hsafck3.png" alt=" " width="710" height="231"&gt;&lt;/a&gt;&lt;br&gt;
Figure 2: Architecture comparison between CBOW and Skip-gram&lt;/p&gt;

&lt;p&gt;Softmax Bottleneck &amp;amp; Negative Sampling (SGNS): Standard language models compute context probabilities using&lt;br&gt;
Softmax over the full vocabulary |V|, creating an O(|V|) computational bottleneck.&lt;br&gt;
Skip-gram with Negative Sampling (SGNS) converts the task into a fast binary logistic regression: determining whether&lt;br&gt;
two words are real context neighbors (label 1) or random noise words (label 0)&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%2Fn92qela6lxrhms3ysiok.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%2Fn92qela6lxrhms3ysiok.png" alt=" " width="721" height="145"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Subsampling Frequent Words: High-frequency stopwords (e.g. 'the', 'is') carry minimal semantic signal. As detailed in D2L&lt;br&gt;
and Lena Voita's course, Word2vec discards frequent words probabilistically:&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%2F3cp6awzm6pjtq9m1tqmm.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%2F3cp6awzm6pjtq9m1tqmm.png" alt=" " width="673" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dual Weight Matrices: Word2vec maintains a Target Embedding Matrix W for input words and a Context Matrix W' for&lt;br&gt;
context words. After training, W' is discarded and W is retained for downstream tasks&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Practical Python Implementation with Gensim
Page 2
The following script demonstrates Skip-gram model training using Gensim, matching the pipeline described in D2L and
Lena Voita&lt;/li&gt;
&lt;/ol&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%2Fh8xs8ppldrb8qgc795cf.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%2Fh8xs8ppldrb8qgc795cf.png" alt=" " width="668" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Architecture Comparison &amp;amp; Recommended Resources&lt;/li&gt;
&lt;/ol&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%2Feemtkmm9jzzrb7ljmz3k.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%2Feemtkmm9jzzrb7ljmz3k.png" alt=" " width="688" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Recommended Learning Resources:&lt;br&gt;
• Jay Alammar  The Illustrated Word2vec (Visual intuitive guide to embeddings and Skip-gram).&lt;br&gt;
• Lena Voita :NLP Course  Word Embeddings (Detailed mathematical derivations of SGNS and distribution&lt;br&gt;
hypothesis).&lt;br&gt;
• StatQuest with Josh Starmer Word Embedding and Word2Vec, Clearly Explained!!! (Step-by-step neural network&lt;br&gt;
mechanics).&lt;br&gt;
• Aston Zhang, Zachary C. Lipton, Mu Li, &amp;amp; Alexander J. Smola  Dive into Deep Learning (D2L.ai) Chapter 15:&lt;br&gt;
Natural Language Processing: Pretraining.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>nlp</category>
      <category>python</category>
    </item>
  </channel>
</rss>
