<?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: anne sonia</title>
    <description>The latest articles on DEV Community by anne sonia (@anne_sonia).</description>
    <link>https://dev.to/anne_sonia</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%2F4152142%2F8e538bb6-742c-4aa5-bae5-9570e217d4d8.png</url>
      <title>DEV Community: anne sonia</title>
      <link>https://dev.to/anne_sonia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anne_sonia"/>
    <language>en</language>
    <item>
      <title>UNDERSTANDING VECTOR RAG, GRAPH RAG, AND AGENTIC RAG</title>
      <dc:creator>anne sonia</dc:creator>
      <pubDate>Tue, 03 Nov 2026 07:09:52 +0000</pubDate>
      <link>https://dev.to/anne_sonia/understanding-vector-rag-graph-rag-and-agentic-rag-ip</link>
      <guid>https://dev.to/anne_sonia/understanding-vector-rag-graph-rag-and-agentic-rag-ip</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction: What is RAG, and why was it needed?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Retrieval-Augmented Generation (RAG) is an Artificial Intelligence technique that combines information retrieval with Large Language Models (LLMs). It allows an LLM to search for relevant information from external knowledge sources, such as documents, databases, websites, and company records, before generating an answer.&lt;/p&gt;

&lt;p&gt;RAG was developed to address some limitations of LLMs. First, LLMs mainly depend on information learned during their training, which means their knowledge may become outdated. Second, they may not have access to private or specialized information, such as company documents. Third, they can produce incorrect information that sounds convincing, a problem known as hallucination.&lt;/p&gt;

&lt;p&gt;RAG improves the quality of responses by retrieving relevant and updated information and providing it to the LLM as context. This helps the model generate answers that are more relevant, accurate, and supported by external information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PART A: VECTOR RAG&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. How does Vector RAG work?&lt;/strong&gt;&lt;br&gt;
Vector RAG is a retrieval approach that uses numerical representations called embeddings to search for information based on meaning or semantic similarity.&lt;br&gt;
&lt;strong&gt;It works through the following steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Document collection: The system collects documents such as PDFs, reports, and text files.&lt;/li&gt;
&lt;li&gt; Chunking: The documents are divided into smaller sections called chunks.&lt;/li&gt;
&lt;li&gt; Embedding: Each chunk is converted into a numerical vector using an embedding model.&lt;/li&gt;
&lt;li&gt; Storage: The vectors and their associated text are stored in a vector database.&lt;/li&gt;
&lt;li&gt; Query embedding: When a user asks a question, the question is also converted into a vector.&lt;/li&gt;
&lt;li&gt; Similarity search: The system compares the question vector with stored vectors and retrieves the most relevant chunks.&lt;/li&gt;
&lt;li&gt; Generation: The retrieved information is provided to the LLM, which generates the final answer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;For example&lt;/strong&gt;, if a student asks, "How can I pay my university fees?", Vector RAG searches university documents and retrieves information about tuition payment methods, even if the documents use different wording.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. When was it developed, and who introduced it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The original Retrieval-Augmented Generation framework was introduced in 2020 by Patrick Lewis and other researchers from Facebook AI Research, University College London, and New York University.&lt;br&gt;
Their research paper was titled "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks" and was published at NeurIPS 2020.&lt;br&gt;
The researchers combined a pre-trained language model with an external knowledge source using a dense vector index of Wikipedia. This research established an important foundation for modern vector-based RAG systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. What problem did it solve?&lt;/strong&gt;&lt;br&gt;
Vector RAG addressed the problem of LLMs depending only on their internal training knowledge. Traditional LLMs could not easily access newly updated information or private documents.&lt;br&gt;
It also addressed the difficulty of finding relevant information using exact keyword matching. By using embeddings, Vector RAG can identify information with similar meanings even when different words are used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. What are its real-world applications?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Customer support:&lt;/strong&gt; Companies use Vector RAG to build chatbots that retrieve answers from product manuals, FAQs, and customer service documents.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Education&lt;/strong&gt;: Universities can use Vector RAG to develop student assistants that answer questions using lecture notes, academic materials, and university handbooks.&lt;/li&gt;
&lt;li&gt; **Healthcare: **Healthcare organizations can use it to retrieve relevant information from medical guidelines and research documents to support information access by professionals.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;5. What are its limitations?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Limited understanding of relationships: Vector RAG mainly retrieves similar text sections and may fail to understand complex relationships between different people, organizations, and concepts.&lt;/li&gt;
&lt;li&gt; Retrieval errors: It may retrieve irrelevant or incomplete information if the question is unclear or the embeddings do not represent the meaning accurately.&lt;/li&gt;
&lt;li&gt; Chunking challenges: Dividing documents into small sections may separate important information that originally belonged together.&lt;/li&gt;
&lt;li&gt; Dependence on embedding quality: Poor-quality embeddings can reduce the accuracy of semantic searches.&lt;/li&gt;
&lt;li&gt; Limited global understanding: It can struggle with questions that require understanding the overall themes of a large collection of documents.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;PART B: GRAPH RAG&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. How does Graph RAG work?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Graph RAG is an approach that combines retrieval-augmented generation with knowledge graphs. A knowledge graph organizes information into entities and relationships.&lt;br&gt;
Entities are represented as nodes, while relationships between entities are represented as edges.&lt;br&gt;
For example:&lt;br&gt;
• Sonia → studies → Information Technology&lt;br&gt;
• Sonia → attends → University&lt;br&gt;
• University → offers → Machine Learning&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Graph RAG works through the following steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Document collection: The system collects information from different documents.&lt;/li&gt;
&lt;li&gt; Entity extraction: It identifies important entities such as people, places, organizations, and concepts.&lt;/li&gt;
&lt;li&gt; Relationship extraction: It identifies how those entities are connected.&lt;/li&gt;
&lt;li&gt; Graph construction: It organizes the entities and relationships into a knowledge graph.&lt;/li&gt;
&lt;li&gt; Retrieval: When a user asks a question, the system searches the graph for relevant entities and their connections.&lt;/li&gt;
&lt;li&gt; Generation: The retrieved information is provided to the LLM to generate an answer.
&lt;strong&gt;For example&lt;/strong&gt;, a student may ask, "Which lecturer teaches Machine Learning, and which university offers the course?" Graph RAG can follow the relationships between the lecturer, course, and university to retrieve the connected information.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;2. When was it developed, and who introduced it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Knowledge graphs existed before Graph RAG and have been researched for many years.&lt;br&gt;
However, Microsoft's GraphRAG approach became prominent in 2024. It was introduced by researchers at Microsoft Research, including Darren Edge, Ha Trinh, Newman Cheng, Joshua Bradley, Alex Chao, Apurva Mody, Steven Truitt, Dasha Metropolitansky, Robert Osazuwa Ness, and Jonathan Larson.&lt;br&gt;
Their research paper, "From Local to Global: A Graph RAG Approach to Query-Focused Summarization," was published as a preprint in April 2024.&lt;br&gt;
Microsoft developed GraphRAG to improve how LLMs understand and answer questions about large collections of private documents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. What problem did it solve?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Graph RAG was developed to address the limitations of traditional vector-based retrieval when answering complex questions involving relationships between multiple entities.&lt;br&gt;
Vector RAG is effective at finding relevant text sections, but it may not capture how information across different documents is connected.&lt;br&gt;
For example, when analyzing thousands of research papers, it may be difficult to understand how different drugs, genes, diseases, and researchers are related.&lt;br&gt;
Graph RAG solves this problem by organizing information into connected entities and relationships. It also helps answer global questions about the main themes and connections within large document collections.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. What are its real-world applications&lt;/strong&gt;?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Healthcare and medical research: Researchers can use Graph RAG to explore relationships between drugs, genes, diseases, and medical studies.&lt;/li&gt;
&lt;li&gt; Financial analysis: Financial institutions can use it to understand relationships between companies, investors, transactions, and financial risks.&lt;/li&gt;
&lt;li&gt; Legal research: Lawyers can use Graph RAG to connect cases, legal documents, people, laws, and important legal relationships.&lt;/li&gt;
&lt;li&gt; Business intelligence: Organizations can use it to understand connections between departments, employees, projects, customers, and business activities.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;5. What are its limitations?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; High implementation complexity: Building a knowledge graph requires identifying entities, extracting relationships, and organizing information correctly.&lt;/li&gt;
&lt;li&gt; High computational cost: Extracting entities and relationships using LLMs can require significant processing resources and API costs.&lt;/li&gt;
&lt;li&gt; Data quality problems: Incorrectly extracted entities or relationships can produce misleading results.&lt;/li&gt;
&lt;li&gt; Difficult maintenance: Knowledge graphs must be updated when new information becomes available or existing relationships change.&lt;/li&gt;
&lt;li&gt; Limited suitability for simple questions: For basic questions that require retrieving one relevant document section, Graph RAG may introduce unnecessary complexity.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;PART C: AGENTIC RAG&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. How does Agentic RAG work?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Agentic RAG is an advanced retrieval approach that uses AI agents to plan, manage, and control the retrieval process.&lt;br&gt;
Unlike traditional RAG, which usually follows a fixed retrieval process, Agentic RAG allows an AI agent to decide which sources to search, which tools to use, and whether additional information is needed.&lt;br&gt;
&lt;strong&gt;It works through the following steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; User query: The user submits a question or task.&lt;/li&gt;
&lt;li&gt; Planning: The AI agent analyzes the question and creates a plan for finding the required information.&lt;/li&gt;
&lt;li&gt; Tool selection: The agent decides which tools or knowledge sources to use, such as vector databases, knowledge graphs, APIs, or web searches.&lt;/li&gt;
&lt;li&gt; Retrieval: The agent searches for relevant information.&lt;/li&gt;
&lt;li&gt; Evaluation: It checks whether the retrieved information is sufficient and relevant.&lt;/li&gt;
&lt;li&gt; Additional retrieval: If information is missing, the agent can perform more searches or use different tools.&lt;/li&gt;
&lt;li&gt; Generation: The agent provides the collected information to the LLM to generate the final response.
For example, a financial analyst may ask, "Compare the revenue growth of this company with its three main competitors and identify the risks."
An Agentic RAG system can search financial reports, retrieve revenue figures, compare company information, investigate risks, and generate a final report.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;2. When was it developed, and who introduced it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Agentic RAG does not have one universally recognized invention date or a single inventor. It developed from research on AI agents, tool use, reasoning, and retrieval-augmented generation.&lt;br&gt;
An important foundation was introduced in 2022 by Shunyu Yao and other researchers in their paper titled "ReAct: Synergizing Reasoning and Acting in Language Models."&lt;br&gt;
ReAct combined reasoning and actions, allowing language models to interact with external tools and gather additional information.&lt;br&gt;
Another important development was Self-RAG, introduced by Akari Asai and other researchers in October 2023 and published at ICLR 2024. It enabled language models to decide when retrieval was needed and evaluate their own generated responses.&lt;br&gt;
These developments helped establish the foundations for modern Agentic RAG systems, which became increasingly popular in 2024 and afterward.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. What problem did it solve?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Agentic RAG was developed to address the limitations of fixed and predefined retrieval processes.&lt;br&gt;
Traditional RAG systems usually retrieve information using a predefined search method. They may fail when a question requires multiple searches, different information sources, or several reasoning steps.&lt;br&gt;
Agentic RAG improves this process by allowing AI agents to make decisions during retrieval. They can plan searches, select tools, evaluate results, and retrieve additional information when necessary.&lt;br&gt;
This makes it more suitable for complex tasks that require several steps before generating a final answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. What are its real-world applications?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Financial analysis: Financial analysts can use Agentic RAG to search company reports, compare financial performance, analyze competitors, and identify business risks.&lt;/li&gt;
&lt;li&gt; Customer support: AI agents can retrieve customer information, check order statuses, search company policies, and provide personalized responses.&lt;/li&gt;
&lt;li&gt; Research assistance: Researchers can use Agentic RAG to search multiple academic databases, compare research findings, and summarize information from different studies.&lt;/li&gt;
&lt;li&gt; Healthcare information systems: Healthcare information assistants can retrieve medical guidelines and relevant records from different sources to support professionals in finding information.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;5. What are its limitations?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; High complexity: Developing an Agentic RAG system requires designing agents, tools, workflows, and retrieval processes.&lt;/li&gt;
&lt;li&gt; High cost: Multiple searches and repeated LLM calls can increase API costs and computational requirements.&lt;/li&gt;
&lt;li&gt; Slower responses: Performing several retrieval and reasoning steps can take more time than traditional RAG.&lt;/li&gt;
&lt;li&gt; Unreliable decisions: An AI agent may select the wrong tool, make an incorrect plan, or retrieve irrelevant information.&lt;/li&gt;
&lt;li&gt; Security risks: Giving agents access to external tools, private databases, or APIs may introduce security and privacy risks if permissions are not properly controlled.&lt;/li&gt;
&lt;li&gt; Difficult evaluation: It can be challenging to test and monitor every decision and retrieval step performed by an agent.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;PART D: COMPARISON AND CHOOSING THE RIGHT APPROACH&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Comparison table&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Criteria&lt;/th&gt;
&lt;th&gt;Vector RAG&lt;/th&gt;
&lt;th&gt;Graph RAG&lt;/th&gt;
&lt;th&gt;Agentic RAG&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Year developed (approx.)&lt;/td&gt;
&lt;td&gt;2020&lt;/td&gt;
&lt;td&gt;2024 (Microsoft GraphRAG)&lt;/td&gt;
&lt;td&gt;2022–2024 foundations; popularized as an approach around 2024 onward&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Problem it solved&lt;/td&gt;
&lt;td&gt;Limited access to external and updated knowledge&lt;/td&gt;
&lt;td&gt;Difficulty understanding complex relationships and global themes&lt;/td&gt;
&lt;td&gt;Fixed retrieval workflows that cannot adapt to complex tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How it retrieves information&lt;/td&gt;
&lt;td&gt;Uses embeddings and semantic similarity search&lt;/td&gt;
&lt;td&gt;Uses knowledge graphs, entities, and relationships&lt;/td&gt;
&lt;td&gt;Uses agents to plan and perform one or more retrieval operations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best suited for&lt;/td&gt;
&lt;td&gt;Document search and question answering&lt;/td&gt;
&lt;td&gt;Relationship analysis and complex knowledge discovery&lt;/td&gt;
&lt;td&gt;Multi-step research, analysis, and decision-making tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Main limitations&lt;/td&gt;
&lt;td&gt;Chunking, retrieval accuracy, and weak relationship understanding&lt;/td&gt;
&lt;td&gt;Graph construction complexity, cost, and maintenance&lt;/td&gt;
&lt;td&gt;Cost, latency, complexity, and unreliable agent decisions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost and complexity&lt;/td&gt;
&lt;td&gt;Low to medium&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;2. Scenario-based recommendations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario 1:&lt;/strong&gt; A company wants a chatbot that answers questions from its 500-page employee handbook.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommended approach: Vector RAG&lt;/strong&gt;&lt;br&gt;
I would choose Vector RAG because it is suitable for searching large collections of documents and retrieving relevant information based on the meaning of a question. The company can divide the employee handbook into smaller chunks, convert them into embeddings, and store them in a vector database. When employees ask questions about leave policies, salaries, or working hours, the system retrieves the relevant sections and provides them to an LLM. This approach is relatively simple, cost-effective, and appropriate for a document-based chatbot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario 2: A researcher needs to understand how drugs, genes, and diseases are connected across thousands of papers.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommended approach: Graph RAG&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I would choose Graph RAG because the research requires understanding relationships between different entities, including drugs, genes, and diseases. It can extract these entities from research papers and represent their connections in a knowledge graph. Researchers can then explore how a particular drug is related to a gene or disease across multiple studies. This makes Graph RAG more suitable than ordinary vector retrieval for complex relationship-based research.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario 3: A financial analyst asks: "Compare this company's revenue growth with its top three competitors and summarize the risks."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommended approach: Agentic RAG&lt;/strong&gt;&lt;br&gt;
I would choose Agentic RAG because the task requires several research and analysis steps. An AI agent can search financial reports, identify the company's competitors, retrieve revenue information, and compare the results. It can also search for financial risks and additional information when the initial results are incomplete. Finally, it can organize the findings into a report that explains the comparison and identifies possible risks.&lt;br&gt;
&lt;strong&gt;3. How each approach grew out of the limitations of the one before it&lt;br&gt;
Vector RAG, Graph RAG, and Agentic RAG represent different ways of improving how LLMs retrieve and use external information.&lt;/strong&gt;&lt;br&gt;
 Vector RAG provided an important foundation by allowing LLMs to retrieve relevant information using semantic similarity, but it can struggle with complex relationships and questions that require understanding an entire collection of documents. Graph RAG addresses some of these limitations by organizing information into knowledge graphs containing connected entities and relationships. However, Graph RAG can be expensive and complicated to build and maintain, and it does not automatically provide flexible decision-making for every task. Agentic RAG extends retrieval by introducing AI agents that can plan searches, select different tools, evaluate results, and retrieve additional information when necessary. Together, these approaches demonstrate how RAG systems have developed from simple semantic retrieval into more structured and adaptive information retrieval systems.&lt;br&gt;
**REFERENCES&lt;br&gt;
**1.    Lewis, P., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. Advances in Neural Information Processing Systems (NeurIPS 2020). &lt;a href="https://arxiv.org/abs/2005.11401" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2005.11401&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Edge, D., et al. (2024). From Local to Global: A Graph RAG Approach to Query-Focused Summarization. Microsoft Research. &lt;a href="https://arxiv.org/abs/2404.16130" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2404.16130&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt; Yao, S., et al. (2022). ReAct: Synergizing Reasoning and Acting in Language Models. &lt;a href="https://arxiv.org/abs/2210.03629" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2210.03629&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt; Asai, A., et al. (2023). Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection. ICLR 2024. &lt;a href="https://arxiv.org/abs/2310.11511" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2310.11511&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt; Microsoft Research. (2024). Project GraphRAG. &lt;a href="https://www.microsoft.com/en-us/research/project/graphrag/" rel="noopener noreferrer"&gt;https://www.microsoft.com/en-us/research/project/graphrag/&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>rag</category>
    </item>
    <item>
      <title>Exploring Open-Source Large Language Models: Choosing the Right Model for MiniChefGPT</title>
      <dc:creator>anne sonia</dc:creator>
      <pubDate>Mon, 26 Oct 2026 14:35:01 +0000</pubDate>
      <link>https://dev.to/anne_sonia/exploring-open-source-large-language-models-choosing-the-right-model-for-minichefgpt-5ana</link>
      <guid>https://dev.to/anne_sonia/exploring-open-source-large-language-models-choosing-the-right-model-for-minichefgpt-5ana</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When I started learning about Large Language Models (LLMs), I thought they were mainly used for chatbots like ChatGPT. However, after studying Transformers, attention mechanisms, embeddings, and text generation, I realized that language models can solve many different problems.&lt;/p&gt;

&lt;p&gt;In our MiniChefGPT project, we developed an AI application that generates cooking recipes from ingredients entered by a user. For example, someone can enter chicken, tomatoes, onions, and garlic, and the application attempts to generate a recipe with cooking instructions.&lt;/p&gt;

&lt;p&gt;We built a small GPT-style Transformer from scratch using Python and PyTorch. This helped me understand how language models learn and predict the next token. However, our model still has limitations, especially when generating complete and accurate recipes.&lt;/p&gt;

&lt;p&gt;For this research, I explored three open-weight language models: Qwen3-0.6B, SmolLM2-1.7B-Instruct, and Phi-3.5-mini-instruct. My goal was to find a model that could improve MiniChefGPT while remaining affordable and practical for students using Google Colab.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Understanding Open-Source LLMs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A Large Language Model is a neural network trained on large amounts of text to understand and generate human language.&lt;/p&gt;

&lt;p&gt;Most modern generative LLMs use the Transformer architecture. Transformers contain important components such as token embeddings, attention mechanisms, feed-forward networks, and normalization layers.&lt;/p&gt;

&lt;p&gt;One important thing I learned is that open-weight and open-source do not always mean the same thing. Open-weight models provide downloadable model parameters, while fully open-source development may also involve openly available code, training information, and permissive licenses.&lt;/p&gt;

&lt;p&gt;For my project, I focused on models that provide downloadable weights and allow local inference without paying for a commercial API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Qwen3-0.6B&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Qwen is a language model family developed by Alibaba's Qwen team.&lt;/p&gt;

&lt;p&gt;The Qwen3-0.6B model has approximately 0.6 billion parameters, as reported by its official model card. It supports a context window of 32,768 tokens and is distributed under the Apache 2.0 license.&lt;/p&gt;

&lt;p&gt;Qwen3 supports instruction following, text generation, multilingual tasks, and reasoning. It also offers thinking and non-thinking modes.&lt;/p&gt;

&lt;p&gt;What interests me most is its relatively small size. It can generate text without requiring the same computing resources as models with several billion parameters.&lt;/p&gt;

&lt;p&gt;For MiniChefGPT, Qwen could receive a list of ingredients and generate a recipe in a specific format, including a title, ingredients, and numbered cooking steps.&lt;/p&gt;

&lt;p&gt;Its Apache 2.0 license also makes it attractive for educational and future application development.&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="https://huggingface.co/Qwen/Qwen3-0.6B" rel="noopener noreferrer"&gt;https://huggingface.co/Qwen/Qwen3-0.6B&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. SmolLM2-1.7B-Instruct&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SmolLM2 is a family of compact language models developed by Hugging Face.&lt;/p&gt;

&lt;p&gt;The version I researched has 1.7 billion parameters and supports a context window of 8,192 tokens. It uses the Apache 2.0 license.&lt;/p&gt;

&lt;p&gt;SmolLM2 was designed to provide useful language capabilities while remaining relatively lightweight.&lt;/p&gt;

&lt;p&gt;The instruction-tuned version is suitable for tasks such as answering questions, rewriting text, summarization, and following user instructions.&lt;/p&gt;

&lt;p&gt;For our project, SmolLM2 could help generate cooking instructions in a clearer format. For example, we could ask it to return five cooking steps without adding unrelated explanations.&lt;/p&gt;

&lt;p&gt;Its main disadvantage compared with Qwen3-0.6B is its larger memory requirement. Although it should fit on a Google Colab T4 for short-prompt inference, it needs more GPU memory.&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct" rel="noopener noreferrer"&gt;https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Phi-3.5-mini-instruct&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Phi-3.5-mini-instruct was developed by Microsoft.&lt;/p&gt;

&lt;p&gt;It contains approximately 3.8 billion parameters and supports a context window of 128,000 tokens. The model is available under the MIT license.&lt;/p&gt;

&lt;p&gt;Microsoft designed Phi models to provide useful language capabilities using relatively compact architectures and carefully selected training data.&lt;/p&gt;

&lt;p&gt;Phi-3.5-mini-instruct is useful for instruction following, reasoning, and text generation.&lt;/p&gt;

&lt;p&gt;For MiniChefGPT, it could help organize cooking instructions and respond to more complicated requests, such as generating a vegetarian recipe or adapting a recipe to specific preferences.&lt;/p&gt;

&lt;p&gt;However, this model is considerably larger than Qwen3-0.6B. Running it on a free T4 GPU is possible with suitable settings, but it uses more memory and may require additional optimization for longer prompts.&lt;/p&gt;

&lt;p&gt;Reference: &lt;a href="https://huggingface.co/microsoft/Phi-3.5-mini-instruct" rel="noopener noreferrer"&gt;https://huggingface.co/microsoft/Phi-3.5-mini-instruct&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Comparison of the Three Models&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Qwen3-0.6B&lt;/th&gt;
&lt;th&gt;SmolLM2-1.7B&lt;/th&gt;
&lt;th&gt;Phi-3.5-mini&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Developer&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Alibaba Qwen&lt;/td&gt;
&lt;td&gt;Hugging Face&lt;/td&gt;
&lt;td&gt;Microsoft&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Parameters&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0.6B&lt;/td&gt;
&lt;td&gt;1.7B&lt;/td&gt;
&lt;td&gt;3.8B&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Context window&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;32,768 tokens&lt;/td&gt;
&lt;td&gt;8,192 tokens&lt;/td&gt;
&lt;td&gt;128,000 tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;License&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Apache 2.0&lt;/td&gt;
&lt;td&gt;Apache 2.0&lt;/td&gt;
&lt;td&gt;MIT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Approx. FP16 weight memory&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1.2 GB&lt;/td&gt;
&lt;td&gt;3.4 GB&lt;/td&gt;
&lt;td&gt;7.6 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Free T4 inference&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes, with care&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Main strengths&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Lightweight, multilingual, instruction following&lt;/td&gt;
&lt;td&gt;Compact, instruction following&lt;/td&gt;
&lt;td&gt;Reasoning, long context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Main limitation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Less capacity than larger models&lt;/td&gt;
&lt;td&gt;More memory than Qwen&lt;/td&gt;
&lt;td&gt;Higher memory and compute requirements&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Note: Memory figures are approximate estimates for model weights at 16-bit precision. Actual GPU memory usage is higher because inference also requires memory for activations, attention caches, and other operations.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;All three models can be downloaded and run locally without paying for an API key. Their public model repositories do not normally require accepting a special gated-access license, although downloading through Hugging Face may involve normal platform requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. The Model I Choose for MiniChefGPT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After comparing the three models, I choose Qwen3-0.6B for our MiniChefGPT project.&lt;/p&gt;

&lt;p&gt;My decision is based on five reasons.&lt;/p&gt;

&lt;p&gt;First, it fits our available hardware. As students, we cannot depend on expensive GPUs. Google Colab provides access to a T4 GPU with 16 GB of VRAM when available. Qwen3-0.6B has a relatively small memory footprint, making it practical for experimentation.&lt;/p&gt;

&lt;p&gt;Second, it is free to use locally. We can download its public weights from Hugging Face and run inference without paying for an API key. The Apache 2.0 license is also suitable for developing applications.&lt;/p&gt;

&lt;p&gt;Third, it supports instruction following. MiniChefGPT needs a model that can respond to specific requests and produce structured cooking instructions. We can prompt Qwen to generate a recipe title followed by numbered steps.&lt;/p&gt;

&lt;p&gt;Fourth, its small size may make inference faster. Compared with larger models, Qwen3-0.6B generally requires fewer computations and less memory. However, I would need to benchmark generation time in Colab before claiming a specific speed.&lt;/p&gt;

&lt;p&gt;Finally, it provides a practical upgrade path. Our original MiniChefGPT Transformer has about 1.05 million parameters and was trained from scratch using recipe data. Qwen has already learned general language patterns from much broader training.&lt;/p&gt;

&lt;p&gt;I expect this pretrained knowledge to help with recipe generation, but I cannot claim it will automatically produce better recipes until we test it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. How Qwen Could Improve MiniChefGPT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Currently, our application accepts ingredients and generates a recipe using our custom Transformer.&lt;/p&gt;

&lt;p&gt;Our testing showed that the model can produce recipe-like text, but sometimes omits requested ingredients, repeats phrases, or generates incorrect cooking instructions.&lt;/p&gt;

&lt;p&gt;My proposed improvement is to keep our original model and integrate Qwen3-0.6B as an alternative generator.&lt;/p&gt;

&lt;p&gt;For example, the user could enter:&lt;/p&gt;

&lt;p&gt;Ingredients: Chicken, tomato, onion, garlic.&lt;/p&gt;

&lt;p&gt;We would ask Qwen to produce a recipe title, the ingredients used, and clear numbered instructions.&lt;/p&gt;

&lt;p&gt;To evaluate the improvement, we could give both models the same ingredient lists and compare ingredient coverage, instruction completeness, repeated text, generation time, and cooking safety.&lt;/p&gt;

&lt;p&gt;We could also test whether Qwen follows a fixed output format. This would make it easier to display generated recipes in our Streamlit application.&lt;/p&gt;

&lt;p&gt;One challenge is that even pretrained LLMs can invent ingredients or provide incorrect cooking advice. Therefore, generated recipes must still be checked before use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Researching these models helped me understand that choosing an LLM is not only about selecting the largest or most powerful model.&lt;/p&gt;

&lt;p&gt;We must also consider the available hardware, memory usage, licensing, cost, and the actual problem we want to solve.&lt;/p&gt;

&lt;p&gt;Qwen3-0.6B, SmolLM2-1.7B-Instruct, and Phi-3.5-mini-instruct all offer useful capabilities, but they have different resource requirements.&lt;/p&gt;

&lt;p&gt;For our MiniChefGPT project, I selected Qwen3-0.6B because it provides a practical balance between size, accessibility, and instruction-following capabilities.&lt;/p&gt;

&lt;p&gt;My next step is to test Qwen alongside our original Transformer and measure whether it improves recipe quality.&lt;/p&gt;

&lt;p&gt;Building MiniChefGPT from scratch helped me understand how Transformers work. Exploring pretrained LLMs is helping me understand how to turn that knowledge into more useful AI applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Qwen Team. Qwen3-0.6B Model Card. &lt;a href="https://huggingface.co/Qwen/Qwen3-0.6B" rel="noopener noreferrer"&gt;https://huggingface.co/Qwen/Qwen3-0.6B&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hugging Face. SmolLM2-1.7B-Instruct Model Card. &lt;a href="https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct" rel="noopener noreferrer"&gt;https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Microsoft. Phi-3.5-mini-instruct Model Card. &lt;a href="https://huggingface.co/microsoft/Phi-3.5-mini-instruct" rel="noopener noreferrer"&gt;https://huggingface.co/microsoft/Phi-3.5-mini-instruct&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Qwen Team. Qwen3 Technical Report. &lt;a href="https://arxiv.org/abs/2505.09388" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2505.09388&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hugging Face. SmolLM2: When Smol Goes Big. &lt;a href="https://arxiv.org/abs/2502.02737" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2502.02737&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MiniChefGPT Project. &lt;a href="https://minichefgpt.streamlit.app/" rel="noopener noreferrer"&gt;https://minichefgpt.streamlit.app/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>Learning Vision-Language Models (VLMs): My First Steps</title>
      <dc:creator>anne sonia</dc:creator>
      <pubDate>Mon, 26 Oct 2026 07:38:05 +0000</pubDate>
      <link>https://dev.to/anne_sonia/learning-vision-language-models-vlms-my-first-steps-1ifg</link>
      <guid>https://dev.to/anne_sonia/learning-vision-language-models-vlms-my-first-steps-1ifg</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As someone learning Machine Learning and Deep Learning, I want to understand how artificial intelligence can work with both images and language. This is what led me to start studying &lt;strong&gt;Vision-Language Models (VLMs)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I am beginning this journey from the fundamentals. My goal is not only to understand the theory but also to build practical AI applications using Python and Google Colab.&lt;/p&gt;

&lt;p&gt;In this first stage, I am learning how computers represent images as numerical data and how this representation connects to the larger idea of multimodal artificial intelligence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. What Is a Vision-Language Model?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A Vision-Language Model, commonly called a VLM, is an AI model designed to work with visual information and language.&lt;/p&gt;

&lt;p&gt;Traditional computer vision models can perform tasks such as recognizing objects in photographs. Natural Language Processing (NLP) models work with text, such as sentences, questions, and documents.&lt;/p&gt;

&lt;p&gt;VLMs connect these two areas.&lt;/p&gt;

&lt;p&gt;For example, imagine uploading a photograph of a dog. A VLM might describe the image, answer a question about it, or compare it with a text description.&lt;/p&gt;

&lt;p&gt;Some tasks VLMs can perform include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Image captioning:&lt;/strong&gt; Generating a description of an image.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visual question answering:&lt;/strong&gt; Answering questions about an image.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image-text matching:&lt;/strong&gt; Finding which text description best matches a photograph.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image search:&lt;/strong&gt; Searching for images using natural-language descriptions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What interests me most is that these models allow people to interact with images using ordinary language.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Understanding Computer Vision, NLP, and VLMs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before studying VLMs deeply, I need to understand the relationship between three important areas of AI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Computer Vision&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Computer Vision teaches computers to extract information from images and videos.&lt;/p&gt;

&lt;p&gt;For example, a computer vision model might recognize whether an image contains a cat, a dog, a car, or a person.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Natural Language Processing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Natural Language Processing focuses on helping computers process and understand human language.&lt;/p&gt;

&lt;p&gt;Examples include text classification, sentiment analysis, machine translation, and chatbots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vision-Language Models&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Vision-Language Models combine visual information with language.&lt;/p&gt;

&lt;p&gt;For example, instead of simply classifying a photograph as containing a dog, a VLM may generate a sentence describing the dog and its surroundings.&lt;/p&gt;

&lt;p&gt;This combination makes VLMs useful for applications that need both image understanding and language interaction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. How Does a VLM Work?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A simplified VLM architecture can contain several important components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Image Encoder&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The image encoder processes an image and converts it into numerical representations called features or embeddings.&lt;/p&gt;

&lt;p&gt;These representations help a model capture useful information about visual content.&lt;/p&gt;

&lt;p&gt;For example, an encoder may learn visual patterns associated with objects, shapes, colors, and textures.&lt;/p&gt;

&lt;p&gt;Vision Transformers (ViTs) are one type of architecture that can be used as an image encoder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Text Encoder&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A text encoder converts words or sentences into numerical representations.&lt;/p&gt;

&lt;p&gt;For example, the sentence "A brown dog playing in the grass" can be transformed into a representation that captures useful information about its meaning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connecting Images and Language&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The model must learn how visual information relates to language.&lt;/p&gt;

&lt;p&gt;One approach is to train image and text encoders so that an image and a relevant description have similar representations.&lt;/p&gt;

&lt;p&gt;Another approach is to connect an image encoder to a language model so that the model can generate responses about the image.&lt;/p&gt;

&lt;p&gt;These approaches are related, but they do not work in exactly the same way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. What Are Embeddings?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the important concepts I am learning is the meaning of an embedding.&lt;/p&gt;

&lt;p&gt;An embedding is a numerical representation produced by a model. It can encode useful information about an image, a word, or a sentence.&lt;/p&gt;

&lt;p&gt;For example, a vision-language model can create an embedding for an image of a cat and another embedding for the sentence "A cat sitting on a chair."&lt;/p&gt;

&lt;p&gt;A model such as CLIP learns image and text representations that can be compared in a shared space.&lt;/p&gt;

&lt;p&gt;This makes it possible to measure how well an image matches a text description.&lt;/p&gt;

&lt;p&gt;I am also learning that an embedding is different from the original image pixels. Pixels represent the image's color values, while an embedding is a learned representation produced by a neural network.&lt;/p&gt;

&lt;p&gt;Understanding this difference is important because embeddings are central to many modern AI applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. My First Practical Step: Representing Images as Numbers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before using a pretrained VLM, I am learning how Python handles images.&lt;/p&gt;

&lt;p&gt;An image may look simple to a human, but a computer processes its numerical representation.&lt;/p&gt;

&lt;p&gt;Using Python, NumPy, and Pillow, I can load an image and convert it into an array.&lt;/p&gt;

&lt;p&gt;For example:&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;PIL&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;

&lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sample.jpg&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;convert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;RGB&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;image_array&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="n"&gt;image&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Image shape:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;image_array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Data type:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;image_array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;imshow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;axis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;off&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Image.open()&lt;/code&gt; loads the image.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;convert("RGB")&lt;/code&gt; converts it to red, green, and blue color channels.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;np.array(image)&lt;/code&gt; converts the image into numerical data.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;image_array.shape&lt;/code&gt; shows its dimensions and number of color channels.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;plt.imshow()&lt;/code&gt; displays the image.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a standard RGB image, the array usually has the shape &lt;code&gt;(height, width, 3)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The three channels represent red, green, and blue.&lt;/p&gt;

&lt;p&gt;I am learning that this numerical representation is one of the first steps before an image can be processed by a deep-learning model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. What Is Image Normalization?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Another concept I have started learning is normalization.&lt;/p&gt;

&lt;p&gt;For a standard eight-bit RGB image, each channel's pixel values typically range from 0 to 255.&lt;/p&gt;

&lt;p&gt;We can scale these values to a range from 0 to 1:&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;image_normalized&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;image_array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;astype&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;float32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;255.0&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Minimum value:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;image_normalized&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Maximum value:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;image_normalized&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dividing by 255 changes the scale of the pixel values without changing the image dimensions.&lt;/p&gt;

&lt;p&gt;However, I have learned that pretrained models may require specific preprocessing steps, including resizing, cropping, and channel normalization. Therefore, when I begin working with a pretrained VLM, I will use the image processor recommended for that model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. What I Want to Learn Next: CLIP&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My next learning goal is to understand CLIP, which stands for Contrastive Language–Image Pre-training.&lt;/p&gt;

&lt;p&gt;CLIP is an important vision-language model that learns relationships between images and text.&lt;/p&gt;

&lt;p&gt;For example, given an image and descriptions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A cat sitting on a chair.&lt;/li&gt;
&lt;li&gt;A dog running in a field.&lt;/li&gt;
&lt;li&gt;A person riding a bicycle.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A trained CLIP model can compare the image with these text descriptions and rank them according to their similarity.&lt;/p&gt;

&lt;p&gt;This is useful for image-text matching and zero-shot classification, where a model can classify images using text labels without training a separate classifier for each set of labels.&lt;/p&gt;

&lt;p&gt;I want to explore how CLIP produces image and text embeddings, how similarity is calculated, and how these ideas can be used to build a practical application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. My Learning Goals&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As I continue studying VLMs, I plan to focus on the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Strengthen my understanding of Python, NumPy, and PyTorch.&lt;/li&gt;
&lt;li&gt;Learn how image encoders and text encoders work.&lt;/li&gt;
&lt;li&gt;Understand embeddings and contrastive learning.&lt;/li&gt;
&lt;li&gt;Build a simple image-text matching application with CLIP.&lt;/li&gt;
&lt;li&gt;Explore image captioning and visual question answering.&lt;/li&gt;
&lt;li&gt;Build portfolio projects that demonstrate my practical AI skills.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I plan to use Google Colab for my experiments so that I can work with Python and pretrained models in a cloud environment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My journey into Vision-Language Models has just begun. I have learned that VLMs connect computer vision and language, and that image encoders, text encoders, embeddings, and preprocessing are important concepts for understanding how they work.&lt;/p&gt;

&lt;p&gt;I have also started exploring how images are represented as numerical arrays in Python.&lt;/p&gt;

&lt;p&gt;My next step is to move from understanding the fundamentals to experimenting with a pretrained model such as CLIP.&lt;/p&gt;

&lt;p&gt;I know that learning VLMs will take time and practice, but I am excited to keep learning, building projects, and documenting my progress.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is the beginning of my VLM learning journey, and I look forward to sharing what I discover along the way.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;References and Learning Resources&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/docs/transformers/" rel="noopener noreferrer"&gt;Hugging Face Transformers Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/docs/transformers/tasks/image_text_to_text" rel="noopener noreferrer"&gt;Hugging Face: Image-text-to-text tasks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/openai/CLIP" rel="noopener noreferrer"&gt;OpenAI CLIP Repository&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://colab.research.google.com/" rel="noopener noreferrer"&gt;Google Colab&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;This post documents my introductory study of VLMs. The concepts and practical examples will be expanded as I continue learning and experimenting.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>deeplearning</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Introduction to Computer Vision</title>
      <dc:creator>anne sonia</dc:creator>
      <pubDate>Tue, 13 Oct 2026 13:13:46 +0000</pubDate>
      <link>https://dev.to/anne_sonia/introduction-to-computer-vision-3m2m</link>
      <guid>https://dev.to/anne_sonia/introduction-to-computer-vision-3m2m</guid>
      <description>&lt;p&gt;Computer vision is the technology that teaches computers to understand pictures and videos. Look at a photo of a coffee cup and you know right away what it is. You may even guess the coffee is hot. A computer sees none of that. It sees only numbers, and computer vision is the set of ideas that turns those numbers into meaning.&lt;br&gt;
In this post, we explain how computers "see", the main tasks they can do, why this field is growing so fast, and how it is already helping people across Africa.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;What a computer really sees&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
A digital photo is a grid of tiny squares called pixels. Each pixel is stored as three numbers: how much red, green and blue it contains. Each number goes from 0 to 255.&lt;br&gt;
So even a small photo, 400 pixels wide and 600 pixels tall, holds 400 × 600 × 3 = 720,000 numbers. A modern phone photo holds more than 30 million. The big challenge of computer vision is to go from all these numbers to real meaning.&lt;/p&gt;

&lt;p&gt;You can think of a colour image as three grids stacked on top of each other: one for red, one for green and one for blue. A red cup looks bright in the red grid and dark in the blue grid.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Three questions every vision system answers&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Computer vision lets computers get meaning from images and video. Almost every system answers one or more of these questions:&lt;br&gt;
• What is in the picture? For example, a cat or a cassava leaf.&lt;br&gt;
• Where is it? Which part of the picture, or which pixels.&lt;br&gt;
• What is happening? For example, a person crossing the road. This is mostly for video.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Humans and computers see differently&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Humans&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Years of seeing the world
2.Understanding context, learning from few examples
3.Getting tired
&lt;strong&gt;Computers&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Millions of labelled images
2.Speed and working at large scale
3.Things that look different from their training images&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A computer can check thousands of X-rays in a day without getting tired. But it can easily fail on something it has never seen before. We will come back to this later.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Five core tasks&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Most computer vision work falls into five tasks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Classification: give one label to the whole image.&lt;/li&gt;
&lt;li&gt;Detection: draw a box around each object.&lt;/li&gt;
&lt;li&gt;Segmentation: give a label to every single pixel.&lt;/li&gt;
&lt;li&gt;OCR: read the text inside an image.&lt;/li&gt;
&lt;li&gt;Tracking: follow objects from one video frame to the next.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is an example. Take one photo of a street. A classifier may say "minibus" and be 57% sure. That is not wrong, but it is not very useful. A detector will find one bus and four people and draw boxes around them. A segmenter will outline exactly which pixels belong to each object. The more detail you want, the more detailed the training labels must be, and the more it costs to create them.&lt;br&gt;
&lt;strong&gt;How a computer finds patterns&lt;/strong&gt;&lt;br&gt;
The first step is to find edges, the places where brightness changes. To do this, we use a filter. A filter is a small grid of numbers. We slide it over the image, multiply each pixel by the matching number, and add up the results. This operation is called convolution.&lt;br&gt;
Here is a simple example. The filter below is called a Sobel filter. It subtracts the left side from the right side:&lt;br&gt;
-1,0,1&lt;br&gt;
-2,0,2&lt;br&gt;
-1,0,1&lt;br&gt;
• On a flat area where every pixel is 100, the left side gives −400 and the right side gives +400. The total is 0, so there is no edge.&lt;br&gt;
• On an area that goes from dark (0) to bright (200), the left side gives 0 and the right side gives +800. The big number tells us there is an edge.&lt;br&gt;
Other filters can blur a picture or make it sharper. In code, a blur is just a 5 × 5 grid of ones divided by 25, which means each pixel becomes the average of the 25 pixels around it.&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%2F8wo4cyssb511g642vyd5.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%2F8wo4cyssb511g642vyd5.png" alt="how a computer find pattern" width="800" height="463"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Letting the computer learn its own filters&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
In the past, people designed filters by hand. Today we use a convolutional neural network (CNN), which learns its own filters from labelled examples. Nobody designs them. The network builds up understanding step by step:&lt;br&gt;
Pixels → Edges → Textures → Objects&lt;br&gt;
The first layers find simple edges and colours. The middle layers find textures and parts, like eyes or wheels. The last layers recognise whole objects.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Finding objects fast with YOLO&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Older detectors, such as R-CNN, worked in two steps. First they looked for regions that might contain an object, then they classified each region. This was accurate but slow.&lt;br&gt;
YOLO stands for "You Only Look Once". It looks at the whole image one time and predicts every box and label together. This is fast enough for live video and for small devices. It was introduced in 2015 by Joseph Redmon and his colleagues.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Why computer vision is growing now&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Five things came together at the same time:&lt;br&gt;
• Cameras everywhere: every phone is a camera and a small computer.&lt;br&gt;
• Data: there are huge image collections, including satellite images of whole continents.&lt;br&gt;
• Computing power: cloud GPUs train big models, and small models can run on cheap phones with no internet.&lt;br&gt;
• Pretrained models: you do not start from zero. You can adapt an existing model with a few thousand local photos.&lt;br&gt;
• Multimodal AI: AI assistants can now read images as well as text.&lt;br&gt;
There is also a link with language AI. A Vision Transformer cuts an image into small 16 × 16 patches and treats each patch like a word. A 224 × 224 image becomes 196 patches. Then the same attention method used for text reads the picture.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Computer vision across Africa&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Computer vision is already solving real problems on the continent. Here are six examples.&lt;br&gt;
• Farming (East Africa): The Nuru app helps farmers find crop diseases. A farmer takes a photo of a cassava leaf and the app names the disease and gives advice. It works offline on a basic phone, so it is useful in fields with no internet. Task: image classification.&lt;br&gt;
• Health (Nigeria): In 2022, software scored the chest X-rays of 5,298 people in Gombe and Adamawa. People with a high score got a lab test, and 85 people with TB were found. Task: classification with a threshold.&lt;br&gt;
• Conservation (Gabon): A small computer next to a camera trap spots elephants and people, then sends an alert to rangers by satellite within minutes. Task: object detection "at the edge", meaning on the device itself.&lt;br&gt;
• Finance (6 countries): Smile ID matches a selfie to an ID photo and checks that the person is real and live. It handled more than 1 million identity checks per month in 2021. Tasks: face verification and OCR.&lt;br&gt;
• Mapping (whole continent): Google's Open Buildings project found 1.8 billion building outlines from satellite images. Health teams use them to plan vaccination campaigns, and aid teams use them after floods. Task: segmentation.&lt;br&gt;
• Accessibility (Kigali): BLAIVA, built by FabLab Rwanda and still in beta testing, is a wearable camera that describes objects, text and faces through earphones. Tasks: detection, OCR and face recognition.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;When computer vision fails&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
A model only knows what it was trained on. In one test on a street photo, the model found "1 bus, 4 people". Then the photo was changed:&lt;br&gt;
• Very dark: the model added a skateboard that was not there.&lt;br&gt;
• Upside down: the model missed the bus.&lt;br&gt;
• Very low resolution: the model found nothing.&lt;br&gt;
Many popular models were trained mostly on photos from Europe, North America and Asia. They can make more mistakes on African crops, clothes, roads, skin tones and lighting. Early face recognition systems, for example, often worked worse on darker skin because the training data was not representative. Face data is also very private, so it needs great care.&lt;br&gt;
The fix is local data. When a model is adapted with local photos, it works better for local people. It is also important to ask who could be harmed if a model is wrong: a farmer, a patient or a customer.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Tools to get started&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
You rarely need to start from zero. These tools are popular:&lt;br&gt;
• PyTorch: build and train your own neural networks.&lt;br&gt;
• TensorFlow / Keras: Google's alternative, common in mobile apps.&lt;br&gt;
• Hugging Face: download pretrained models and adapt them.&lt;br&gt;
• Ultralytics YOLO: ready-made detection, classification and segmentation.&lt;br&gt;
&lt;strong&gt;&lt;em&gt;Key takeaways&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
• Images are just numbers: height × width × 3.&lt;br&gt;
• Filters find patterns, and CNNs learn the filters by themselves.&lt;br&gt;
• The main tasks are classification, detection and segmentation.&lt;br&gt;
• Computer vision is already used in farming, health, conservation, finance, mapping and accessibility across Africa.&lt;br&gt;
• Models fail on things they have not seen, so local data matters.&lt;br&gt;
A good way to start is to take 5 to 10 photos of your own surroundings, such as a street, a market stall or a crop leaf, and run them through a pretrained model. Notice what it gets right and what it misses. That is the best way to understand both the power and the limits of computer vision.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>computerscience</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Word Embeddings: How Machines Learn the Meaning Behind Words</title>
      <dc:creator>anne sonia</dc:creator>
      <pubDate>Wed, 30 Sep 2026 12:54:46 +0000</pubDate>
      <link>https://dev.to/anne_sonia/word-embeddings-how-machines-learn-the-meaning-behind-words-4355</link>
      <guid>https://dev.to/anne_sonia/word-embeddings-how-machines-learn-the-meaning-behind-words-4355</guid>
      <description>&lt;p&gt;When I started learning Natural Language Processing (NLP), one of the things that confused me was a simple question: How can a computer understand the meaning of words?&lt;/p&gt;

&lt;p&gt;Computers work with numbers, but humans communicate using words, sentences, and different ways of expressing the same idea. This became especially interesting to me when I started building a simple FAQ chatbot for a clothing shop.&lt;/p&gt;

&lt;p&gt;My first approach used TF-IDF to represent questions. It worked by looking at the words in a question and comparing them with the words in stored FAQ questions. But I wanted my chatbot to understand more than just matching words.&lt;/p&gt;

&lt;p&gt;That is where word embeddings became important.&lt;/p&gt;

&lt;p&gt;What are word embeddings?&lt;/p&gt;

&lt;p&gt;Word embeddings are numerical representations of words or pieces of text. Instead of representing a word only as a label such as "dress", an embedding represents it as a vector of numbers.&lt;/p&gt;

&lt;p&gt;For example, we can imagine:&lt;/p&gt;

&lt;p&gt;dress → [0.21, -0.14, 0.73, 0.42, ...]&lt;br&gt;
shirt → [0.19, -0.10, 0.68, 0.39, ...]&lt;br&gt;
car   → [-0.51, 0.83, -0.22, 0.11, ...]&lt;/p&gt;

&lt;p&gt;The actual vectors contain many more dimensions, and the numbers are learned from data.&lt;/p&gt;

&lt;p&gt;The important idea is that words or sentences with related meanings can have vectors that are closer together in the embedding space.&lt;/p&gt;

&lt;p&gt;This is useful because language is not only about exact words. Two people can ask the same question using completely different wording.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;"What is the price of this dress?"&lt;/p&gt;

&lt;p&gt;and:&lt;/p&gt;

&lt;p&gt;"How much does this dress cost?"&lt;/p&gt;

&lt;p&gt;They are different sentences, but they have almost the same meaning.&lt;/p&gt;

&lt;p&gt;A system based only on exact word matching can have difficulty with this. Embeddings help us represent semantic relationships.&lt;/p&gt;

&lt;p&gt;Word2Vec&lt;/p&gt;

&lt;p&gt;One of the important embedding methods I learned about is Word2Vec.&lt;/p&gt;

&lt;p&gt;Word2Vec was introduced by Mikolov and colleagues in 2013. It learns vector representations of words from their surrounding context. The basic idea is that words appearing in similar contexts tend to develop similar representations.&lt;/p&gt;

&lt;p&gt;There are two well-known Word2Vec approaches:&lt;/p&gt;

&lt;p&gt;CBOW (Continuous Bag of Words)&lt;br&gt;
Skip-gram&lt;/p&gt;

&lt;p&gt;CBOW uses surrounding words to predict a target word.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;"The customer bought a new ___ yesterday."&lt;/p&gt;

&lt;p&gt;The surrounding context can help the model predict a word such as:&lt;/p&gt;

&lt;p&gt;dress&lt;/p&gt;

&lt;p&gt;Skip-gram works in the opposite direction. It uses a target word to predict words that are likely to appear around it.&lt;/p&gt;

&lt;p&gt;During training, the model learns vectors that capture relationships between words.&lt;/p&gt;

&lt;p&gt;One famous type of example associated with word embeddings is:&lt;/p&gt;

&lt;p&gt;king - man + woman ≈ queen&lt;/p&gt;

&lt;p&gt;The interesting part is that the vectors can capture relationships rather than simply storing dictionary definitions.&lt;/p&gt;

&lt;p&gt;Why do embeddings matter?&lt;/p&gt;

&lt;p&gt;Embeddings are useful because many NLP problems require understanding relationships between words and text.&lt;/p&gt;

&lt;p&gt;They can be used for:&lt;/p&gt;

&lt;p&gt;Semantic search&lt;br&gt;
Question answering&lt;br&gt;
Chatbots&lt;br&gt;
Text classification&lt;br&gt;
Recommendation systems&lt;br&gt;
Similarity detection&lt;br&gt;
Information retrieval&lt;br&gt;
Clustering&lt;/p&gt;

&lt;p&gt;For my FAQ chatbot, the most important use is semantic similarity.&lt;/p&gt;

&lt;p&gt;Imagine a clothing customer asks:&lt;/p&gt;

&lt;p&gt;"Do you have something I can wear to a party?"&lt;/p&gt;

&lt;p&gt;The FAQ database might contain:&lt;/p&gt;

&lt;p&gt;"Do you sell party clothes?"&lt;/p&gt;

&lt;p&gt;The two questions don't contain exactly the same words, but their meanings are related.&lt;/p&gt;

&lt;p&gt;This is the kind of problem where embeddings can be useful.&lt;/p&gt;

&lt;p&gt;From TF-IDF to embeddings in my chatbot&lt;/p&gt;

&lt;p&gt;My first chatbot version used TF-IDF.&lt;/p&gt;

&lt;p&gt;TF-IDF converts text into numerical vectors based mainly on the importance of words in the documents. I then used cosine similarity to find the FAQ question most similar to the user's question.&lt;/p&gt;

&lt;p&gt;The improved version uses a pre-trained Sentence Transformer model:&lt;/p&gt;

&lt;p&gt;from sentence_transformers import SentenceTransformer&lt;/p&gt;

&lt;p&gt;model = SentenceTransformer(&lt;br&gt;
    "sentence-transformers/all-MiniLM-L6-v2"&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;questions = [&lt;br&gt;
    "Do you sell party clothes?",&lt;br&gt;
    "What sizes do you have?",&lt;br&gt;
    "How can I order clothes?"&lt;br&gt;
]&lt;/p&gt;

&lt;p&gt;embeddings = model.encode(questions)&lt;/p&gt;

&lt;p&gt;print(embeddings.shape)&lt;/p&gt;

&lt;p&gt;The Sentence Transformers documentation shows the same basic workflow: load a pretrained model, encode text into embeddings, and compare the resulting vectors for similarity. The all-MiniLM-L6-v2 model produces 384-dimensional embeddings.&lt;/p&gt;

&lt;p&gt;For example, my chatbot can encode both the customer's question and the stored FAQ questions, then compare their vectors.&lt;/p&gt;

&lt;p&gt;from sklearn.metrics.pairwise import cosine_similarity&lt;/p&gt;

&lt;p&gt;user_question = model.encode(&lt;br&gt;
    ["How much does a dress cost?"]&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;similarities = cosine_similarity(&lt;br&gt;
    user_question,&lt;br&gt;
    embeddings&lt;br&gt;
)[0]&lt;/p&gt;

&lt;p&gt;best_index = similarities.argmax()&lt;/p&gt;

&lt;p&gt;print(questions[best_index])&lt;br&gt;
print(similarities[best_index])&lt;/p&gt;

&lt;p&gt;The chatbot can then return the FAQ answer associated with the question having the highest similarity.&lt;/p&gt;

&lt;p&gt;What surprised me&lt;/p&gt;

&lt;p&gt;The most interesting thing I learned is that similar meaning does not always require the same words.&lt;/p&gt;

&lt;p&gt;Before learning about embeddings, I mainly thought of text as words that needed to be matched. Embeddings changed how I think about NLP.&lt;/p&gt;

&lt;p&gt;For example, these questions are different:&lt;/p&gt;

&lt;p&gt;"How much is a dress?"&lt;br&gt;
"What is the price of a dress?"&lt;br&gt;
"How expensive is that dress?"&lt;/p&gt;

&lt;p&gt;A human immediately understands that they are asking about the same thing.&lt;/p&gt;

&lt;p&gt;The goal of semantic embeddings is to represent that relationship numerically.&lt;/p&gt;

&lt;p&gt;What I struggled with&lt;/p&gt;

&lt;p&gt;One challenge was understanding what the numbers in an embedding actually mean.&lt;/p&gt;

&lt;p&gt;At first, seeing a vector such as:&lt;/p&gt;

&lt;p&gt;[0.034, -0.218, 0.731, ...]&lt;/p&gt;

&lt;p&gt;does not tell us anything directly. The meaning is not stored in one specific number. Instead, useful information is distributed across the vector, and relationships can be studied by comparing vectors.&lt;/p&gt;

&lt;p&gt;I also learned that choosing an embedding model matters. Different models can behave differently depending on the task and the data. A model that works well for general semantic similarity may not automatically be perfect for a specific FAQ dataset.&lt;/p&gt;

&lt;p&gt;What I learned from the project&lt;/p&gt;

&lt;p&gt;Building the clothing-shop FAQ chatbot helped me understand why embeddings are important in practical NLP systems.&lt;/p&gt;

&lt;p&gt;TF-IDF is simple, fast, and useful when important keywords are enough to identify the correct answer.&lt;/p&gt;

&lt;p&gt;Embeddings provide another way to represent text by capturing semantic relationships. This can be especially useful when users express the same idea using different words.&lt;/p&gt;

&lt;p&gt;The next step in my project is to evaluate both approaches using the same test questions and compare their results.&lt;/p&gt;

&lt;p&gt;For me, word embeddings are not just another machine learning technique. They are a way of moving from thinking about text as a collection of individual words toward thinking about relationships and meaning in language.&lt;/p&gt;

&lt;p&gt;Sources&lt;br&gt;
Mikolov et al., Efficient Estimation of Word Representations in Vector Space (2013).&lt;br&gt;
Mikolov et al., Distributed Representations of Words and Phrases and their Compositionality (2013).&lt;br&gt;
Sentence Transformers documentation, Quickstart and Computing Embeddings.&lt;br&gt;
&lt;strong&gt;REFERENCES&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Mikolov, T., Chen, K., Corrado, G., &amp;amp; Dean, J. (2013). Efficient Estimation of Word Representations in Vector Space. arXiv. &lt;a href="https://arxiv.org/abs/1301.3781" rel="noopener noreferrer"&gt;https://arxiv.org/abs/1301.3781&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pennington, J., Socher, R., &amp;amp; Manning, C. D. (2014). GloVe: Global Vectors for Word Representation. Proceedings of EMNLP 2014. &lt;a href="https://aclanthology.org/D14-1162/" rel="noopener noreferrer"&gt;https://aclanthology.org/D14-1162/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sentence Transformers Documentation. Quickstart. &lt;a href="https://www.sbert.net/docs/quickstart.html" rel="noopener noreferrer"&gt;https://www.sbert.net/docs/quickstart.html&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sentence Transformers. all-MiniLM-L6-v2. Hugging Face. &lt;a href="https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2" rel="noopener noreferrer"&gt;https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  nlp #machinelearning #python
&lt;/h1&gt;

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