<?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 Chinmay Mittal on Medium]]></title>
        <description><![CDATA[Stories by Chinmay Mittal on Medium]]></description>
        <link>https://medium.com/@mittal.chinmay?source=rss-731ab97f7bb1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yrEoMnHGdhG6PF5kExtHDg.jpeg</url>
            <title>Stories by Chinmay Mittal on Medium</title>
            <link>https://medium.com/@mittal.chinmay?source=rss-731ab97f7bb1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:43:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mittal.chinmay/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[Papers Explained: Logic-LM Empowering Large Language Models with Symbolic Solvers for Faithful…]]></title>
            <link>https://medium.com/@mittal.chinmay/papers-explained-logic-lm-empowering-large-language-models-with-symbolic-solvers-for-faithful-57afd0f7f039?source=rss-731ab97f7bb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/57afd0f7f039</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[reasoning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[research]]></category>
            <dc:creator><![CDATA[Chinmay Mittal]]></dc:creator>
            <pubDate>Tue, 19 Dec 2023 14:36:28 GMT</pubDate>
            <atom:updated>2023-12-19T14:36:28.047Z</atom:updated>
            <content:encoded><![CDATA[<h3>Papers Explained: Logic-LM Empowering Large Language Models with Symbolic Solvers for Faithful Logical Reasoning</h3><h3><strong>Background</strong></h3><p><strong>Large Langauge Models</strong></p><p>Language Models are Machine Learning models aimed at understanding Natural Language. A common architecture for these models is to predict the next word given some context. People have tried to make these models Large and train these Large Language Models on massive datasets. Studies have noticed that LLMs have emergent abilities with scale meaning there are abilities that small Language Models don’t possess but are possessed by Large Language Models. Essentially as you make a model very good at filling out blanks in massive datasets crawled from the web, it not only gets good at understanding Natural Language but also eventually gets good at other things such as Maths / Science / Reasoning, etc. Interestingly these models also get better when you provide them in-context examples through prompts without any finetuning.</p><p><strong>Reasoning with LLMs</strong></p><p>One important emergent ability in LLMs is that of reasoning. LLMs are good at reasoning tasks and can improve with prompting strategies such as Chain of Thought prompting. But LLMs remain black-box probabilistic models trying their best to predict the next word correctly. It so happens that in this process of predicting the next word correctly, they end up solving more complicated tasks such as reasoning. There are no guarantees that these sequences of tokens generated to reach the final answer are coherent. There is no way to guarantee the correctness/faithfulness of the underlying process in strategies such as Chain of Thought prompting. LLMs are fundamentally Natural Language models, while they can do reasoning to some extent, they don’t provide any guarantees for the kind of reasoning they do. They often end up making mistakes and they still struggle with more complicated forms of non-linear reasoning involving planning and search.</p><p><strong>Classical AI and Symbolic Solvers</strong></p><p>In classical AI, logic plays a fundamental role in representing and reasoning about knowledge and information. Classical AI systems often rely on symbolic logic, such as propositional logic and first-order logic, to perform reasoning tasks. These logical systems provide a structured and formal framework for representing facts, rules, and relationships in a way that enables faithful and precise reasoning.</p><p>Unlike LLMs, which primarily rely on statistical patterns learned from vast amounts of text data, classical AI systems use explicitly defined rules and logical deductions to derive conclusions. This explicit rule-based approach allows classical AI to perform faithful reasoning because it ensures that conclusions are based on well-defined logical principles and accurately reflect the information provided.</p><p>A symbolic solver is a software tool or system that is designed to perform symbolic computations and manipulate mathematical expressions or equations in their symbolic form. Symbolic solvers are closely intertwined with logic and classical AI, serving as tools for working with symbolic representations of knowledge, performing logical inference, solving complex problems, and building expert systems. Think of Symbolic solvers as very smart calculators working with well-defined formal languages ( very similar to programming languages) performing deterministic algorithms on programs specified in these languages to answer reasoning questions (specified in these languages). These algorithms involve logical deductions from facts, searching for potential answers based on pre-existing knowledge, etc.</p><p>Symbolic Solvers work with Symbolic Languages such as Prolog. These Languages are Formal Languages with well-defined syntax (rules that tell you how to write or say things correctly so that others can understand) and semantics (meaning of these rules).</p><h3>Logic-LM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*KYyo_YT0FqMV6_2uLwjErg.png" /><figcaption>Logic-LM Framework</figcaption></figure><p><strong>Overview</strong></p><p>Logic-LM is a novel framework to combine LLMs and Symbolic Solvers for faithful Logical Reasoning. Instead of making the LLM solve the reasoning problem (something it is not that good at inherently), Logic-LM introduces a new paradigm where the LLM represents the problem in Symbolic Language and the Symbolic Solver performs the actual reasoning on this Symbolic representation. The LLM translates the problem from Natural Language to a Symbolic Language. This is essentially a Machine Translation task (something LLMs are very good at), which purely involves understanding Language and does not involve reasoning. The Symbolic Solver does the actual reasoning which involves planning, searching, logical deductions, arithmetic, etc. The Symbolic Solver is an algorithm, that provides correctness guarantees, it is efficient, and we understand very well what is doing exactly and how it is answering questions we pose it.</p><p>The reason it can do so is it works on abstract symbols and abstract representations with well-defined syntax and semantics for which making rule-based approaches is easy. These symbolic solvers can’t be made to work on Natural Language, because it is inherently ambiguous and unstructured, unlike Symbolic Languages. Working with Natural Language is something that requires experience (in other words learning from data), it is not possible to make rule-based approaches that work well with Natural Language. LLMs on the other hand have learnt from experience on massive datasets and have become very good at understanding Natural language. Logic-LM is a novel paradigm to combines the complementary strengths of two important ideas in Classical AI (Symbolic Solvers) and Modern AI (LLMs).</p><p>Logic-LM is aimed at answering Logical Reasoning Questions posed in Natural Language. The question is accompanied by a Goal which can be for example a Multiple-Choice Question.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*up9BLdJdTtNKr6H-E_OsUg.png" /><figcaption>Illustration for a Logical Reasoning Question in Natural Language with the associated Context and Goal</figcaption></figure><p><strong>Problem Formulation</strong>: The goal of this stage is to translate the Natural Language Question (including both the context and query) into a Symbolic Representation. The LLM is prompted to make this conversion. The LLM is provided with detailed instructions about the Symbolic Language it has to use including details such as the grammar of the the Symbolic Language. The LLM also leverages in-context learning meaning it is given some demonstrations that show how this transformation is achieved for other related problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*M276RU23X1bYXsr-Jky3Xw.png" /><figcaption>A sample demonstration given to the LLM including details about the Symbolic Language</figcaption></figure><p>The result of this stage is the question including the goal and the context both translated to a Symbolic Representation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*si_0FBI6u25rg72UeLkq1A.png" /><figcaption>Symbolic Representation of the Natural Language Question</figcaption></figure><p><strong>Symbolic Reasoner: </strong>A Symbolic Solver performs reasoning on the resulting facts to answer the Query. The result is the answer to the Query in Symbolic Representation</p><p><strong>Result Interpretation: </strong>This Symbolic Result (in Symbolic Language) is then interpreted to generate the answer to the original query (in Natural language). This can be done using rule-based approaches or another LLM call depending on the complexity of this conversion and the nuances of the Symbolic Representation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*mHcBddrBhvTo3mQe8rX6pA.png" /><figcaption>The Symbolic Solver generates the answer in Symbolic Language (Entailment) which is converted to Natural Language (true)</figcaption></figure><p><strong>Self-Refinement: </strong>For complicated programs, the LLM may struggle to generate a Symbolic Representation that is syntactically correct. For such cases, self-refinement is introduced which prompts the LLM what is wrong in the Symbolic Representation (error messages from the Symbolic Solver). Along with a few shot demonstrations showing how common errors can be fixed.</p><p><strong>Other details:</strong></p><p>The paper evaluates Logic-LM on several datasets involving different kinds of reasoning. For each dataset, they choose a Symbolic language suited to the kind of reasoning involved in the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*El-2vj35z9cHLhMDhtIB5w.png" /><figcaption>Different kinds of Reasoning, Symbolic Representations, Solvers, and Datasets are explored in the paper.</figcaption></figure><p>The paper shows that Logic-LM is better than Standard LLM prompting and Chain of Thought prompting.</p><p>The paper also shows that self-refinement is effective and with several rounds of refinement the executable rate improves (meaning more problems are converted to syntactically correct representations)</p><p>The paper shows that Logic-LM is robust (meaning it is not affected much by the difficulty of the reasoning problems) whereas the performance of other techniques degrades with an increase in the difficulty of reasoning.</p><p>Check out the <a href="https://arxiv.org/pdf/2305.12295.pdf">paper</a> and the <a href="https://github.com/teacherpeterpan/Logic-LLM">code</a> for more details.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57afd0f7f039" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Bias-Variance Tradeoff: A Mathematical Approach]]></title>
            <link>https://medium.com/@mittal.chinmay/the-bias-variance-tradeoff-a-mathematical-approach-cbf861cffc6?source=rss-731ab97f7bb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbf861cffc6</guid>
            <category><![CDATA[bias-variance-tradeoff]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Chinmay Mittal]]></dc:creator>
            <pubDate>Sat, 08 Apr 2023 15:13:28 GMT</pubDate>
            <atom:updated>2023-04-08T15:13:28.060Z</atom:updated>
            <content:encoded><![CDATA[<p>The bias-variance tradeoff is<strong> <em>the central dilemma</em></strong> when it comes to learning from data. Several resources do a great job of explaining the tradeoff intuitively, and while that intuition is more than enough to do Machine Learning in practice sometimes intuitions can lead us astray : (</p><p><strong>What does this article cover? </strong>This article aims to ground things in reality with t<strong>he Mathematics behind Bias and Variance</strong> : ) We’ll see what these things mean mathematically and the intuition behind why the tradeoff occurs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*iQ6j9k3HhgqboXS4JE1JTQ.jpeg" /></figure><p><strong>Prerequisites: </strong>I’ll assume you have some knowledge about Machine Learning and of course, I’ll assume you have some background with Probability and Algebra to understand the Maths.</p><p><strong>The Learning Problem</strong></p><p>Let&#39;s first define what the learning problem is. We have some <strong>target function ( <em>f </em>)</strong> that we wish to learn about from the data. That target function maps points from the <strong>input vector space (<em>X</em>)</strong> to the <strong>output vector space (<em>Y</em>)</strong>. We have an abundance of data points out there that capture <em>f </em><strong><em>(</em>data distribution)</strong><em>. </em>Any data point we have is of the form (x, y). x comes from space <em>X</em> and y comes from space <em>Y. </em>The data distribution is such that it captures <em>f. </em>We’ll assume that the distribution captures <em>f </em>exactly and that <em>f </em>is a deterministic target (each input has exactly one correct output). f(x) = y for any data point (x,y) from the distribution.</p><p>If we had all the data in the world (we know the data distribution exactly) for training our ML model then learning f becomes trivial !!! For any input point x we just see what the label was in our training dataset (we have all the data we need and hence x is in our dataset)</p><p>But the problem is that we don’t have all the data in the world. What we have is a few data points called the<strong> training dataset</strong> (sampled from the underlying data distribution). <strong>The learning problem thus becomes learning a good model ( <em>g </em>) for <em>f</em> based on the training data (</strong>learning the distribution from a few points sampled from that distribution)</p><p>And <strong>What is a good model</strong>? We expect the learnt model to predict values close to the true value for all inputs (input distribution). We define an <strong>error metric</strong> which quantifies how good a prediction is when compared to the actual value and what we want is for the prediction from our learnt model to have a low error value for all inputs (input distribution).</p><p>The<strong> out-of-sample error</strong> (test error) is the average (expectation) of the error over all data points (data distribution). The <strong>in-sample error</strong> (training error) is the average error on the training data points which are sampled from the data distribution.</p><p>Typically the way ML algorithms work is that we have a set of potential functions from which we choose one particular function <em>g</em> to model <em>f </em>using the training data. The set of functions from which we choose the eventual model is called the <strong><em>hypothesis set </em>(<em>H</em>)</strong>. For eg. in linear regression the hypothesis set is the set of all linear functions and an algorithm like gradient descent picks one linear function from this set using the training data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8h-yVKOnp81_hqbWLdJgTw.jpeg" /><figcaption>The Learning Problem</figcaption></figure><p>The Hypothesis set might not contain the target <em>f. </em>Also, the learning algorithm might pick a different model from the same hypothesis set depending on the training dataset. <em>gᴰ</em> refers to the model the algorithm learns using training dataset <em>D. </em>The out-of-sample error is defined as follows (it measures how good a proxy the learnt function is for the true target)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZsxr-_abDpM0kOKmjWO0g.jpeg" /><figcaption>The out-of-sample error for the function g learnt from the dataset D</figcaption></figure><p>To quantify how good an ML algorithm is we take the expectation of the out-of-sample error over all possible training datasets and we do a bit of algebra to arrive at the following equation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZlcnhhq6a2EHyb6QtxjCg.jpeg" /></figure><p>An important term highlighted in red is the <strong>average function </strong>learnt. Intuitively what it means is that each time we change the training dataset we learn a new function and if we take an average of all these different functions learnt as the training dataset changes what we get is the average function learnt.</p><p>Some more algebra to arrive at the mathematical form of bias and variance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Vsq_kio-o5mxCEiHogeLQ.jpeg" /><figcaption>Derivation of Bias and Variance</figcaption></figure><p>Interestingly the expected out-of-sample error (how well our model does) is exactly the bias plus the variance of our learning algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5PeDoYEC1abkLIC9OCIGyQ.jpeg" /></figure><p><strong>BIAS</strong></p><p>As seen from the formula the bias measures how good the average function learnt (average over all training datasets) is (when compared to the true target). Intuitively it thus refers to how biased the learning algorithm is from the true target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WGwEemt8HgjLMt1DfsxOIA.jpeg" /><figcaption>Mathematical Definition of Bias</figcaption></figure><p><strong>VARIANCE</strong></p><p>As the name suggests, it is the variance of the learnt function. Intuitively a higher variance means that the function learnt changes a lot (compared to the average function) when the dataset changes (there is a higher spread in the learnt functions)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LOKFc9QmftZLNT121QHinw.jpeg" /><figcaption>The mathematical definition of Variance</figcaption></figure><p><strong>The Bias-Variance Tradeoff</strong></p><p>What we want is an algorithm that has low bias i.e. the average function that the algorithm learns is not very far from the true target and has a low variance that is the function the algorithm learns does not change a lot when we change the training dataset and stays close to the average function learnt.</p><p>Hence an algorithm with low bias and low variance will learn an average function which is close to the target and also will be robust to the training dataset (the learnt functions don’t change a lot when the training dataset changes and stays close to the average function which is close to the target)</p><p>But such algorithms rarely exist in practice : ( and hence the tradeoff.</p><p><strong>Overly Complicated Hypothesis Sets</strong></p><p>When we choose an overly complicated Hypothesis set the average function learnt will be pretty close to the actual target. But the learnt function changes a lot as the training dataset changes (low bias and high variance) and while the average function is close to the target each of the individual functions learnt is not a good proxy for the target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7XpYnVak02IfRLP-E0JL_w.jpeg" /><figcaption>Extremely complicated models have high variance and low bias</figcaption></figure><p>On the other hand, if the hypothesis set is simple the learnt function does not change much when we change the training dataset but the average function learnt is not a good proxy for the true target (low variance and high bias).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H8Qyo48KRbRQSJA2Mt_VDg.jpeg" /><figcaption>Simple Models have low variance and high bias</figcaption></figure><p>The tradeoff is about finding the sweet spot. How complicated can our hypothesis set be so that it can capture the target (low bias) without having to pay the price that the learnt function might have overfitted the training dataset and be quite far from the target (high variance, each time we change the training dataset the learnt function changes a lot to fit the training data)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mnZfX3McyAeD9Ke3xsvDLw.jpeg" /><figcaption>The bias-variance tradeoff</figcaption></figure><p><strong>References</strong></p><p><a href="https://work.caltech.edu/telecourse">Learning From Data - Online Course (MOOC)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbf861cffc6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>