<?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 Arjun Patel on Medium]]></title>
        <description><![CDATA[Stories by Arjun Patel on Medium]]></description>
        <link>https://medium.com/@arjunkirtipatel_88473?source=rss-25da849639a5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GWA6X8WCgTMS19M1pRpEOQ.jpeg</url>
            <title>Stories by Arjun Patel on Medium</title>
            <link>https://medium.com/@arjunkirtipatel_88473?source=rss-25da849639a5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 15:24:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arjunkirtipatel_88473/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[How I used Cohere LLMs to up my flashcard game]]></title>
            <link>https://medium.com/@arjunkirtipatel_88473/how-i-used-cohere-llms-to-up-my-flashcard-game-48e65987c4d9?source=rss-25da849639a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/48e65987c4d9</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[study]]></category>
            <category><![CDATA[flashcards]]></category>
            <dc:creator><![CDATA[Arjun Patel]]></dc:creator>
            <pubDate>Tue, 21 Mar 2023 01:32:13 GMT</pubDate>
            <atom:updated>2023-03-21T01:32:13.465Z</atom:updated>
            <content:encoded><![CDATA[<p>LLMs + Flashcards = Awesome!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OnhEdGKz-7hN9TBd" /><figcaption>Study, study study. Photo by <a href="https://unsplash.com/@mattragland?utm_source=medium&amp;utm_medium=referral">Matt Ragland</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There’s a really uncomfortable truth I learned about studying back in college.</p><p>I absolutely dreaded taking tests. It was a significant source of anxiety for me, one that cost me hours of sleep and stomach pain. I used to pour over my textbooks, trying to force knowledge to stick inside my squishy brain.</p><p>Sometimes spending that time memorizing would help me, and sometimes I wouldn’t even have time for that. Either way, I’d still end up with the same terrible scores on my exams.</p><p>I realized that the amount of time I spent studying had almost no impact on my actual grades.</p><p>I needed to come up with a study method that would test exactly what I didn’t know, and examine specifically those pieces of knowledge to learn further.</p><p>Wait a second. Examine? Test? Yep, it turns out the only way to get better at taking tests is to…. take more tests. And the best way to do this is to make practice tests yourself in the form of your handy-dandy flashcards.</p><h3>My deceptively short shortcut to studying</h3><p>I turned to using a smart flashcard software called Anki to help me learn these concepts. Anki allows you to create flashcards virtually and even has algorithms to help you remember and learn concepts over time. After using Anki, I immediately started acing my classes! I did it! All was better.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*35DpRMh92UTXGlwo" /><figcaption>What I thought it would feel like using flashcards. Photo by <a href="https://unsplash.com/@nullplus?utm_source=medium&amp;utm_medium=referral">Razvan Chisu</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Just kidding, LMAO. If only it were that easy…</p><p>You see, Anki does two things really well:</p><ol><li>It allows you to quickly practice flashcards</li><li>It automates the process of memorizing them.</li></ol><p>But making flashcards and memorizing them does not make a good student! Practicing the concepts you actually need practice on is key. Anki does this by asking how well you actually remembered a flashcard definition right after you review it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*51nyy42niZwOYbXovIz3Jw.png" /><figcaption>The Anki feedback buttons. This is an old flashcard, hence the year value for “Easy”</figcaption></figure><p>There are four buttons that let you grade yourself on your ability to recall, and they determine how long the software will wait to show you the cards again.</p><blockquote><strong>You must complete this step honestly, otherwise, you won’t be presented with the cards you need to work on</strong></blockquote><p>And readers, it’s so hard, to be honest when you are running on little sleep, when you feel overconfident about your memorization skills, or when you lose patience staring at the same flashcards over and over again. I’m prone to making these deceptions myself so often. This very human trait was my downfall in reviewing my flashcards, and I would have benefited much from a fix that prevented this.</p><h3>The Revelation</h3><p>What if we never had to click this button? What if, we could just open a flashcard, state the answer, and have it be automatically graded and move to the next card? If that were true, then we’d never get the opportunity to deceive ourselves, and we could maintain the integrity of flashcard systems like Anki to improve memorization.</p><h3>The Solution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RkpQoh3biublNcAGZUZKTw.png" /><figcaption>A screenshot of my app!</figcaption></figure><p>I decided it was time to build a tool to do that. My best friend Ashton Smith and I built Smartflash Companion, an auto-grading flashcard solution proof of concept. We used pre-trained large language models to automatically grade user responses to a predefined set of flashcards.</p><p>When prompted, a user can type a possible answer into our textbox, and our application automatically grades the response and moves on to the next flashcard. Now, you don’t need to worry about tricking yourself. The app takes care of that for you.</p><h3>How it works</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e9UCAvDmWRKhoLCeyis-Ng.jpeg" /><figcaption>Sentence similarity in action! Image is taken from <a href="https://txt.cohere.ai/what-is-similarity-between-sentences/">Cohere blog post by Luis Serrano, here.</a></figcaption></figure><p>Words and sentences can be represented by sets of numbers called vectors. It turns out, that it’s possible to construct vectors that encode the meaning of the words. We can measure how close these word and sentence vectors are in vector space, in order to make guesses about how close their actual meanings are.</p><p><a href="https://docs.cohere.ai/">Cohere is a software company</a> that has large language models and natural language processing as a service, so <a href="https://docs.cohere.ai/docs/embeddings">I used their embedding model</a> to encode flashcard definitions and definitions of a given user response as sentence vectors. We then calculate the cosine similarity of those sentence vectors, to see how “close” those vectors are in vector space, which correlates with how closely those sentences correlate in meaning.</p><p>We also used <a href="https://api-inference.huggingface.co/models/roberta-large-mnli">a pre-trained model from Hugging Face</a> that classified any pair of texts as a contradiction, entailment, or neither statement. If the proposed answer and true answer contradicted or were neutral, then we’d consider that an incorrect answer. We found out about using this approach <a href="https://stackoverflow.com/questions/69374258/sentence-similarity-models-not-capturing-opposite-sentences">from this discussion</a> after running into issues with sentences that were similar in content but not meaningful.</p><p>If the response is similar enough, and sufficiently entails the definition, then we grade it as correct and move you on through! We needed the entailment definition to account for some edge cases where sentences could be similar in wording but not content.</p><h3>Try it yourself</h3><p>You can try Smartflash Companion here, <a href="https://smartflash-companion.streamlit.app/">over on Streamlit</a>. This project was made during the first Assembly AI Hackathon, as we originally wanted to add speech recognition support.</p><p>The demo exists as a proof of concept, so you might get some nonsensical scoring with sentences Ashton and I haven’t tried yet. Try typing the following sentences for the “clinical” definition, and see what you get!</p><ul><li>based on or characterized by inobservable and mythical symptoms</li><li>relating to the observation and treatment of actual patients rather than theoretical or laboratory studies.</li><li>actual symptoms occurring in illness or injury rather than theoretical</li></ul><p>We may also add support for using your own flashcards to make them easier to use. If that’s something you’d see, voice your support with those claps and comments!</p><p>Finally, if you felt inspired by my breakdown here and want to get started building your own NLP-powered applications, head over to <a href="https://discord.gg/co-mmunity">the Cohere co:mmunity over on Discord</a> and join the conversation. We’re happy to welcome you and get you started.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48e65987c4d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Internet Statistics: Lotteries!]]></title>
            <link>https://medium.com/@arjunkirtipatel_88473/drawing-a-blank-think-b5e4f45acf03?source=rss-25da849639a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5e4f45acf03</guid>
            <category><![CDATA[kindness]]></category>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[problem-solving]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[lottery]]></category>
            <dc:creator><![CDATA[Arjun Patel]]></dc:creator>
            <pubDate>Tue, 06 Dec 2022 05:59:03 GMT</pubDate>
            <atom:updated>2022-12-06T06:12:45.045Z</atom:updated>
            <content:encoded><![CDATA[<p>Is selecting a sequence better than random numbers?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XwgSedfNf_g0Mc9-" /><figcaption>Photo by <a href="https://unsplash.com/@introspectivedsgn?utm_source=medium&amp;utm_medium=referral">Erik Mclean</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So there I was, splayed out on my couch performing the same mystical ritual many of my fellow Americans spend hours a day doing: scrolling mindlessly through my phone. On today’s menu were Youtube Shorts, and I was served a particulary spicy video.</p><p>It had a few podcasters sitting together heatedly discussing a topic many people are thinking about right now. The video declared to me that they found “the dumbest person ever to play the lotto”. One podcaster announced that they served someone who selected a sequence of numbers for their Powerball ticket, which they thought was less likely than picking any other sequence. After all, what are the chances of getting a Powerball of numbers all in a row?</p><p><a href="https://www.youtube.com/shorts/HhjkVfXRtgQ">Lottery - The Numbers, What do they MEAN ?!?? 🤪🥴</a></p><p>The other spirited podcasters quickly pounced, reminding the first that the lotto numbers are <em>randomly selected, </em>so any sequence you pick is just as likely as any other sequence. In fact, the podcaster who ridiculed the customer is silly, not the customer. Right?</p><p>Well, not so fast. Let’s take our time and try to work this out!</p><h3>Sequences vs Combinations</h3><p>Let’s talk about the elephant in the room first: Yes, if you roll up to your local 7-Eleven and ask for your favorite six numbers in a sequence, you probably aren’t worse off than anyone else.</p><p>This is because each sequence has the same chance of occurring, independent of each game. So go ahead, slurp that cherry Slurpee and ask for your digits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HwBOHydjbER6c5EC" /><figcaption>Your delicious reward for doing the math! (Photo by <a href="https://unsplash.com/@greg_rosenke?utm_source=medium&amp;utm_medium=referral">Greg Rosenke</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>But wait, isn’t it still true to say that a sequence like 123456 is way less likely to occur than any sequence that isn’t in order? After all, aren’t there WAY more ways to get non-sequences than sequences in a lotto drawing?</p><p>It’s true that there are more sequences to be selected than not. But, it’s also important to remember that each game is independent from every other game, so the odds of any number combination occuring stay the same between games.</p><p>Still not convinced? What if we actually just chose sequences for the the lotto as our strategy? What would happen?</p><p>As of last read, the chances of winning the Powerball is <a href="https://www.cbsnews.com/news/powerball-jackpot-record-amount-19-billion-odds-of-winning/">1 in 292 million</a>, so we can’t all make a pact to try these strategies and see who ends up winning. So, what else can we do? Let’s try a building a simulation instead!</p><h3>Welcome to our Lotto!</h3><p><strong>Here are the rules:</strong></p><blockquote>We’ll have a drawing of six numbers, and we’ll only let them range from 1–10. We’ll also be kind and let you win if any combination of your numbers is chosen, which is standard Powerball rules.</blockquote><p>In this game, the probability of winning is (6* 5 * 4 * 3 * 2 *1)/(10 * 9 * 8 * 7 * 6 * 5), or about a 0.4162% chance to win. This is because we take the number of possible ways of ordering a sequence (6!) over all possible sequences.</p><p>In order to actually “see” wins in our simulation, we’ll have to play a lot of games! Let’s have one participant play the lottery a million times.</p><p>Under this regime, we should expect to see about about 4162 wins using a random selection strategy.</p><p>Here’s some code to set up our game, and begin the draw:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc30d45e2e3ce24700b8a37075970343/href">https://medium.com/media/bc30d45e2e3ce24700b8a37075970343/href</a></iframe><p>Next, we’ll write a for loop to simulate the games:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0a1c2e080208851ba52cbb85434ed19/href">https://medium.com/media/a0a1c2e080208851ba52cbb85434ed19/href</a></iframe><p>Finally, we apply a one sample Z-test for proportions to the observed share of wins. This is because we can treat each lotto game as a Bernoulli random variable, and the whole collection as a binomial distribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*KnP35iClpOm1QABcr35SMg.png" /><figcaption>Image from: <a href="https://stats.stackexchange.com/questions/573048/how-is-the-denominator-in-one-sample-z-test-of-proportion-derived">https://stats.stackexchange.com/questions/573048/how-is-the-denominator-in-one-sample-z-test-of-proportion-derived</a></figcaption></figure><p>We’ve already calculated what we expect the probablity should be, so all that’s left is calculating the statistic:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf8ffa54639b9bb20062ab6d3757fa64/href">https://medium.com/media/bf8ffa54639b9bb20062ab6d3757fa64/href</a></iframe><p>Since this score is nowhere near the required to be significant, we can safely reaffirm that selecting sequences is no better than selecting random numbers in the long run.</p><p>Wait a second! No one plays the lottery by themselves, so this simulation doesn’t feel exactly right. The problem with sequences isn’t that you are worse off by picking them. It’s that <em>other people </em>might pick them too!</p><p>You non-trivially increase your chance of splitting your sweet, sweet lotto reward if you pick one. Yikes! However, this misses the original point, as this nuance isn’t brought up in the Short above.</p><h3>Be nice to people</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j60Q2Nq5kk59dDzJ" /><figcaption>Photo by <a href="https://unsplash.com/@meilingmirow?utm_source=medium&amp;utm_medium=referral">Mei-Ling Mirow</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The conversation we overheard on Youtube Shorts isn’t as clean cut as we want it to be. Statistical intuition can only be built through problem-solving and a sprinkle of mathematics, not mean-spirited assertions. None of this comes easy for humans, so our best option is to be kind and explain.</p><p>So the next time you find yourself back on that comfy sectional scrolling through Youtube, and see someone making fun of statistics, just swipe up.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5e4f45acf03" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>