<?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 Vanama Yaswanth on Medium]]></title>
        <description><![CDATA[Stories by Vanama Yaswanth on Medium]]></description>
        <link>https://medium.com/@vanamayaswanth?source=rss-3de04fe6853d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kfQz3wpgK1A6MEpQ_InBZw.jpeg</url>
            <title>Stories by Vanama Yaswanth on Medium</title>
            <link>https://medium.com/@vanamayaswanth?source=rss-3de04fe6853d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 16:19:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vanamayaswanth/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 to Make Prompts Production-Ready with the UXIC Framework (UML + XML + ICB + Caveman)]]></title>
            <link>https://medium.com/@vanamayaswanth/how-to-make-prompts-production-ready-with-the-uxic-framework-uml-xml-icb-caveman-ab547e2e0b6a?source=rss-3de04fe6853d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab547e2e0b6a</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[writing-prompts]]></category>
            <category><![CDATA[harness-engineering]]></category>
            <dc:creator><![CDATA[Vanama Yaswanth]]></dc:creator>
            <pubDate>Tue, 12 May 2026 11:37:46 GMT</pubDate>
            <atom:updated>2026-05-12T11:37:46.528Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Vanama Yaswanth</strong></p><p>If you’ve ever shipped an LLM prompt to production, you’ve felt the pain: the prompt works in a chat, but breaks the moment you put it behind an API, run it at scale, or hand it to someone else. The fix isn’t “better wording” but turning your prompt into an architecture.</p><p>The fastest way to do that is to use <strong>UXIC</strong>: an instruction set you give to a second AI, the “Transformer”, that rewrites your raw prompt into a strict, testable format.</p><ul><li><strong>UML (Mermaid.js)</strong> to force explicit control flow</li><li><strong>XML</strong> to force clear boundaries and slot filling</li><li><strong>ICB (In-Context Baseline)</strong> to freeze examples and constraints into a reusable baseline</li></ul><p>This post explains what to write, which tags go where, and why each piece exists.</p><h2>The Core Idea: “Prompt Compiler” vs “Prompt Copywriter”</h2><p>A normal AI treats your prompt like prose. A Transformer AI treats your prompt like source code:</p><ul><li><strong>Input:</strong> messy intent (“do X, maybe Y, format like Z”)</li><li><strong>Compile step:</strong> diagram + schema + constraints + examples</li><li><strong>Output:</strong> a deterministic baseline prompt you can version-control and reuse</li></ul><p>That is what “production-grade” means here: less interpretation, more structure.</p><h2>The UXIC Prompt</h2><p>Paste this into the Transformer AI once, then send your raw prompt.</p><pre>&lt;meta_instruction_protocol&gt;<br>    &lt;task&gt;<br>        Transform the user&#39;s provided &quot;Raw Prompt&quot; into a structured &quot;In-Context Baseline (ICB)&quot; architecture using XML encapsulation and UML (Mermaid.js) logic blocks.<br>    &lt;/task&gt;<br>    &lt;transformation_rules&gt;<br>        1. STRIP AMBIGUITY: Convert all prose instructions into a deterministic Mermaid sequence diagram.<br>        2. ENCAPSULATE: Wrap instructions in &lt;system_instructions&gt;, &lt;logic_baseline&gt;, and &lt;output_format&gt; XML tags.<br>        3. ESTABLISH BASELINE: Create 1-2 high-fidelity &quot;Few-Shot&quot; examples that demonstrate the logic flow.<br>        4. DEFINE DOMAINS: Explicitly define the boundaries (e.g., what is a &#39;Requester&#39; vs &#39;Approver&#39;) as hard constraints.<br>        5. OUTPUT SPECIFICATION: Force the final response into a structured JSON format with a mandatory &quot;Reasoning_Path&quot; key.<br>    &lt;/transformation_rules&gt;<br>    &lt;template_structure&gt;<br>        [SYSTEM ROLE]<br>        &lt;logic_baseline&gt;<br>            [MERMAID SEQUENCE DIAGRAM]<br>        &lt;/logic_baseline&gt;<br>        &lt;domain_constraints&gt;<br>            [DEFINITIONS]<br>        &lt;/domain_constraints&gt;<br>        &lt;baseline_examples&gt;<br>            [INPUT/OUTPUT PAIRS]<br>        &lt;/baseline_examples&gt;<br>        &lt;execution_task&gt;<br>            [USER INPUT DATA]<br>        &lt;/execution_task&gt;<br>    &lt;/template_structure&gt;<br>    &lt;instruction&gt;<br>        When I provide a raw task, you will output the REWRITTEN prompt only. Do not explain your changes unless asked.<br>    &lt;/instruction&gt;<br>&lt;/meta_instruction_protocol&gt;</pre><h2>What Each Tag Means</h2><p>Think of each XML tag as a compiler phase output. The goal is to stop the model from blending instructions, examples, and user data into one soup.</p><h3>1. &lt;meta_instruction_protocol&gt;: Namespace</h3><p><strong>What goes here:</strong> the entire transformation contract.</p><p><strong>Why it matters:</strong> a unique root tag acts like a namespace. It tells the Transformer that everything inside is instructional protocol, not content to answer.</p><h3>2. &lt;task&gt;: One-Sentence Mission</h3><p><strong>What goes here:</strong> what transformation you want, in one sentence.</p><p><strong>Why it matters:</strong> LLMs drift when the goal is implied. A single explicit mission reduces “helpful” detours.</p><h3>3. &lt;transformation_rules&gt;: Non-Negotiables</h3><p><strong>What goes here:</strong> short, numbered rules that can be checked after the fact.</p><p><strong>Why it matters:</strong> rules become acceptance criteria. If the output has no Mermaid, it failed rule 1. If there are no few-shots, it failed rule 3.</p><h3>4. &lt;template_structure&gt;: The Output Skeleton</h3><p><strong>What goes here:</strong> the exact sections you want in the rewritten prompt.</p><p><strong>Why it matters:</strong> this is the shape of your production prompt. It prevents the Transformer from inventing a new structure each time.</p><p>Inside this skeleton, you are defining the parts of your ICB.</p><h3>a. [SYSTEM ROLE] / &lt;system_instructions&gt;</h3><p><strong>What goes here:</strong> the role the target AI must assume, such as “You are a Software Architect and protocol executor.”</p><p><strong>Why it matters:</strong> this forces the second AI, the one doing the real task, to behave like a system component instead of a chat partner.</p><h3>b. &lt;logic_baseline&gt;</h3><p><strong>What goes here:</strong> a Mermaid sequence diagram describing deterministic flow.</p><p><strong>Why it matters:</strong> diagrams eliminate hidden assumptions. If a decision point is not drawn, it usually is not enforced.</p><p>Use Mermaid sequence diagrams when you want strict, linear “who does what next” logic. Use flowcharts when you want branching if/else trees.</p><h3>c. &lt;domain_constraints&gt;</h3><p><strong>What goes here:</strong> hard definitions of terms and boundaries.</p><p><strong>Why it matters:</strong> most production failures are domain failures, such as “approver” treated like “requester” or “PII” treated like “public data”. This section turns definitions into constraints.</p><p>If a term is important enough to appear in your output, define it here.</p><h3>d. &lt;baseline_examples&gt;</h3><p><strong>What goes here:</strong> 1–2 high-fidelity input/output pairs.</p><p><strong>Why it matters:</strong> examples become the model’s behavioral anchor. They reduce creative formatting and increase output stability.</p><p>High-fidelity means realistic inputs, edge cases, and the exact JSON structure you expect.</p><h3>e. &lt;execution_task&gt;</h3><p><strong>What goes here:</strong> the actual user data such as email text, ticket text, or transcript.</p><p><strong>Why it matters:</strong> this separation lets you freeze everything above as your baseline and swap only the payload at runtime.</p><h3>5. &lt;instruction&gt;: Output Gating</h3><p><strong>What goes here:</strong> “output the rewritten prompt only.”</p><p><strong>Why it matters:</strong> this prevents the Transformer from adding explanations and breaking your pipeline. In production, you want a clean compiled artifact, not commentary.</p><h2>The Missing Piece: Add These Tags Explicitly</h2><p>Your rules reference &lt;system_instructions&gt; and &lt;output_format&gt;, but the skeleton only shows &lt;logic_baseline&gt; and related tags. In practice, you want the rewritten prompt to contain both.</p><p>Here is a production-friendly skeleton you can ask the Transformer to output:</p><pre>&lt;system_instructions&gt;<br>You are a Software Architect and protocol executor. Follow the logic baseline and domain constraints strictly.<br>&lt;/system_instructions&gt;<br>&lt;logic_baseline&gt;<br>sequenceDiagram<br>    autonumber<br>    actor User<br>    participant Model as Target_AI<br>    User-&gt;&gt;Model: execution_task payload<br>    Model-&gt;&gt;Model: Validate domain constraints<br>    Model-&gt;&gt;Model: Apply extraction / transformation rules<br>    Model-&gt;&gt;Model: Validate against output_format schema<br>    Model--&gt;&gt;User: JSON response<br>&lt;/logic_baseline&gt;<br>&lt;domain_constraints&gt;<br>&lt;!-- Hard definitions go here --&gt;<br>&lt;/domain_constraints&gt;<br>&lt;baseline_examples&gt;<br>&lt;!-- Few-shot examples go here --&gt;<br>&lt;/baseline_examples&gt;<br>&lt;output_format&gt;<br>{<br>  &quot;Reasoning_Path&quot;: [&quot;...&quot;],<br>  &quot;Result&quot;: { }<br>}<br>&lt;/output_format&gt;<br>&lt;execution_task&gt;<br>&lt;!-- Runtime payload goes here --&gt;<br>&lt;/execution_task&gt;</pre><p>Why add &lt;output_format&gt;? Because &quot;format like JSON&quot; is not enough. You want the target AI to treat JSON as a contract, not a suggestion.</p><h2>What I Would Update to Make This More Production-Ready</h2><p>Your protocol is strong for designing a baseline. To make it production-safe, I would harden it with three additions: schema, failure mode, and validation.</p><h3>1. Add &lt;output_schema&gt;</h3><p>&lt;output_format&gt; is a human-readable shape. In production, you also want a JSON Schema so your app can validate outputs deterministically.</p><pre>&lt;output_schema&gt;<br>{<br>  &quot;$schema&quot;: &quot;https://json-schema.org/draft/2020-12/schema&quot;,<br>  &quot;type&quot;: &quot;object&quot;,<br>  &quot;required&quot;: [&quot;Reasoning_Path&quot;, &quot;Result&quot;],<br>  &quot;additionalProperties&quot;: false,<br>  &quot;properties&quot;: {<br>    &quot;Reasoning_Path&quot;: { &quot;type&quot;: &quot;array&quot;, &quot;items&quot;: { &quot;type&quot;: &quot;string&quot; } },<br>    &quot;Result&quot;: { &quot;type&quot;: &quot;object&quot; }<br>  }<br>}<br>&lt;/output_schema&gt;</pre><p>Then update your &lt;logic_baseline&gt; to include validating output against &lt;output_schema&gt;.</p><h3>2. Add an Explicit Error Contract</h3><p>Without this, models apologize or output half-JSON. Add a strict error shape and make it mutually exclusive with success.</p><pre>&lt;error_format&gt;<br>{ &quot;Error&quot;: { &quot;Code&quot;: &quot;string&quot;, &quot;Message&quot;: &quot;string&quot; } }<br>&lt;/error_format&gt;</pre><p>Rule: if the transcript is empty or invalid, return error_format JSON only.</p><h3>3. Add a Validation Loop</h3><p>Instruct the target model to do this every run:</p><ol><li>Produce JSON.</li><li>Check valid JSON parse.</li><li>Check it matches &lt;output_schema&gt; with no extra keys and all required keys.</li><li>If validation fails, fix it and re-check.</li><li>Output final JSON only.</li></ol><p>This turns formatting issues into a recoverable step instead of a production incident.</p><h3>Optional Upgrade</h3><p>If your model or API supports structured outputs, JSON mode, or function calling, use that at runtime and keep your XML and UML as the baseline spec. You still keep the compiled prompt, but stop relying on “please output JSON” as enforcement.</p><h2>Worked Example: Raw Prompt to Compiled ICB</h2><h3>Raw Prompt</h3><blockquote>“Extract procurement details from approval emails. Identify the requester and approver, and return a JSON summary. If anything is missing, set it to null.”</blockquote><p>This sounds fine, but it hides assumptions:</p><ul><li>What counts as a requester vs approver?</li><li>What if the email mentions multiple people?</li><li>What is the exact JSON schema?</li><li>What is the order of operations?</li></ul><h3>What the Transformer Should Produce</h3><p>When you paste the meta-prompt and the raw prompt into the Transformer AI, the output should be a rewritten prompt that:</p><ul><li>Defines the system role with &lt;system_instructions&gt;</li><li>Draws the flow with &lt;logic_baseline&gt; and Mermaid</li><li>Locks definitions with &lt;domain_constraints&gt;</li><li>Shows examples with &lt;baseline_examples&gt;</li><li>Freezes the schema with &lt;output_format&gt;</li><li>Includes the payload slot with &lt;execution_task&gt;</li></ul><p>You can then feed that compiled prompt to your target AI with a real email inside &lt;execution_task&gt;.</p><h2>Real-World Example: A Meeting Summary Agent</h2><p>This is a realistic use case where chat-style prompts fail in production: you want consistent summaries and action items from messy meeting transcripts.</p><h3>Raw Prompt</h3><blockquote>“Summarize this meeting transcript. Extract action items with owners and due dates. Also list decisions, risks, and open questions. Output JSON.”</blockquote><p>That prompt is underspecified. Here is what a compiled ICB version looks like.</p><h3>Compiled Prompt (ICB)</h3><pre>&lt;system_instructions&gt;<br>You are a deterministic Meeting Summary Agent used in production. You must follow &lt;logic_baseline&gt;,<br>&lt;domain_constraints&gt;, &lt;baseline_examples&gt;, and &lt;output_format&gt; strictly.<br>Hard rules:<br>- Do not invent facts not present in &lt;execution_task&gt;.<br>- If a field is unknown, use null (not an empty string).<br>- Output MUST be valid JSON matching &lt;output_format&gt;. No markdown. No extra keys.<br>- &quot;Reasoning_Path&quot; must be a high-level list of steps (no hidden chain-of-thought, no private deliberation).<br>&lt;/system_instructions&gt;<br>&lt;logic_baseline&gt;<br>sequenceDiagram<br>    autonumber<br>    actor User<br>    participant Model as Target_AI<br>    User-&gt;&gt;Model: &lt;execution_task&gt; transcript payload<br>    Model-&gt;&gt;Model: Validate transcript is present + non-empty<br>    Model-&gt;&gt;Model: Apply domain_constraints definitions<br>    Model-&gt;&gt;Model: Extract (Summary, KeyPoints, Decisions, ActionItems, Risks, OpenQuestions)<br>    Model-&gt;&gt;Model: Normalize dates (YYYY-MM-DD) and set unknowns to null<br>    Model-&gt;&gt;Model: Validate JSON structure matches output_format<br>    Model--&gt;&gt;User: JSON response only<br>&lt;/logic_baseline&gt;<br>&lt;domain_constraints&gt;<br>Definitions (hard constraints):<br>- Transcript: The raw text in &lt;execution_task&gt;. Treat it as the only source of truth.<br>- KeyPoint: A notable fact stated in the transcript (not an interpretation).<br>- Decision: A resolved choice (&quot;we will do X&quot;, &quot;we decided Y&quot;). If it is not resolved, it is not a Decision.<br>- ActionItem: A task someone should do after the meeting. Must be phrased as a verb + object.<br>- Owner: A person or team explicitly mentioned in the transcript as responsible. If not explicit, set Owner to null.<br>- DueDate: Only include when explicitly stated. Use YYYY-MM-DD. Otherwise null.<br>- Risk: A potential negative outcome mentioned (timeline risk, scope risk, security risk, etc.).<br>- OpenQuestion: A question left unresolved in the transcript.<br>Normalization:<br>- Priority is one of: P0, P1, P2 (infer only if explicit urgency is stated; otherwise default P1).<br>- Status is one of: open, blocked, done (only &quot;done&quot; if explicitly completed).<br>&lt;/domain_constraints&gt;<br>&lt;baseline_examples&gt;<br>Example 1<br>INPUT (&lt;execution_task&gt;):<br>&quot;Asha: We need the v2 signup flow by May 20. Ben, can you draft the tracking plan by Friday?<br>Also: decision - we&#39;ll use Stripe Billing, not Chargebee. Risk: Legal review could delay launch.<br>Open question: do we support Apple Pay on day one?&quot;<br>OUTPUT (must match &lt;output_format&gt;):<br>{<br>  &quot;Reasoning_Path&quot;: [<br>    &quot;Validate transcript&quot;,<br>    &quot;Apply domain constraints&quot;,<br>    &quot;Extract entities (decisions, actions, risks, questions)&quot;,<br>    &quot;Normalize dates and unknowns&quot;,<br>    &quot;Validate output schema&quot;<br>  ],<br>  &quot;Result&quot;: {<br>    &quot;Title&quot;: &quot;Meeting Summary&quot;,<br>    &quot;OneParagraphSummary&quot;: &quot;The team aligned on delivering the v2 signup flow by May 20, selected Stripe Billing, and identified legal review as a potential schedule risk. Follow-ups include drafting a tracking plan and clarifying Apple Pay support for launch.&quot;,<br>    &quot;KeyPoints&quot;: [<br>      &quot;Target date mentioned: May 20 for v2 signup flow&quot;,<br>      &quot;Decision: Stripe Billing chosen over Chargebee&quot;,<br>      &quot;Risk: legal review could delay launch&quot;,<br>      &quot;Open question: Apple Pay support on day one&quot;<br>    ],<br>    &quot;Decisions&quot;: [<br>      { &quot;Decision&quot;: &quot;Use Stripe Billing (not Chargebee)&quot;, &quot;Rationale&quot;: null, &quot;Date&quot;: null }<br>    ],<br>    &quot;ActionItems&quot;: [<br>      { &quot;Task&quot;: &quot;Draft the tracking plan&quot;, &quot;Owner&quot;: &quot;Ben&quot;, &quot;DueDate&quot;: null, &quot;Priority&quot;: &quot;P1&quot;, &quot;Status&quot;: &quot;open&quot; }<br>    ],<br>    &quot;OpenQuestions&quot;: [<br>      &quot;Do we support Apple Pay on day one?&quot;<br>    ],<br>    &quot;Risks&quot;: [<br>      { &quot;Risk&quot;: &quot;Legal review could delay launch&quot;, &quot;Impact&quot;: &quot;medium&quot;, &quot;Mitigation&quot;: null }<br>    ],<br>    &quot;ExtraNotes&quot;: null<br>  }<br>}<br>Example 2<br>INPUT (&lt;execution_task&gt;):<br>&quot;Diego: Quick update - API error rate dropped after the hotfix. Decision: pause new features until stability is green for 48 hours.<br>Action item: SRE team to add an alert for 5xx spikes. No due date mentioned.&quot;<br>OUTPUT (must match &lt;output_format&gt;):<br>{<br>  &quot;Reasoning_Path&quot;: [<br>    &quot;Validate transcript&quot;,<br>    &quot;Apply domain constraints&quot;,<br>    &quot;Extract entities (decisions, actions, risks, questions)&quot;,<br>    &quot;Normalize dates and unknowns&quot;,<br>    &quot;Validate output schema&quot;<br>  ],<br>  &quot;Result&quot;: {<br>    &quot;Title&quot;: &quot;Meeting Summary&quot;,<br>    &quot;OneParagraphSummary&quot;: &quot;After a hotfix reduced API error rates, the team decided to pause new feature work until stability remains green for 48 hours and assigned SRE to add alerting for 5xx spikes.&quot;,<br>    &quot;KeyPoints&quot;: [<br>      &quot;API error rate dropped after hotfix&quot;,<br>      &quot;Decision: pause new features until stability is green for 48 hours&quot;,<br>      &quot;Action item: add alert for 5xx spikes&quot;<br>    ],<br>    &quot;Decisions&quot;: [<br>      { &quot;Decision&quot;: &quot;Pause new features until stability is green for 48 hours&quot;, &quot;Rationale&quot;: null, &quot;Date&quot;: null }<br>    ],<br>    &quot;ActionItems&quot;: [<br>      { &quot;Task&quot;: &quot;Add an alert for 5xx spikes&quot;, &quot;Owner&quot;: &quot;SRE team&quot;, &quot;DueDate&quot;: null, &quot;Priority&quot;: &quot;P1&quot;, &quot;Status&quot;: &quot;open&quot; }<br>    ],<br>    &quot;OpenQuestions&quot;: [],<br>    &quot;Risks&quot;: [],<br>    &quot;ExtraNotes&quot;: null<br>  }<br>}<br>&lt;/baseline_examples&gt;<br>&lt;output_format&gt;<br>{<br>  &quot;Reasoning_Path&quot;: [&quot;string (high-level steps only)&quot;],<br>  &quot;Result&quot;: {<br>    &quot;Title&quot;: &quot;string&quot;,<br>    &quot;OneParagraphSummary&quot;: &quot;string&quot;,<br>    &quot;KeyPoints&quot;: [&quot;string&quot;],<br>    &quot;Decisions&quot;: [<br>      { &quot;Decision&quot;: &quot;string&quot;, &quot;Rationale&quot;: &quot;string|null&quot;, &quot;Date&quot;: &quot;YYYY-MM-DD|null&quot; }<br>    ],<br>    &quot;ActionItems&quot;: [<br>      { &quot;Task&quot;: &quot;string&quot;, &quot;Owner&quot;: &quot;string|null&quot;, &quot;DueDate&quot;: &quot;YYYY-MM-DD|null&quot;, &quot;Priority&quot;: &quot;P0|P1|P2&quot;, &quot;Status&quot;: &quot;open|blocked|done&quot; }<br>    ],<br>    &quot;OpenQuestions&quot;: [&quot;string&quot;],<br>    &quot;Risks&quot;: [<br>      { &quot;Risk&quot;: &quot;string&quot;, &quot;Impact&quot;: &quot;low|medium|high&quot;, &quot;Mitigation&quot;: &quot;string|null&quot; }<br>    ],<br>    &quot;ExtraNotes&quot;: &quot;string|null&quot;<br>  }<br>}<br>&lt;/output_format&gt;<br>&lt;execution_task&gt;<br>{{meeting_transcript}}<br>&lt;/execution_task&gt;</pre><h2>Caveman Compiled Prompt</h2><p>Same contract, fewer tokens.</p><pre>&lt;system_instructions&gt;<br>You are Meeting Summary Agent (production). Follow tags strictly.<br>Rules:<br>- Use only &lt;execution_task&gt;. No invent.<br>- Unknown =&gt; null (not empty string).<br>- Output JSON only. Must match &lt;output_format&gt;. No markdown. No extra keys.<br>- &quot;Reasoning_Path&quot; = high-level steps only (no hidden chain-of-thought).<br>&lt;/system_instructions&gt;<br>&lt;logic_baseline&gt;<br>sequenceDiagram<br>    autonumber<br>    actor User<br>    participant Model as Target_AI<br>    User-&gt;&gt;Model: &lt;execution_task&gt; transcript<br>    Model-&gt;&gt;Model: Check transcript non-empty<br>    Model-&gt;&gt;Model: Apply domain constraints<br>    Model-&gt;&gt;Model: Extract fields<br>    Model-&gt;&gt;Model: Normalize dates (YYYY-MM-DD), else null<br>    Model-&gt;&gt;Model: Validate JSON matches output_format<br>    Model--&gt;&gt;User: JSON only<br>&lt;/logic_baseline&gt;<br>&lt;domain_constraints&gt;<br>- Transcript: text inside &lt;execution_task&gt;. Only source.<br>- KeyPoint: fact stated. Not interpretation.<br>- Decision: resolved choice (&quot;we decided X&quot;). Not resolved =&gt; not Decision.<br>- ActionItem: post-meeting task (verb + object).<br>- Owner: only if explicit; else null.<br>- DueDate: only if explicit; format YYYY-MM-DD; else null.<br>- Risk: potential negative outcome mentioned.<br>- OpenQuestion: question left unresolved.<br>- Priority: P0|P1|P2 (infer only if urgency explicit; else P1).<br>- Status: open|blocked|done (done only if explicitly completed).<br>&lt;/domain_constraints&gt;<br>&lt;baseline_examples&gt;<br>Example 1<br>INPUT (&lt;execution_task&gt;):<br>&quot;Asha: We need the v2 signup flow by May 20. Ben, can you draft the tracking plan by Friday?<br>Decision: use Stripe Billing, not Chargebee. Risk: Legal review could delay launch.<br>Open question: do we support Apple Pay on day one?&quot;<br>OUTPUT:<br>{<br>  &quot;Reasoning_Path&quot;: [&quot;validate&quot;, &quot;extract&quot;, &quot;normalize&quot;, &quot;schema-check&quot;],<br>  &quot;Result&quot;: {<br>    &quot;Title&quot;: &quot;Meeting Summary&quot;,<br>    &quot;OneParagraphSummary&quot;: &quot;Team targets May 20 for v2 signup flow, chose Stripe Billing, noted legal review as a schedule risk, and assigned Ben to draft a tracking plan. Apple Pay support remains open.&quot;,<br>    &quot;KeyPoints&quot;: [<br>      &quot;Target date mentioned: May 20 for v2 signup flow&quot;,<br>      &quot;Decision: Stripe Billing chosen over Chargebee&quot;,<br>      &quot;Risk: legal review could delay launch&quot;,<br>      &quot;Open question: Apple Pay support on day one&quot;<br>    ],<br>    &quot;Decisions&quot;: [<br>      { &quot;Decision&quot;: &quot;Use Stripe Billing (not Chargebee)&quot;, &quot;Rationale&quot;: null, &quot;Date&quot;: null }<br>    ],<br>    &quot;ActionItems&quot;: [<br>      { &quot;Task&quot;: &quot;Draft the tracking plan&quot;, &quot;Owner&quot;: &quot;Ben&quot;, &quot;DueDate&quot;: null, &quot;Priority&quot;: &quot;P1&quot;, &quot;Status&quot;: &quot;open&quot; }<br>    ],<br>    &quot;OpenQuestions&quot;: [<br>      &quot;Do we support Apple Pay on day one?&quot;<br>    ],<br>    &quot;Risks&quot;: [<br>      { &quot;Risk&quot;: &quot;Legal review could delay launch&quot;, &quot;Impact&quot;: &quot;medium&quot;, &quot;Mitigation&quot;: null }<br>    ],<br>    &quot;ExtraNotes&quot;: null<br>  }<br>}<br>Example 2<br>INPUT (&lt;execution_task&gt;):<br>&quot;Diego: API error rate dropped after the hotfix. Decision: pause new features until stability is green for 48 hours.<br>Action item: SRE team to add an alert for 5xx spikes.&quot;<br>OUTPUT:<br>{<br>  &quot;Reasoning_Path&quot;: [&quot;validate&quot;, &quot;extract&quot;, &quot;normalize&quot;, &quot;schema-check&quot;],<br>  &quot;Result&quot;: {<br>    &quot;Title&quot;: &quot;Meeting Summary&quot;,<br>    &quot;OneParagraphSummary&quot;: &quot;After a hotfix reduced API error rates, the team decided to pause new features until stability is green for 48 hours and assigned SRE to add 5xx spike alerting.&quot;,<br>    &quot;KeyPoints&quot;: [<br>      &quot;API error rate dropped after hotfix&quot;,<br>      &quot;Decision: pause new features until stability is green for 48 hours&quot;,<br>      &quot;Action item: add alert for 5xx spikes&quot;<br>    ],<br>    &quot;Decisions&quot;: [<br>      { &quot;Decision&quot;: &quot;Pause new features until stability is green for 48 hours&quot;, &quot;Rationale&quot;: null, &quot;Date&quot;: null }<br>    ],<br>    &quot;ActionItems&quot;: [<br>      { &quot;Task&quot;: &quot;Add an alert for 5xx spikes&quot;, &quot;Owner&quot;: &quot;SRE team&quot;, &quot;DueDate&quot;: null, &quot;Priority&quot;: &quot;P1&quot;, &quot;Status&quot;: &quot;open&quot; }<br>    ],<br>    &quot;OpenQuestions&quot;: [],<br>    &quot;Risks&quot;: [],<br>    &quot;ExtraNotes&quot;: null<br>  }<br>}<br>&lt;/baseline_examples&gt;<br>&lt;output_format&gt;<br>{<br>  &quot;Reasoning_Path&quot;: [&quot;string (high-level steps only)&quot;],<br>  &quot;Result&quot;: {<br>    &quot;Title&quot;: &quot;string&quot;,<br>    &quot;OneParagraphSummary&quot;: &quot;string&quot;,<br>    &quot;KeyPoints&quot;: [&quot;string&quot;],<br>    &quot;Decisions&quot;: [<br>      { &quot;Decision&quot;: &quot;string&quot;, &quot;Rationale&quot;: &quot;string|null&quot;, &quot;Date&quot;: &quot;YYYY-MM-DD|null&quot; }<br>    ],<br>    &quot;ActionItems&quot;: [<br>      { &quot;Task&quot;: &quot;string&quot;, &quot;Owner&quot;: &quot;string|null&quot;, &quot;DueDate&quot;: &quot;YYYY-MM-DD|null&quot;, &quot;Priority&quot;: &quot;P0|P1|P2&quot;, &quot;Status&quot;: &quot;open|blocked|done&quot; }<br>    ],<br>    &quot;OpenQuestions&quot;: [&quot;string&quot;],<br>    &quot;Risks&quot;: [<br>      { &quot;Risk&quot;: &quot;string&quot;, &quot;Impact&quot;: &quot;low|medium|high&quot;, &quot;Mitigation&quot;: &quot;string|null&quot; }<br>    ],<br>    &quot;ExtraNotes&quot;: &quot;string|null&quot;<br>  }<br>}<br>&lt;/output_format&gt;<br>&lt;execution_task&gt;<br>{{meeting_transcript}}<br>&lt;/execution_task&gt;</pre><h2>Option: Use TOON Instead of JSON</h2><p>If your main goal is token reduction, you can swap JSON for <strong>TOON</strong> (Token-Oriented Object Notation), a compact, human-readable encoding of the JSON data model designed for LLM prompts. It keeps the same underlying data model but removes much of the repeated punctuation and repeated keys in large uniform arrays.</p><p>The practical production pattern is:</p><ul><li>In prompts, send structured context as TOON, especially big arrays</li><li>In code, decode TOON to JSON, then validate with JSON Schema</li><li>For model output, you can request TOON output, but still decode and validate server-side</li></ul><h3>Replace &lt;output_format&gt; with a TOON Contract</h3><pre>&lt;output_format&gt;<br>Reasoning_Path[N]: comma-delimited strings (high-level steps only)<br>Result:<br>  Title: string<br>  OneParagraphSummary: string<br>  KeyPoints[N]: strings<br>  Decisions[N]{Decision,Rationale,Date}:<br>    Decision(string),Rationale(string|null),Date(YYYY-MM-DD|null)<br>  ActionItems[N]{Task,Owner,DueDate,Priority,Status}:<br>    Task(string),Owner(string|null),DueDate(YYYY-MM-DD|null),Priority(P0|P1|P2),Status(open|blocked|done)<br>  OpenQuestions[N]: strings<br>  Risks[N]{Risk,Impact,Mitigation}:<br>    Risk(string),Impact(low|medium|high),Mitigation(string|null)<br>  ExtraNotes: string|null<br>&lt;/output_format&gt;</pre><h3>Example TOON Output</h3><pre>Reasoning_Path[4]: validate,extract,normalize,schema-check<br>Result:<br>  Title: Meeting Summary<br>  OneParagraphSummary: &quot;Team targets May 20 for v2 signup flow, chose Stripe Billing, noted legal review as a schedule risk, and assigned Ben to draft a tracking plan. Apple Pay support remains open.&quot;<br>  KeyPoints[4]: &quot;Target date mentioned: May 20 for v2 signup flow&quot;,&quot;Decision: Stripe Billing chosen over Chargebee&quot;,&quot;Risk: legal review could delay launch&quot;,&quot;Open question: Apple Pay support on day one&quot;<br>  Decisions[1]{Decision,Rationale,Date}:<br>    Use Stripe Billing (not Chargebee),null,null<br>  ActionItems[1]{Task,Owner,DueDate,Priority,Status}:<br>    Draft the tracking plan,Ben,null,P1,open<br>  OpenQuestions[1]: &quot;Do we support Apple Pay on day one?&quot;<br>  Risks[1]{Risk,Impact,Mitigation}:<br>    &quot;Legal review could delay launch&quot;,medium,null<br>  ExtraNotes: null</pre><p>Important: TOON has quoting rules. If a string contains : or ,, you must quote it or parsing can break.</p><h2>Where Each Tag Goes</h2><ul><li>Put role and hard output gating in &lt;system_instructions&gt; so the target model cannot &quot;be helpful&quot; and change formats.</li><li>Put deterministic steps in &lt;logic_baseline&gt; so missing steps are obvious and reviewable.</li><li>Put definitions in &lt;domain_constraints&gt; so category boundaries do not drift between runs.</li><li>Put 1–2 realistic examples in &lt;baseline_examples&gt; so the model anchors to your exact JSON shape.</li><li>Put the JSON contract in &lt;output_format&gt; so validation is possible.</li><li>Put runtime text in &lt;execution_task&gt; so you can freeze the baseline and only swap payloads.</li></ul><h2>A Practical Checklist</h2><p>Use this checklist before you accept a compiled prompt:</p><ul><li>&lt;system_instructions&gt; exists and sets a strict role</li><li>&lt;logic_baseline&gt; contains valid Mermaid and includes validation steps</li><li>&lt;domain_constraints&gt; defines every domain term that appears in output keys</li><li>&lt;baseline_examples&gt; includes at least one messy realistic example</li><li>&lt;output_format&gt; is a JSON shape, not a vague description</li><li>&lt;execution_task&gt; is the only place you paste runtime text</li></ul><p>If any item is missing, the Transformer did not follow the protocol, or the protocol did not force it clearly enough.</p><h2>Production Reality: What This Meta-Prompt Solves</h2><h3>It Solves</h3><ul><li><strong>Ambiguity:</strong> by drawing the flow and enforcing a schema</li><li><strong>Inconsistent output:</strong> by few-shot anchoring and output contracts</li><li><strong>Team handoff:</strong> by making prompts readable as a spec</li></ul><h3>It Does Not Solve</h3><ul><li><strong>Bad logic:</strong> a perfect diagram of a broken process is still broken</li><li><strong>Cost:</strong> the compiled prompt is longer, often 3x to 5x</li><li><strong>Small-model brittleness:</strong> weaker models may struggle with Mermaid correctness or strict JSON</li></ul><h2>Pro Tip: Do a Caveman Compression Pass</h2><p>Once you have a compiled prompt that works, you can often reduce runtime cost by running one more transformation: rewrite the compiled baseline into a shorter caveman-style prompt with short phrases and no fluff, without changing structure.</p><p>The key is simple: compress the words, not the contract.</p><h3>Where Token Cost Usually Comes From</h3><ul><li>Baseline bulk: XML, Mermaid, constraints, and schema add a lot of fixed tokens</li><li>Few-shot examples: usually the biggest cost driver</li><li>Large payloads: long transcripts or emails inside &lt;execution_task&gt; can dominate everything</li></ul><h3>Tips to Keep Token Cost Under Control</h3><ul><li>Freeze the baseline and swap only &lt;execution_task&gt; at runtime</li><li>Minimize examples: start with one strong example and add a second only if needed</li><li>Compress after it works: apply caveman style only after validating behavior with test cases</li><li>Shorten the payload: trim signatures, footers, irrelevant threads, and long transcript sections</li><li>Use caching when available: prompt caching or persistent system prompts can remove repeated baseline costs</li><li>If you have large uniform lists, consider TOON for inputs to reduce tokens, then decode to JSON and validate in code</li></ul><h3>What You Can Compress</h3><ul><li>Text inside &lt;system_instructions&gt;</li><li>Verbose descriptions in &lt;domain_constraints&gt;</li><li>Step labels in &quot;Reasoning_Path&quot;</li></ul><h3>What You Should Not Compress</h3><ul><li>XML tag structure</li><li>JSON keys and schema in &lt;output_format&gt;</li><li>Mermaid syntax inside &lt;logic_baseline&gt;</li><li>The separation between baseline and payload, where &lt;execution_task&gt; stays a clean slot</li></ul><h2>A Caveman Compiler Prompt You Can Reuse</h2><p>Use this with a capable model once, then save the output and reuse it.</p><pre>You are a prompt optimizer. Rewrite the prompt I paste to be shorter (&quot;caveman style&quot;):<br>- Keep ALL XML tags and their order.<br>- Keep ALL JSON keys exactly the same.<br>- Keep Mermaid valid.<br>- Remove filler. Use short imperative phrases.<br>- No new features. No new constraints. No deleted constraints that affect meaning.<br>- Output the rewritten prompt only.</pre><h3>Tiny Example</h3><p><strong>Before:</strong></p><blockquote>“You are a deterministic Meeting Summary Agent used in production. You must follow logic_baseline, domain_constraints, baseline_examples, and output_format strictly…”</blockquote><p><strong>After:</strong></p><blockquote>“You are Meeting Summary Agent. Follow tags. No invent. Unknown =&gt; null. Output JSON only. Match output_format. No extra keys.”</blockquote><p>This works best when you freeze the compressed baseline and only swap the &lt;execution_task&gt; payload at runtime.</p><h2>Before and After: Real Excerpt</h2><p>Below is what caveman compression looks like when applied to the compiled meeting-summary baseline from above.</p><h3>Before</h3><pre>&lt;system_instructions&gt;<br>You are a deterministic Meeting Summary Agent used in production. You must follow &lt;logic_baseline&gt;,<br>&lt;domain_constraints&gt;, &lt;baseline_examples&gt;, and &lt;output_format&gt; strictly.<br>Hard rules:<br>- Do not invent facts not present in &lt;execution_task&gt;.<br>- If a field is unknown, use null (not an empty string).<br>- Output MUST be valid JSON matching &lt;output_format&gt;. No markdown. No extra keys.<br>- &quot;Reasoning_Path&quot; must be a high-level list of steps (no hidden chain-of-thought, no private deliberation).<br>&lt;/system_instructions&gt;</pre><h3>After</h3><pre>&lt;system_instructions&gt;<br>You are Meeting Summary Agent (production). Follow tags strictly.<br>Rules:<br>- Use only &lt;execution_task&gt;. No invent.<br>- Unknown =&gt; null.<br>- Output JSON only. Must match &lt;output_format&gt;. No extra keys. No markdown.<br>- &quot;Reasoning_Path&quot; = high-level steps only (no hidden chain-of-thought).<br>&lt;/system_instructions&gt;</pre><p>Notice what did not change:</p><ul><li>The tag name stayed &lt;system_instructions&gt;</li><li>The constraints stayed the same</li><li>The output gating stayed the same</li></ul><p>You can do the same compression for &lt;domain_constraints&gt;:</p><pre>&lt;domain_constraints&gt;<br>- Decision: resolved choice (&quot;we decided X&quot;). If not resolved =&gt; not a Decision.<br>- ActionItem: post-meeting task (verb + object).<br>- Owner: only if explicit in transcript; else null.<br>- DueDate: only if explicit; format YYYY-MM-DD; else null.<br>&lt;/domain_constraints&gt;</pre><h2>How to Check the Caveman Version</h2><p>Do these checks every time you compress:</p><ul><li><strong>Structure check:</strong> same XML tags, same order</li><li><strong>Schema check:</strong> &lt;output_format&gt; JSON keys are identical character-for-character</li><li><strong>Mermaid check:</strong> the &lt;logic_baseline&gt; diagram still parses</li><li><strong>Behavior check:</strong> run the same transcript through both prompts and compare outputs for the same keys, fewer creative extras, and no new hallucinations</li></ul><p>If you want bigger savings than wording compression, use prompt caching where available and keep the baseline frozen.</p><h2>The Payoff: Freeze the Baseline, Swap Only the Payload</h2><p>The most production-ready way to use this approach is:</p><ol><li>Run the Transformer to generate the baseline once.</li><li>Save the compiled prompt in version control.</li><li>In your app, do not regenerate the whole thing each request.</li><li>Only replace what is inside &lt;execution_task&gt; and any explicit {{variables}} you define.</li></ol><p>That is how you move from prompting to prompt engineering as configuration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab547e2e0b6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MCP vs RAG routers]]></title>
            <link>https://medium.com/@vanamayaswanth/mcp-vs-rag-routers-cd65e4f1cc37?source=rss-3de04fe6853d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd65e4f1cc37</guid>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[vanama]]></category>
            <category><![CDATA[llmops]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[llm-applications]]></category>
            <dc:creator><![CDATA[Vanama Yaswanth]]></dc:creator>
            <pubDate>Wed, 09 Apr 2025 14:12:52 GMT</pubDate>
            <atom:updated>2025-04-09T14:12:52.976Z</atom:updated>
            <content:encoded><![CDATA[<p>Here’s a comprehensive blog post that combines all the information about RAG routers, MCP, and how to integrate them for enhanced AI systems</p><h3>Unlocking AI Potential: Combining RAG Routers and MCP</h3><p>The world of artificial intelligence is rapidly evolving, with innovations like RAG (Retrieval-Augmented Generation) and MCP (Model Context Protocol) transforming how AI systems interact with data. In this blog post, we’ll explore the roles of routers in RAG systems, compare them with MCP, and discuss how combining these technologies can lead to even more powerful AI systems.</p><h3>Introduction to RAG Routers</h3><p>Routers in RAG systems are specialized components that manage the flow of user queries. Their primary function is to direct queries to the most appropriate processing pipeline or model based on the query’s characteristics, such as intent, complexity, or domain relevance. This routing is crucial for optimizing retrieval and ensuring that responses are accurate and relevant.</p><h3>Key Features of RAG Routers:</h3><p>- Semantic Routing: Uses semantic similarity to classify queries and route them to the correct response pipeline.</p><p>- Modularity: Integrates multiple retrieval and generation pipelines, enhancing system flexibility and scalability.</p><p>- Cost Efficiency: Directs complex tasks to powerful models while cost-effective models handle simpler tasks.</p><h3>Introduction to MCP</h3><p>MCP is a protocol designed to facilitate real-time interaction between language models and external tools or databases. It enables AI models to perform actions like creating files, querying APIs, or updating databases in real-time. This capability makes MCP particularly useful for applications requiring dynamic updates or live data integration.</p><h3>Key Features of MCP</h3><p>- Real-Time Interaction: Facilitates bidirectional communication between models and external systems.</p><p>- Dynamic Adaptability: Supports real-time updates and actions, making it ideal for live data applications.</p><p>- Operational Flexibility: Enables models to interact with a wide range of external tools and databases.</p><h3>Comparison: RAG Routers vs. MCP</h3><p>While both are essential for AI systems, they serve different purposes:</p><p>- RAG Routers focus on optimizing query handling and retrieval for informed responses.</p><p>- MCP facilitates real-time interaction with external systems for dynamic actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/0*xe9EK9npefYw9d3V" /></figure><p>Difference between the MCP and RAG</p><h3>Combining RAG Routers and MCP</h3><p>Imagine a system that not only retrieves relevant information efficiently but also performs real-time actions based on that information. Combining RAG routers with MCP can create such a powerful AI system. Here’s how:</p><p>1. Enhanced Retrieval and Action: RAG routers can direct queries to the most relevant data sources, and MCP can then use this information to perform real-time actions. For example, in a financial analysis application, RAG routers could retrieve relevant stock data, and MCP could use this data to execute trades or update financial models in real-time.</p><p>2. Dynamic Feedback Loop: By integrating MCP’s real-time capabilities with RAG’s retrieval efficiency, you can create a dynamic feedback loop. This loop allows the system to continuously update its knowledge base and adapt to changing conditions, ensuring that responses and actions remain accurate and relevant.</p><p>3. Improved Efficiency and Scalability: Combining these technologies can also enhance system efficiency. RAG routers can optimize resource allocation by directing tasks to the appropriate models, while MCP ensures that these tasks are executed in real-time, reducing latency and improving overall system performance.</p><h3>Steps to Integrate MCP and RAG</h3><p>To leverage the strengths of both technologies, follow these steps:</p><p>1. Define Use Cases: Identify scenarios where both real-time actions (MCP) and retrieval-based grounding (RAG) are needed.</p><p>- Healthcare: RAG retrieves medical literature, while MCP updates patient records or triggers alerts.</p><p>2. Establish an MCP Server: Set up an MCP server to connect AI models to external tools, APIs, and databases. This server acts as the interface layer, enabling real-time data access and action execution.</p><p>3. Integrate RAG Pipelines: Incorporate RAG pipelines within the MCP framework:</p><p>- Use RAG to fetch relevant documents from vector databases or knowledge graphs.</p><p>- Feed retrieved data into the MCP workflow for further processing or decision-making.</p><p>4. Create a Unified Ecosystem: Combine MCP’s ability to interact with tools and APIs with RAG’s retrieval capabilities:</p><p>- Route queries through RAG for factual accuracy and context.</p><p>- Use MCP to execute actions based on retrieved information, such as sending emails or querying live databases.</p><p>5. Optimize Workflow: Ensure seamless integration by:</p><p>- Using semantic routers to direct queries to either RAG or MCP depending on the task.</p><p>- Minimizing computational overhead by leveraging MCP for direct data access when retrieval is unnecessary.</p><h3>Benefits of Integration</h3><p>1. Real-Time Action with Factual Grounding: RAG ensures responses are accurate, while MCP enables immediate execution of tasks based on retrieved data.</p><p>2. Enhanced Efficiency: Combining retrieval and real-time capabilities reduces latency and improves system performance.</p><p>3. Scalability: The unified ecosystem supports diverse applications across industries like finance, healthcare, and customer service.</p><p>### Example Use Cases</p><p>- Smart Home Automation: A smart home system could use RAG routers to retrieve user preferences and MCP to execute actions like adjusting lighting or temperature in real-time.</p><p>- Healthcare Analytics: In healthcare, RAG routers could retrieve patient data, and MCP could use this data to update medical records or trigger alerts for healthcare providers in real-time.</p><h3>Conclusion</h3><p>In conclusion, while RAG routers and MCP are powerful tools on their own, combining them can unlock even greater potential for AI systems. By integrating efficient retrieval with real-time action capabilities, developers can create more versatile, efficient, and dynamic AI applications that meet the evolving needs of users across various industries.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd65e4f1cc37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[30 days — what-are-large-language-models-used-for-ai]]></title>
            <link>https://medium.com/@vanamayaswanth/30-days-what-are-large-language-models-used-for-ai-954c2d70c884?source=rss-3de04fe6853d------2</link>
            <guid isPermaLink="false">https://medium.com/p/954c2d70c884</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[vision]]></category>
            <category><![CDATA[students]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Vanama Yaswanth]]></dc:creator>
            <pubDate>Fri, 04 Oct 2024 09:30:54 GMT</pubDate>
            <atom:updated>2024-10-04T09:30:54.193Z</atom:updated>
            <content:encoded><![CDATA[<h3>30 days — what-are-large-language-models-used-for-ai</h3><p>Explore the world of large language models (LLMs) in AI! Discover their applications in text generation, chatbots, sentiment analysis &amp; more — unlocking new possibilities for businesses &amp; individuals alike!</p><h3>Unlocking the Power of Language: What Large Language Models Can Do for You</h3><p>In today’s digital landscape, large language models (LLMs) are making waves across various sectors, from tech to healthcare. But what exactly are these models, and how can they be utilized? In this blog post, we’ll explore the ins and outs of LLMs, their applications, and what they can do for you. So, grab your favorite beverage, get comfy, and let’s dive in!</p><h4>What Are Large Language Models?</h4><p>Large language models are sophisticated AI systems designed to understand and generate human language. They are built using deep learning techniques, particularly the transformer architecture, which allows them to process vast amounts of text data efficiently. Think of LLMs as highly advanced text generators that can produce coherent responses based on the input they receive.</p><p>These models are trained on diverse datasets that include books, articles, websites, and other text sources. This extensive training enables them to grasp grammar, facts about the world, and even some reasoning abilities. The power of LLMs lies in their ability to predict the next word in a sentence based on context, making them incredibly versatile tools for various applications.</p><h4>How Do Large Language Models Work?</h4><p>At the core of LLMs is a complex interplay of algorithms and data processing techniques. Here’s a simplified breakdown of how they function:</p><p><strong>1. Training Phase:</strong> LLMs undergo a two-step training process: pre-training and fine-tuning. During pre-training, the model learns from a massive corpus of text without specific tasks in mind. Fine-tuning follows, where the model is adjusted for particular applications or industries.</p><p>2. <strong>Word Representation: </strong>Instead of treating words as isolated entities, LLMs use embeddings — multi-dimensional vectors that capture semantic relationships between words. This allows them to understand context and meaning more effectively.</p><p>3. <strong>Attention Mechanisms:</strong> One of the key innovations in LLMs is the attention mechanism. This feature enables the model to focus on different parts of the input text when generating responses, enhancing its understanding of context and nuance.</p><p>By leveraging these techniques, LLMs can perform a wide array of tasks that go beyond simple text generation.</p><p>Follow for more! stay tune for Day-2</p><p><a href="https://www.linkedin.com/in/vanama-yaswanth/">https://www.linkedin.com/in/vanama-yaswanth/</a></p><p>#Happyleaarning #whatarelargelanguagemodelsusedforai #learnwithvanama</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=954c2d70c884" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AutoGen will help LLM ?]]></title>
            <link>https://medium.com/@vanamayaswanth/autogen-will-help-llm-ddb2bd617374?source=rss-3de04fe6853d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddb2bd617374</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[autogen]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[langchain]]></category>
            <dc:creator><![CDATA[Vanama Yaswanth]]></dc:creator>
            <pubDate>Tue, 03 Oct 2023 06:45:45 GMT</pubDate>
            <atom:updated>2023-10-03T06:45:45.289Z</atom:updated>
            <content:encoded><![CDATA[<h3>AutoGen will help LLM ?</h3><p>let&#39;s see how autoGen can help us</p><p><strong>What is AutoGen ?</strong></p><p>AutoGen is a new framework from Microsoft that aims to simplify the orchestration, optimization, and automation of large language model (LLM) workflows. LLMs are a type of artificial intelligence (AI) that can generate and understand human language. They are becoming increasingly powerful and capable, but they can also be complex and difficult to use.</p><p>AutoGen aims to make LLMs more accessible and user-friendly by providing a framework for developing and deploying LLM applications. AutoGen is still under development, but it has the potential to be a powerful tool for researchers and developers who are working with LLMs.</p><p><strong>How AutoGen works ?</strong></p><p>AutoGen works by using a system of agents to collaborate on LLM tasks. Agents can be based on LLMs themselves, or they can be based on other types of tools or resources, such as humans, databases, or other AI systems.</p><p>Agents can communicate with each other to exchange information and request assistance. This allows AutoGen to develop complex workflows that involve multiple LLMs and other resources.</p><p>AutoGen also provides a number of features that can help to optimize the performance of LLM workflows. For example, AutoGen can automatically cache LLM outputs and reuse them whenever possible. AutoGen can also automatically parallelize tasks to improve performance.</p><p><strong>Potential use cases for AutoGen ?</strong></p><p>AutoGen can be used to develop a variety of LLM applications, such as:</p><p>Code interpreters<br>Chatbots<br>Question answering systems<br>Creative writing tools<br>Translation tools<br>Research tools<br>Benefits of using AutoGen</p><p><strong>There are a number of benefits to using AutoGen to develop LLM applications:</strong></p><p>Simpler development process: AutoGen simplifies the process of developing LLM applications by providing a framework for managing agents and workflows.</p><p><strong>Improved performance:</strong> AutoGen can help to improve the performance of LLM applications by caching outputs and parallelizing tasks.</p><p><strong>Increased scalability:</strong> AutoGen can help to scale LLM applications to larger workloads by allowing multiple agents to collaborate on tasks.<br>Drawbacks of using AutoGen</p><p>One of the main drawbacks of using AutoGen is that it is still under development. This means that it may not be as stable or feature-rich as some other LLM development frameworks.</p><p>Another drawback is that AutoGen can be complex to configure and use. This is especially true for users who are not familiar with LLMs and agent-based systems.</p><p>Overall, AutoGen is a promising new framework for developing and deploying LLM applications. It is still under development, but it has the potential to be a powerful tool for researchers and developers who are working with LLMs.</p><p><strong>Here is a funny analogy to help you understand AutoGen:</strong></p><p>Imagine that you are trying to build a house. You have all the necessary materials and tools, but you are not sure how to put them together. You could try to build the house yourself, but it would be difficult and time-consuming.</p><p>A better approach would be to hire a team of contractors. Each contractor would have a specific task, such as building the foundation, framing the walls, or installing the roof. The contractors would communicate with each other and work together to build the house.</p><p>AutoGen is like a team of contractors for LLM applications. It provides a framework for developing and deploying LLM applications by managing agents and workflows. Agents can be based on LLMs themselves, or they can be based on other types of tools or resources, such as humans, databases, or other AI systems.</p><p>Agents can communicate with each other to exchange information and request assistance. This allows AutoGen to develop complex workflows that involve multiple LLMs and other resources.</p><p>Just as a team of contractors can help you to build a house faster and more efficiently, AutoGen can help you to develop and deploy LLM applications faster and more efficiently.</p><p>website: <a href="https://www.vanamayaswanth.com/">https://www.vanamayaswanth.com/</a></p><p>GitHub: <a href="https://github.com/vanamayaswanth">https://github.com/vanamayaswanth</a></p><p>Linkedin : <a href="https://www.linkedin.com/in/vanama-yaswanth-560612184/">https://www.linkedin.com/in/vanama-yaswanth-560612184/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddb2bd617374" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Self-Supervised Learning for Natural Language Processing Overview]]></title>
            <link>https://medium.com/@vanamayaswanth/self-supervised-learning-for-natural-language-processing-overview-7ca579818ca5?source=rss-3de04fe6853d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ca579818ca5</guid>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[self-supervised-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <dc:creator><![CDATA[Vanama Yaswanth]]></dc:creator>
            <pubDate>Thu, 24 Aug 2023 06:05:24 GMT</pubDate>
            <atom:updated>2023-08-24T12:41:44.192Z</atom:updated>
            <content:encoded><![CDATA[<p>The study of the interaction between computers and human (natural) languages is known as natural language processing (NLP). In NLP research, supervised learning — in which the model is trained on a collection of labeled data — has typically taken center stage. However, labeled data can be expensive and time-consuming to collect, which has limited the scalability of NLP models.</p><p><strong>Self-supervised learning</strong> is a type of machine learning that does not require labeled data. Instead, the model learns from unlabeled data by creating its own labels. This can be done by creating tasks that require the model to make inferences about the data. For example, a self-supervised model for NLP might be trained to predict the next word in a sentence or to determine whether two sentences are semantically equivalent.</p><p>The paper “A Self-Supervised Learning Approach to Natural Language Processing” by researchers at Google AI proposes a new self-supervised learning approach for NLP. The approach is based on the idea of masked language modeling. In masked language modeling, the model is trained to predict words that have been masked out of a sentence. This forces the model to learn the relationships between words, which can be used to improve the performance of the model on downstream tasks, such as text classification and question answering.</p><p>The authors of the paper evaluated their approach to a variety of NLP tasks and found that it outperformed previous self-supervised learning approaches. They also found that the approach was able to learn representations that were more robust to noise and other distortions.</p><p>The findings of this paper suggest that self-supervised learning is a promising approach for NLP. However, there are still some limitations to the approach. One limitation is that self-supervised learning models can be computationally expensive to train. Another limitation is that self-supervised learning models can be sensitive to the choice of the masking strategy.</p><p>Despite these limitations, self-supervised learning is a promising approach for NLP, and it is likely to play an increasingly important role in the future of this field.</p><p><strong>The Mathematics Behind the Approach</strong></p><p>The mathematics behind the self-supervised learning approach proposed in the paper is relatively simple. The model is a neural network that is trained to predict the words that have been masked out of a sentence. The loss function for the model is the cross-entropy loss, which is a measure of the difference between the predicted words and the ground-truth words.</p><p>The model is trained using stochastic gradient descent, which is an iterative optimization algorithm. In each iteration, the model parameters are updated to minimize the loss function.</p><p>The masking strategy is a critical component of the self-supervised learning approach. The authors of the paper used a variety of masking strategies, including random masking, contiguous masking, and masked language modeling.</p><p>Random masking involves randomly masking out a certain percentage of the words in a sentence. Contiguous masking involves masking out contiguous sequences of words. Masked language modeling involves masking out a single word in a sentence, and then predicting that word.</p><p>The choice of the masking strategy can affect the performance of the model. The authors of the paper found that masked language modeling was the most effective masking strategy.</p><p><strong>Conclusion</strong></p><p>The self-supervised learning approach proposed in the paper is a promising approach for NLP. The approach is computationally efficient and can learn representations that are robust to noise and other distortions. However, there are still some limitations to the approach, such as the need for a large amount of unlabeled data.</p><p>Despite these limitations, self-supervised learning is a promising approach for NLP, and it is likely to play an increasingly important role in the future of this field.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ca579818ca5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Excel for Data Analysis: Unleashing the Power of Spreadsheets for Data Analysts]]></title>
            <link>https://medium.com/@vanamayaswanth/excel-for-data-analysis-unleashing-the-power-of-spreadsheets-for-data-analysts-347e552cf807?source=rss-3de04fe6853d------2</link>
            <guid isPermaLink="false">https://medium.com/p/347e552cf807</guid>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[data-analsis]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Vanama Yaswanth]]></dc:creator>
            <pubDate>Wed, 26 Jul 2023 09:53:07 GMT</pubDate>
            <atom:updated>2023-07-26T09:53:07.058Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Introduction:</blockquote><p>As a data analyst, you are well aware of the importance of Excel in your day-to-day tasks. Excel is a versatile tool that empowers data professionals to organize, analyze, and visualize data efficiently. In this blog, we will explore the essential features of Excel that every data analyst should master. Additionally, we will delve into some of the most important shortcuts and formulas that can streamline your data analysis workflow and boost your productivity.</p><blockquote>Excel Basics for Data Analysis:</blockquote><p>1. Data Entry and Management:<br> Excel provides a user-friendly interface to enter, edit, and manage data. You can organize your data in rows and columns, create tables, and apply filters to easily sort and manipulate large datasets.</p><p>2. Formulas and Functions:<br> Excel’s real power lies in its formulas and functions. From simple arithmetic calculations to complex statistical analysis, Excel offers a wide range of built-in functions to perform various operations on your data.</p><p>3. Data Visualization:<br> Visualizing data is essential for understanding patterns and trends. Excel offers numerous chart types and customization options to create insightful graphs and charts.</p><blockquote>Important Excel Shortcuts for Data Analysts:</blockquote><p>1. Navigating Through Worksheets:<br> — Switch between worksheets: Ctrl + PgUp (previous worksheet) and Ctrl + PgDn (next worksheet)<br> — Move to the beginning/end of data: Ctrl + ↑ (up arrow) or Ctrl + ↓ (down arrow)</p><p>2. Selecting and Editing Data:<br> — Select entire column: Ctrl + Spacebar<br> — Select entire row: Shift + Spacebar<br> — Insert current date: Ctrl + ;<br> — Insert current time: Ctrl + Shift + ;</p><p>3. Data Analysis:<br> — AutoSum: Alt + =<br> — Calculate average: Alt + Shift + K<br> — Sort data: Alt + H + S</p><p>Important Excel Formulas for Data Analysts:</p><p>1. VLOOKUP (Vertical Lookup):<br> This function allows you to search for a value in the first column of a table and return a corresponding value from another column. It is commonly used for data merging and data validation.</p><p>2. IF Function:<br> The IF function evaluates a given condition and returns one value if the condition is true, and another value if the condition is false. It is fundamental for data cleaning and filtering.</p><p>3. SUMIFS:<br> SUMIFS is used to sum values based on multiple criteria. It helps in calculating conditional sums and is particularly useful in data aggregation.</p><p>4. COUNTIF:<br> COUNTIF counts the number of cells within a range that meet a specified criterion. It is valuable for data profiling and quality assessment.</p><p>5. AVERAGEIF:<br> AVERAGEIF calculates the average of cells that meet a given condition. It is beneficial for summarizing data based on specific criteria.</p><p>Conclusion:</p><p>Excel is a powerful tool for data analysts, enabling them to efficiently manage, analyze, and visualize data. By mastering essential shortcuts and formulas, data professionals can significantly improve their productivity and streamline their data analysis workflow. Whether you are conducting basic calculations or performing complex data transformations, Excel’s features and capabilities make it an indispensable tool for every data analyst. So, embrace Excel’s potential, practice the shortcuts, and wield the formulas to uncover valuable insights from your data. Happy analyzing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=347e552cf807" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Dive into Machine UNLearning]]></title>
            <link>https://medium.com/@vanamayaswanth/deep-dive-into-machine-unlearning-8eac0cf8a3bc?source=rss-3de04fe6853d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8eac0cf8a3bc</guid>
            <category><![CDATA[gpt-4]]></category>
            <category><![CDATA[unlearning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Vanama Yaswanth]]></dc:creator>
            <pubDate>Wed, 19 Jul 2023 11:06:43 GMT</pubDate>
            <atom:updated>2023-07-19T11:06:43.883Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deep Dive into Machine UnLearning</h3><blockquote>Machine Unlearning: How to Make Machine Learning Models Forget</blockquote><p>Machine learning models are trained on large datasets of data. This data can include sensitive information, such as personal data or financial data. If this data is compromised, it could be used to harm individuals or organizations.</p><p>Machine unlearning is a technique that allows machine learning models to forget specific pieces of data. This can be useful for protecting privacy, preventing fraud, and mitigating adversarial attacks.</p><blockquote>What is Forget set?</blockquote><p>In the context of machine unlearning, the forget set is a set of examples that the model is no longer needed to make predictions for. The forget set can be used to train the model to forget the examples in the set. This can be useful in a number of situations, such as when the model is no longer needed to make predictions for those examples, or when the model has learned to make biased or discriminatory predictions for those examples.</p><p>The forget set can be defined in a number of different ways. One way to define the forget set is to manually specify the examples that the model should forget. Another way to define the forget set is to use a technique called data sampling. Data sampling involves randomly sampling a subset of the training data, and using that subset as the forget set.</p><p>Once the forgotten set has been defined, the model can be trained to forget the examples in the set. This can be done using a number of different algorithms, such as regularization, adversarial training, or zero-shot machine unlearning.</p><blockquote>Regularization</blockquote><p>Regularization is a technique that penalizes the model for making predictions that are too similar to the predictions that it made for the forget set. This can be done by adding a penalty term to the model’s objective function, or by using a technique called dropout, which randomly drops out some of the model’s features during training like using L1 and L2</p><blockquote>Adversarial Training</blockquote><p>Adversarial training is a technique that involves training two models simultaneously: a primary model that makes predictions, and a discriminator model that tries to distinguish between the predictions that the primary model makes for the forget set and the predictions that it makes for the rest of the training data. The primary model is then updated to make it more difficult for the discriminator model to distinguish between the two sets of predictions.</p><blockquote>Zero-Shot Machine Unlearning</blockquote><p>Zero-shot machine unlearning is a technique that allows the model to forget a specific subset of training examples without being explicitly told which examples to forget. This is done by using a technique called data augmentation, which involves creating new training examples that are similar to the examples in the forgotten set.</p><p>The model is then trained on the augmented dataset, which helps it to forget the original examples in the forget set.</p><p>Machine unlearning is a promising technique for protecting privacy and security in machine learning. However, more research is needed to improve the efficiency and effectiveness of these techniques.</p><p>Here are some resources that you can refer to for more information on machine unlearning:</p><ul><li><a href="https://arxiv.org/abs/1912.03817">Machine Unlearning paper</a></li><li><a href="https://arxiv.org/abs/2201.05629">Zero-Shot Machine Unlearning</a></li><li><a href="https://arxiv.org/abs/2201.06640">Adversarial Machine Unlearning</a></li></ul><p>I hope this blog post has been helpful. Please let me know if you have any other questions. : vanamayaswanth@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8eac0cf8a3bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Machine Unlearning]]></title>
            <link>https://medium.com/@vanamayaswanth/introducing-the-machine-unlearning-ways-to-make-your-model-forgets-9c7e36736d18?source=rss-3de04fe6853d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c7e36736d18</guid>
            <category><![CDATA[datascience-training]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[unlearning]]></category>
            <dc:creator><![CDATA[Vanama Yaswanth]]></dc:creator>
            <pubDate>Mon, 17 Jul 2023 13:30:51 GMT</pubDate>
            <atom:updated>2023-07-17T18:02:12.383Z</atom:updated>
            <content:encoded><![CDATA[<p>(Ways to make your model forgets the past )</p><h3>What is Machine Learning?</h3><p>Machine learning models are trained on data. This data can be anything from images to text to medical records. But what happens when you want to remove some of that data from the model? This is where machine unlearning comes in.</p><p><strong>Learning Vs Unlearning</strong></p><p>Machine unlearning is the process of removing the influence of a specified subset of training data from a machine-learning model. This can be done for a variety of reasons, such as to comply with privacy regulations, to improve the fairness of the model, or to remove outdated or inaccurate data.</p><p>There are a number of different approaches to machine unlearning. One common approach is to retrain the model from scratch, but this can be computationally expensive. Another approach is to use a technique called D<strong>ifferential privacy</strong>, which can be used to add noise to the model’s parameters, making it more difficult to recover the original training data.</p><p>In recent years, there has been a growing interest in machine unlearning. This is due in part to the increasing importance of privacy, as well as the growing awareness of the potential biases that can be introduced into machine learning models.</p><blockquote>How does machine unlearning work?</blockquote><p>Machine unlearning works by modifying the loss function of the model. The loss function is a measure of how well the model is performing, and it is used to update the model’s parameters during training. When a model is unlearned, the loss function is modified to include a penalty for the data that is being removed. This penalty makes it more difficult for the model to learn from the removed data, and it helps to ensure that the model forgets about the removed data.</p><blockquote><strong>Differential privacy</strong></blockquote><p>One common algorithm for machine unlearning is called differential privacy. Differential privacy is a technique that adds noise to the model’s parameters, making it more difficult to recover the original training data. This is done by adding a random noise term to the model’s parameters, which makes it impossible to know for sure which data points were used to train the model.</p><blockquote>SISA training</blockquote><p>Another algorithm for machine unlearning is called SISA training. SISA training is a framework that expedites the unlearning process by strategically limiting the influence of a data point in the training procedure. This is done by first identifying the data points that are most important to the model, and then limiting the influence of these data points during the unlearning process.</p><blockquote>Applications of machine unlearning</blockquote><p>Machine unlearning has a number of potential applications. One application is to comply with privacy regulations. For example, the European Union’s General Data Protection Regulation (GDPR) gives individuals the right to have their personal data deleted. Machine unlearning can be used to help organizations comply with this right.</p><p>Another application of machine unlearning is to improve the fairness of machine learning models. Machine learning models can sometimes be biased, and this bias can be exacerbated if the model is trained on data that includes sensitive information. Machine unlearning can be used to remove this sensitive information from the training data, which can help to improve the fairness of the model.</p><blockquote>Conclusion</blockquote><p>Machine unlearning is a complex problem, but it is an important one. As machine learning models become more sophisticated, it is becoming increasingly important to be able to unlearn them. This is necessary to protect privacy, improve fairness, and ensure the quality of machine learning models.</p><p>I hope this blog post has given you a better understanding of machine unlearning. If you have any questions, please feel free to leave a comment <a href="http://vanamayaswanth@gmail.com/">below</a> or<a href="http://vanamayaswanth@gmail.com/"> Gmail</a>: vanamayaswanth@gmail.com</p><p>For services : <a href="https://topmate.io/vanama_yaswanth">https://topmate.io/vanama_yaswanth</a> , now go and book your call for greater deals</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c7e36736d18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Naked Data Science Day — 46]]></title>
            <link>https://medium.com/@vanamayaswanth/naked-data-science-day-46-60be968b832d?source=rss-3de04fe6853d------2</link>
            <guid isPermaLink="false">https://medium.com/p/60be968b832d</guid>
            <category><![CDATA[word2vec]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[nltk]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Vanama Yaswanth]]></dc:creator>
            <pubDate>Fri, 14 Jul 2023 07:11:01 GMT</pubDate>
            <atom:updated>2023-07-14T07:11:29.445Z</atom:updated>
            <content:encoded><![CDATA[<h3>Naked Data Science Day — 46 (Exploring Word2Vec and Bag of Words in Natural Language Processing)</h3><p>Introduction:</p><p>In the realm of Natural Language Processing (NLP), understanding the semantic meaning of words is crucial for various tasks such as sentiment analysis, document classification, and information retrieval. Two commonly used techniques for word representation are Word2Vec and Bag of Words. These approaches enable us to capture the essence of words in a numerical form, facilitating further analysis and modeling. In this blog, we will delve into the concepts of Word2Vec and Bag of Words, understand their mathematical foundations, and explore their applications in NLP.</p><blockquote>Understanding Bag of Words:</blockquote><p>The Bag of Words model represents text as a collection of unique words, disregarding their order or structure. It creates a numerical representation of text by counting the occurrence of each word. The resulting representation, known as a “bag,” can be used as input for various machine learning algorithms. For example, consider the sentence “The cat is on the mat.” The Bag of Words representation would be [1, 1, 1, 1, 1], indicating the counts of the words “the,” “cat,” “is,” “on,” and “mat” respectively.</p><blockquote>The Mathematics of Bag of Words:</blockquote><p>The Bag of Words model involves several mathematical steps:</p><p>1. Tokenization:<br> The text is divided into individual words or tokens using techniques like word tokenization or n-gram tokenization.</p><p>2. Vocabulary Creation:<br> A unique set of words, known as the vocabulary, is constructed from the tokens in the corpus.</p><p>3. Counting:<br> The occurrence of each word in the vocabulary is counted for each document, creating a word count matrix.</p><p>4. Vectorization:<br> Each document is represented as a vector, where each dimension corresponds to a word in the vocabulary, and the value represents the word count.</p><blockquote>Understanding Word2Vec:</blockquote><p>Word2Vec is a neural network-based technique that represents words as dense vectors in a continuous vector space. It aims to capture the semantic meaning of words by considering their context within a given corpus. The resulting word embeddings can be used to measure word similarity and perform arithmetic operations on words. For example, the vectors for “king” and “queen” might have similar directions and magnitudes.</p><blockquote>The Mathematics of Word2Vec:</blockquote><p>Word2Vec involves training a neural network, such as a skip-gram or continuous bag of words (CBOW) model, on a large corpus of text. The network learns to predict the context words given a target word or vice versa. The word embeddings are generated as a byproduct of this training process, where similar words have similar vector representations based on their context relationships.</p><p>In this code example, we use the Natural Language Toolkit (NLTK), sci-kit-learn, and Gensim libraries in Python. We initialize a CountVectorizer object to create a Bag of Words representation of the provided documents. Additionally, we utilize the Word2Vec model from Gensim to generate word embeddings for the given sentences. The code demonstrates how to access the vocabulary, as well as the Bag of Words representation and Word2Vec vector for a specific word.</p><pre>import nltk<br>from sklearn.feature_extraction.text import CountVectorizer<br>from gensim.models import Word2Vec<br><br># Example documents<br>documents = [<br>    &quot;I love to eat pizza&quot;,<br>    &quot;Pizza is my favorite food&quot;,<br>    &quot;I enjoy going out for pizza with friends&quot;,<br>]<br><br># Bag of Words<br>vectorizer = CountVectorizer()<br>bag_of_words = vectorizer.fit_transform(documents)<br><br>print(&quot;Bag of Words vocabulary:&quot;, vectorizer.get_feature_names())<br>print(&quot;Bag of Words representation:\n&quot;, bag_of_words.toarray())<br><br># Word2Vec<br>sentences = [nltk.word_tokenize(document.lower()) for document in documents]<br>model = Word2Vec(sentences, min_count=1)<br><br>print(&quot;Word2Vec vocabulary:&quot;, list(model.wv.vocab))<br>print(&quot;Word2Vec representation for &#39;pizza&#39;:&quot;, model.wv[&#39;pizza&#39;])</pre><p><strong>Applications and Use Cases:</strong></p><p>1. Sentiment Analysis:<br> Both Bag of Words and Word2Vec techniques are used in sentiment analysis to classify text based on the expressed sentiment or emotion. The Bag of Words approach helps in identifying keywords associated with positive or negative sentiment, while Word2Vec captures semantic similarities between words, allowing for more nuanced sentiment analysis.</p><p>2. Information Retrieval:<br> Bag of Words is commonly used in search engines and information retrieval systems to match user queries with relevant documents. By representing documents as vectors of word frequencies, the similarity between query and document vectors can be measured to rank and retrieve relevant results.</p><p>3. Text Classification:<br> Bag of Words and Word2Vec are employed in text classification tasks such as topic classification, spam detection, and document categorization. The representations enable the extraction of important features from text, enabling machine learning models to learn patterns and make accurate predictions.</p><p><strong>Conclusion:</strong></p><p>Bag of Words and Word2Vec are powerful techniques in the field of Natural Language Processing that allow us to represent and understand text data in a numerical form. The Bag of Words model captures word frequencies, while Word2Vec leverages neural networks to learn word embeddings that capture semantic relationships. By employing these techniques, data scientists and NLP practitioners can unlock the hidden insights within textual data and build models for various language processing tasks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60be968b832d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Naked Data Science Day — 45 (Unraveling the Power of Stemming and Lemmatization in NLP)]]></title>
            <link>https://medium.com/@vanamayaswanth/naked-data-science-day-45-unraveling-the-power-of-stemming-and-lemmatization-in-nlp-e43207d559c1?source=rss-3de04fe6853d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e43207d559c1</guid>
            <category><![CDATA[lemmatization]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[stemming-nltk]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Vanama Yaswanth]]></dc:creator>
            <pubDate>Wed, 05 Jul 2023 06:32:15 GMT</pubDate>
            <atom:updated>2023-07-05T06:32:15.331Z</atom:updated>
            <content:encoded><![CDATA[<h3>Naked Data Science Day — 45 (Unraveling the Power of Stemming and Lemmatization in NLP)</h3><blockquote>Introduction:</blockquote><p>In the realm of Natural Language Processing (NLP), the process of text normalization plays a pivotal role in understanding and analyzing textual data. Two commonly employed techniques in this domain are stemming and lemmatization. These methods aim to reduce words to their root or base form, facilitating text analysis and improving the accuracy of language models. In this blog, we will explore the concepts of stemming and lemmatization, dive into the mathematical foundations behind them, and discuss their respective benefits and use cases.</p><blockquote>Understanding Stemming:</blockquote><p>Stemming is a text normalization technique that involves reducing words to their root or stem form. It removes affixes from words, such as prefixes and suffixes, to derive a base form that represents the core meaning of the word. The resulting stems may not always be actual words, but they serve the purpose of grouping together related words. For example, stemming would convert words like “running” and “runs” to their common stem “run”.</p><blockquote>The Mathematics of Stemming:</blockquote><p>Stemming algorithms employ various mathematical strategies, such as heuristic rules and linguistic patterns, to perform the process of stemming. One commonly used algorithm is the Porter stemming algorithm, which applies a set of rules to remove suffixes and achieve word normalization.</p><blockquote>The Porter Stemming Algorithm:</blockquote><p>The Porter stemming algorithm follows a set of five phases to progressively reduce words to their stems:</p><p>1. Removal of standard suffixes:<br> The algorithm removes common suffixes such as “s”, “ed”, and “ing” from words.</p><p>2. Handling special cases:<br> Specific rules address exceptional cases and handle words with irregular forms.</p><p>3. Removal of suffixes in exceptional cases:<br> Additional rules target specific suffixes that are removed from certain words.</p><p>4. Adjustments to the stem:<br> Further modifications are made to the stems of certain words based on linguistic patterns.</p><p>5. Cleanup:<br> Finally, any remaining extraneous characters or affixes are removed from the word.</p><blockquote>Understanding Lemmatization:</blockquote><p>Lemmatization, like stemming, aims to reduce words to their base form. However, unlike stemming, lemmatization ensures that the resulting form is an actual word found in the dictionary. It considers the context and part of speech (POS) of a word, enabling a more accurate transformation. For example, lemmatization would convert words like “running” and “runs” to the base form “run” for nouns, verbs, and adjectives.</p><blockquote>The Mathematics of Lemmatization:</blockquote><p>Lemmatization relies on linguistic knowledge, including word dictionaries and POS tagging. It employs various mathematical techniques such as rule-based approaches, machine learning models, and morphological analysis to determine the lemma of a word.</p><p>Code Example: Stemming and Lemmatization using NLTK</p><pre>import nltk<br>from nltk.stem import PorterStemmer, WordNetLemmatizer<br>from nltk.tokenize import word_tokenize<br><br># Initialize stemming and lemmatization objects<br>stemmer = PorterStemmer()<br>lemmatizer = WordNetLemmatizer()<br><br># Example sentence<br>sentence = &quot;The quick brown foxes jumped over the lazy dogs&quot;<br><br># Tokenize the sentence<br>tokens = word_tokenize(sentence)<br><br># Perform stemming<br>stemmed_words = [stemmer.stem(token) for token in tokens]<br><br># Perform lemmatization<br>lemmatized_words = [lemmatizer.lemmatize(token) for token in tokens]<br><br># Print the results<br>print(&quot;Stemmed words:&quot;, stemmed_words)<br>print(&quot;Lemmatized words:&quot;, lemmatized_words)</pre><p>In this code example, we use the Natural Language Toolkit (NLTK) library in Python. We initialize the PorterStem</p><p>mer and WordNetLemmatizer objects, tokenize the input sentence, and apply stemming and lemmatization techniques to the tokens. Finally, we print the stemmed and lemmatized words.</p><blockquote>Benefits and Use Cases:</blockquote><p>Stemming and lemmatization offer several benefits in NLP tasks, including:</p><p>1. Text Analysis and Retrieval:<br> By reducing words to their base forms, stemming and lemmatization facilitate text analysis, information retrieval, and search operations. The normalized words improve the matching and retrieval of relevant documents or information.</p><p>2. Language Modeling and Classification:<br> Stemming and lemmatization help in building language models and classifiers by reducing the vocabulary size and enhancing the accuracy of feature extraction. The normalized words ensure better generalization and improve model performance.</p><p>3. Preprocessing for NLP Tasks:<br> Stemming and lemmatization are crucial preprocessing steps for various NLP tasks, including sentiment analysis, named entity recognition, topic modeling, and machine translation. These techniques aid in reducing noise, improving efficiency, and enhancing the overall quality of the output.</p><p>Conclusion:</p><p>Stemming and lemmatization are essential techniques in the field of NLP that enable text normalization and improve the accuracy and efficiency of language processing tasks. Stemming focuses on reducing words to their base form by removing affixes, while lemmatization ensures the resulting form is an actual word found in the dictionary. By understanding the mathematical foundations behind these techniques and implementing them in code, data scientists and NLP practitioners can unlock the full potential of textual data for analysis, modeling, and decision-making.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e43207d559c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>