<?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 Aditya Maheshwari on Medium]]></title>
        <description><![CDATA[Stories by Aditya Maheshwari on Medium]]></description>
        <link>https://medium.com/@adityamaheshwari_0808?source=rss-94a20d1a07f7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uoLYfzZ4-muT9kH0qJh-1g.jpeg</url>
            <title>Stories by Aditya Maheshwari on Medium</title>
            <link>https://medium.com/@adityamaheshwari_0808?source=rss-94a20d1a07f7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 11:05:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adityamaheshwari_0808/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[Chat GPT and Prompt Engineering Tips]]></title>
            <link>https://medium.com/@adityamaheshwari_0808/chat-gpt-and-prompt-engineering-tips-8488a0c3209a?source=rss-94a20d1a07f7------2</link>
            <guid isPermaLink="false">https://medium.com/p/8488a0c3209a</guid>
            <dc:creator><![CDATA[Aditya Maheshwari]]></dc:creator>
            <pubDate>Mon, 08 Jan 2024 23:57:58 GMT</pubDate>
            <atom:updated>2024-06-19T23:17:18.126Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is part of a series on where AI can fit into the public service, intended for all levels of technical audiences. With all the hype, especially within the Government, on what AI can do, we’re trying to unpack and make concrete what AI actually does. All views are my own; this does not represent the view of any government.</p><h3>Contents</h3><ol><li><a href="https://medium.com/@adityamaheshwari_0808/artificial-intelligence-in-the-public-service-e3722a157ee4">The first article in this series</a> predicts <strong>what AI will impact</strong> the most across the Government, focusing on central agency functions.</li><li><a href="https://medium.com/@adityamaheshwari_0808/ai-case-study-in-the-public-service-785f77e08300">The second section of articles in this series</a> showcase a proof of concept example of <strong>where AI is used in the government now</strong>. <a href="https://medium.com/@adityamaheshwari_0808/chat-gpt-and-prompt-engineering-tips-8488a0c3209a">The article it is associated with</a> showcases <strong>how to leverage open source AI tools in the public service</strong>.</li><li><a href="https://medium.com/@adityamaheshwari_0808/high-level-how-artificial-intelligence-works-3daa5230fa94">The third section of articles in this series</a> explain <strong>how AI works</strong>, focusing on stakeholders and critical activities in each step.</li><li><a href="https://medium.com/@azeem.rabab/how-does-text-generative-ai-work-bb880c174051">The final section of articles in this series</a> cover <strong>how Generative AI</strong> <strong>works </strong>from a technical lens.</li></ol><h3>How to leverage open source AI tools in the public service</h3><p>ChatGPT is a language model that can answer questions and assist with tasks, including:</p><ul><li>Writing and editing documents and emails</li><li>Summarizing information</li><li>Brainstorming</li><li>Research and understanding concepts</li><li>Translation</li></ul><p>It is accessible in a chatbot interface. Anyone can use it right now, publicly or privately:</p><ul><li>Public implementations use prompts generated and inputs fed in to improve the language model.</li><li>Private implementations also allow users to use the language model without moving their information out of their organizations’ Azure environment.</li></ul><p>Best practices with this tool to get the most accurate responses include:</p><ol><li>Clear: Describe precisely what you need: “Tell me about dogs.” vs “Provide a detailed description of the characteristics, behaviour, and care required for domestic dogs.“</li><li>Precise: Ask for a specific response: “List the top 10 most populous countries in the world.“</li><li>Role: Give it perspective: “As a data scientist, describe the process of cleaning a dataset before it is used for analysis.”</li></ol><p><strong>What to watch for as you are using Generative AI in Your Work:</strong></p><ol><li>Check privacy policies and avoid entering sensitive information into LLMs. ChatGPT collects everything you type. Models that you cache/save locally and run offline will not collect your data. APIs for models (aka running models online in code) may collect your data.</li><li>Bias. Some LLMs may display bias in their responses about certain groups because of the data they were trained on. Check outputs for bias, especially if other people will see it.</li><li>Hallucinations. When LLMs make up information, it is called a hallucination. Always fact-check LLMs.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8488a0c3209a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[High Level How Artificial Intelligence Works]]></title>
            <link>https://medium.com/@adityamaheshwari_0808/high-level-how-artificial-intelligence-works-3daa5230fa94?source=rss-94a20d1a07f7------2</link>
            <guid isPermaLink="false">https://medium.com/p/3daa5230fa94</guid>
            <dc:creator><![CDATA[Aditya Maheshwari]]></dc:creator>
            <pubDate>Mon, 08 Jan 2024 23:56:48 GMT</pubDate>
            <atom:updated>2024-06-19T23:17:25.086Z</atom:updated>
            <content:encoded><![CDATA[<h3>High Level on How Artificial Intelligence Works</h3><p>This article is part of a series on where AI can fit into the public service, intended for all levels of technical audiences. With all the hype, especially within the Government, on what AI can do, we’re trying to unpack and make concrete what AI actually does. All views are my own; this does not represent the view of any government.</p><h3>Contents</h3><ol><li><a href="https://medium.com/@adityamaheshwari_0808/artificial-intelligence-in-the-public-service-e3722a157ee4">The first article in this series</a> predicts <strong>what AI will impact</strong> the most across the Government, focusing on central agency functions.</li><li><a href="https://medium.com/@adityamaheshwari_0808/ai-case-study-in-the-public-service-785f77e08300">The second section of articles in this series</a> showcase a proof of concept example of <strong>where AI is used in the government now</strong>. <a href="https://medium.com/@adityamaheshwari_0808/chat-gpt-and-prompt-engineering-tips-8488a0c3209a">The article it is associated with</a> showcases <strong>how to leverage open source AI tools in the public service</strong>.</li><li><a href="https://medium.com/@adityamaheshwari_0808/high-level-how-artificial-intelligence-works-3daa5230fa94">The third section of articles in this series</a> explain <strong>how AI works</strong>, focusing on stakeholders and critical activities in each step.</li><li><a href="https://medium.com/@azeem.rabab/how-does-text-generative-ai-work-bb880c174051">The final section of articles in this series</a> cover <strong>how Generative AI</strong> <strong>works </strong>from a technical lens.</li></ol><h3>How AI works</h3><p>In this section, we cover how AI works at a high level. Here, we do not focus so much on the deeper technical components — those will be covered in the next section on how Generative AI works. In this section, what we do is:</p><ol><li>Unravel AI step-by-step.</li><li>Explain which stakeholders are involved in each step.</li></ol><p>The case study that we refer to in these notes is sentiment analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*scXHiMX6gPZbzn4Jj5XUUQ.png" /><figcaption>Case study</figcaption></figure><h4>Output Layer: Using Recommendations</h4><p>Most people engage exclusively with the output of an AI system. This is the piece where a label is generated. In our example, the system generates positive, negative, or neutral. In fact, an AI system often would output a confidence score for each sentiment (10% is positive, 85% is negative, and 5% is neutral).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*dAiikkSkdhVK5jbVbAj1Rg.png" /><figcaption>Output Layer of AI System</figcaption></figure><p>Users at this stage mostly see the aggregate outcome of the AI system, not necessarily the sub-predictions that form this aggregate. Stakeholders, for example, could be a Communications team viewing the aggregate sentiment on a collection of emails for the day or all emails under a similar topic for a day to influence messaging on a set of issues. Similarly, an executive may look at aggregate numbers to stay informed of public sentiment.</p><h4>Validation Layer: Validating Recommendations</h4><p>This step does not necessarily happen before the label is used, but we slot it before for purposes of this case study. In reality, for AI to improve, it needs some feedback on the quality of recommendations it is generating. This feedback can be implicit or explicit. For example, an operational worker can receive a recommended tone for each incoming email to inform which template to use for a response. Operational workers can explicitly correct the tone so a suitable template is chosen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*wT_I97_uPybG10ar9WyJkw.png" /><figcaption>Validation Layer of AI System</figcaption></figure><p>In another problem entirely, say weather prediction, the model can give a prediction of the following day’s weather and then, on the following day, get the actual weather to validate its prediction.</p><p>This is also a step that many AI users who don’t exclusively deal with outputs engage in. They score the quality of recommendations either through their actions (implicit) or by directly inputting the correct data (explicit).</p><h4>Training Layer: Generating Labels</h4><p>Before a label is validated and then used, the label or prediction needs to be generated in the first place! This is one of the more technical aspects of data science, and the mathematical process for generating these labels is beyond the scope of this section.</p><p>At a high level, the model receives what is known as a loss function, which is a rigorous definition of the distance between model predictions and real values that the modelling framework tries to minimize. Intuitively, when the model receives a new email to find the sentiment, it looks for which emails are similar to the current email and then creates a label for the new email based on a weighted average of existing emails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*p_th4aqAll68efm6ntpe4Q.png" /><figcaption>Training Layer for AI System</figcaption></figure><p>At this stage, data scientists are typically used to train AI to minimize the loss function. At the same time, subject matter expertise in the problem can also provide inputs into designing the loss function.</p><p>At this stage, a widespread challenge in AI is figuring out where intelligence is needed. For instance, an SME can point out simple rules of certain incoming emails they know need to be filed as neutral. It is beneficial to then handle these outside of the AI system and spend more resources on emails that are fuzzy or hard to provide explicit rules for labelling.</p><h4>Standardization Layer: Converting Inputs into Features</h4><p>For the AI to map inputs to outputs, it needs to be able to compare one input with another. The process for this is called feature engineering. The idea is to find a standard way of encoding inputs so each input can be mapped to the same structure of representations. Examples of features can include:</p><ul><li>How many capital letters are in the text?</li><li>How many punctuation marks are in the text?</li><li>How many words are in the text?</li><li>How many of the letters “y” are in the text?</li></ul><p>AI seeks generalizable patterns between this standardized input and the correct output. In practice, discussed in the following article in this series, there are far more sophisticated mathematical ways to pull info out of text data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7cusR5kPx1r7I_dICWBTCg.png" /><figcaption>Feature Engineering Layer of AI System</figcaption></figure><p>Regarding stakeholders, this layer is also technical and coupled with model training. Typically, a combination of subject matter experts and data scientists handle this layer.</p><h4>Input Layer: Receiving New Observations</h4><p>The final part of the system is receiving input. This is an essential and underrated step, as the input needs to follow a similar format as the inputs the AI system was trained on. For example, if the system is trained on sentences, and a user tries to send it a picture. Naturally, this is easy to flag. However, if it is trained on single sentence email and receives a double-sentence email, it will still generate a prediction but that prediction could be fully inaccurate. Similarly, a model trained on emails can still guess the sentiment of a tweet, but these are two varying forms of information, and again, an accurate process would be training the model with a more significant number of tweets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlPWx_7dypXRyf_OtC0tPQ.png" /></figure><h4>Summary of How AI Works</h4><p>In summary, below is our process of how an AI system works. Nowadays, many AI models are already trained on various tasks (i.e. sentiment analysis), so a full dataset rarely needs to be collected for the AI to train from scratch. Instead, a model trained on large amounts of information is often fine-tuned with local data to improve performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C70gJRsnyTP5n4Gi_jNMBA.png" /><figcaption>AI System</figcaption></figure><p>The AI system in traditional AI can receive a reasonably complicated input (email) but generally outputs a much more discretized and simple output (in this case, a sentiment label). In the new wave of Generative AI, models can produce an output as complicated as the input they receive.</p><h3>Conclusions</h3><ol><li>AI is conceptually simple.</li><li>Engineering is what makes it look like magic.</li><li>Leveraging AI to improve decision-making is iterative and very challenging in practice. It requires a discretized workflow with relatively key decision points.</li><li>The government can build custom applications for sensitive information as well!</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3daa5230fa94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Artificial Intelligence Case Study in the Public Service]]></title>
            <link>https://medium.com/@adityamaheshwari_0808/ai-case-study-in-the-public-service-785f77e08300?source=rss-94a20d1a07f7------2</link>
            <guid isPermaLink="false">https://medium.com/p/785f77e08300</guid>
            <dc:creator><![CDATA[Aditya Maheshwari]]></dc:creator>
            <pubDate>Mon, 08 Jan 2024 23:55:51 GMT</pubDate>
            <atom:updated>2024-06-19T23:16:31.194Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article has received contributions from </em><a href="https://medium.com/u/fe9d071f5893"><em>Rabab Azeem</em></a><em>. All views are our own.</em></p><p>This article is part of a series on where AI can fit into public service, intended for all levels of technical audiences. With all the hype, especially within the Government, on what AI can do, we’re trying to unpack and make concrete what AI does.</p><h3>Contents</h3><ol><li><a href="https://medium.com/@adityamaheshwari_0808/artificial-intelligence-in-the-public-service-e3722a157ee4">The first article in this series</a> predicts <strong>what AI will impact</strong> the most across the Government, focusing on central agency functions.</li><li><a href="https://medium.com/@adityamaheshwari_0808/ai-case-study-in-the-public-service-785f77e08300">This series’s second section of articles </a>showcases a proof of concept example of <strong>where AI is used in the Government now</strong>. <a href="https://medium.com/@adityamaheshwari_0808/chat-gpt-and-prompt-engineering-tips-8488a0c3209a">The article it is associated with</a> showcases <strong>how to leverage open-source AI tools in public service</strong>.</li><li><a href="https://medium.com/@adityamaheshwari_0808/high-level-how-artificial-intelligence-works-3daa5230fa94">This series’s third section of articles </a>explains <strong>how AI works</strong>, focusing on stakeholders and critical activities in each step.</li><li><a href="https://medium.com/@azeem.rabab/how-does-text-generative-ai-work-bb880c174051">This series’s final article </a>covers <strong>how Generative AI</strong> <strong>works </strong>from a technical lens.</li></ol><h3>Artificial-Intelligence Generated Intelligence Reports on the Prime Minister&#39;s Emails</h3><p>In this article, we go through a proof-of-concept solution that applies AI to interpret the PM&#39;s emails to generate a report that informs senior decision-makers about what the public is interested in. Note that this is a proof of concept, and none of the numbers presented here are official (just estimates from the AI). The contents are as follows:</p><ol><li>Executive Correspondence and Artificial Intelligence Background</li><li>AI-Generated Report and Some Results</li><li>Technical Details on the Machine Learning Approach</li><li>Modelling Feedback Loop <em>(not yet in production)</em></li><li>Data Pipeline, Architecture, and Tools</li></ol><h3>Executive Correspondence and Artificial Intelligence</h3><p>Executive Correspondence is a direct channel through which the public communicates concerns, needs, and perspectives to the PM. The PM receives millions of emails every year from anyone in the world.</p><ul><li>A large proportion (estimated ~75%) are from “write-in campaigns”, where many people in the public send the same message.</li><li>Of the remaining proportion, a decent number includes spam and auto-subscriptions (i.e. to Google groups).</li><li>An estimated ~10% are “substantive” meaning they are non-spam and non-campaign.</li></ul><p>Executive correspondence analysts are tasked with actioning every incoming email, whether forwarding it to the Minister who can handle the request, responding directly, etc.</p><h4><strong>Business Opportunity: Dynamically Extracting Grassroots Intelligence</strong></h4><ul><li>These emails and letters provide real-time insight into public sentiment and topics of interest.</li><li>Correspondences are a valuable source of grassroots intelligence and can help the Government stay informed and strategically address emerging issues.</li><li>The hypothesis is that timely, accurate, and customized responses to the public can improve public trust and assure the public their views are heard.</li></ul><h4>Current Intelligence Extraction Process</h4><p>Many analysts are tasked with manually reading and responding to correspondence. For intelligence purposes, they tag each email with keywords and a tone.</p><p>The weekly and monthly counts of the most popular keywords are reported upward. Additionally, ten emails are curated and sent up to provide an example of the most popular topics.</p><p>Challenges with this approach include:</p><ul><li>ECS analysts need to process hundreds of emails daily. Their focus is operational, ensuring emails are forwarded to the right departments and flagging threats.</li><li>There are limitations to the nuance in the keywords and limited time to choose among the hundreds of keywords.</li><li>New keywords go through a process before being approved as an option, leading to potential lags in reporting. Additionally, there are not many real-time updates.</li></ul><h4>Artificial Intelligence to the Rescue!</h4><ul><li>Artificial Intelligence (described in previous articles) can be used to discover topics, classify sentiment, and detect other features of incoming emails. This helps <strong>understand constituent needs in close to real-time.</strong></li><li>Reports can be generated daily, offering more granularity on a shorter time horizon to understand what is trending. <strong>This can help inform communications and support policy decision prioritization.</strong></li><li>In the longer term, more dynamic longer-term reporting can help people look at topics and how engagement and sentiment have changed over time.</li><li>Eventually, AI can be integrated into the operational workflow to provide recommendations to analysts for actioning emails and suggest more customized responses. <strong>This can help improve the timeliness and specificity of responses.</strong></li></ul><h3>AI-Generated Report</h3><p>By using AI to interpret topics and sentiments associated with correspondence, one can augment the ability of the Government to communicate in a way that addresses public concerns. These reports are designed to showcase what the AI can do. Any results shown should not be taken as actual information with which to make decisions; this is more to illustrate the concept. We break down the sections in more detail to give an idea of some of the insights pulled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TygSD3GsLGV_1h8bLimWxA.jpeg" /><figcaption>AI-generated intelligence report from executive correspondence</figcaption></figure><p>We break down the sections in more detail to give an idea of some of the insights that can be pulled by AI.</p><h4>Overview</h4><p>The first panel gives a snapshot of the change in engagement in the two weeks leading up to the report date.</p><ul><li>Visual: graph of total emails received over previous weeks leading into the report date.</li><li>Panels: total emails over the previous week broken out by email type.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iR2yAPHx1f-wPLlbaatmHg.png" /><figcaption>Overview Section of Report</figcaption></figure><h4>Popular Topics for Substantive Emails</h4><p>Substantive refers to email not part of a write-in campaign, and not classified as hate speech, spam, toxic, offensive, etc.</p><ul><li>Visual: popular topics among substantive emails by sentiment.</li><li>Panels: total breakdown by sentiment across all substantive emails.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mw8BCG3y00lk1fFYGoDcHg.png" /><figcaption>Substantive Section of Report</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UodmF-pXMXj1M_jrpETaMw.png" /><figcaption>Substantive topics on different dates</figcaption></figure><h4>Popular Topics for Write-Ins</h4><p>Write-in campaigns are many senders sending the same text. These are coordinated and designed to flood the inbox.</p><ul><li>Visual: most popular write-in topics and frequencies.</li><li>Panels: count of total write-ins by language.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYgvVP29Fpw-wdRdfS75xQ.png" /><figcaption>Write-In Section of Report</figcaption></figure><h4>Popular Topics for All Email Types</h4><p>This panel includes all email types except for write-ins to understand the most popular topics when factoring in hate speech, etc.</p><ul><li>Visual: most popular topics include non-substantive emails broken out by type of email.</li><li>Panels: count of emails in each non-substantive topic.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jFHekckqvRl9KIo9MtBYKA.png" /><figcaption>All Email Types for Report</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxWYS0IZy6qh2UWKT90UmQ.png" /><figcaption>Popular topics for different dates</figcaption></figure><h4>Trending Topics by Sentiment</h4><ul><li>Trending topics refer to the topics with the largest increase in the 3-day average leading up to the report date, compared to three-day averages of previous dates in the week. The topics are broken down by sentiment.</li><li>Week-over-week increase is the largest increase in overall, negative, and positive engagement.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ek6D5AWfQCNs4vvceb0G8A.png" /><figcaption>Comparisons factoring all email Types</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V0I_4vP7h-LoLMfmtLHHqw.png" /><figcaption>Comparisons for largest week over week increases</figcaption></figure><h4>Other Languages</h4><p>The volume of French emails is much lower than English, so we separate it during topic modelling; otherwise, it has a lower proportional impact.</p><ul><li>Visual: most popular French topics.</li><li>Panels: count of French and non-English/French languages.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CcZvSyHjaMxav-wYMI2w2Q.png" /><figcaption>Non-English Section of Report</figcaption></figure><h4><strong>Overall Achievements:</strong></h4><ul><li>Automated identifying emerging issues and associated sentiments and categorizing emails into spam, inappropriate, write-in, and substantive in real-time using AI.</li><li>Automated daily generation of intelligence reports that show trending topics and sentiments.</li><li>Development of an application to score the quality of AI, using human intervention to improve the model’s accuracy over time.</li></ul><h4><strong>Forward-looking steps:</strong></h4><ul><li>Using AI to create first drafts of tailored responses.</li><li>Integrating these reports or summaries of incoming topics into communications strategies.</li></ul><h3>Technical Details on the Machine Learning Approach</h3><p>In this section, we walk through the machine learning implementation and follow it with more details on the approach and nuances.</p><p>Many open-source models exist that have been trained on millions of tweets, documents, or other text to predict hate speech, toxicity, spam, and sentiment. <strong>We chose to use these rather than use existing manually labelled emails as a “ground truth.” Once analysts can engage with these outputs, we can iteratively improve prediction quality.</strong></p><p>The new approach to assigning topics is to group together similar text based on sentence structure and content and then add tags based on keywords occurring frequently in each group. <strong>This gives a better idea of key themes in the actual emails incoming, rather than forcing each email into a pre-defined topic.</strong></p><p>Three different sets of models: email type classifiers, sentiment polarity, and topic models.</p><h4>Email Type Classifiers</h4><p><strong>A high volume of emails, after filtering out write-ins, still falls into categories including toxic/vulgar, threatening, sexist, racist/offensive, and spam/junk. Decision-makers should be able to filter out “non-substantive” emails when they understand what issues and sentiments interest Canadians.</strong></p><p>We use the machine learning models shown in the table below to classify emails initially. These are not trained on email data directly, and in future phases of the project we would use the model scoring app (described in the section below) to assist with scoring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X40r8q_d8XxDs5Csec_bEg.png" /><figcaption>Models Used to Classify Emails</figcaption></figure><p>Using a sample of data from May 2023, we see the following classification rates. Note these are not official numbers but estimates in our proof of concept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EwS2vXiVRumWY9ROvviJgQ.png" /><figcaption>Results from Modelling Steps</figcaption></figure><h4>Sentiment Analysis</h4><ul><li>CardiffNLP (Roberta Base Sentiment) pulled from Huggingface. Multilingual.</li><li>Originally, we were using BERT-Based Uncased but found it overpredicted Neutral.</li></ul><h4>Topic Modelling</h4><p>The topic modelling process is as follows:</p><ol><li><strong>Pull</strong> all emails from the previous two weeks into Pandas</li><li><strong>Apply</strong> BERTopic separately in English and French</li><li><strong>Merge</strong> together similar words within each topic</li><li><strong>Combine</strong> together similar topics</li><li><strong>Manually adjust</strong> any spam topics or unclear topics</li></ol><p>The topic modelling is done using BERTopic. At a high level:</p><ul><li>Emails are embedded and grouped together based on similarities in embeddings.</li><li>Interesting words are extracted from each group.</li></ul><h3>Modelling Feedback Loop</h3><p>We developed the following application to assist with scoring the models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*IPaUa-0T5QPUAdNQOnbkFA.png" /><figcaption>Scoring Application</figcaption></figure><p>For the interim, the scoring instructions we gave are broken down below.</p><h4>Language</h4><p><strong>Language</strong> labelled by the AI: <strong>&lt;English&gt; <br></strong><em>Definition: Language refers to the primary language used in the main part of the email.</em></p><p>Did the AI model correctly identify the language? Select from:</p><ul><li>Yes, AI is correct (default)</li><li>No, it is English</li><li>No, it is French</li><li>No, it is another non-EN/FR language</li><li>No, the email has no clear language</li></ul><h4>Spam</h4><p>Flagged as <strong>Spam</strong> by the AI<br><em>Definition: Spam refers to any of the following:<br>1. Incoherent Emails (meaning the message contents cannot be understood)<br>2.</em> <em>Emails that are auto-subscription-based (i.e. a newsletter or public group)<br>3.</em> <em>Emails that should not be sent to the PM (i.e. my house is haunted, non-sensical issue)<br>4.</em> <em>Emails that are scams or phishing</em></p><p>Did the AI flag spam correctly? Select from:</p><ul><li>Yes, AI is correct (default)</li><li>No, the email is spam</li><li>No, the email is not spam</li></ul><h4>Inappropriate</h4><p>Flagged as <strong>Inappropriate</strong> by the AI<br><em>Definition: Inappropriate refers to content that is:<br>1.</em> <em>Hateful, sexist, toxic, obscene, insulting, threatening, related to identity-based hate, sexually explicit, or offensive </em><strong><em>AND<br></em></strong><em>2.</em> <em>Absent of any substantive issue. Please note that emails which contain a substantive issue (i.e. environment, housing) should not be flagged as inappropriate, even if they are critical of the PM or a group of people.</em></p><p>Did the AI flag inappropriate correctly? Select from:</p><ul><li>Yes, AI is correct (default)</li><li>No, email is inappropriate</li><li>No, email is not inappropriate</li></ul><h4>Sentiment</h4><p><strong>Sentiment</strong> generated by the AI: NEG/NEU/POS<br><em>Definition: Sentiment can be positive, negative, or neutral<br>1.</em> <em>Positive: Emails that compliment or reference recent policy, make strong suggestions to change policy or create new policy, or provide constructive criticism on recent government activity.<br>2.</em> <em>Neutral: Administrative Emails. Generally, emails should not be classified as neutral unless they are procedural.<br>3.</em> <em>Negative: Emails that comment against a recent action taken by the government, with no constructive criticism or suggestions for improvement. Includes emails asking for impossible change (i.e. stop funding causes or issues). Complaints fall into negative emails.</em></p><p>Did the AI label sentiment correctly? Select from:</p><ul><li>Yes, AI is correct (default)</li><li>No, email is positive</li><li>No, email is neutral</li><li>No, email is negative</li></ul><h4>Topic</h4><p><strong>Topic</strong> for this email generated by the AI model: &lt;&gt;<br><em>Definition: Topics are identified by grouping together similar emails, and then pulling out interesting keywords from each grouping.<br>- A keyword </em><strong><em>does not</em></strong><em> have to exist in the email content, but it should be strongly related to the content. Any keywords not related to the content should be removed from the list.<br>- A missing keyword </em><strong><em>should </em></strong><em>exist in the email but is missing from the keyword list for the topics. Any missing keywords should be added to the list.</em></p><p>What topic do you recommend? By default, the topic modelling output is listed, and users can add or remove words that don’t match the content).</p><h3>Next Steps for Each Machine Learning Component</h3><ul><li>Topics: Generate new topics for a new day and seamlessly link with old topics. Utilize manual scoring to improve topic quality.</li><li>Sentiment and Email Type Classification: Re-train using manual scores.</li><li>Scoring: Maximize the effectiveness of crowd-sourced scoring.</li><li>Reporting: Provide valuable insights to tailor communication strategies or inform policy development.</li></ul><h3>Data Pipeline, Architecture, and Tools</h3><p>The pipeline within the Databricks step sits as a parallelized workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ROH-S3lwhWmgXiA4jSRuWA.png" /><figcaption>Data Pipeline</figcaption></figure><h4><strong>Data Extraction &amp; Loading</strong></h4><ul><li>Raw emails were extracted from SQL Server underneath Dynamics and uploaded to Azure Delta Lake.</li></ul><h4><strong>Data Cleaning &amp; Transforming:</strong></h4><ul><li><strong>Clean Text: </strong>Trim whitespace, replace email addresses, domain names, phone numbers, time stamps, dates etc. with &lt;email&gt;, &lt;domain&gt; etc. tags</li><li><strong>Detect Message Language:</strong> Langdetect implementation (sparknlp)</li><li><strong>Filter write-ins: </strong>50 characters that are the same in the body of the message, retain only one copy of each write-in for modelling and store the count of the write-ins.</li><li><strong>Word Count and Prolific:</strong> Add a word count feature to emails and also identify if the sender is prolific</li></ul><h4>Modelling</h4><p><strong>Email Type Modelling:</strong></p><ul><li>Hate Speech Detection: cardiffnlp/twitter-roberta-base-hate-latest</li><li>Sexism Detection: NLP-LTU/bertweet-large-sexism-detector</li><li>Toxicity: unitary/toxic-bert</li><li>Spam Classifier: mshenoda/roberta-spam</li><li>Offensive: cardiffnlp/twitter-roberta-base-2021–124m-offensive</li><li>Sentiment: bert-base-uncased</li></ul><p><strong>Topic Modelling:</strong></p><ul><li>Topic modelling is done with BERTopic (Python implementation)</li><li>Currently will run on the equivalent of 1 month of data (approx 40,000 rows)</li><li>Takes roughly 25 mins</li><li>Topics are fuzzy-matched to the closest ECS keyword</li></ul><h4><strong>Visualization</strong></h4><p>AI-generated report (designed in PowerBI) is then refreshed via a live connection to Databricks to enable a near real-time analytical view of the latest ECS email correspondence.</p><h4><strong>Scoring Application</strong></h4><p>Web application receives AI predictions in real time and provide an interface for analysts to manually score individual emails. These scores are used to re-train the AI to improve model accuracy in the future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=785f77e08300" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Artificial Intelligence in the Public Service]]></title>
            <link>https://medium.com/@adityamaheshwari_0808/artificial-intelligence-in-the-public-service-e3722a157ee4?source=rss-94a20d1a07f7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3722a157ee4</guid>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[government]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[topic-modeling]]></category>
            <dc:creator><![CDATA[Aditya Maheshwari]]></dc:creator>
            <pubDate>Fri, 22 Dec 2023 18:09:45 GMT</pubDate>
            <atom:updated>2024-06-19T23:17:41.751Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is part of a series on where AI can fit into public service, intended for all levels of technical audiences. With all the hype, especially within the Government, on what AI can do, we’re trying to unpack and make concrete what AI does. All views are my own; this does not reflect the view of any govenrment.</p><h3>Contents</h3><ol><li><a href="https://medium.com/@adityamaheshwari_0808/artificial-intelligence-in-the-public-service-e3722a157ee4">The first article in this series</a> predicts <strong>what AI will impact</strong> the most across the Government, focusing on central agency functions.</li><li><a href="https://medium.com/@adityamaheshwari_0808/ai-case-study-in-the-public-service-785f77e08300">This series’s second section of articles </a>showcases a proof of concept example of <strong>where AI is used in the Government now</strong>. <a href="https://medium.com/@adityamaheshwari_0808/chat-gpt-and-prompt-engineering-tips-8488a0c3209a">The article it is associated with</a> showcases <strong>how to leverage open-source AI tools in public service</strong>.</li><li><a href="https://medium.com/@adityamaheshwari_0808/high-level-how-artificial-intelligence-works-3daa5230fa94">This series’s third section of articles </a>explains <strong>how AI works</strong>, focusing on stakeholders and critical activities in each step.</li><li><a href="https://medium.com/@azeem.rabab/how-does-text-generative-ai-work-bb880c174051">This series’s final article </a>covers <strong>how Generative AI</strong> <strong>works </strong>from a technical lens.</li></ol><h3>What AI will impact</h3><p>In any government agency, especially a central government agency, the mandate is to provide non-partisan advice and support to the PM and Cabinet.</p><h4>What administrative data is generated by Government operations</h4><p>Administrative data, for purposes of this article, refers to data generated organically by a business function.</p><ul><li>Booking and then signing into a desk in a remote office setup generates administrative data (booking time, sign in time).</li><li>Writing a briefing note to management in the government, the briefing note itself can be seen as a business function, and the note itself once submitted becomes a piece of administrative data.</li><li>A survey, on the other hand, purely designed to collect data and not necessarily a part of a business function, would be seen as a non-administrative dataset.</li></ul><p>As a result of business operations in the government, Figure 1 gives a list of associated administrative datasets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SnrQwGaXcVVp9LFm0ey3-Q.png" /><figcaption>Figure 1: Data collected as a result of operations</figcaption></figure><h4>What can be done with administrative data in the Government</h4><ol><li>Provide insights from internal data: Uncover intelligence, for example, by summarizing documents, finding topics in text, or grouping similar text across documents.</li><li>Increase efficiency and automation: Streamlining internal processes such as identifying secretariats with information related to a topic and creating search interfaces to build quick reports.</li><li>Enhance content generation: Combining external public information with internal data to produce drafts of briefing notes, policy documents, communications, and email responses.</li></ol><h4><strong>How AI can be used to leverage data generated by the Government</strong></h4><p>We break AI into two categories.</p><ul><li><strong>Artificial Intelligence</strong> is a machine’s ability to provide cognitive functions we typically associate with human minds.</li><li><strong>Generative Artificial Intelligence </strong>is a machine’s ability to create new content autonomously through learning patterns and generating novel outputs.</li></ul><p><strong>Artificial Intelligence</strong> applications can include:</p><ol><li>Document tagging and topic identification.</li><li>Sentiment analysis for public opinion monitoring.</li><li>Citizen engagement and information retrieval.</li></ol><p><strong>Generative Artificial Intelligence</strong> applications can include:</p><ol><li>Document summarization and drafting of briefing notes.</li><li>Drafting public messaging and correspondence with the general public.</li><li>Multilingual communication and translation (in real-time).</li></ol><h4>What factors influence an AI solution&#39;s potential to impact</h4><p>Any operation that has the following five elements will be augmented the most and increase in efficiency and ease of delivery:</p><ol><li>Decision Points: Opportunities for the data science solution to make recommendations or predictions.​</li><li>Success Metrics: Qualitatively or quantitatively evaluate the solution&#39;s accuracy, effectiveness, and impact.​</li><li>Domain Knowledge: Interpret results and provide context to the data science solution.</li><li>Feedback Loops: Continual improvement to regularly update the models and strategies based on real-world outcomes and user feedback.​</li><li>Collaboration: Communication with relevant stakeholders, including end-users, to ensure that the solution is user-friendly.</li></ol><h4>How AI Solutions Get Developed</h4><ol><li>Operational data is collected (tables, emails, images, etc.)</li><li>Data is cleaned and assessed for usefulness</li><li>Research is done to find or create relevant AI models and algorithms</li><li>Models learn patterns in the data and extract new information or extrapolate to project future scenarios</li><li>Outputs (classifications, labels, topics, summaries) are validated qualitatively and/or quantitatively using accuracy scoring or human feedback</li><li>Stakeholders give feedback on the process and results (dashboard, report, excel file, text document)</li></ol><h4>Common Misconceptions about Data Science in the Public Service</h4><ol><li><strong>Technical Knowledge</strong>. The <em>misconception </em>is that all stakeholders involved in developing AI need technical knowledge about coding or machine learning to work on data science solutions. The <em>reality </em>is that non-technical stakeholders are equally valuable as they provide subject matter expertise to assess the quality and relevance of data science outputs.</li><li><strong>Governance</strong>. The <em>misconception </em>is that AI projects need very clear governance and this should be sorted prior to development. The <em>reality </em>is that AI functions as an extra layer above existing business processes and software, and so much of the same governance that applies to the business process will carry over to the AI.</li><li><strong>Historical Data. </strong>The <em>misconception </em>is that data science requires large amounts of historical data. The <em>reality</em> is that in modern data science, barriers are more around receiving and ingesting new data; many pre-trained models exist to turn smaller amounts of training data into larger datasets.</li><li><strong>Immediate Insights and Solutions. </strong>The <em>misconception</em> is that data science delivers immediate results, much like analytics. The <em>reality</em> is that data science is an iterative process, and results improve with time as the model behaviour is continually validated. Benefits are increased performance over time.</li><li><strong>Technical Debt. </strong>The <em>misconception </em>is that technical debt and succession should be planned prior to starting development. The <em>reality</em> is that unlike traditional software development, once an AI system exists and a pipeline is live, the workflow tends to stay automated unless the underlying business process has a major change.</li></ol><h3>Why the government should invest in AI</h3><p>There are three reasons we see investment into AI as valuable for the Government:</p><ol><li>AI applications are associated with innovation, and an increase in internal AI development raises the bar for what the government funds externally.</li><li>AI can drive decision-making across Government. We are not referring to automated decision-making (this would raise many ethical and legal red flags within the government context), but more guiding or providing recommendations that are corrected and approved. For example, creating the first draft of decisions.</li><li>AI can directly support internal operations, which is very hard for an external vendor to come in and do. This can reduce the amount of work spent on repetitive procedures and tasks, and allow for more time for systems thinking and focus on defining outcomes.</li></ol><h3>Conclusions</h3><ol><li>AI is conceptually simple.</li><li>Engineering is what makes it look like magic.</li><li>Leveraging AI to improve decision-making is iterative and very challenging in practice. It requires a discretized workflow with relatively key decision points.</li><li>The government can build custom applications for sensitive information as well!</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3722a157ee4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>