<?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: Nastaran Moghadasi</title>
    <description>The latest articles on DEV Community by Nastaran Moghadasi (@nastaranai).</description>
    <link>https://dev.to/nastaranai</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2224641%2F4060d080-8747-4ec0-8065-4f8688543e61.png</url>
      <title>DEV Community: Nastaran Moghadasi</title>
      <link>https://dev.to/nastaranai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nastaranai"/>
    <language>en</language>
    <item>
      <title>Why Google Maps Won't Let Gemini Take the Wheel</title>
      <dc:creator>Nastaran Moghadasi</dc:creator>
      <pubDate>Wed, 24 Dec 2025 21:03:39 +0000</pubDate>
      <link>https://dev.to/nastaranai/why-google-maps-wont-let-gemini-take-the-wheel-3mfd</link>
      <guid>https://dev.to/nastaranai/why-google-maps-wont-let-gemini-take-the-wheel-3mfd</guid>
      <description>&lt;p&gt;A few weeks ago, I watched someone try to hammer a screw into a wall! They succeeded, eventually. But the result was ugly, unstable, and took three times longer than it should have. This is roughly what happens when organizations deploy generative AI for problems that don’t need it.&lt;/p&gt;

&lt;p&gt;The current discourse around AI has a selection bias problem. We hear constantly about what generative models can do, but we rarely hear about when they shouldn’t be used. This matters because choosing the wrong model architecture isn’t just inefficient. It can be dangerous.&lt;/p&gt;

&lt;p&gt;Let me explain through a product you probably use every day.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Navigation Problem&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Consider GPS navigation apps like Google Maps or Waze. These systems solve several distinct problems: classifying traffic patterns, recognizing road signs from imagery, predicting travel times, and computing optimal routes.&lt;/p&gt;

&lt;p&gt;Here is a question worth asking. Which of these tasks actually benefits from a generative model?&lt;/p&gt;

&lt;p&gt;To answer this, we need to be precise about what generative and discriminative actually mean.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;&lt;a href="https://papers.nips.cc/paper/2001/hash/7b7a53e239400a13bd6be6c91c4f6c4e-Abstract.html" rel="noopener noreferrer"&gt;discriminative model&lt;/a&gt;&lt;/strong&gt; learns the boundary between categories. Given input &lt;code&gt;x&lt;/code&gt;, it models &lt;code&gt;P(y∣x)&lt;/code&gt; directly, the probability of output &lt;code&gt;y&lt;/code&gt; conditioned on input. It asks: &lt;em&gt;given this road segment and current traffic, is the delay 5 minutes or 20 minutes?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;&lt;a href="https://papers.nips.cc/paper/2001/hash/7b7a53e239400a13bd6be6c91c4f6c4e-Abstract.html" rel="noopener noreferrer"&gt;generative model&lt;/a&gt;&lt;/strong&gt; learns the joint distribution &lt;code&gt;P(x,y)&lt;/code&gt; or, in the case of modern large language models, models the probability of the next token given the context. It can generate new samples that resemble the training distribution. It asks: &lt;em&gt;what would a plausible route description look like?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;

&lt;/p&gt;
&lt;div class="katex-element"&gt;
  &lt;span class="katex-display"&gt;&lt;span class="katex"&gt;&lt;span class="katex-mathml"&gt;P(xt+1∣x1,...,xt)P(x_{t+1} | x_1, ..., x_t) &lt;/span&gt;&lt;span class="katex-html"&gt;&lt;span class="base"&gt;&lt;span class="strut"&gt;&lt;/span&gt;&lt;span class="mord mathnormal"&gt;P&lt;/span&gt;&lt;span class="mopen"&gt;(&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mord mathnormal"&gt;x&lt;/span&gt;&lt;span class="msupsub"&gt;&lt;span class="vlist-t vlist-t2"&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="sizing reset-size6 size3 mtight"&gt;&lt;span class="mord mtight"&gt;&lt;span class="mord mathnormal mtight"&gt;t&lt;/span&gt;&lt;span class="mbin mtight"&gt;+&lt;/span&gt;&lt;span class="mord mtight"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-s"&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="mord"&gt;∣&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mord mathnormal"&gt;x&lt;/span&gt;&lt;span class="msupsub"&gt;&lt;span class="vlist-t vlist-t2"&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="sizing reset-size6 size3 mtight"&gt;&lt;span class="mord mtight"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-s"&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="mpunct"&gt;,&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mord"&gt;...&lt;/span&gt;&lt;span class="mpunct"&gt;,&lt;/span&gt;&lt;span class="mspace"&gt;&lt;/span&gt;&lt;span class="mord"&gt;&lt;span class="mord mathnormal"&gt;x&lt;/span&gt;&lt;span class="msupsub"&gt;&lt;span class="vlist-t vlist-t2"&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;span class="pstrut"&gt;&lt;/span&gt;&lt;span class="sizing reset-size6 size3 mtight"&gt;&lt;span class="mord mathnormal mtight"&gt;t&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-s"&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class="vlist-r"&gt;&lt;span class="vlist"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="mclose"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;


&lt;p&gt;The distinction matters. These models have fundamentally different failure modes.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why Discriminative Models Win for Pathfinding&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;When you ask Google Maps for directions to the airport, the blue line on your screen is computed by algorithms that have nothing to do with generative AI. The underlying computation is typically some variant of &lt;a href="https://ieeexplore.ieee.org/document/4082128" rel="noopener noreferrer"&gt;A* search&lt;/a&gt; or &lt;a href="https://eudml.org/doc/131436" rel="noopener noreferrer"&gt;Dijkstra’s algorithm&lt;/a&gt;. It is potentially augmented by &lt;a href="https://arxiv.org/abs/2108.11482" rel="noopener noreferrer"&gt;graph neural networks for traffic prediction&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is precisely the kind of problem where we &lt;em&gt;don’t&lt;/em&gt; want creativity. We want the global optimum.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is the correct architectural choice, and here is why.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ground truth constraints are non-negotiable.&lt;/strong&gt; When you are driving at 100 km/h, you need the system to discriminate between a drivable road and a pedestrian path. The model must be bound by the physical reality of the road network. A generative model might produce a “plausible-looking” route that happens to include a road segment that was closed for construction because it fits the statistical pattern of routes it has seen, not because it is actually traversable.&lt;/p&gt;

&lt;p&gt;The problem has a well-defined optimum. Route planning is a graph optimization problem. Given edge weights (travel times, distances, fuel costs), we want the path that minimizes total cost. This is precisely the kind of problem where we don’t want creativity. We want the global optimum. We have principled algorithms that can find it efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reliability dominates over delight.&lt;/strong&gt; Generative AI excels when surprising outputs are valuable. In creative writing, an unexpected metaphor might be brilliant. In navigation, an unexpected route means you are lost in an unfamiliar neighborhood or late for your flight.&lt;/p&gt;

&lt;p&gt;Imagine a generative navigation system. You ask for directions to the airport, and it suggests a route through what it imagines would be a scenic park road. It does this because in its training data, parks and pleasant drives co-occur frequently. The fact that this particular park has no through-road is lost in the statistical averaging.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The model has optimized for &lt;em&gt;plausibility&lt;/em&gt;, not &lt;em&gt;correctness&lt;/em&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Wait, Didn’t Google Just Add Gemini to Maps?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Yes. And this is exactly where the nuance lives.&lt;/p&gt;

&lt;p&gt;In late 2024, &lt;a href="https://blog.google/products/maps/gemini-navigation-features-landmark-lens/" rel="noopener noreferrer"&gt;Google integrated Gemini into Google Maps&lt;/a&gt;. The key question is: what is Gemini actually doing?&lt;/p&gt;

&lt;p&gt;The answer reveals how thoughtful architecture works in practice.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What Gemini Does&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Gemini powers the natural language interface and contextual descriptions. When the app tells you “turn right after the blue Thai restaurant,” that instruction was generated by a &lt;a href="https://www.ibm.com/think/topics/multimodal-llm" rel="noopener noreferrer"&gt;multimodal model&lt;/a&gt;. It analyzed Street View imagery and synthesized a human-friendly landmark description.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkuw0uf2ckgxdimxd7pjg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkuw0uf2ckgxdimxd7pjg.png" alt="An Abstraction, showing generative and discriminative models converge"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is genuinely generative work. It involves creating natural language from raw data (GPS coordinates, business names, visual features). The model is &lt;em&gt;generating&lt;/em&gt; descriptions that don’t exist in any database. It is reasoning about what would be most salient to a human driver scanning the street.&lt;/p&gt;

&lt;p&gt;Gemini also powers semantic search. When you type “cozy cafe with parking near me,” you are querying with natural language that needs to be interpreted, not just matched against keywords. This is where the world knowledge of a generative model becomes valuable.&lt;/p&gt;

&lt;p&gt;Crucially, this generation is securely tethered to reality through a process called &lt;strong&gt;grounding&lt;/strong&gt;. As the specific documentation for &lt;a href="https://ai.google.dev/gemini-api/docs/maps-grounding" rel="noopener noreferrer"&gt;Grounding with Google Maps&lt;/a&gt; explains, when a user’s query contains geographical context, the Gemini model invokes the Maps API as a source of truth. The model then generates responses grounded in actual Google Maps data relevant to the location, rather than relying solely on its training weights.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What Gemini Doesn’t Do&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Gemini does not compute your route.&lt;/p&gt;

&lt;p&gt;The actual pathfinding (the blue line, the ETA, the turn-by-turn sequence) is still handled by optimization algorithms and &lt;a href="https://arxiv.org/abs/2108.11482" rel="noopener noreferrer"&gt;graph neural networks&lt;/a&gt;. These systems take the road network as a constraint rather than a suggestion. They find the minimum-cost path through a graph, with edge weights updated by discriminative models that predict traffic delays.&lt;/p&gt;

&lt;p&gt;The architecture looks something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhw2kdbme0x64sjwyn7vr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhw2kdbme0x64sjwyn7vr.png" alt="Decision Matrix showing which area in the Google Map handles with Generative, and which part handles using Discriminative models"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a hybrid architecture. It is hybrid for a reason.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Safety Principle&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Here is the key insight:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Google uses Gemini for the &lt;em&gt;description&lt;/em&gt; but not for the &lt;em&gt;direction&lt;/em&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If Gemini were allowed to be creative with actual routing decisions, it might hallucinate that a pedestrian bridge is a valid vehicle crossing. Visually, bridges that cars use and bridges that only pedestrians use look similar. The model has learned associations, not physical constraints.&lt;/p&gt;

&lt;p&gt;By constraining generative models to the interface layer (natural language input/output, landmark descriptions, semantic search) while keeping pathfinding in the realm of constrained optimization, the system gets the benefits of both paradigms.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The generative model makes the experience feel natural and human.&lt;/li&gt;
&lt;li&gt;The discriminative and optimization models keep you on actual roads.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This isn’t a limitation of generative AI. It is appropriate scoping.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Broader Principle&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Navigation is just one example. The same logic applies across domains.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Medical diagnosis:&lt;/strong&gt; You probably want a discriminative model that estimates rather than a generative model that produces plausible-sounding diagnoses. The latter might generate confident text about a condition the patient doesn’t have.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fraud detection:&lt;/strong&gt; The goal is to discriminate between legitimate and fraudulent transactions. A generative model might be useful for creating synthetic training data, but the production classifier should be discriminative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structural engineering:&lt;/strong&gt; When computing whether a bridge can support a given load, you want physics simulations and finite element analysis. You do not want a model that generates realistic-looking stress distributions.&lt;/p&gt;

&lt;p&gt;The pattern is clear. When the problem has a ground truth that must be respected, when there is a well-defined optimum, and when creative outputs would be failures rather than features, discriminative models and traditional optimization often outperform generative approaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;When Generative AI&lt;/strong&gt; &lt;strong&gt;&lt;em&gt;Is&lt;/em&gt;&lt;/strong&gt; &lt;strong&gt;the Right Choice&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To be clear, generative AI is genuinely transformative for many problems.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Open-ended content creation:&lt;/strong&gt; writing, art, music, code generation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Natural language interfaces:&lt;/strong&gt; making complex systems accessible through conversation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic understanding:&lt;/strong&gt; interpreting intent, summarizing documents, answering questions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Synthetic data generation:&lt;/strong&gt; creating training examples for rare cases.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exploration and ideation:&lt;/strong&gt; when you want novelty and surprise.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The question isn’t whether generative AI is powerful. It demonstrably is. The question is whether it is appropriate for the specific problem you are solving.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Meta-Point&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We are in a moment where generative AI is being treated as a universal solution. The commercial pressure to add AI to every product is immense. But good engineering has always been about choosing the right tool for the job.&lt;/p&gt;

&lt;p&gt;The most sophisticated AI systems today are hybrids. They use generative models where creativity and natural language matter, discriminative models where classification accuracy matters, and traditional algorithms where mathematical guarantees matter. The skill is in knowing which is which.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The next time someone proposes adding a large language model to a system, it is worth asking: what problem are we actually solving, and is a generative model the right tool for it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes the answer is yes. And sometimes, you just need a good classifier and a well-tuned &lt;a href="https://eudml.org/doc/131436" rel="noopener noreferrer"&gt;Dijkstra implementation&lt;/a&gt;.&lt;/p&gt;

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

&lt;p&gt;Derrow-Pinion, A., She, J., Wong, D., Lange, O., Hester, T., Perez, L., Nunkesser, M., Lee, S., Guo, X., Wiltshire, B., Battaglia, P. W., Gupta, V., Li, A., Xu, Z., Sanchez-Gonzalez, A., and Li, Y. 2021. ETA Prediction with Graph Neural Networks in Google Maps. arXiv preprint arXiv:2108.11482. &lt;a href="https://arxiv.org/abs/2108.11482" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2108.11482&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dijkstra, E. W. 1959. A Note on Two Problems in Connexion with Graphs. Numerische Mathematik, 1(1), 269–271. &lt;a href="https://eudml.org/doc/131436" rel="noopener noreferrer"&gt;https://eudml.org/doc/131436&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Google. 2024. Grounding with Google Maps. Google AI for Developers. &lt;a href="https://ai.google.dev/gemini-api/docs/maps-grounding" rel="noopener noreferrer"&gt;https://ai.google.dev/gemini-api/docs/maps-grounding&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Google. 2024. New ways to get around with Google Maps, powered by AI. The Keyword (Google Blog). &lt;a href="https://blog.google/products/maps/gemini-navigation-features-landmark-lens/" rel="noopener noreferrer"&gt;https://blog.google/products/maps/gemini-navigation-features-landmark-lens/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hart, P. E., Nilsson, N. J., and Raphael, B. 1968. A Formal Basis for the Heuristic Determination of Minimum Cost Paths. IEEE Transactions on Systems Science and Cybernetics, 4(2), 100–107. &lt;a href="https://ieeexplore.ieee.org/document/4082128" rel="noopener noreferrer"&gt;https://ieeexplore.ieee.org/document/4082128&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ng, A. Y. and Jordan, M. I. 2002. On Discriminative vs. Generative Classifiers: A comparison of logistic regression and naive Bayes. Advances in Neural Information Processing Systems 14. &lt;a href="https://papers.nips.cc/paper/2001/hash/7b7a53e239400a13bd6be6c91c4f6c4e-Abstract.html" rel="noopener noreferrer"&gt;https://papers.nips.cc/paper/2001/hash/7b7a53e239400a13bd6be6c91c4f6c4e-Abstract.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>gemini</category>
      <category>deeplearning</category>
    </item>
    <item>
      <title>How AI Knows a Cat Is Like a Dog: An Intuitive Guide to Word Embeddings</title>
      <dc:creator>Nastaran Moghadasi</dc:creator>
      <pubDate>Mon, 22 Dec 2025 08:53:51 +0000</pubDate>
      <link>https://dev.to/nastaranai/how-ai-knows-a-cat-is-like-a-dog-an-intuitive-guide-to-word-embeddings-4ong</link>
      <guid>https://dev.to/nastaranai/how-ai-knows-a-cat-is-like-a-dog-an-intuitive-guide-to-word-embeddings-4ong</guid>
      <description>&lt;p&gt;Have you ever wondered how a computer knows that a cat is more like a dog than a car?&lt;/p&gt;

&lt;p&gt;To a machine, words are just strings of characters or arbitrary ID numbers. But in the world of Natural Language Processing, we’ve found a way to give words a home in a multi-dimensional space. In this space, the neighbors are their semantic relatives.&lt;/p&gt;

&lt;p&gt;In this post, we’ll explore the fascinating world of &lt;strong&gt;word embeddings&lt;/strong&gt;. We’ll start with the intuition (no deep technical dives) and build up a clear understanding of what word embeddings really are (along with code), and how they enable AI systems to capture meaning and relationships in human language.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcbndf2st7avw2rb3mhba.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcbndf2st7avw2rb3mhba.png" alt="Word embeddings in NLP, comparing cat, dog, and car in space." width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Magic of Word Math: Static Embeddings
&lt;/h2&gt;

&lt;p&gt;Imagine if you could do math with ideas. The &lt;a href="https://spotintelligence.com/2023/11/27/glove-embedding/" rel="noopener noreferrer"&gt;classic example&lt;/a&gt; in the world of embeddings is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;King - Man + Woman ≈ Queen&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This isn’t just a clever trick! This is the power of &lt;strong&gt;Static Embeddings&lt;/strong&gt; like &lt;strong&gt;&lt;a href="https://nlp.stanford.edu/projects/glove/" rel="noopener noreferrer"&gt;GloVe&lt;/a&gt;&lt;/strong&gt; (Global Vectors for Word Representation).&lt;/p&gt;

&lt;p&gt;GloVe works by looking at massive amounts of text to see how often words appear near each other. It then assigns each word a fixed numerical vector. Because these vectors represent the “&lt;em&gt;meaning&lt;/em&gt;”, words that are semantically similar end up close together.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnv7f7dxsw1mrids9889v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnv7f7dxsw1mrids9889v.png" alt="King is closer to queen than man or woman." width="800" height="744"&gt;&lt;/a&gt;&lt;br&gt;
King is closer to queen than man or woman.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Bank Problem: When One Vector Isn’t Enough
&lt;/h2&gt;

&lt;p&gt;As powerful as static models like GloVe are, they have a blind spot called &lt;strong&gt;polysemy&lt;/strong&gt;: words with multiple meanings.&lt;/p&gt;

&lt;p&gt;Think about the word &lt;strong&gt;“bank”&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I need to go to the &lt;strong&gt;bank&lt;/strong&gt; to deposit some money. (A financial institution).&lt;/li&gt;
&lt;li&gt;We sat on the &lt;strong&gt;bank&lt;/strong&gt; of the river. (The edge of a river).&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.amazonaws.com%2Fuploads%2Farticles%2Fe27vr80azsaexcda2y7x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe27vr80azsaexcda2y7x.png" alt="bank vs river bank meaning" width="800" height="466"&gt;&lt;/a&gt;&lt;br&gt;
Bank vs river bank (two different meanings of one word).&lt;/p&gt;

&lt;p&gt;In a static model like GloVe, a bank has one single, fixed vector. This single meaning is an average across all contexts the model saw during training. This means the model can’t truly distinguish between a place where you keep your savings and the grassy side of a river.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Solution: Contextual Embeddings with BERT
&lt;/h2&gt;

&lt;p&gt;This is where &lt;strong&gt;Dynamic or Contextual Embeddings,&lt;/strong&gt; like &lt;strong&gt;&lt;a href="https://arxiv.org/abs/1810.04805" rel="noopener noreferrer"&gt;BERT&lt;/a&gt;&lt;/strong&gt; (Bidirectional Encoder Representations from Transformers)&lt;strong&gt;,&lt;/strong&gt; have changed the game. Unlike GloVe, BERT doesn’t just look up a word in a fixed dictionary. It looks at the &lt;strong&gt;entire sentence&lt;/strong&gt; to generate a unique vector for a word every single time it appears.&lt;/p&gt;

&lt;p&gt;When BERT processes our two bank sentences, it recognizes the surrounding words (like “river” or “deposit”) and generates two completely different vectors. It understands that the context changes the core identity of the word.&lt;/p&gt;

&lt;p&gt;Here is the simple usage of BERT with PyTorch in code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;transformers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BertTokenizer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;BertModel&lt;/span&gt;

&lt;span class="c1"&gt;# Load tokenizer and model
&lt;/span&gt;&lt;span class="n"&gt;tokenizer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;BertTokenizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;./bert_model&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;model_bert&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;BertModel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;./bert_model&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Prevent training
&lt;/span&gt;&lt;span class="n"&gt;model_bert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;eval&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;print_token_embeddings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sentence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Tokenizes a sentence, runs it through BERT,
    and prints the first 5 values of each token&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s embedding.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="c1"&gt;# Tokenize input
&lt;/span&gt;    &lt;span class="n"&gt;inputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sentence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;return_tensors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Forward pass
&lt;/span&gt;    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;no_grad&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
        &lt;span class="n"&gt;outputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;model_bert&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="c1"&gt;# Contextual embeddings for each token
&lt;/span&gt;    &lt;span class="n"&gt;embeddings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;last_hidden_state&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="c1"&gt;# Convert token IDs back to readable tokens
&lt;/span&gt;    &lt;span class="n"&gt;tokens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;convert_ids_to_tokens&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;input_ids&lt;/span&gt;&lt;span class="sh"&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="c1"&gt;# Print token + partial embedding
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;--- &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; ---&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;vector&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;tokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;embeddings&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;numpy&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&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="c1"&gt;# Example sentences
&lt;/span&gt;&lt;span class="n"&gt;sentence1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;I went to the bank to deposit money.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;sentence2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;We sat on the bank of the river.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;# Compare contextual embeddings
&lt;/span&gt;&lt;span class="nf"&gt;print_token_embeddings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sentence1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sentence 1&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print_token_embeddings&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sentence2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sentence 2&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;h3&gt;
  
  
  Output
&lt;/h3&gt;

&lt;p&gt;The output shows that BERT assigns different vectors to the word &lt;em&gt;bank&lt;/em&gt; based on its surrounding context.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ztci4kbaa388cwx2ts2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ztci4kbaa388cwx2ts2.png" alt="Sentence 1: I went to the bank to deposit money." width="800" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sentence 1: I went to the bank to deposit money.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F51ojgtv01skpfejakszv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F51ojgtv01skpfejakszv.png" alt="Sentence 2: We sat on the bank of the river." width="800" height="284"&gt;&lt;/a&gt;&lt;br&gt;
Sentence 2: We sat on the bank of the river.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which Model Should You Use?
&lt;/h2&gt;

&lt;p&gt;Choosing the right embedding depends entirely on your specific task and your available computational resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static Embeddings (like GloVe)&lt;/strong&gt; are the best choice when you need a fast, computationally lightweight solution with a small memory footprint. They are perfect for straightforward tasks like document classification, where the broader meaning of words is usually sufficient.&lt;/p&gt;

&lt;p&gt;On the other hand, &lt;strong&gt;Contextual Embeddings (such as BERT)&lt;/strong&gt; are necessary when your task requires a deep understanding of language and ambiguity, such as question answering or advanced chatbots. They excel at handling words with multiple meanings, which is often the key to an application’s success. However, keep in mind that they require more computational power and a larger memory footprint.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Embeddings are the foundation of how AI reads and processes our human world. Whether you are using a pre-trained model like BERT or building a simple embedding model from scratch using &lt;strong&gt;PyTorch’s&lt;/strong&gt; &lt;a href="https://docs.pytorch.org/docs/stable/generated/torch.nn.Embedding.html" rel="noopener noreferrer"&gt;&lt;code&gt;nn.Embedding&lt;/code&gt; &lt;strong&gt;layer&lt;/strong&gt;&lt;/a&gt;, you are essentially building a bridge between human thought and machine calculation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What do you think?&lt;/strong&gt; If you were training a model from scratch today, what specific vocabulary or niche topic would you want it to learn first? Let me know in the comments 👇.&lt;/p&gt;

&lt;p&gt;Note: All illustrations in this post were generated using &lt;a href="https://openai.com/index/dall-e-3/" rel="noopener noreferrer"&gt;DALL·E&lt;/a&gt; 3.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Quiz
&lt;/h2&gt;

&lt;p&gt;Let’s test your understanding. Share your answer in the comments 👇.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does text data differ from image data in machine learning?&lt;/strong&gt;&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;Devlin, J. et al. (2018). &lt;em&gt;BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Stanford NLP Group. &lt;em&gt;GloVe: Global Vectors for Word Representation&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Spot Intelligence. &lt;em&gt;GloVe Embeddings Explained&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>nlp</category>
      <category>pytorch</category>
      <category>bert</category>
      <category>ai</category>
    </item>
    <item>
      <title>Why Your Model is Failing (Hint: It’s Not the Architecture)</title>
      <dc:creator>Nastaran Moghadasi</dc:creator>
      <pubDate>Thu, 18 Dec 2025 20:51:34 +0000</pubDate>
      <link>https://dev.to/nastaranai/why-your-model-is-failing-hint-its-not-the-architecture-27cl</link>
      <guid>https://dev.to/nastaranai/why-your-model-is-failing-hint-its-not-the-architecture-27cl</guid>
      <description>&lt;p&gt;We’ve all been there. You spend days tuning hyperparameters and tweaking your architecture, but the loss curve just won’t cooperate. In my experience, the difference between a successful project and a failure is rarely the model architecture. It’s almost always the data pipeline.&lt;/p&gt;

&lt;p&gt;I recently built a robust data pipeline solution for a private work project. While I can’t share that proprietary data due to privacy reasons, the challenges I faced are universal: messy file structures, proprietary label formats, and corrupted images.&lt;/p&gt;

&lt;p&gt;To show you exactly how I solved them, I’ve recreated the solution using the Oxford 102 Flowers dataset. It is the perfect playground for this because it mimics real-world messiness: over 8,000 generically named images with labels hidden inside a proprietary MATLAB (.mat) file rather than nice, clean category folders.&lt;/p&gt;

&lt;p&gt;Here is the step-by-step guide to building a bugproof PyTorch data pipeline that handles the mess so your model doesn’t have to.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Strategy: Lazy Loading &amp;amp; The Off-by-One Trap
&lt;/h2&gt;

&lt;p&gt;If you can’t reliably load your data, nothing else matters.&lt;/p&gt;

&lt;p&gt;For this pipeline, I built a custom PyTorch Dataset class focused on lazy loading. Instead of loading all 8,000+ images into RAM at once, we store only the file paths during setup (&lt;strong&gt;init&lt;/strong&gt;) and load the actual image data on-demand (&lt;strong&gt;getitem&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;A critical lesson learned: Watch out for indexing errors. The Oxford dataset uses 1-based indexing for its labels, but PyTorch expects 0-based indexing. Catching this off-by-one error early saves you from training a perpetually confused model.&lt;/p&gt;

&lt;p&gt;The Dataset Skeleton&lt;br&gt;
Here is the core structure we need to implement:&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;torch.utils.data&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Dataset&lt;/span&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="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;FlowerDataset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Dataset&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;img_paths&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;transform&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;img_paths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;img_paths&lt;/span&gt;

        &lt;span class="c1"&gt;# Adjust for 0-based indexing if your source is 1-based
&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;labels&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; 
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;transform&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__len__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;img_paths&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__getitem__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&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="c1"&gt;# Lazy loading happens here
&lt;/span&gt;
        &lt;span class="n"&gt;img&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="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;img_paths&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;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;label&lt;/span&gt; &lt;span class="o"&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;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;labels&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="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;img&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Consistency: The Pre-processing Pipeline
&lt;/h2&gt;

&lt;p&gt;Real-world data is rarely consistent. In the Flowers dataset, images have wildly different dimensions (e.g., 670x500 vs 500x694). PyTorch batches require identical dimensions, so we need a rigorous transform pipeline.&lt;/p&gt;

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

&lt;p&gt;I strictly avoid simple resizing, which distorts the image. Instead, I use a Resize on the shorter edge to preserve the aspect ratio, followed by a CenterCrop to get our uniform square. Finally, we convert to tensors and normalize pixel intensity from 0-255 down to 0-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="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;torchvision&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;transforms&lt;/span&gt;

&lt;span class="c1"&gt;# Standard normalization stats
&lt;/span&gt;
&lt;span class="n"&gt;mean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.485&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.456&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.406&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;std&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.229&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.224&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.225&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;base_transform&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;transforms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Compose&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="n"&gt;transforms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Resize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;256&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;transforms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CenterCrop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;224&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;transforms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ToTensor&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="n"&gt;transforms&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Normalize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;])&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;And here is the output for a sample image:&lt;/p&gt;

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

&lt;h2&gt;
  
  
  3. Augmentation: Endless Variation, Zero Extra Storage
&lt;/h2&gt;

&lt;p&gt;One of the biggest advantages of PyTorch’s on-the-fly augmentation is that it provides endless variation without taking up extra storage.&lt;/p&gt;

&lt;p&gt;By applying random transformations (flips, rotations, and color jitters) only when the image is loaded during training, the model sees a slightly different version of the image every epoch. This forces the model to learn essential features like shape and color rather than memorizing pixels.&lt;/p&gt;

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

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note: Always disable augmentation for validation and testing to ensure your metrics reflect actual performance improvements.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The Bugproof Pipeline: Handling Corrupted Data
&lt;/h2&gt;

&lt;p&gt;This is the part that usually gets overlooked in tutorials but is vital in production. A single corrupted image can crash a training run hours after it starts.&lt;/p&gt;

&lt;p&gt;To fix this, we update the &lt;strong&gt;getitem&lt;/strong&gt; method to be resilient. If it encounters a bad file (corrupted bytes, empty file, etc.), it shouldn’t crash. Instead, it should log the error and recursively call itself to fetch the next valid image.&lt;/p&gt;

&lt;p&gt;Here is the pattern I use:&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="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__getitem__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&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="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;img&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="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;img_paths&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;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="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;img&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;img&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;access_counts&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="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
            &lt;span class="k"&gt;return&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;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;labels&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="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log_error&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;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="c1"&gt;# Recursively skip to the next valid sample
&lt;/span&gt;
            &lt;span class="n"&gt;new_idx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;idx&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="o"&gt;%&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;__getitem__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;new_idx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Telemetry: Know Your Data
&lt;/h2&gt;

&lt;p&gt;Finally, I added basic telemetry to the pipeline. By tracking load times and access counts, you can identify if specific images are dragging down your training throughput (e.g., massive high-res files) or if your random sampler is neglecting certain files.&lt;/p&gt;

&lt;p&gt;In my implementation, if an image takes longer than 1 second to load, the system warns me. After training, I print a summary like:&lt;/p&gt;

&lt;p&gt;Total images: 8,189&lt;/p&gt;

&lt;p&gt;Errors encountered: 2&lt;/p&gt;

&lt;p&gt;Average load time: 7.8 ms&lt;/p&gt;

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

&lt;p&gt;If you are shipping models to production, you need to invest as much time in your data pipeline as you do in your model architecture.&lt;/p&gt;

&lt;p&gt;By implementing lazy loading, consistent transforms, on-the-fly augmentation, and robust error handling, you ensure that your sophisticated neural network isn’t being sabotaged by a broken data strategy.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>pytorch</category>
      <category>dataengineering</category>
    </item>
    <item>
      <title>How to Read a Scientific Paper Efficiently: A 5-Step Guide</title>
      <dc:creator>Nastaran Moghadasi</dc:creator>
      <pubDate>Wed, 17 Dec 2025 02:05:37 +0000</pubDate>
      <link>https://dev.to/nastaranai/how-to-read-a-scientific-paper-efficiently-a-5-step-guide-1nek</link>
      <guid>https://dev.to/nastaranai/how-to-read-a-scientific-paper-efficiently-a-5-step-guide-1nek</guid>
      <description>&lt;p&gt;&lt;em&gt;I’ve found that one of the most challenging yet rewarding skills to develop is the ability to effectively read and understand scientific research papers. It’s a journey of deconstructing complex ideas, and I’m excited to share what I’ve learned with you. This blog post is a guide for anyone who wants to dive into the world of academic research, inspired by the insights from Somdip Dey’s “A Beginner’s Guide to Computer Science Research.” [1]&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64ts4yms7q7wmtlkh3go.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64ts4yms7q7wmtlkh3go.png" alt="How to Read a Scientific Paper Efficiently: A 5-Step Guide" width="800" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Art of Reading a Scientific Paper
&lt;/h2&gt;

&lt;p&gt;Reading a research paper is not like reading a novel or a news article. It’s an active process that requires a systematic approach. The goal is not just to read the words on the page but to engage with the ideas, critically evaluate the research, and connect it to your own knowledge and interests. Here’s a breakdown of a five-step process that can help you navigate the dense world of academic literature.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Find Your Focus
&lt;/h3&gt;

&lt;p&gt;The first and most crucial step is to choose a subject area that genuinely interests you. Research requires a significant investment of time and effort, and your passion for the topic will be the fuel that keeps you going. Instead of blindly following trends or suggestions, take the time to explore different areas and find what truly excites you. This personal connection to the subject matter will make the entire process more enjoyable and sustainable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Master the Art of the Search
&lt;/h3&gt;

&lt;p&gt;Once you have a topic in mind, the next step is to find relevant research papers. While a simple Google search might be your first instinct, it’s essential to use scholarly databases and search engines to ensure the credibility of the sources. Here are some of the most valuable resources for computer science research:&lt;/p&gt;

&lt;p&gt;Search Engine/Database Description Google Scholar A freely accessible web search engine that indexes the full text or metadata of scholarly literature across an array of publishing formats and disciplines. Microsoft Academic Search A free public web search engine for academic publications and literature, developed by Microsoft Research. ACM Digital Library A research, discovery and networking platform containing the full text of every article ever published by ACM. IEEEXplore A digital library providing access to scientific and technical content published by the Institute of Electrical and Electronics Engineers (IEEE) and its publishing partners. DBLP A computer science bibliography website that provides open bibliographic information on major computer science journals and proceedings. Scopus A multidisciplinary bibliographic database containing abstracts and citations for academic journal articles. ScienceDirect A leading full-text scientific database offering journal articles and book chapters from more than 2,500 peer-reviewed journals and more than 11,000 books.&lt;/p&gt;

&lt;p&gt;When searching, use a combination of broad and specific keywords related to your topic. Keep a running list of these keywords, as they will be invaluable for future searches.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Organize and Categorize
&lt;/h3&gt;

&lt;p&gt;As you start collecting papers, you’ll quickly realize that not all research is the same. Dey suggests categorizing papers into two main types: &lt;strong&gt;argumentative&lt;/strong&gt; and &lt;strong&gt;analytical&lt;/strong&gt;. Argumentative papers present a new idea and provide evidence to support it, while analytical papers offer a new perspective or analysis of an existing topic. Understanding the type of paper you’re reading will help you better grasp the author’s intent.&lt;/p&gt;

&lt;p&gt;To manage your growing library of papers, consider using reference management software like EndNote, or BibDesk. These tools can help you organize your references, take notes, and even visualize the connections between different papers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: The Three-Pass Approach
&lt;/h3&gt;

&lt;p&gt;Reading a paper effectively is a multi-step process. A popular method, also referenced by Dey, is the “three-pass approach” proposed by S. Keshav. [2] This method involves reading the paper three times, with each pass having a different goal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The First Pass (5-10 minutes):&lt;/strong&gt; This is a quick scan to get a general idea of the paper. Read the title, abstract, and introduction. Glance at the section and sub-section headings. Read the conclusions. This will give you a high-level overview of the paper’s contribution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Second Pass (up to an hour):&lt;/strong&gt; In this pass, you’ll read the paper more carefully, but you can still ignore the finer details like proofs. Pay attention to the figures, diagrams, and illustrations. This will help you understand the context of the work and the evidence presented.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Third Pass (4-5 hours for beginners):&lt;/strong&gt; This is the most detailed pass. The goal here is to understand the paper in its entirety. You should be able to mentally re-implement the paper’s ideas and identify its strengths and weaknesses.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 5: The Art of Critical Thinking
&lt;/h3&gt;

&lt;p&gt;Reading a paper is not a passive activity. The final and most important step is to critically engage with the content. As you read, ask yourself the following questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the core problem the paper is trying to solve?&lt;/li&gt;
&lt;li&gt;What is the proposed solution?&lt;/li&gt;
&lt;li&gt;How is the solution evaluated? Are the benchmarks and evaluations fair?&lt;/li&gt;
&lt;li&gt;What are the underlying assumptions made by the authors?&lt;/li&gt;
&lt;li&gt;What are the limitations of the research?&lt;/li&gt;
&lt;li&gt;Can the work be improved? What are the potential avenues for future research?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Answering these questions will not only deepen your understanding of the paper but also help you generate your own ideas and contribute to the conversation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Journey Continues
&lt;/h2&gt;

&lt;p&gt;Reading research papers is a skill that takes time and practice to develop. Don’t be discouraged if you find it challenging at first. By following a systematic approach and actively engaging with the material, you’ll gradually build the confidence and expertise to navigate the world of academic research. This journey of a thousand papers begins with a single, well-read one.&lt;/p&gt;

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

&lt;p&gt;[1] Dey, S. (2014). A Beginner’s Guide to Computer Science Research. &lt;em&gt;XRDS: Crossroads, The ACM Magazine for Students&lt;/em&gt;, 20(4), 14-15.&lt;/p&gt;

&lt;p&gt;[2] Keshav, S. (2007). How to Read a Paper. &lt;em&gt;ACM SIGCOMM Computer Communication Review&lt;/em&gt;, 37(3), 83-84.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>tutorial</category>
      <category>productivity</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
