<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cher Lim on Medium]]></title>
        <description><![CDATA[Stories by Cher Lim on Medium]]></description>
        <link>https://medium.com/@cher.lim8?source=rss-9836afe3dfb3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*gKfe2Il4RIQ35sV6.jpg</url>
            <title>Stories by Cher Lim on Medium</title>
            <link>https://medium.com/@cher.lim8?source=rss-9836afe3dfb3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 10:04:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cher.lim8/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Can Classical Logic Keep Modern AI in Check?]]></title>
            <link>https://medium.com/@cher.lim8/can-classical-logic-keep-modern-ai-in-check-50e9add69a0c?source=rss-9836afe3dfb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/50e9add69a0c</guid>
            <category><![CDATA[knowledge-representation]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai-safety]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Cher Lim]]></dc:creator>
            <pubDate>Sat, 07 Nov 2026 10:08:08 GMT</pubDate>
            <atom:updated>2026-11-07T10:08:08.828Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How Knowledge Bases can help control the actions of AI agents</em></p><p>Large Language Models (LLMs) can understand requests, analyse information and use tools. With agentic AI, they can also execute tasks such as bookings and transactions.</p><p><strong>But how do we ensure AI agents act within their authority?</strong></p><p><strong>Scenario:</strong> A manager asks an AI agent to approve a $10,000 purchase, but the manager’s approval limit is only $5,000. The agent approves it without checking the authorisation rules.</p><p><strong>Consequence:</strong> The agent understands the request but makes an unauthorised decision.</p><p>In classical AI, knowledge bases (KBs) were used to represent facts and rules to derive conclusions. In modern agentic AI, they can serve a different purpose: <strong>checking whether an AI agent’s proposed actions follow defined rules.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*owXdwrPGiQjjcn3y9aZs6A.png" /></figure><h3>1. What is a Knowledge Base?</h3><p>In classical AI, a <strong>Knowledge Base (KB)</strong> stores facts and rules about a problem.</p><p>For example, a company requires three conditions for purchase approval, represented using <strong>propositional logic</strong>:</p><p>· <strong>A</strong> = Purchase is within the approval limit.</p><p>· <strong>B</strong> = Requester has the required authority.</p><p>· <strong>C</strong> = Compliance checks have passed.</p><p>· <strong>P</strong> = Purchase meets the approval requirements.</p><p>The approval rule is:</p><p><strong>P ↔ A ∧ B ∧ C</strong></p><p>Note: ∧ means AND; ↔ means IF AND ONLY IF.</p><p>The KB can then evaluate whether the purchase meets all three conditions, rather than relying on the LLM to interpret the policy each time.</p><h3>2. How does a KB make a decision?</h3><p>Using the rule <strong>P ↔ A ∧ B ∧ C</strong>, the KB evaluates whether all approval conditions are satisfied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*elydyY87raqy1WKj5RoGfg.png" /></figure><p>The KB allows approval only when all conditions are confirmed True. If any condition is False, approval is rejected. If a condition is Unknown, the decision is put on hold until the missing information is confirmed.</p><h3>3. How do we know the conclusion follows logically?</h3><p>In propositional logic, <strong>entailment</strong> means that a conclusion must follow from the facts and rules in the Knowledge Base (KB).</p><p>Recall our approval rule:</p><p><strong>P ↔ A ∧ B ∧ C</strong></p><p>Suppose the KB confirms that A, B and C are all True. The purchase must therefore meet the approval requirements.</p><p>We express this as:</p><p><strong>KB ⊨ P</strong></p><p>The symbol <strong>⊨</strong> means <em>logically entails</em>. In simple terms, the KB provides sufficient evidence to establish P.</p><p>But if C is Unknown, the KB cannot establish P, even though A and B are True.</p><p>This is the key difference between <strong>logical entailment and a likely conclusion</strong>. An LLM may generate an answer based on learned patterns, while logical entailment requires the conclusion to follow from the stated facts and rules.</p><p>However, logical correctness does not guarantee factual correctness. If the KB contains incorrect information, the conclusion may still be wrong in the real world.</p><h3>4. Why not use a KB to check every LLM answer?</h3><p>The main challenge is <strong>scalability</strong>. A general-purpose LLM covers many subjects, making it impractical to build and maintain a KB containing all the necessary facts and rules. Furthermore, not all knowledge can be expressed as simple True or False statements.</p><p>A more practical approach is to use <strong>domain-specific KBs</strong> to verify important decisions where rules are clearly defined, such as company purchasing policies, university enrolment requirements or banking transactions.</p><h3>5. Combining an LLM with a Knowledge Base</h3><p>A practical approach is to use the KB as an <strong>independent verification mechanism</strong>. The LLM interprets the user’s request and proposes an action, while a policy engine checks it against the rules in the KB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*yhouxzx5BuWwRSEoliRmaQ.png" /></figure><p>For our $10,000 purchase example, the policy engine finds that the amount exceeds the $5,000 approval limit (<strong>A = False</strong>). The request is therefore denied, even though the other conditions are satisfied.</p><p><strong>The LLM proposes the action; the KB and logic engine verify whether it is permitted.</strong> The system must enforce this decision before executing the action.</p><h3>6. AWS adoption</h3><p>A recent example is <strong>Amazon Bedrock AgentCore Policy</strong>, which became generally available in March 2026. It uses Cedar-based rules to control what actions AI agents can perform.</p><p>Cedar uses explicit rules and logical conditions, similar in principle to classical AI languages such as Prolog, but focuses on authorisation rather than general-purpose reasoning.</p><p>For example, an agent may retrieve purchase information but cannot approve transactions exceeding a specified limit. The policy engine checks each controlled action before allowing or denying it.</p><p><strong>AI Agent Proposes → Policy Engine Checks → Allow or Deny</strong></p><p>AWS also supports translating natural-language requirements into formal policies. This combines the flexibility of LLMs with the consistency of symbolic reasoning.</p><p>AgentCore Policy controls what an AI agent is allowed to do, rather than verifying the factual accuracy of everything it says.</p><h3>7. From Intelligent AI to Accountable AI</h3><p>A Knowledge Base cannot guarantee complete AI reliability. Its effectiveness depends on accurate facts and well-defined rules. It can only verify decisions against the information and rules available to it.</p><p>Nevertheless, KBs provide an important layer of control. Rather than representing everything an AI needs to know, they can focus on the rules governing its actions.</p><p>As AI moves from generating answers to performing real-world tasks, <strong>the challenge is not simply to make AI more intelligent, but to ensure it acts within clearly defined rules</strong>.</p><h3>References</h3><p>1. Amazon Web Services. <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/policy-core-concepts.html">Amazon Bedrock AgentCore Policy — Core Concepts</a></p><p>2. Cedar Policy Language. <a href="https://www.cedarpolicy.com/">Official documentation</a></p><p>3. Pan et al. (2023). <a href="https://aclanthology.org/2023.findings-emnlp.248/">Logic-LM: Empowering Large Language Models with Symbolic Solvers</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50e9add69a0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Graphs Matter Again in AI]]></title>
            <link>https://medium.com/@cher.lim8/why-graphs-matter-again-in-ai-62d428b97ec7?source=rss-9836afe3dfb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/62d428b97ec7</guid>
            <category><![CDATA[graphrag]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Cher Lim]]></dc:creator>
            <pubDate>Fri, 18 Sep 2026 08:24:17 GMT</pubDate>
            <atom:updated>2026-09-18T08:24:17.552Z</atom:updated>
            <content:encoded><![CDATA[<p><em>From search algorithms to GraphRAG</em></p><p>Graphs have been one of the fundamental ideas in computer science, especially in formulating search problems.</p><p>When we think of search, many of us think of route finding, puzzle solving or navigation in a game world. In these problems, graphs provide a convenient way of representing the possible places we can go and the paths connecting them.</p><p>In modern AI systems, however, graphs are increasingly useful for another reason. AI does not only need to find things that are similar. It also needs to understand how things are connected.</p><p>This article looks at both sides of the story: how graphs support classical AI search, and how the same basic idea has found a new role in knowledge graphs and graph-based retrieval.</p><h3>Graph Representation</h3><p>A graph consists of a set of vertices V and edges E. Mathematically, we write:</p><p><em>G = (V, E)</em></p><p>The most familiar example is a map or transport network. The locations are nodes, while the roads connecting them are edges.</p><p>Now imagine that we are at A and want to reach E. The graph is no longer simply a representation of a network. It becomes a search problem.</p><p>In classical AI, we can think of each node as a state, while an edge represents an action or transition that takes us from one state to another.</p><p>· an initial state</p><p>· a set of possible actions</p><p>· a transition model</p><p>· a goal test</p><p>· a cost, where necessary</p><p><strong>Which states should I explore, and in what order?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*JvcKJTWJD6AdvKis9G_7Tg.png" /><figcaption><em>Figure 1. A real-world network can be abstracted into nodes and edges.</em></figcaption></figure><h3>Different Ways of Searching the Same Graph</h3><p>Once a problem is represented as a graph, the next question is how to explore it. This is where different search algorithms come in.</p><p>Breadth-First Search (BFS) explores nearby states first, level by level. It uses a first-in-first-out, or FIFO, queue. If all edges have equal cost, BFS will find a path containing the minimum number of edges.</p><p>Depth-First Search (DFS) takes a different approach. It follows one path as deeply as possible before backtracking and trying another. Its frontier behaves like a last-in-first-out, or LIFO, stack.</p><p>Both are examples of uninformed search. The search algorithm has no additional information telling it which direction is likely to lead towards the goal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*xOTPB8C_2KF4GF2a45SQxw.png" /><figcaption><em>Figure 2. BFS and DFS navigate the same graph in different orders.</em></figcaption></figure><p>What if we do have information about which direction is likely to lead towards the goal? This leads us to A* search.</p><p><em>f(n) = g(n) + h(n)</em></p><p>Here, g(n) is the cost already incurred in reaching node n, while h(n) is the estimated cost from n to the goal.</p><p><strong>A* considers both: How far have I travelled? And how far do I think I still have to go?</strong></p><p>The important point is that the graph itself has not changed. What changes is the strategy used to navigate it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*tLeYRiSwsOwyHdsEHoOVGg.png" /><figcaption><em>Figure 3. A* combines the cost already incurred with an estimate of the cost remaining.</em></figcaption></figure><h3>Graphs in Modern AI</h3><p>So far, our nodes have represented locations or states, while our edges have represented possible movements. But nothing in the mathematics says that a node has to be a location.</p><p>What if a node represented a person, a company, a product or an AI concept? And what if an edge represented the relationship between them? This takes us from a state graph to a knowledge graph.</p><p>Suppose we have three sentences:</p><p>1. Alice works for ABC Robotics.</p><p>2. ABC Robotics developed Robot-X.</p><p>3. Robot-X uses reinforcement learning.</p><p>Instead of treating these merely as sentences, we could represent their information as a graph. We still have G = (V, E), but now V represents entities or concepts, while E represents relationships.</p><p><em>(Robot-X, USES, Reinforcement Learning)</em></p><p>This is the basic idea behind a knowledge graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*Fz2Iy6JrMKGF-tsMfMrtvw.png" /><figcaption><em>Figure 4. The same graph idea can represent states and actions or entities and relationships.</em></figcaption></figure><h3>Searching for Relationships</h3><p>Knowledge graphs provide a different way of representing information from embeddings.</p><p>Embeddings represent information as vectors in a continuous space, where items with similar meanings tend to be located closer together. Knowledge graphs do something different: they explicitly represent entities and the relationships between them. Modern AI systems can combine both approaches.</p><p>In conventional Retrieval-Augmented Generation, or RAG, documents are typically divided into chunks and converted into embedding vectors. A query is also converted into an embedding, and retrieval can compare the query with stored chunks using a similarity measure such as cosine similarity.</p><p><em>cos(θ) = (e_q · e_i) / (||e_q|| ||e_i||)</em></p><p><strong>Which pieces of text are most similar in meaning to my question?</strong></p><p>This is very useful. But similarity is not the same as relationship.</p><p>Two pieces of text can be semantically similar without having an explicit relationship. Conversely, two entities can be strongly related even when the words used to describe them are quite different.</p><p>Vector retrieval is particularly useful for asking: What information is similar to this question? A graph gives us another capability: What is connected to what — and through which relationships?</p><p>Consider the question: How is Alice connected to reinforcement learning? In our example, there is no sentence directly stating that Alice is connected to reinforcement learning. Instead, the answer exists through a chain of relationships: Alice → ABC Robotics → Robot-X → Reinforcement Learning.</p><p>The graph makes that connection explicit. And suddenly this starts to look very much like a search problem again.</p><h3>The Rise of Graph-Based Retrieval</h3><p>Microsoft’s GraphRAG approach illustrates how graph structure can be incorporated into retrieval for LLM applications.</p><p>Instead of treating a collection of documents only as independent chunks, GraphRAG can identify entities and relationships in the text and organize this information into a graph. It can also identify communities of related information and generate summaries of those communities.</p><p>A simplified pipeline: Documents → text units → entity extraction → relationship extraction → graph construction → community detection → community summaries → retrieval → LLM answer.</p><p>The interesting part is that the structure itself now becomes useful during retrieval.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*TE0sHTOPqVG61I4YDDkV2Q.png" /><figcaption><em>Figure 5. Vector RAG emphasizes semantic similarity; GraphRAG adds explicit graph structure and connected information.</em></figcaption></figure><h3>Conclusion</h3><p>When we hear the word search, we often think about Google or a database query. But search has a much deeper meaning in artificial intelligence.</p><p>Classical AI used graphs to represent possible states and actions. Algorithms such as BFS, DFS, UCS and A* provided systematic ways of navigating those graphs to find a path towards a goal.</p><p>Modern AI increasingly uses graphs to represent something different: entities, concepts and relationships.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62d428b97ec7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Prediction to Decision: The Mathematics of Reinforcement Learning]]></title>
            <link>https://medium.com/@cher.lim8/from-prediction-to-decision-the-mathematics-of-reinforcement-learning-c9c9e9767fdc?source=rss-9836afe3dfb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9c9e9767fdc</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[bellman-equation]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <dc:creator><![CDATA[Cher Lim]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 10:09:51 GMT</pubDate>
            <atom:updated>2026-08-20T08:30:56.345Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How rewards, value functions and Bellman equations teach AI what to do</em></p><p><em>The AI Sense-Making Series — Article 6</em></p><p>This article is part of the <strong>AI Sense-Making Series</strong>, where we explore the key ideas behind modern AI — one concept at a time.</p><p>Previous article:</p><p>Article 5 — <em>How AI Learns to Predict the Consequences of Its Actions</em></p><p><a href="https://medium.com/@cher.lim8/from-self-supervised-learning-to-world-models-8369ebbb375e?sharedUserId=cher.lim8">Read it here</a></p><h3>Introduction</h3><p>In the previous article, <strong>From Self-Supervised Learning to World Models</strong>, we explored how AI can learn representations of its environment and predict what might happen next.</p><p>But prediction creates another question:</p><p><strong>If several actions are possible, how does an AI decide what to do?</strong></p><p>This is one the central problems addressed by <strong>reinforcement learning (RL)</strong>.</p><p>Reinforcement learning is surprisingly intuitive. Think of training a dog: actions lead to consequences, feedback shapes future behaviour, and over time some actions become more likely than others. The mathematics of RL formalises this simple idea.</p><p>I shall start with a very small environment and use it to build the mathematics behind this concept.</p><h3>Representing the Environment as States</h3><p>Traditional reinforcement learning begins with an important assumption: the environment can be represented in terms of <strong>states</strong>.</p><p>A state describes the situation the agent is currently in.</p><p>For our simple example, suppose the environment contains three states: S1, S2, S3 where S1 is the starting state and S3 is the terminal state.</p><p>The agent can take actions that move it between these states.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*ELq4wUjJwRUJUB6ek2chyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/210/1*hBmqvUJ6iT_302815SOBAA.png" /></figure><p>Each transition therefore has three important components:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*OKQBklvNoPaQtyl9zJsxxQ.png" /></figure><p>For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/184/1*65ninYa4ykrTnaTFSG4RQg.png" /></figure><p>means:</p><ul><li>the agent is currently in S1,</li><li>it chooses the action <strong>Safe</strong>,</li><li>it receives a reward of +2,</li><li>and the environment moves to S2 .</li></ul><p>This representation of <strong>states, actions, transitions and rewards</strong> forms the foundation of the traditional reinforcement-learning problem.</p><h3>Reward vs Return: Immediate Benefit Is Not Enough</h3><p>Looking at our environment, the agent has two choices from S1.</p><p>The <strong>Risky</strong> action gives: R = +5</p><p>The <strong>Safe</strong> action gives only: R= +2</p><p>If the agent cares only about the immediate reward, it would choose Risky: 5 &gt; 2</p><p>But Safe takes the agent to S2, where another reward of +10 is available.</p><p>· <strong>Reward</strong> is what the agent receives immediately after an action.</p><p>· <strong>Return</strong> measures the rewards accumulated into the future.</p><p>The formula for discounted return is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*zL4YjqqBtg6hjyXQm7IlRg.png" /></figure><p>where γ is the <strong>discount factor</strong>.</p><p>We assume γ=0.9:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*qIRkHvILU04mifKZ-Hj0UQ.png" /></figure><p>The return of Safe action is actually higher than Risky action (11 &gt; 5) in spite of a lower immediate reward.</p><h3>Policy: How Does the Agent Choose an Action?</h3><p>At each state, the agent needs a rule for deciding what action to take.</p><p>This rule is called a <strong>policy</strong>, represented by the Greek letter: π</p><p>A policy maps a state to an action:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*q2VfgKZK8VB7BGhKVDmaUw.png" /></figure><p>A policy may choose one action with certainty (<strong>deterministic</strong>), or assign probabilities to different actions (<strong>probabilistic</strong>).π(a∣s) is <strong>the probability of choosing action a when the agent is in state s.</strong></p><p>For our example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*xd3q8Pat5QIF0t5HvLz7Hw.png" /></figure><p>This means that at S1, the policy chooses <strong>Safe 80% of the time</strong> and <strong>Risky 20% of the time</strong>. At S2, Finish is chosen with certainty (probability=1).</p><h3>Value, Q and Bellman: Putting a Number on the Future</h3><p>Recall that the environment is represented in states. In order to determine what actions to take, we need to put some numbers on the future.</p><p>· <strong>Value V(s)</strong>: How good is it to be in this state?</p><p>· <strong>Q(s, a)</strong>: How good is this action from this state?</p><p>· <strong>Bellman </strong>connects the present to the future.</p><p><strong>Value now = Immediate reward + Discounted value of next state</strong></p><p>The example above is summarised in the following table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SIVn-JCv7ANLvvfecX2-fw.png" /></figure><p>The formal Bellman equation for a policy is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*cCmdfs52xOH7TLL9zVKRJA.png" /></figure><p>For choosing the best action, the same principle can be written in terms of Q:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*lABicwyKlZIQ66I6sClMVA.png" /></figure><h3>From Bellman to Learning</h3><p>So far, we have assumed that the values of the states are already known. But in many real problems, the agent may not know the transition dynamics and rewards of the environment in advance. Instead, it must <strong>learn from experience</strong>.</p><p>Suppose the agent experiences:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/156/1*CRC9fPGISZgcFWeSq0R09Q.png" /></figure><p>It has now observed four pieces of information:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*2YRpzcJvMgdNtl7ahhC1zg.png" /></figure><p>In our example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*YAw2WXZWUijVgfrmJOd_nA.png" /></figure><p>How should this new experience change what the agent believes about the value of taking Safe from?</p><h3>Temporal-Difference Learning: Learning from Experience</h3><p>TD learning uses the difference between what the agent expected and what its latest experience suggests to improve its value estimate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*z5A7pEyW1DUkbLRUSI6FYA.png" /></figure><p><strong>Temporal-Difference error</strong>, or <strong>TD error</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*hd-YIB-4PQjjWpfppu5bkg.png" /></figure><p>The agent used this error to update its estimate, where α is the <strong>learning rate.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*nxlJTumBCzQsOXCQTbagQg.png" /></figure><p>With repeated experience, the estimates will progressively improve.</p><h3>From TD Learning to Q-Learning</h3><p>TD learning shows how the agent can learn the <strong>value of states</strong>, but ultimately the agent needs to decide which <strong>action</strong> to take.</p><p>So instead of updating V(s), why not update Q(s, a) directly?</p><p>This leads to the classic Q-learning:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*cUYOEm7MqHvHTiHUfvS-gg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*geKU39I9KZ9pLx-nn-HDGQ.png" /></figure><p>So, the entire Q-learning equation can be understood as:</p><p>New Q = Old Q + α (Better Estimate — Old Q)</p><h3>A simple Q-Learning Update example</h3><p>Suppose Q(S1, Safe) = 4</p><p>The agent takes Safe and receives: R = 2</p><p>Suppose the best Q-value available from S2 is currently</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*ps7w7GOk8NucO6HsmlrdsQ.png" /></figure><p>Using γ = 0.9 and α = 0.5, we obtain:</p><p>Qnew = 4 + 0.5[2 + 0.9*8 -4] = 6.6</p><p>The estimate has now moved from 4 to 6.6.</p><p>Q values converge toward values that tell the agent which actions are most valuable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*Wr2uzHeiNgqV0HAOB9AOyg.png" /></figure><p>We can now bring these ideas together: <strong>The reinforcement learning loop</strong></p><p>The agent acts according to a policy, evaluates outcomes using value functions, connects present and future through the Bellman relationship, and uses experience to improve its estimates and ultimately its policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*ScCz4DbKM7hIdT7YUslwEQ.png" /></figure><h3>From Three States to Autonomous Driving</h3><p>In our three-state example, the states and transitions were explicitly defined. In autonomous driving, the challenge is much greater: the state must represent a complex and continuously changing environment, while the consequences of different actions must be predicted or learned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*F0pO-SUnpJHK6TqwZ2BVZA.png" /></figure><p>Instead of simple rewards such as +2, +5, +10 .. the objectives now involve multiple considerations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*SmytSbjcYajv6vQlH_pCrw.png" /></figure><p><strong>A world model asks:</strong> “If I take this action, what might happen next?”</p><p><strong>Reinforcement-learning mathematics asks:</strong> “How desirable are the consequences over time?”</p><p>Modern autonomous-driving systems combine learned prediction, policies, trajectory optimization and classical control in different ways.</p><h3>A Unifying Perspective</h3><p>Reinforcement learning gives us a mathematical framework for <strong>decision making</strong>. Reward tells us what is desirable, value extends that judgement into the future, Bellman connects one decision to the next, and learning allows those estimates to improve through experience. Together, these ideas allow the agent to improve its policy — its rule for deciding what to do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*Q6ZUESQoXiT43ksn-tfa4Q.png" /></figure><p>As the environment grows from three simple states to the complexity of an autonomous vehicle, the fundamental question remains the same: Given where I am now, what should I do if I care about what happens next?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9c9e9767fdc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Self-Supervised Learning to World Models]]></title>
            <link>https://medium.com/@cher.lim8/from-self-supervised-learning-to-world-models-8369ebbb375e?source=rss-9836afe3dfb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8369ebbb375e</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[latent-space]]></category>
            <category><![CDATA[world-models]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Cher Lim]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 09:34:50 GMT</pubDate>
            <atom:updated>2026-08-04T09:34:50.333Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How AI Learns to Predict the Consequences of Its Actions</em></p><p><em>The AI Sense-Making Series — Article 5</em></p><p>This article is part of the <strong>AI Sense-Making Series</strong>, where we explore the key ideas behind modern AI — one concept at a time.</p><p>Previous article:</p><p>Article 4 — When AI learned relationships</p><p>How attention changed Artificial Intelligence</p><p><a href="https://medium.com/@cher.lim8/when-ai-learned-relationships-ce7f42799eca?sharedUserId=cher.lim8">Read it here</a>.</p><h3>Introduction</h3><p>In the previous articles, I have focused on techniques around supervised learning. These techniques are critical to form the baseline of understanding how machine learning works. However, supervised learning has its limitations. The entire pipeline depends on the existence of ground truth labels, largely marked by humans. These input-output pairs create a definitive scenario for the machine model. Any deviations will render errors.</p><p>Humans do not learn this way. We learn from experience, and deviations from experience are absorbed as new experience. This is the gist of self-supervised learning, and it is the backbone to the development of world models.</p><p>In this article, I will use the example of autonomous driving to describe the entire pipeline of self-supervised learning. Although it is a simplified flow to how world model works, I believe it is sufficient to act as a preview for what is to come in the next wave of machine learning development.</p><h3>Example Overview</h3><p>The environment in which an autonomous vehicle operates is complex and multi-modal. The vehicle must recognise pedestrians, traffic lights, lane markings and other vehicles. In addition, it must also understand how the situation is likely to change given the action of the vehicle. For example, what happens if it accelerates, brakes, turns right?</p><p>This requires more than identifying what is present in an image. It requires a model that makes decision based on how the environment evolves.</p><h3>The Model Pipeline</h3><p>The figure below summarises the key difference between supervised learning and self-supervised learning.</p><p>In supervised learning, every training image requires a human-provided label. For autonomous driving, these labels may identify pedestrians, traffic lights, vehicles or lane markings. The model learns to recognise what is present in a single image.</p><p>Self-supervised learning takes a different approach. Instead of learning from manually labelled images, it learns from sequences of observations. The next camera image naturally becomes the learning target. Since the environment itself provides the next observation, the need for manual labelling is greatly reduced.</p><p>This seemingly small change fundamentally alters how AI learns. Rather than memorising input-output pairs, the model begins learning how the environment evolves over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*Bqx13OLz4QKhAOAh4Ev4JQ.png" /></figure><h3>Collecting Training Examples</h3><p>The first stage of training is to collect driving experience.</p><p>Each training example consists of three components:</p><ul><li>the current camera image,</li><li>the action taken by the vehicle,</li><li>the actual camera image immediately after the action.</li></ul><p>Unlike supervised learning, no human needs to provide the correct answer. The driving system already records what actually happened after the steering wheel was turned, the brakes were applied or the vehicle accelerated.</p><p>For example, if the vehicle receives a camera image while approaching a right-hand bend and the steering wheel is turned 10° to the right, the next camera image naturally records the consequence of that action.</p><p>This sequence becomes one self-supervised training example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*8R4SkfzdtQtPYQXZFhGvEg.png" /></figure><h3>Training the World Model</h3><p>Raw camera images contain millions of pixels, making them inefficient for prediction.</p><p>Instead, each image is first passed through an encoder, which converts it into a compact latent representation. This latent state captures the essential features of the current driving situation without preserving every pixel.</p><p>The world model then receives two inputs:</p><ul><li>the <strong>current latent state</strong>, and</li><li>the <strong>recorded action</strong>.</li></ul><p>Its objective is to predict the <strong>future latent state</strong> that should result from that action.</p><p>Meanwhile, the actual next camera image is passed through the same encoder to produce the <strong>actual future latent state</strong>.</p><p>The predicted future latent state is then compared with the actual future latent state. The difference between them represents the prediction error.</p><p>This prediction error is backpropagated through the network, updating both the encoder and the world model. After repeating this process across millions of driving examples, the model gradually learns how actions change the environment.</p><p>Importantly, the model is <strong>not learning to reproduce images</strong>. It is learning the <strong>dynamics of the environment</strong>.</p><p>Instead of learning: “<em>What does this image contain?”</em></p><p>It learns: “<em>Given this situation and this action, what is likely to happen next?”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*c64HHBtC5wzkavVkc-GyTw.png" /></figure><h3>Using the World Model During Deployment</h3><p>Once training is complete, the learning phase ends and the deployment phase begins.</p><p>The autonomous vehicle first receives a live camera image, which is encoded into its current latent state.</p><p>Rather than executing an action immediately, the world model performs a series of internal simulations.</p><p>Starting from the same current latent state, it predicts several possible futures.</p><p>For example, it may estimate the consequences of:</p><ul><li>braking,</li><li>continuing straight,</li><li>steering right.</li></ul><p>Each action produces a different predicted future latent state.</p><p>These predicted futures are then evaluated by the planner using criteria such as safety, lane position, collision risk and progress toward the destination.</p><p>Only after comparing these possible futures does the planner select the most desirable action to execute in the real world.</p><p>The important point is that the vehicle does not react directly to the camera image. Instead, it first predicts several possible consequences before deciding how to act.</p><p>This ability to internally simulate different futures is one of the defining characteristics of a world model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*94I62FLMHq_1krpJ9HgDyA.png" /></figure><h3>What Happens After Every Action?</h3><p>Once the selected action is executed, the environment changes.</p><p>The camera captures a new image, which is encoded into a new latent state.</p><p>The planning cycle then repeats.</p><p>Although the vehicle continuously updates its understanding of the current situation, the trained encoder and world model usually remain unchanged during deployment.</p><p>Instead, new driving experiences are recorded and stored for future training.</p><p>At a later stage, engineers can use these new experiences to retrain and validate an improved version of the world model before deploying it to the vehicle.</p><p>This separation between <strong>state updating</strong> and <strong>model updating</strong> is an important distinction.</p><p>During deployment:</p><ul><li>the <strong>latent state</strong> changes continuously,</li><li>the <strong>model parameters</strong> usually remain fixed.</li></ul><p>The model therefore uses what it has already learned to interpret new situations, while continuously refining its understanding of the vehicle’s current position in the environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*irdw-pu2NcNXO9qR4qNbtA.png" /></figure><h3>A Unifying Perspective</h3><p>In my previous articles, I described how AI evolved from learning a function, to optimising its parameters, to representing knowledge through embeddings, and finally to modelling relationships using attention.</p><p>World models represent another step in this evolution.</p><p>Supervised learning teaches AI to recognise the world.</p><p>Self-supervised learning allows AI to learn from experience.</p><p>World models use that experience to predict how the world is likely to change when actions are taken. This is edging towards how humans generally behave — experiences help us reason and make decision.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8369ebbb375e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When AI Learned Relationships]]></title>
            <link>https://medium.com/@cher.lim8/when-ai-learned-relationships-ce7f42799eca?source=rss-9836afe3dfb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce7f42799eca</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Cher Lim]]></dc:creator>
            <pubDate>Sun, 19 Jul 2026 07:09:48 GMT</pubDate>
            <atom:updated>2026-07-19T07:09:48.158Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Why Attention Changed Artificial Intelligence</em></p><p><em>The AI Sense-Making Series — Article 4</em></p><p>This article is part of the <strong>AI Sense-Making Series</strong>, where we explore the key ideas behind modern AI — one concept at a time.</p><p>Previous article:</p><p>Article 3 — The hidden language of AI: Understanding Embeddings</p><p>How AI transforms words, images and documents into meaning.</p><p><a href="https://medium.com/@cher.lim8/the-hidden-language-of-ai-understanding-embeddings-178563df00fa?sharedUserId=cher.lim8">Read it here</a>.</p><h3>Introduction</h3><p>Artificial Intelligence has been around for decades. It could recognise faces, classify images, recommend movies, and translate languages. These were impressive achievements, but most AI systems were designed to solve only one specific task.</p><p>Then something changed.</p><p>Today’s AI can write software, analyse research papers, answer complex questions, and even assist doctors, lawyers, and engineers. It appears to understand information in a much deeper way.</p><p>While more computing power and larger datasets are contributing factors, they do not fully explain why modern AI became so much more capable.</p><p>The real breakthrough is when AI learned to understand <strong>relationships</strong>.</p><p>In the previous article, we saw how embeddings allow AI to represent the meaning of words, images, and other forms of information as numerical vectors. But knowing what an object represents is only part of intelligence. Intelligence also depends on understanding how different pieces of information relate to one another.</p><p>This seemingly simple idea changed the direction of Artificial Intelligence.</p><p>In this article, we will explore the concept of <strong>attention</strong> — the mechanism that enables AI to discover these relationships — and see how it became the foundation of the Transformer architecture behind today’s large language models and many other modern AI systems.</p><h3>Relationships Are Where Understanding Begins</h3><p>Embeddings are numerical vectors that represent words, images, and other forms of information. Similar concepts occupy nearby regions in a high-dimensional space. However, <strong>meaning</strong> also depends on how objects relate to one another.</p><p>Consider this sentence:</p><p><strong><em>The little boy wearing a blue shirt dropped his lunchbox because he tripped.</em></strong></p><p>Most people immediately understand that <em>he</em> refers to the boy, that the lunchbox was dropped, and that tripping caused the event. Our minds connect these ideas without conscious calculation.</p><p>Embeddings represent <strong>boy</strong>, <strong>shirt</strong>, <strong>lunchbox</strong> and <strong>tripped</strong> as numerical vectors in a high-dimensional space.</p><p>But how does AI decide which words belong together? This is where attention comes in.</p><h3>Attention: Learning What Matters</h3><p>Attention allows each word to compare itself with other words and assign more importance to the ones that are most relevant. For <em>he</em>, the model should focus strongly on boy and much less on shirt or lunchbox.</p><p>In simple terms, attention asks: <strong>Which other pieces of information matter most for understanding this one?</strong></p><p>To answer this question, we create three separate vectors (<strong>Query, Key,</strong> and <strong>Value</strong>) from the original embeddings, each of which maintains the same dimensionality as the original embedding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*Y4SZELlLWGs5TYRzBVAFZA.png" /></figure><h3>Query, Key and Value</h3><p>Mathematically, each embedding X is transformed into three vectors:</p><p>Q = XW_Q, K = XW_K, V = XW_V</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*IH-vQ0dVhpOLKVD6LIZhzw.png" /></figure><p>The matrices W_Q, W_K and W_V are learnable parameters. During training, they are updated just like the θ values introduced in Article 2.</p><h3>The Attention Equation</h3><p>The model compares Queries with Keys (dot product of Q and K), converts the resulting scores into weights, and uses those weights to combine the Values:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*wdjRXk76GL03Gl6xdxdRiw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*ygORNtNeKqxpnWsPv3MlvQ.png" /></figure><p>The Attention equation performs three operations:</p><ol><li>Compare the Query with every Key.</li><li>Convert the similarity scores into attention weights using Softmax.</li><li>Compute a weighted sum of all the Value vectors.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*4B7VTw171Qhyk2pQWf3XuA.png" /></figure><h3>From Attention to the Transformer</h3><p>Attention is a mathematical operation. A Transformer is a complete neural-network architecture built around repeated attention and processing blocks.</p><p>A <strong>Transformer block</strong> consists of:</p><p>1. A Multi-Head Self-Attention to gather relevant information,</p><p>2. A Feed Forward Network to transform each token representation, and</p><p>3. Residual connections with layer normalization to preserve information and stabilize learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*9-_72i7hPlgGR-ZFx2y14w.png" /></figure><h3>Why Multiple Attention Heads?</h3><p>A single attention calculation gives one view of the relationships in a sentence. Multi-Head Attention performs several attention operations in parallel:</p><p>headᵢ = Attention(Qᵢ, Kᵢ, Vᵢ)</p><p>MultiHead(Q, K, V) = Concat(head₁, …, headₕ)W_O</p><p>Different heads can specialize in different patterns. One may track pronouns, another verb-object relationships, another cause and effect, while others capture long-range dependencies. Their outputs are combined to give the model several perspectives at once.</p><p>To make this more concrete, consider a Transformer with eight attention heads. Each head receives the same input embeddings but learns different relationships by using its own Query, Key and Value matrices. Their outputs are then combined to produce a richer context-aware embedding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*tjgdbVoohODFxnRYwlQaOQ.png" /></figure><h3>Why Stack Many Layers?</h3><p>Each Transformer block receives the representations produced by the previous layer and refines them again. Consider the embedding for “he”, the layers gradually incorporate boy, dropped lunchbox, and tripped.</p><p>By the final layers, the representation no longer means only he. It encodes the boy in this particular sentence and the relationships surrounding him.</p><p>This repeated refinement is one reason Transformers can maintain context, analyse long passages, and generate coherent responses.</p><p><em>The Transformer itself does not generate words.</em> It produces context-aware embeddings. <strong>A final prediction layer converts these embeddings into probabilities over the vocabulary,</strong> allowing the model to generate the next word. That’s how LLMs generate text token by token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*KSFNwQ5I4nBFE-jlotg7Zw.png" /></figure><h3>Relationships Exist Beyond Language</h3><p>The same principle appears across AI:</p><p>· In computer vision, attention highlights informative image regions.</p><p>· In healthcare, it can connect measurements, history, symptoms, and test results.</p><p>· Recommendation systems use it to model relationships among users, items, and past behaviour.</p><p>· Scientific AI can use it to represent interactions among molecules, proteins, and other structured data.</p><h3>A Unifying Perspective</h3><p>Throughout this series, we have gradually built a mental model of how modern AI works:</p><p>· AI Models are parameterised mathematical functions.</p><p>· Learning updates the model parameters (θ).</p><p>· Embeddings represent knowledge.</p><p>· Attention refines embeddings by learning relationships</p><p>· Transformer repeatedly refines those embeddings through multiple layers.</p><p>Understanding relationships transformed modern AI, but it is only part of intelligence. Humans can also imagine future possibilities, predict outcomes, and plan before acting. Can AI learn to do the same?</p><p>That is the question we will explore in the next article on World Models.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce7f42799eca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Hidden Language of AI: Understanding Embeddings]]></title>
            <link>https://medium.com/@cher.lim8/the-hidden-language-of-ai-understanding-embeddings-178563df00fa?source=rss-9836afe3dfb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/178563df00fa</guid>
            <category><![CDATA[transfer-learning]]></category>
            <category><![CDATA[world-models]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[embedding]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Cher Lim]]></dc:creator>
            <pubDate>Wed, 08 Jul 2026 09:11:09 GMT</pubDate>
            <atom:updated>2026-07-08T09:11:09.453Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How AI transforms words, images and documents into meaning.</em></p><p><strong><em>AI Sense-Making Series. Article 3</em></strong></p><p>This article is part of the <strong>AI Sense-Making Series</strong>, where we explore the key ideas behind modern AI — one concept at a time.</p><p>Previous article:</p><p><strong>Article 2 — The hidden process behind AI learning</strong></p><p>How does an AI model learn from mistakes?</p><p><a href="https://medium.com/@cher.lim8/changing-%CE%B8-the-hidden-process-behind-ai-learning-4daaf8175afd?sharedUserId=cher.lim8">Read it here</a></p><h3>Introduction</h3><p>GenAI tools appears to understand language. But inside the computer there are no words, only numbers.</p><p>So where does this semantic understanding come from?</p><p>In Article 1, I introduced the predictive model: y = fθ(x)</p><p>This simple equation tells us that an AI system learns a function that maps inputs to outputs.</p><p>In Article 2, I explained how the model learns by adjusting its parameters θ through gradient descent and backpropagation. We saw that deeper networks are harder to train — but also more rewarding. The reward is not just better predictions, but richer internal representations.</p><p><strong>This raises a natural question:</strong></p><p>If AI simply adjusts numerical parameters, what does it actually build inside itself?</p><p>The answer lies in one of the most important concepts in modern AI: <strong>Embeddings</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*T7YYqKR3tgpC4B0U5j3pEQ.png" /></figure><h3>What Is an Embedding?</h3><p>An embedding is a numerical representation that captures the important characteristics of an object. The object could be a word, a sentence, an image, or a customer.</p><p>The goal is to convert complex real-world objects into vectors that preserve meaningful relationships. Objects that are similar should have similar embeddings; objects that are different should have different embeddings.</p><p>But where do these numbers come from?</p><h3>The Embedding Matrix</h3><p>In many AI models, embeddings are stored in a large table called the <strong>embedding matrix</strong>, usually denoted by <strong>E</strong>.</p><p>Each row of the matrix corresponds to one word (or token) in the vocabulary. Looking up a word simply retrieves its embedding vector from this matrix.</p><p>Initially, every row contains random numbers because the model has not learned any relationships yet.</p><p>But how does the model learn meaningful embeddings?</p><p>Imagine the model is repeatedly trained on sentences such as:</p><p>· The dog chased the ball.</p><p>· The cat chased the ball.</p><p>Both sentences appear in very similar contexts. To predict the next word accurately, the model gradually learns that <strong>“dog”</strong> and <strong>“cat”</strong> should have similar internal representations.</p><p>As Gradient Descent (introduced in Article 2) updates the embedding matrix to minimize prediction errors, the embeddings evolve from random vectors into meaningful representations.</p><p>For example:</p><ul><li>Dog → [0.21, -0.44, 0.92, …]</li><li>Cat → [0.19, -0.40, 0.89, …]</li><li>Car → [-0.73, 0.65, -0.11, …]</li></ul><p>Notice that the embeddings for <strong>Dog</strong> and <strong>Cat</strong> become much more similar than the embedding for <strong>Car</strong>, because the model has learned that dogs and cats often appear in similar linguistic contexts.</p><p>Over time, the embedding matrix becomes much more than a lookup table. It becomes a learned map of concepts, where similar ideas are naturally organised close together.</p><h3>Measuring Similarity: The Geometry of Meaning</h3><p>If embeddings are coordinates in space, how do we measure if two concepts are “close”?</p><p>In high-dimensional spaces, we rarely use simple straight-line distance (Euclidean distance). Instead, we measure the <strong>angle</strong> between two vectors using <strong>Cosine Similarity</strong>.</p><p>The formula is:</p><p>· Similarity(A, B) = (A · B) / (||A|| × ||B||)</p><p>· A · B is the dot product (how much the vectors point in the same direction).</p><p>· ||A|| is the length (magnitude) of vector A.</p><p>Why angle instead of distance? Because we are interested in <strong>meaning</strong>, not frequency. The word “The” might appear 1,000 times in a text (large magnitude), while “Quantum” appears once (small magnitude). Cosine similarity normalizes for this, focusing purely on the <strong>direction of the meaning</strong>. If the angle is small (similarity ≈ 1), the concepts are related. If the angle is 90° (similarity ≈ 0), they are unrelated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*CzcQNRO8hr7vRSo-hWGeYg.png" /></figure><h3>Beyond Text: Embeddings in Vision</h3><p>So far, we have discussed word embeddings. The same idea applies to images.</p><p>Consider a Convolutional Neural Network (CNN) trained to recognize objects. As an image passes through successive convolutional layers, the network generates increasingly abstract <strong>feature maps</strong>, gradually transforming raw pixels into edges, shapes, object parts and higher-level visual features.</p><p>Before making its final prediction (e.g., <strong>“Dog”</strong>), the CNN typically applies <strong>Global Average Pooling</strong> or <strong>Flattening</strong> to convert these feature maps into a single 1D vector. This vector is called the <strong>global image embedding (or feature vector)</strong> because it summarizes the visual content of the entire image.</p><p>The dense classification layers then use this embedding to predict the object class.</p><p>However, if we remove the classification head, the global image embedding remains a powerful representation of the image. Similar images produce similar embeddings, allowing applications such as <strong>Image Search</strong>, <strong>Transfer Learning</strong>, and <strong>Image Clustering</strong> to compare images directly using <strong>Cosine Similarity</strong>, without requiring the model to output class labels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*YXMIzVfsvYOafjqB-nPt-Q.png" /></figure><h3>Beyond Objects: Embeddings Can Represent Situations</h3><p>So far, we have looked at embeddings of individual objects such as words and images.</p><p>Modern AI goes one step further.</p><p>Instead of representing a single object, an embedding can represent an entire situation.</p><p>Imagine a photograph of a child kicking a football.</p><p>Rather than memorizing millions of pixel values, an AI model can encode the entire scene into a single embedding that captures the essential information, such as:</p><ul><li>the child</li><li>the football</li><li>the direction of movement</li><li>the surrounding environment</li><li>the relationships between these elements</li></ul><p>The embedding is no longer describing just one object.</p><p>It is describing the state of the world at that moment.</p><p>This idea is becoming increasingly important in modern AI.</p><p>If one embedding can represent the current situation, it is natural to ask whether another embedding could represent what the situation might become next.</p><p>This simple idea will eventually lead us to one of the newest directions in AI research: learning models that predict future embeddings rather than future pixels.<strong> </strong>One example is the <strong>Joint Embedding Predictive Architecture (JEPA),</strong>proposed by Yann LeCun.</p><h3>A Unifying Perspective</h3><p>The first three articles in this series can now be viewed as a connected story.</p><p>· Article 1: What is learned? A predictive model (<strong>y = fθ(x)</strong>).</p><p>· Article 2: How is it learned? Gradient-based optimization (<strong>θnew = θold — η ∂L/∂θ</strong>).</p><p>· Article 3: What is being learned internally? Embeddings — the hidden geometric representations that allow AI systems to capture similarity, structure, and meaning.</p><p><strong>Embeddings are not the final output of AI. They are the internal language that AI uses to think before producing an answer.</strong></p><h3>Summary</h3><p>Modern AI systems do not operate directly on words, images, or documents. They operate on embeddings.</p><p>Through gradient-based learning, neural networks gradually organise these embeddings into a high-dimensional space where similar concepts are positioned close together. Whether the input is a word, an image, or an entire scene, the network transforms it into an embedding that captures its essential characteristics.</p><p>Viewed from this perspective, embeddings can be seen as the hidden language of modern AI.</p><p>They allow AI systems not only to compare words, images, and documents, but also to build increasingly rich representations of the world itself.</p><p>The next question is therefore no longer <strong>what an embedding is</strong>, but <strong>how modern AI systems manipulate embeddings to understand context, reason about relationships, and eventually predict what may happen next.</strong></p><p>In the next article, we begin with the Transformer, whose attention mechanism allows embeddings to interact with one another.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=178563df00fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Changing θ: The Hidden Process Behind AI Learning]]></title>
            <link>https://medium.com/@cher.lim8/changing-%CE%B8-the-hidden-process-behind-ai-learning-4daaf8175afd?source=rss-9836afe3dfb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4daaf8175afd</guid>
            <category><![CDATA[deep-learning-course]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Cher Lim]]></dc:creator>
            <pubDate>Wed, 17 Jun 2026 10:21:42 GMT</pubDate>
            <atom:updated>2026-07-08T08:53:54.819Z</atom:updated>
            <content:encoded><![CDATA[<p>AI Sense-Making Series. Article 2 — Learning from mistakes</p><p>Previous article:</p><p><strong>Article 1 — One Formula, Many Models</strong><br>A unifying view of predictive models through the framework y = fθ(x)</p><p>Read it here: <a href="https://medium.com/@cher.lim8/one-formula-many-models-e220a530f014">https://medium.com/@cher.lim8/one-formula-many-models-e220a530f014</a></p><h3>Introduction</h3><p>In the previous article, I introduced a unifying view of predictive models.</p><p>Many AI systems can be viewed through a common mathematical framework: y = fθ(x)</p><p>An input x is transformed by a parameterized function f to produce an output y. The parameters θ determine how the function behaves.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*_v877jIW5xpRc0wsrC4iBA.png" /></figure><p>During training, the model makes predictions, compares those predictions with the ground truth, and computes a loss that measures the prediction error. Backpropagation then computes the gradient of the loss with respect to the model parameters ∂L/∂</p><p>. Gradient Descent uses this information to update θ, gradually improving the model’s predictive accuracy. Training therefore becomes a search for parameter values that allow the model to produce useful predictions.</p><p>Although different AI models employ different architectures, they learn through the same fundamental principle: repeatedly measuring prediction errors and adjusting θ to reduce those errors.</p><p>This article explores how that process works.</p><h3>Measuring Mistakes: Loss Functions</h3><p>To improve a model, we first need a way to measure how wrong it is. This is the role of the loss function.</p><p>A loss function assigns a numerical penalty to incorrect predictions.</p><p>· Large errors produce large losses and require larger corrections.</p><p>· Small errors produce small losses and require only minor corrections.</p><p>Different tasks often require different loss functions.</p><h3>Regression Problems</h3><p>For regression tasks, where the objective is to predict a continuous value such as a stock price or temperature, one of the most common loss functions is Mean Squared Error (MSE).</p><p>MSE = (1/N) Σ(yi − ŷi)²</p><p>where</p><p>· N: Number of input samples</p><p>· yi: The correct answer for sample i</p><p>· ŷi: The model’s prediction for sample i</p><p>The square serves two purposes.</p><p>1. It prevents positive and negative errors from cancelling one another.</p><p>2. It penalizes large errors more heavily than small ones.</p><p>As a result, the model is encouraged to reduce large prediction errors.</p><h3>Classification Problems</h3><p>Classification tasks require a different perspective.</p><p>Now imagine a medical AI that looks at chest X-rays and decides: “Does this patient have pneumonia?” Assuming the ground truth is patient has pneumonia. Below shows possible AI model predictions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*jXctGl80Z9YI-hFZTA5y9g.png" /></figure><p>Cases 1 and 2 correctly predict pneumonia, but Case 1 is more confident. In Case 3, the model predicts <strong>No Pneumonia</strong> with high confidence, making it a <strong>confidently</strong> <strong>wrong</strong> prediction.</p><p>Cross-Entropy is a loss function that handles this situation well because it assigns large penalty to confidently wrong predictions. This is what we want during training.</p><h3>Why Use Cross-Entropy Instead of MSE for Classification?</h3><p>This is a common question. Let’s explain it — with just a bit of math to show <em>why</em>.</p><h3>How a Classification Model Works</h3><p>The answer lies in the gradients used during training.</p><p>A classification model doesn’t directly output a probability. Instead, it first produces a raw score <strong>z</strong>, then converts it to a probability <strong>p</strong> using a function called the <strong>Sigmoid</strong>:</p><p>p = σ(z) = 1/(1 + e⁻ᶻ)</p><p>Think of <strong>z</strong> as the model’s “raw scores.” A large positive <strong>z</strong> means “very confident yes.” A large negative <strong>z</strong> means “very confident no.”</p><p>The Sigmoid function simply turns raw scores into a probability between 0 and 1.</p><p>When the model makes a mistake, we need to figure out how much to adjust <strong>z</strong> (the raw score). This correction signal is called the <strong>gradient</strong>, written as <strong>∂L/∂z</strong> — which you can read as: <em>“How much does the loss change when we tweak z?”</em></p><p><strong>MSE</strong></p><p>· Loss function: L = (p − y)²</p><p>· Gradient ∂L/∂z = 2(p − y) p (1 − p)</p><p>· When confidently wrong, ∂L/∂z shrinks to near zero.</p><p><strong>Cross-Entropy</strong></p><p>· Loss function: L = -[y log (p) + (1-y) log(1-p)]</p><p>· Consider ground truth is Pneumonia i.e., y=1, then L = -y log (p)</p><p>· Gradient ∂L/∂z = p — y</p><p>· When confidently wrong, ∂L/∂z stays strong.</p><p>Notice that the MSE gradient contains an additional factor p (1-p). When the model becomes very confident (p = 0 or 1), this factor becomes small and weakens the correction signal.</p><p>Cross-Entropy avoids this shrinking effect and therefore preserves a <strong>stronger learning signal </strong>when the model is confidently wrong.</p><h3>From Loss Functions to Optimisation</h3><p>Once a loss function has been defined, training becomes an optimisation problem. <strong>Find values of θ that minimize the loss.</strong></p><h4>A Helpful Mental Image</h4><p>Imagine standing on a hilly landscape. Your goal is to find the lowest valley.</p><ul><li><strong>High hills</strong> = Large errors (bad predictions)</li><li><strong>Low valleys</strong> = Small errors (good predictions)</li></ul><p>Training is like walking downhill, step by step, until you reach the bottom.</p><h3>The Central Equation of Learning</h3><p>Most of the ideas in this article can be understood through a single equation:</p><p>θnew = θold − η (∂L/∂θ)</p><p>where:</p><p>• θ = model parameters</p><p>• L = loss function</p><p>• ∂L/∂θ = gradient of the loss with respect to the parameters</p><p>• η = learning rate</p><p><strong>New parameters = Old parameters — (Step size × Direction to improve)</strong></p><h3>Two Steps That Make Learning Happen</h3><p><strong>Step 1</strong>: Work backwards from error to figure out which parameter contributed to the error and by how much.</p><p>· Backpropagation computes the gradient of loss ∂L/∂θ</p><p><strong>Step 2</strong>: Turn each parameter slightly in the direction that reduces the error.</p><p>· Gradient descent updates the parameters θnew = θold − η (∂L/∂θ)</p><h3>Learning Rate η</h3><p>The learning rate η controls how much to adjust the parameter each time:</p><p>· If η is too small, learning progresses slowly.</p><p>· If η is too large, updates may overshoot good solutions and become unstable.</p><p>It is important not to confuse learning rate with the shape of the loss landscape.</p><p>· The gradient determines where we move.</p><p>· The learning rate determines how far we move.</p><h3>A Unifying Perspective</h3><p>Although AI models may appear very different, their learning processes share a common structure.</p><p>· For a linear regression model, θ represents a set of weights.</p><p>· For a decision tree, θ represents split variables and threshold values.</p><p>· For a neural network, θ represents millions of weights and biases.</p><p>· For a transformer-based large language model, θ represents billions of learned parameters.</p><p>The details differ, but the underlying objective remains the same.</p><p><strong>Find parameter values that reduce prediction errors.</strong></p><h3>Key Takeaways</h3><p>1. Loss functions measure error.</p><p>2. Backpropagation computes the gradient: ∂L/∂θ</p><p>3. Gradient Descent updates parameters.</p><p>4. The learning rate (η) balances speed and stability.</p><p>5. All AI models learn the same way.</p><h3>Summary</h3><p>In the previous article, I argued that many AI models can be viewed as different implementations of a parameterized function: y = fθ(x)</p><p>In this article, I focused on how the parameters θ are learned.</p><p>1. Loss functions measure prediction errors.</p><p>2. Backpropagation computes gradients.</p><p>3. Gradient Descent uses those gradients to update the parameters.</p><p>As neural networks become deeper, the process of propagating gradients through many layers introduces additional challenges. These challenges motivated innovations such as ReLU activation functions, residual connections, and modern network architectures.</p><p>Understanding these developments requires a closer look at deep neural networks, which will be the focus of the next article in the AI Sense-Making Series.</p><h3>AI Sense-Making Series Roadmap</h3><p>✓<strong>Article 1</strong>: One Formula, Many Models <a href="https://medium.com/@cher.lim8/one-formula-many-models-e220a530f014">https://medium.com/@cher.lim8/one-formula-many-models-e220a530f014</a></p><p>✓<strong>Article 2</strong>: Changing θ: The Hidden Process Behind AI Learning</p><p>→<strong>Coming next: Article 3</strong> — Deep Networks and the Challenge of Learning</p><p><strong>Future topics may include:</strong></p><p>• Bayesian Thinking in AI</p><p>• Graphs and Relationships</p><p>• Logic and Reasoning</p><p>• Search and Planning</p><p>• Reinforcement Learning</p><p>• Large Language Models</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4daaf8175afd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One Formula, Many Models]]></title>
            <link>https://medium.com/@cher.lim8/one-formula-many-models-e220a530f014?source=rss-9836afe3dfb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e220a530f014</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning-course]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science-courses]]></category>
            <dc:creator><![CDATA[Cher Lim]]></dc:creator>
            <pubDate>Fri, 12 Jun 2026 07:40:50 GMT</pubDate>
            <atom:updated>2026-06-17T10:29:04.665Z</atom:updated>
            <content:encoded><![CDATA[<p><em>AI Sense-Making Series. Article 1 — A Unifying View of AI</em></p><h3>Introduction</h3><p>In studying and teaching AI, I have found that many apparently different models can be understood through a common mathematical framework.</p><p>Linear regression, decision trees, random forests, neural networks, deep learning architectures, and large language models are often introduced as distinct topics. Their implementations differ substantially, yet they share a common starting point:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/1*ZBxblIKK2O-1EkacPA6sFw.png" /></figure><p>This deceptively simple equation captures the essence of predictive modelling. An input (x) is transformed by a function (f), parameterized by a set of learnable parameters (θ), to produce an output (y).</p><p>The purpose of this article is not to claim that all AI models are identical. Rather, it is to show that many predictive models can be understood as different ways of implementing the same fundamental idea: learning a mapping from inputs to outputs.</p><p>To explore this idea, I will use the 5W1H framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*M30fK1cX3gOKlgBks5_kFw.png" /></figure><h3>The Core Idea</h3><p>This equation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/1*ZBxblIKK2O-1EkacPA6sFw.png" /></figure><p>has four important components:</p><p>· x = Input e.g., Pixel values, Customer records, Sensor measurements</p><p>· y = Prediction e.g., Class label, Price estimate, Probability scores, Recommendation</p><p>· f = Mapping function, e.g., Linear model, Decision tree, Neural network</p><p>· θ = Model parameters, e.g., Weights, Biases, Thresholds, Tree structure</p><p>Machine learning becomes the process of discovering suitable values of θ</p><p>for a chosen function family.</p><h3>Different Choices for the Function</h3><p>The equation itself does not specify what form the function should take. Different AI models correspond to different choices for (f).</p><h3>Linear Models</h3><p>Linear regression represents the simplest case.</p><p>y = wᵀx</p><p>Here, (w) is simply a specific instance of the more general parameter set θ.</p><p>The prediction is a weighted sum of the input features.</p><p>Linear models are attractive because they are computationally efficient, easy to interpret, and often surprisingly effective.</p><p>Their primary limitation is that they can only represent linear relationships.</p><h3>Decision Trees</h3><p>A different approach is to represent the function as a sequence of decisions. Each path through the tree corresponds to a prediction.</p><p>A simple decision tree may be written as a piecewise function. Example:</p><p>f(x) = {1 if x &lt; 30, 0 otherwise}</p><p>More complex trees partition the input space into multiple regions; each associated with a prediction. Conceptually, the decision tree is still a function that maps an input x to an output y. In this case, θ consists of split variables, threshold values, and tree structure.</p><h3>Ensemble Methods</h3><p>Instead of relying on a single model, ensemble methods combine the predictions of multiple models.</p><p>The intuition is often described as the wisdom of crowds: multiple imperfect models can collectively produce a more reliable prediction than any individual model.</p><p>A single model uses</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/1*ZBxblIKK2O-1EkacPA6sFw.png" /></figure><p>An ensemble combines multiple models</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/186/1*JU0LxwXbd8YrTHiKHQhXHg.png" /></figure><p>where each (fi) represents an individual model. This averaging formulation is commonly used in regression problems.</p><p>For classification, aggregation is typically performed using majority voting rather than averaging.</p><p>The power of an ensemble comes from the fact that different models often make different mistakes. When combined, those errors can partially cancel one another.</p><h3>Random Forests</h3><p>Random Forest is the most widely used ensemble method.</p><p>Each decision tree is trained on a different sample of the training data and a different subset of features.</p><p>Prediction becomes f(x) = 1/N ∑Ti​(x) where Ti is the i-th decision tree.</p><p>Although each tree is relatively simple, the ensemble can approximate highly complex functions.</p><h3>Neural Networks</h3><p>Neural networks introduce non-linearity through activation functions σ.</p><p>A simple two-layer neural network can be written as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*Y7VDGDuLcoFcMoqR8hb5mQ.png" /></figure><p>The non-linearity σ is essential because, without it, multiple layers would collapse into a single linear transformation.</p><h3>Deep Neural Networks</h3><p>Deep learning extends the same principle by stacking many hidden layers. It can be viewed as repeated composition of multiple transformations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*l4D2zzmi2IA4accw0MInrw.png" /></figure><p>Each layer transforms the representation produced by the previous layer.</p><p>A useful intuition is:</p><p>· Early layers learn simple patterns</p><p>· Intermediate layers learn structures</p><p>· Higher layers learn concepts and abstractions</p><p>Although the architecture becomes increasingly sophisticated, it can still be viewed abstractly as y = fθ(x).</p><h3>A Unifying Perspective</h3><p>Despite their apparent differences, all of these models can be understood as alternative ways of constructing the mapping function.</p><p>· Linear Regression: Global linear equation</p><p>· Decision Tree: Piecewise conditional function</p><p>· Random Forest: Ensemble of piecewise functions</p><p>· Neural Network: Layered transformation</p><p>· Deep Neural Network: Deep composition of transformations</p><p>· Transformer: Deep composition with attention mechanisms</p><p>Modern transformer-based large language models can also be viewed as highly parameterized implementations of fθ(x), where the function is realised through deep attention and feedforward transformations.</p><p>There is no universally superior function family. Many developments in AI can be interpreted as attempts to construct increasingly powerful and flexible function approximators.</p><h3>Assumptions</h3><p>Every predictive model embeds assumptions.</p><p>· The input contains relevant information.</p><p>· Training and deployment data are sufficiently similar.</p><p>· A learnable relationship exists.</p><p>· Labels are reasonably accurate.</p><p>· Future data resemble past observations.</p><p>Many predictive models perform poorly not because the model is too simple, but because one or more of these assumptions no longer hold.</p><h3>What This Formula Cannot Do</h3><p>A standard predictive model has no memory of previous inputs. It does not plan. It does not explicitly reason about uncertainty. It does not understand causality. These limitations motivate additional frameworks such as transformers, reinforcement learning, Bayesian methods, and causal models.</p><h3>Summary</h3><p>My objective in this article is not to reduce AI to a single equation, but to provide a useful conceptual anchor.</p><p>Linear regression, decision trees, random forests, neural networks, deep learning architectures, and large language models may appear fundamentally different. From the view of y = fθ(x), they can be understood as different ways of implementing the same underlying idea: mapping inputs to outputs through a parameterized function.</p><p>The next natural question is how those parameters are learned. That question leads to optimization, loss functions, and Gradient Descent — the subject of the next article in the AI Sense-Making Series.</p><h3>AI Sense-Making Series Roadmap</h3><p>✓<strong>Article 1</strong>: One Formula, Many Models</p><p>✓<strong>Article 2</strong>: Changing θ: The Hidden Process Behind AI Learning <a href="https://medium.com/@cher.lim8/changing-%CE%B8-the-hidden-process-behind-ai-learning-4daaf8175afd">https://medium.com/@cher.lim8/changing-%CE%B8-the-hidden-process-behind-ai-learning-4daaf8175afd</a></p><p>✓<strong>Coming next: Article 3</strong> — Deep Networks and the Challenge of Learning</p><p>Future topics may include:</p><p>• Bayesian Thinking in AI</p><p>• Graphs and Relationships</p><p>• Logic and Reasoning</p><p>• Search and Planning</p><p>• Reinforcement Learning</p><p>• Large Language Models</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e220a530f014" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data augmentation using ACGAN]]></title>
            <link>https://medium.com/@cher.lim8/data-augmentation-using-acgan-2f69b8af270d?source=rss-9836afe3dfb3------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f69b8af270d</guid>
            <category><![CDATA[generative-adversarial]]></category>
            <dc:creator><![CDATA[Cher Lim]]></dc:creator>
            <pubDate>Tue, 05 Apr 2022 09:55:07 GMT</pubDate>
            <atom:updated>2022-04-05T09:55:07.894Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ags4Bo7LHsQNcAW1z629jQ.png" /><figcaption>Fig 1. ACGAN implementation</figcaption></figure><p>A common challenge in machine learning tasks is the access to sufficiently large training dataset that is unbiased and meaningful to the problem at hand. A machine learning model trained with limited data will have great difficulty in adapting to previously unseen data. Data augmentation techniques that generate new and different examples to the existing training dataset will be very useful to improve the performance and outcome of the machine learning models.</p><p>This project was designed to explore the use of Generative Adversarial Networks (GAN) as a tool to augment existing data. The target application for this project is a handwritten digit recognition classifier, using the Keras MNIST training dataset. The methodology includes augmenting the original dataset using geometric transformations (flip, rotate and shift), train with the classifier and compare its performance against a retrained classifier from the GAN’s synthetic output blended with the original training data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4BcgDO3tLlti3lxautiVEw.jpeg" /><figcaption>Fig 2. Testing methodology</figcaption></figure><p>The GAN model architecture follows the principles of a conditional GAN that requires the Discriminator to predict the class label of a given input. Several experiments were carried out to determine the impact of the Activation functions (Relu vs Leaky Relu), complexity of Discriminator and Generator on the GAN model performance.</p><p>Results show that for a GAN model to generate plausible synthetic images, the Discriminator accuracy should ideally be around 50%, while the Generator loss should be as low as possible (close to zero ideally).</p><p>The final GAN model used in this project is able to produce recognizable synthetic images after 1500 epochs. It is important to note that quality of output images does not necessarily improve with more epochs.</p><p>Following the completion of the retrained classifiers for both datasets, a GUI (using Gradio) was designed to perform real-life user tests. Basic image pre-processing (using OpenCV) was done to center the user input in the canvas.</p><p>Real life user tests yielded the following observations:</p><p>• Classifier-A (original MNIST dataset) is capable of recognizing majority of the inputs, with a just little difficulty when certain digits are rotated by a large angle.</p><p>• Classifier-B (Geometrically transformed MNIST dataset) able to recognize rotated inputs in most cases, for example when inputs are rotated clockwise or anti-clockwise.</p><p>• Classifier-C (GAN dataset) performs better in recognizing botched and ambiguous inputs.</p><ul><li>Although the GAN model outputs (fake digits) are not stylistically distinctive from the original dataset, it is observed to have encouraged the model’s inference ability when inputs are ambiguous.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7vTyGrNZFl3jk4SlF5H7wA.jpeg" /><figcaption>Fig 3. Real life user tests using Gradio</figcaption></figure><p>This project is a preliminary attempt to understand the capability of GAN in data augmentation. Further work is necessary to explore how to transfer various numeral fonts to the training dataset in order to increase the probability of generating novel outputs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f69b8af270d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>