<?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 music and waves on Medium]]></title>
        <description><![CDATA[Stories by music and waves on Medium]]></description>
        <link>https://medium.com/@pushkaraggrawal?source=rss-3ce58770b334------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by music and waves on Medium</title>
            <link>https://medium.com/@pushkaraggrawal?source=rss-3ce58770b334------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 07:09:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pushkaraggrawal/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[The Prompting Playbook: Inspired by the Claude System Prompt]]></title>
            <link>https://medium.com/@pushkaraggrawal/the-prompting-playbook-inspired-by-the-claude-system-prompt-0b1e2f10622b?source=rss-3ce58770b334------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b1e2f10622b</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <dc:creator><![CDATA[music and waves]]></dc:creator>
            <pubDate>Sat, 17 May 2025 05:02:34 GMT</pubDate>
            <atom:updated>2025-05-17T05:02:34.768Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pU2lqJvW_djraX63MitgWA.png" /></figure><h3>Introduction</h3><p><strong>Purpose:</strong> This playbook aims to deconstruct the art and science of advanced Large Language Model (LLM) prompting, using the highly sophisticated system prompt designed for Claude as a primary reference. The goal is to equip you with principles and techniques to guide LLMs towards desired behaviors, making them more reliable, effective, and aligned with your objectives.</p><p><strong>Core Philosophy:</strong> The effectiveness of an LLM often hinges on the clarity, structure, and comprehensiveness of its guiding prompt. The Claude prompt exemplifies three key ideas:</p><ol><li><strong>Explicitness:</strong> Leave as little to ambiguity as possible.</li><li><strong>Structure:</strong> Organize instructions logically, often using delimiters like tags.</li><li><strong>Iteration &amp; Detail:</strong> Continuously refine and add detail based on observed behavior and desired outcomes.</li></ol><p>Let’s dive into the key strategies.</p><h3>Part 1: Foundational Elements — Setting the Stage</h3><p>Before an LLM can act effectively, it needs a clear understanding of its role, knowledge, and the very structure of its instructions.</p><h4>1.1. Defining the Core Persona &amp; Role</h4><p><strong>Principle:</strong> An LLM should have a well-defined persona. This includes its personality, interaction style, primary objectives, and even its “attitude” towards tasks.</p><p><strong>Technique:</strong></p><ul><li>Clearly state the LLM’s name and creator.</li><li>Describe its intended role (e.g., assistant, expert, creative partner).</li><li>Outline desired personality traits (e.g., helpful, empathetic, concise, proactive).</li><li>Specify overarching goals or philosophies that should guide its responses.</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>“The assistant is Claude, created by Anthropic.”</em></blockquote><blockquote><em>“Claude enjoys helping humans and sees its role as an intelligent and kind assistant to the people, with depth and wisdom that makes it more than a mere tool.”</em></blockquote><blockquote><em>“Claude can lead or drive the conversation, and doesn’t need to be a passive or reactive participant in it.”</em></blockquote><blockquote><em>“If asked for a suggestion or recommendation or selection, it should be decisive and present just one, rather than presenting many options.”</em></blockquote><h4>1.2. Establishing Knowledge Boundaries</h4><p><strong>Principle:</strong> LLMs don’t inherently know everything up to the present moment. Clearly define their knowledge limitations and how they should handle information gaps.</p><p><strong>Technique:</strong></p><ul><li>Specify a knowledge cutoff date.</li><li>Provide explicit instructions on how to respond to queries about events or information past this date (e.g., use a web search tool, state its knowledge limitation).</li><li>For highly specific or rapidly changing critical information (like election results mentioned in the Claude prompt), provide the information directly within the prompt if it’s crucial for the LLM to know.</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>“Claude’s reliable knowledge cutoff date — the date past which it cannot answer questions reliably — is the end of October 2024.”</em></blockquote><blockquote><em>“If asked or told about events or news that occurred after this cutoff date, Claude uses the web search tool to supplement knowledge.”</em></blockquote><blockquote><em>&lt;election_info&gt; section provides specific details about the US Presidential Election.</em></blockquote><h4>1.3. Structuring the Prompt with Tags</h4><p><strong>Principle:</strong> Long prompts benefit immensely from clear structural organization. Using XML-like tags or other consistent delimiters helps the LLM parse and differentiate between various sets of instructions.</p><p><strong>Technique:</strong></p><ul><li>Wrap distinct blocks of instructions in descriptive tags (e.g., &lt;persona_definition&gt;, &lt;tool_usage_rules&gt;).</li><li>Maintain a consistent tagging methodology throughout the prompt.</li><li>This aids both human readability and LLM comprehension.</li></ul><p>Example from Original Prompt (Claude):</p><p>The prompt extensively uses tags like:</p><ul><li>&lt;citation_instructions&gt;</li><li>&lt;artifacts_info&gt;</li><li>&lt;search_instructions&gt;</li><li>&lt;core_search_behaviors&gt;</li><li>&lt;query_complexity_categories&gt;</li><li>&lt;mandatory_copyright_requirements&gt;</li><li>&lt;harmful_content_safety&gt;</li><li>&lt;userPreferences&gt;</li><li>And many more, creating a clear hierarchy of information.</li></ul><h4>1.4. Dynamic Information &amp; Personalization</h4><p><strong>Principle:</strong> Design prompts to incorporate dynamic information and adapt to individual user needs.</p><p><strong>Technique:</strong></p><ul><li>Use placeholders for information that changes (e.g., {{CURRENTDATE}}, {{USER_LOCATION}}).</li><li>Create sections or tags where user-specific preferences or styles can be dynamically inserted.</li><li>Provide clear rules on <em>how</em> and <em>when</em> to apply these personalized settings.</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>“The current date is {{CURRENTDATE}}.”</em></blockquote><blockquote><em>“User location is: {{CITY}}, {{REGION}}, {{COUNTRY_CODE}}.”</em></blockquote><blockquote><em>&lt;userPreferences&gt;: “(User’s specific preference values)”</em></blockquote><blockquote><em>&lt;userStyle&gt;: “(User’s specific style values)”</em></blockquote><blockquote><em>The &lt;preferences_info&gt; section gives detailed rules on applying these: “Apply Behavioral Preferences if, and ONLY if: They are directly relevant to the task…”</em></blockquote><blockquote><em>(Reference: Core System Message, &lt;web_search_guidelines&gt;, &lt;preferences_info&gt;)</em></blockquote><h3>Part 2: Instructing on Tool Usage — Extending Capabilities</h3><p>Modern LLMs often leverage external tools. Clear instructions on tool invocation, parameterization, and result interpretation are paramount.</p><h4>2.1. General Principles for Tool Invocation</h4><p><strong>Principle:</strong> Establish a clear decision-making framework for when and how the LLM should decide to use a tool.</p><p><strong>Technique:</strong></p><ul><li>Prioritize internal knowledge where sufficient.</li><li>Define criteria for when tool use is mandatory (e.g., real-time data, information beyond knowledge cutoff).</li><li>Instruct the LLM to offer tool use when it might be beneficial but not strictly necessary.</li><li>Scale the number and type of tool calls based on query complexity.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*T_XqbXQOKhx5s8Mbvqvu9A.png" /><figcaption><strong>Simplified Tool Usage Decision Flow</strong></figcaption></figure><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>&lt;core_search_behaviors&gt;:</em></blockquote><blockquote><em>“1. Avoid tool calls if not needed: If Claude can answer without using tools, respond without ANY tool calls.”</em></blockquote><blockquote><em>“2. If uncertain, answer normally and OFFER to use tools…”</em></blockquote><blockquote><em>“3. Scale the number of tool calls to query complexity…”</em></blockquote><h4>2.2. Detailed Instructions for Specific Tools</h4><p><strong>Principle:</strong> For each available tool, provide granular instructions covering its purpose, invocation syntax, parameter usage, output interpretation, and any constraints or best practices.</p><p>2.2.1. Focus on Citations (When tools retrieve information)</p><p><strong>Technique:</strong></p><ul><li>Mandate citations when responses are based on tool-retrieved content.</li><li>Specify the exact format for citations, including how to reference specific documents and sentences/sections within them.</li><li>Instruct on citing the minimum necessary information and handling cases where no relevant information is found.</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>&lt;citation_instructions&gt;: “If the assistant’s response is based on content returned by the web_search, drive_search…the assistant must always appropriately cite its response.”</em></blockquote><blockquote><em>Rule: “EVERY specific claim…should be wrapped in &lt;antml:cite&gt; tags… &lt;antml:cite index=”DOC_INDEX-SENTENCE_INDEX”&gt;…&lt;/antml:cite&gt;.”</em></blockquote><blockquote><em>Rule: “The citations should use the minimum number of sentences necessary…”</em></blockquote><p>2.2.2. Focus on Artifacts/Content Generation</p><p><strong>Technique:</strong></p><ul><li>Clearly define when substantial, structured content (code, documents, analyses, creative writing) should be placed in a distinct “artifact.”</li><li>List supported artifact types (e.g., code, markdown, HTML, SVG, React).</li><li>For complex types like code or React components, provide very specific constraints:</li><li>Allowed programming languages/versions.</li><li>Mandatory libraries or disallowed libraries.</li><li>Styling rules (e.g., specific CSS framework usage).</li><li>How to handle dependencies or external resources.</li><li>Instruct on reading files or data needed for artifact generation.</li><li>Provide rules for updating existing artifacts (e.g., minimal changes vs. full rewrite).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*_GS7y0YDXyDEEKNgB-YOSg.png" /><figcaption><strong>Simplified Artifact Creation Decision</strong></figcaption></figure><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>&lt;artifacts_info&gt;: “# You must use artifacts for — Original creative writing… In-depth, long-form analytical content… Writing custom code…”</em></blockquote><blockquote><em>&lt;artifact_instructions&gt;: “Artifact types: Code: application/vnd.ant.code… React Components: application/vnd.ant.react…”</em></blockquote><blockquote><em>For React: “Use only Tailwind’s core utility classes… THIS IS VERY IMPORTANT… Avoid square bracket notation…”</em></blockquote><blockquote><em>List of importable libraries like lucide-react, recharts, lodash, etc., and explicitly: “NO OTHER LIBRARIES…ARE INSTALLED OR ABLE TO BE IMPORTED.”</em></blockquote><p>2.2.3. Focus on Search Tools</p><p><strong>Technique:</strong></p><ul><li>Categorize query types to determine search strategy (e.g., never search, offer to search, single immediate search, research-intensive search).</li><li>Provide guidelines for formulating effective search queries (conciseness, keyword choice).</li><li>Instruct on how to process search results (e.g., using web_fetch to get full content from snippets).</li><li>Set rules for summarizing search results, especially concerning copyright (see Part 3.1).</li><li>Incorporate awareness of user location or other contextual data if relevant for the search.</li></ul><p><strong>Simplified Search Category Mapping</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*Yu9usU1C-CJVsnIV65jwhg.png" /><figcaption><strong>Simplified Search Category Mapping</strong></figcaption></figure><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>&lt;query_complexity_categories&gt;: Defines &lt;never_search_category&gt;, &lt;do_not_search_but_offer_category&gt;, &lt;single_search_category&gt;, &lt;research_category&gt; with examples for each.</em></blockquote><blockquote><em>&lt;research_process&gt;: For complex queries, “1. Planning and tool selection… 2. Research loop: Execute AT LEAST FIVE distinct tool calls…”</em></blockquote><blockquote><em>&lt;web_search_guidelines&gt;: “Keep searches concise — 1–6 words… Often use web_fetch to get complete website content…”</em></blockquote><h4>2.3. Providing Tool Definitions (e.g., JSON Schema)</h4><p><strong>Principle:</strong> The LLM needs a machine-readable definition of each tool’s capabilities, parameters, and expected input/output formats.</p><p><strong>Technique:</strong></p><ul><li>Include a dedicated section (e.g., often denoted by &lt;functions&gt; or similar) where each tool is described using a structured format like JSON Schema.</li><li>This schema should define:</li><li>Tool name.</li><li>Description of its purpose.</li><li>Required and optional parameters, their types, and descriptions.</li><li>Sometimes, example invocations.</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>&lt;functions&gt; section contains JSON Schema definitions for tools like:</em></blockquote><blockquote><em>artifacts: {“description”: “Creates and updates artifacts…”, “name”: “artifacts”, “parameters”: {“properties”: {“command”: …, “content”: …}}}</em></blockquote><blockquote><em>web_search: {“description”: “Search the web”, “name”: “web_search”, “parameters”: {“properties”: {“query”: …}}}</em></blockquote><h3>Part 3: Ensuring Safety, Compliance, and Ethical Behavior</h3><p>Guiding an LLM involves more than just task completion; it requires instilling principles of safety, legality, and ethical conduct.</p><h4>3.1. Copyright and Intellectual Property</h4><p><strong>Principle:</strong> LLMs must be explicitly instructed to respect copyright and intellectual property. This is critical when they have access to web search or other content retrieval tools.</p><p><strong>Technique:</strong></p><ul><li>Establish strict rules against reproducing large portions of copyrighted material.</li><li>Define clear limits on quoting (e.g., maximum number of quotes, maximum word count per quote).</li><li>Prohibit the reproduction of specific content types like song lyrics.</li><li>Instruct on how to summarize content concisely and in its own words, avoiding “displacive summaries” (summaries so thorough they replace the need to view the original).</li><li>Guide the LLM on how to respond if users ask about “fair use” (e.g., define generally but state it’s not a lawyer).</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>&lt;mandatory_copyright_requirements&gt;: “PRIORITY INSTRUCTION: It is critical that Claude follows all of these requirements…”</em></blockquote><blockquote><em>“Strict rule: only ever use at most ONE quote from any search result…MUST be fewer than 20 words long…”</em></blockquote><blockquote><em>“Never reproduce or quote song lyrics in any form…”</em></blockquote><blockquote><em>“Never produces long (30+ word) displace summaries…” (Later refined in &lt;search_reminders&gt; to “2–3 sentences long in total”).</em></blockquote><h4>3.2. Harmful Content Prevention</h4><p><strong>Principle:</strong> Implement robust safeguards to prevent the LLM from generating, facilitating, or searching for harmful content.</p><p><strong>Technique:</strong></p><ul><li>Clearly define categories of harmful content (e.g., hate speech, violence, illegal acts, child abuse, misinformation, extremist content).</li><li>Instruct the LLM to refuse to create search queries for such content.</li><li>If harmful sources appear in search results, instruct the LLM not to use or cite them.</li><li>Provide guidance on how to respond to user queries with harmful intent (e.g., refuse and offer better alternatives).</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>&lt;harmful_content_safety&gt;: “Strictly follow these requirements to avoid causing harm…”</em></blockquote><blockquote><em>“Claude MUST not create search queries for sources that promote hate speech, racism, violence, or discrimination.”</em></blockquote><blockquote><em>“Never help users locate harmful online sources like extremist messaging platforms…”</em></blockquote><blockquote><em>Lists various types of harmful content to avoid.</em></blockquote><h4>3.3. Privacy and Specific Safety Measures</h4><p><strong>Principle:</strong> Address specific privacy concerns and implement unique safety protocols as needed, especially when dealing with sensitive data like images or personally identifiable information (PII).</p><p><strong>Technique:</strong></p><ul><li>For image processing, if facial recognition is a concern, implement a “face blindness” rule: instruct the LLM to describe images as if it cannot recognize any individuals, even famous ones.</li><li>Provide rules for handling any PII it might encounter.</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>Core System Message &gt; Face Blindness: “CRITICAL: Claude always responds as if it is completely face blind. If the shared image happens to contain a human face, Claude never identifies or names any humans in the image…”</em></blockquote><h4>3.4. Ethical Guidelines and User Wellbeing</h4><p><strong>Principle:</strong> Embed broader ethical guidelines and a sense of responsibility for user wellbeing.</p><p><strong>Technique:</strong></p><ul><li>Instruct the LLM to avoid encouraging or facilitating self-destructive behaviors.</li><li>When dealing with topics requiring professional advice (law, medicine, psychology), recommend consultation with a licensed professional.</li><li>Encourage empathy and a caring tone, especially in sensitive conversations.</li><li>Instruct the LLM to prioritize the user’s best interests, even if a request seems benign but could lead to negative outcomes.</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>Core System Message: “Claude cares about people’s wellbeing and avoids encouraging or facilitating self-destructive behaviors…”</em></blockquote><blockquote><em>“If Claude is asked about topics in law, medicine, taxation, psychology and so on where a licensed professional would be useful to consult, Claude recommends that the person consult with such a professional.”</em></blockquote><h3>Part 4: Refining Interaction and Response Quality</h3><p>Beyond just <em>what</em> the LLM does, <em>how</em> it interacts and presents information is crucial.</p><h4>4.1. Using Examples to Demonstrate Behavior (Show, Don&#39;t Just Tell)</h4><p><strong>Principle:</strong> Concrete examples are one of the most powerful ways to teach an LLM desired behaviors, especially for complex instructions or nuanced scenarios.</p><p><strong>Technique:</strong></p><ul><li>Provide example user queries and the ideal LLM response or thought process.</li><li>Include rationales explaining <em>why</em> the example response is correct.</li><li>Use examples to illustrate adherence to specific rules (e.g., search categories, copyright).</li></ul><p>Example from Original Prompt (Claude):</p><p>The &lt;search_examples&gt; section is extensive, showing various user queries and Claude’s thought process and responses:</p><blockquote><em>&lt;example&gt;</em></blockquote><blockquote><em>&lt;user&gt;what are some natural ways to relieve a headache?&lt;/user&gt;&lt;response&gt;Several natural approaches…&lt;/response&gt;</em></blockquote><blockquote><em>&lt;rationale&gt;For queries Claude already knows a lot about, just provide relevant information WITHOUT searching or offering.&lt;/rationale&gt;</em></blockquote><blockquote><em>&lt;/example&gt;</em></blockquote><blockquote><em>Also, &lt;preferences_examples&gt; demonstrates how to apply user preferences.</em></blockquote><h4>4.2. Controlling Verbosity and Formatting</h4><p><strong>Principle:</strong> Guide the LLM on the desired length, style, and format of its responses.</p><p><strong>Technique:</strong></p><ul><li>Instruct on conciseness: provide the shortest helpful answer.</li><li>Specify when to use (or avoid) lists, paragraphs, or other formatting elements like markdown for code.</li><li>Encourage focusing on key information rather than exhaustive dumps.</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>Core System Message: “Claude provides the shortest answer it can to the person’s message, while respecting any stated length and comprehensiveness preferences…”</em></blockquote><blockquote><em>“Claude avoids writing lists, but if it does need to write a list, Claude focuses on key info…”</em></blockquote><blockquote><em>“Claude uses markdown for code.”</em></blockquote><h4>4.3. Handling Ambiguity and User Feedback</h4><p><strong>Principle:</strong> Prepare the LLM to handle situations where user requests are unclear or when users express dissatisfaction.</p><p><strong>Technique:</strong></p><ul><li>Instruct the LLM on how to seek clarification if a request is ambiguous.</li><li>Provide a standard way to respond to negative feedback (e.g., acknowledge the feedback, explain that it can’t learn from the current conversation directly, and guide the user to an official feedback mechanism).</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>Core System Message: “If the person seems unhappy or unsatisfied with Claude or Claude’s performance or is rude to Claude, Claude responds normally and then tells them that although it cannot retain or learn from the current conversation, they can press the ‘thumbs down’ button below Claude’s response and provide feedback to Anthropic.”</em></blockquote><h4>4.4. Nuances of Conversation</h4><p><strong>Principle:</strong> Beyond basic Q&amp;A, guide the LLM on engaging in more natural, nuanced, and contextually appropriate conversation.</p><p><strong>Technique:</strong></p><ul><li>Encourage asking relevant follow-up questions (but not excessively).</li><li>Provide specific instructions for handling creative tasks (e.g., poetry — “avoids using hackneyed imagery”).</li><li>Detail how to approach specific problem types (e.g., classic puzzles — “quotes every constraint…word for word”).</li><li>Instruct on using illustrative examples or metaphors to explain complex concepts.</li><li>Guide responses to personal questions (e.g., about its preferences — “responds as if it had been asked a hypothetical”).</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>Core System Message: “Claude can ask follow-up questions in more conversational contexts, but avoids asking more than one question per response…”</em></blockquote><blockquote><em>“If asked to write poetry, Claude avoids using hackneyed imagery or metaphors or predictable rhyming schemes.”</em></blockquote><blockquote><em>“If Claude is shown a classic puzzle, before proceeding, it quotes every constraint or premise…”</em></blockquote><h3>Part 5: Reinforcement and Reminders — Ensuring Critical Adherence</h3><p><strong>Principle:</strong> For the most critical instructions, simple declaration is not enough. They must be reinforced.</p><p><strong>Technique:</strong></p><ul><li>Create dedicated sections (e.g., &lt;critical_reminders&gt;, &lt;automated_reminder&gt;) that repeat or re-emphasize non-negotiable rules.</li><li>This is particularly important for safety, copyright, and core tool usage syntax.</li><li>The Claude prompt even mentions an &lt;automated_reminder_from_anthropic&gt; tag that will be appended to user messages in later turns, constantly reinforcing key instructions like citation.</li></ul><p><strong>Example from Original Prompt (Claude):</strong></p><blockquote><em>&lt;critical_reminders&gt;: Re-emphasizes: “NEVER use fake…formats for tool calls…”, “Always strictly respect copyright…”, “Refuse or redirect harmful requests…”, “Scale research to query complexity…”</em></blockquote><blockquote><em>&lt;search_reminders&gt;: Provides further detailed reinforcement of copyright and summarization rules for search results.</em></blockquote><blockquote><em>&lt;automated_reminder_from_anthropic&gt;: “Claude should always use citations in its responses.”</em></blockquote><h3>Conclusion: The Art of the Prompt</h3><p>Crafting a system prompt as detailed as Claude’s is an iterative process of instruction, observation, and refinement. Key takeaways for effective prompting include:</p><ul><li><strong>Be Hyper-Specific:</strong> The more detail you provide, especially for complex tasks or critical constraints, the better the LLM can align with your intent.</li><li><strong>Structure is Your Friend:</strong> Use tags, clear headings, and logical flow to make your prompt understandable.</li><li><strong>Show, Don’t Just Tell:</strong> Examples are invaluable.</li><li><strong>Prioritize Safety and Ethics:</strong> Build these in from the ground up.</li><li><strong>Tools Require Meticulous Guidance:</strong> If your LLM uses tools, define their usage with precision.</li><li><strong>Reinforce What Matters Most:</strong> Critical instructions should be repeated or highlighted.</li><li><strong>Plan for Personalization:</strong> Allow for dynamic information and user-specific adaptations.</li></ul><p>This playbook, derived from the robust Claude system prompt, provides a solid foundation for anyone looking to elicit more sophisticated, reliable, and aligned behavior from Large Language Models. Happy prompting!</p><p>Resource — <a href="https://github.com/asgeirtj/system_prompts_leaks/blob/main/claude-3.7-sonnet-full-system-message-humanreadable.md">https://github.com/asgeirtj/system_prompts_leaks/blob/main/claude-3.7-sonnet-full-system-message-humanreadable.md</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b1e2f10622b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decoding Growth #1]]></title>
            <link>https://medium.com/@pushkaraggrawal/decoding-growth-1-052ff826ee5d?source=rss-3ce58770b334------2</link>
            <guid isPermaLink="false">https://medium.com/p/052ff826ee5d</guid>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[startup-growth]]></category>
            <dc:creator><![CDATA[music and waves]]></dc:creator>
            <pubDate>Mon, 11 Nov 2024 18:30:28 GMT</pubDate>
            <atom:updated>2024-11-11T18:52:56.333Z</atom:updated>
            <content:encoded><![CDATA[<p>Lets dive into the complex world of startup growth. Growth isn’t a mere collection of tricks, but a strategic discipline rooted in a deep understanding of user behavior.</p><h3><strong>Beyond Growth Hacks: A Systematic Approach</strong></h3><ul><li><strong>Structured Approach:</strong> Rather than relying on quick-fix solutions, a structured approach is essential. This involves understanding the customer journey, defining key metrics, and leveraging network effects.</li><li><strong>Key Metrics:</strong> <br>Metrics like CAC (Customer Acquisition Cost) and LTV (Lifetime Value) are crucial.<br>A healthy LTV:CAC ratio indicates a sustainable business model. <br>A higher LTV:CAC ratio means that the value of a customer over their lifetime is significantly greater than the cost to acquire them.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSUHD9qTDAzGuEjkehj65Q.png" /><figcaption>wilsonhung.com</figcaption></figure><h3><strong>The Power of Organic Growth</strong></h3><ul><li><strong>Organic Strategies:</strong> <br>Content marketing, SEO, and social media marketing.</li><li><strong>Network Effects:</strong> <br>Leveraging network effects can significantly accelerate growth. This involves encouraging user-generated content, referrals, and community building. A strong network effect can lead to exponential growth as more users attract more users.</li></ul><h3><strong>The Role of Paid Acquisition</strong></h3><ul><li><strong>Strategic Use of Paid Advertising:</strong> <br>While paid advertising can be a powerful tool, it should be used strategically. It should be used as a catalyst and not become the major source of your footprint.</li><li><strong>Channel Selection and Optimisation:</strong> <br>Choosing the right channels (like Google Ads, Facebook Ads) and optimising campaigns for maximum ROI are key. However these should not be a major portion of your growth source.</li></ul><h3><strong>The Esports Case in Organic Growth</strong></h3><ul><li><strong>Organic Growth in Action:</strong> <br>The esports industry serves as a prime example of organic growth, driven by user-generated content, community building, and strategic partnerships. The visual nature of the product experience leaves immense room for content creation.</li></ul><p><em>A balanced approach, combining organic and paid strategies, is often the most effective. By understanding the strengths and weaknesses of each approach, startups can maximize their growth potential in a sustainable way.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=052ff826ee5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Idea to Impact: The Ultimate Playbook for Aspiring Tech Leaders]]></title>
            <link>https://medium.com/@pushkaraggrawal/from-idea-to-impact-the-ultimate-playbook-for-aspiring-tech-leaders-0a0c2fd0daa8?source=rss-3ce58770b334------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a0c2fd0daa8</guid>
            <dc:creator><![CDATA[music and waves]]></dc:creator>
            <pubDate>Thu, 24 Oct 2024 18:26:10 GMT</pubDate>
            <atom:updated>2024-10-24T18:38:14.277Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*d0OFHsfTYzQScvn7.jpg" /></figure><p>As someone striving to succeed as an entrepreneur, strategist, or product manager, it’s critical to master various skills that help you navigate the fast-paced world of business. From building a brand to creating an effective strategy, each aspect contributes to your journey toward becoming a leader in your field.</p><p>In this guide, I’ll walk you through essential topics you need to focus on, along with resources from top professionals to accelerate your learning.</p><p>I’m following this as a 15-week exercise, focusing on one topic each weekend.</p><h3>1. Self-Branding and Marketing</h3><blockquote>Building a personal and professional brand is key to standing out. Marketing yourself effectively will open doors to collaborations, partnerships, and trust with your customers.</blockquote><p>Key Resources: <br>- Blog:<a href="https://seths.blog/"> Seth Godin’s Blog</a> — Marketing insights from one of the top minds in the industry. <br>- Book: Building a StoryBrand by Donald Miller — Teaches you how to create a compelling message that resonates. <br>- Medium Blog: <a href="https://medium.com/@theChrisDo">Chris Do </a>— Creative branding and marketing for entrepreneurs.</p><p>— -</p><h3>2. Sales</h3><blockquote>Mastering sales is critical, whether you’re selling products, services, or ideas. Understanding customer psychology and having a well-defined sales strategy can make or break your business.</blockquote><p>Key Resources: <br>- Blog: <a href="https://blog.close.com/author/steli-efti/">Steli Efti (Close)</a> — Sales strategies, especially for startups. <br>- Book: SPIN Selling by Neil Rackham — A data-driven approach to sales. <br>- Medium Blog: <a href="https://medium.com/@hnshah">Hiten Shah</a> — Co-founder of KISSmetrics, writes extensively on sales and growth.</p><p>— -</p><h3>3. Market Research</h3><blockquote>Knowing your market is a non-negotiable step before launching any product. Market research helps you understand your customers, competitors, and industry trends.</blockquote><p>Key Resources: <br>- Blog: <a href="https://steveblank.com/">Steve Blank’s Blog </a>— Lean Startup pioneer with a focus on customer development. <br>- Tools: Google Trends, Statista — Great for gathering real-time insights. <br>- Medium Blog:<a href="https://productcoalition.com/"> Product Coalition</a> — Offers market research strategies for product managers.</p><h3>4. Go-To-Market (GTM) Strategy</h3><blockquote>GTM strategies define how you’ll bring your product to market, position it for success, and scale it effectively.</blockquote><p>Key Resources: <br>- Blog: <a href="https://brianbalfour.com/">Brian Balfour’s Blog</a>— Deep dives into growth and GTM models. <br>- Book: Crossing the Chasm by Geoffrey Moore — A must-read for launching tech products. <br>- Medium Blog: <a href="https://gtmpartners.medium.com/">GTM Partners</a>— Offers detailed strategies on GTM execution.</p><p>— -</p><h3>5. Growth and Acquisition</h3><blockquote>Scaling a business requires you to have a deep understanding of growth mechanisms, user acquisition, and product-market fit.</blockquote><p>Key Resources: <br>- Blog: [Andrew Chen’s Blog](<a href="https://andrewchen.com/">https://andrewchen.com</a>) — Expert insights on viral growth and network effects. <br>- Book: Hacking Growth by Sean Ellis — Techniques to grow your product and business. <br>- Medium Blog: [Growth Hackers](<a href="https://growthhackers.medium.com/">https://growthhackers.medium.com</a>) — Learn growth marketing and acquisition strategies from top professionals.</p><p>— -</p><h3>6. Retention</h3><blockquote>Customer retention is just as important, if not more so, than acquisition. Building a loyal user base can significantly reduce churn and drive long-term business success.</blockquote><p>Key Resources: <br>- Blog: <a href="https://www.retentioncurve.com/blog">Retention Curve Blog </a>— Focuses on customer retention strategies. <br>- Book: Hooked by Nir Eyal — Learn to build habit-forming products that drive retention. <br>- Medium Blog: <a href="https://retentionscience.medium.com/">Retention Science —</a> Provides advanced retention tactics for modern businesses.</p><p>— -</p><h3>7. Business Valuation</h3><blockquote>Valuation is critical when seeking investments or planning an exit. Understanding your business’s worth enables you to make informed decisions.</blockquote><p>Key Resources: <br>- Harvard Business Review on Valuation: <a href="https://hbr.org/search?term=valuation">HBR on Valuation</a> — Deep dives into financial metrics and business valuation strategies. <br>- Book: Valuation: Measuring and Managing the Value of Companies by McKinsey — An authoritative guide to company valuation. <br>- Medium Blog: <a href="https://valuationacademy.medium.com/">Valuation Academy</a> — Simplifies business valuation concepts for entrepreneurs.</p><p>— -</p><h3>8. Strategy Creation</h3><blockquote>Strategic planning helps you align your resources and efforts to achieve long-term goals. Various models like Porter’s Five Forces and DHM can provide frameworks for decision-making.</blockquote><p>Key Resources: <br>- Blog: <a href="https://www.strategyworks.com/">Michael Porter’s Strategy Works</a> — Competitive strategy insights. <br>- Book: Good Strategy, Bad Strategy by Richard Rumelt — A definitive guide to creating effective strategies. <br>- Medium Blog: <a href="https://strategyu.co/blog">StrategyU </a>— Offers strategic frameworks for business success.</p><p>— -</p><h3>9. Talent Attraction and Hiring</h3><blockquote>Your company is only as strong as the team behind it. Building and retaining a talented team is one of the most critical components of long-term success.</blockquote><p>Key Resources: <br>- Blog: <a href="https://firstround.com/review/">First Round Review</a> — Talent attraction and hiring best practices from top startups. <br>- Book: Who: The A Method for Hiring by Geoff Smart — A step-by-step guide to hiring the best talent. <br>- Medium Blog: <a href="https://hros.co/">HR Open Source</a> — Innovative approaches to talent acquisition and retention.</p><p>— -</p><h3>10. Product Management</h3><blockquote>Product management sits at the intersection of customer needs, business goals, and technology. It’s crucial to understand the lifecycle of building, launching, and iterating products.</blockquote><p>Key Resources: <br>- Blog: <a href="https://www.kennorton.com/donuts.html">Ken Norton’s “Bringing the Donuts”</a>] — Classic reads for product managers. <br>- Book: Inspired by Marty Cagan — An essential guide to building products customers love. <br>- Medium Blog: <a href="https://www.mindtheproduct.com/">Mind the Product</a> — Product management strategies and trends.</p><p>— -</p><h3>11. Leadership and Team Management</h3><blockquote>Strong leadership is the glue that holds a successful business together. As you scale, understanding how to motivate and lead teams becomes essential.</blockquote><p>Key Resources: <br>- Blog: <a href="https://simonsinek.com/">Simon Sinek’s Blog</a> — Leadership and motivation insights. <br>- Book: Leaders Eat Last by Simon Sinek — How leaders build strong, trusting teams. <br>- Medium Blog: <a href="https://firstround.com/review/">First Round Review</a> — Tactics from startup founders and leaders on effective team management.</p><p>— -</p><h3>12. Financial Management</h3><blockquote>Understanding your business’s finances will help you make informed decisions and stay financially healthy while growing.</blockquote><p>Key Resources: <br>- Financial Times: <a href="https://www.ft.com/">FT.com</a> — Stay updated on global business and financial insights. <br>- Book: The Lean Startup by Eric Ries — Focuses on cost management and lean financial strategies for startups. <br>- Medium Blog: <a href="https://startupfinancials.medium.com/">Startup Financials</a> — Covers financial management essentials for startups.</p><p>— -</p><h3>13. Legal Aspects and Compliance</h3><blockquote>Navigating legal issues, from intellectual property to compliance, is critical for avoiding costly mistakes and ensuring your business operates smoothly.</blockquote><p>Key Resources: <br>- Blog: <a href="https://founderscounsel.com/">Founders Counsel Blog</a> — Legal tips for entrepreneurs. <br>- Book: Venture Deals by Brad Feld — Covers legal and financial aspects of fundraising. <br>- Medium Blog: <a href="https://startup-legal.medium.com/">Startup Legal Tips</a> — Practical legal advice for startups.</p><p>— -</p><h3>14. Fundraising and Investor Relations</h3><blockquote>Securing funding is a major milestone for any startup. Understanding how to attract investors and manage those relationships is crucial.</blockquote><p>Key Resources: <br>- Y Combinator Startup Library: <a href="https://www.ycombinator.com/library">Y Combinator</a>— Comprehensive resources on pitching to investors. <br>- Book: Secrets of Sand Hill Road by Scott Kupor — Venture capital insights and fundraising tips. <br>- Medium Blog: <a href="https://blog.samaltman.com/">Sam Altman’s Blog</a>— Fundraising and startup growth advice from a top entrepreneur.</p><p>— -</p><h3>15. Innovation and Design Thinking</h3><blockquote>Innovation is the lifeblood of successful businesses. Design thinking helps you create products and solutions that genuinely address user needs.</blockquote><p>Key Resources: <br>- IDEO’s Blog: <a href="https://www.ideo.com/blog">IDEO Blog</a> — Design thinking and innovation strategies. <br>- Book: Creative Confidence by Tom and David Kelley — Unlock your creativity and foster innovation. <br>- Medium Blog: <a href="https://medium.com/swlh">The Startup</a> — A collection of innovation tips from various entrepreneurs.</p><p>— -</p><h3>Final Thoughts</h3><p>Becoming a successful entrepreneur, strategist, or product manager requires mastering multiple disciplines. These resources will help you learn from the best in the industry, equipping you with the knowledge and skills to make an impact.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a0c2fd0daa8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Category Prediction for Search Query Understanding]]></title>
            <link>https://medium.com/myntra-engineering/category-prediction-for-search-query-understanding-f46283151c92?source=rss-3ce58770b334------2</link>
            <guid isPermaLink="false">https://medium.com/p/f46283151c92</guid>
            <category><![CDATA[information-retrieval]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[ecommerce]]></category>
            <dc:creator><![CDATA[music and waves]]></dc:creator>
            <pubDate>Sun, 21 Apr 2024 12:40:48 GMT</pubDate>
            <atom:updated>2024-04-21T12:40:48.259Z</atom:updated>
            <content:encoded><![CDATA[<p>Navigating through online shopping platforms can sometimes feel like finding your way through a maze. Take the search bar, for example. You type in “winter upper wear,” hoping to find the perfect jacket or cozy sweatshirt. But here’s the tricky part: the search engine has to decipher what you mean. Is it jackets you’re after? Or maybe sweatshirts? Or both?</p><p>It gets even more confusing when you consider the overlapping categories. Kurtas can be standalone articles or part of kurta sets. And loafers? They could belong to formal shoes or casual shoes and certainly not sports shoes. See the challenge?</p><p>To tackle this, Myntra uses a <strong>multi-label search to product category classification model</strong>. It’s like having an assistant that can understand possible intents from your search query. So when you type in something like “whey,” the model knows you might be looking for protein or health supplements.</p><p>But here’s the catch: search queries can be short and vague, and they often use words that don’t directly match category names. People might search using different terms or even regional variations. So, the model needs to be clever enough to map those words to the right categories internally.</p><p>The goal is to capture all possible intents without cluttering your search results with irrelevant stuff. After all, nobody likes sifting through pages of irrelevant products. It’s a delicate balance between covering all bases and keeping things tidy.</p><h3><strong><em>Solution</em></strong></h3><p>The solution has 2 major components.</p><p><strong>I.<em> Data preparation</em></strong><em><br></em>We prepare ( search query : categories ) data points to be consumed in training by the neural classifier. Ex. ( ethnic wear : kurta, sarees )</p><p><strong>II. <em>Training a neural model<br></em></strong>We train a neural multi-label text classifier that consumes the prepared training data which is used to predicts categories for search queries live.</p><h3>I. Data Preparation</h3><p>We generate the supervised text classification training data in form of a search query and its product category(s) as its labels.</p><p>This set is enriched from multiple sources such as</p><p><strong>A. Reformulation</strong></p><p>Users fire multiple queries with converging intents in a single session. We stitch these queries and respective interacted products within a single search session to help create scenarios for tail queries. Ex. in a single session user fires 2 queries</p><p>User Query 1 : “winter upper wear” &gt; Irrelevant results, low user interaction</p><p>User Query 2: “Fleece jackets” &gt; User interacts with jackets in search results.</p><p>We stitch “winter upper wear” too with jackets in our training set.</p><p>&lt; Query : winter upper wear || Label : &lt;Jackets&gt; &gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eDWbfcRlkAVTqh9I.png" /><figcaption>Solving queries using reformulation signals</figcaption></figure><p><strong>B. Catalog</strong></p><p>We create multiple combinations from products’ attributes and coupled them with the products’ category(s). Ex.</p><ol><li>Product categories having the hygienic feature value as “Almond” are stitched together with “Hair Oil”, “Food Oil”, “Chocolates”. Giving training data as :<br>&lt; Query : Almond || Label : &lt;Hair Oil, Food Oil, Chocolates&gt; &gt;</li><li>Using brand + category + gender combinations we instances like<br>a. &lt; Query : Nike sports shoes men || Label : &lt;Sports Shoes&gt; &gt;<br>b. &lt; Query : Garnier facewash men || Label : &lt;Facewash&gt; &gt;</li></ol><p>This helps us inject data for low traffic categories where reformulation lacks coverage.</p><h3>II. Neural Classifier Architecture</h3><p>The model has two parts.</p><p>The first part, called the word embedding module, turns words into numerical representations called word vectors. Word embedding essentially helps the computer understand the context and relationships between words by representing them as vectors in a multi-dimensional space. This helps the program understand the meaning of words.</p><p>The second part is a text classification model that uses neural networks to understand the order of words in a sentence and make predictions based on that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OhGSDhju1RGTRlRF.png" /><figcaption>Bird’s-eye view of the classifier</figcaption></figure><h3>A. Word Embeddings</h3><p>We create word level embeddings using unsupervised representation learning in <a href="https://fasttext.cc/docs/en/unsupervised-tutorial.html">fasttext</a> on a custom e-commerce corpus created using catalog products, clickstream and commercially available ecommerce data sources. The embeddings’ model learns high dimensional word level representations.</p><p>FastText model has following features which make it suitable for our application</p><ol><li><strong>Subword Information</strong></li></ol><p>Breaks words into character n-grams, aiding in handling out-of-vocabulary or noisy spelling queries. Such as “kurta” / “kurti”. The semantic understanding of “kurt” might imply a generic ethnic topwear while the “rta” or “rti” will map it to the long length “kurtas” and shorter “kurtis” respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lSZQWA8tfvpoSyt6.png" /><figcaption>Kurtis (shorter) vs Kurtas (longer)</figcaption></figure><p>This further allows representation of vernacular, unseen or rare words by composing their subword embeddings, enhancing robustness. Ex. “necklace” and “necklas”.</p><p><strong>2. Skip-gram Model</strong></p><p>The skip-gram model represents words using character n-grams. By predicting context words (the words around the current word) from current word during training and adjusting input vector weights through backpropagation, the model learns semantic associations efficiently. For more details checkout this <a href="https://towardsdatascience.com/fasttext-under-the-hood-11efc57b2b3">detailed guide on fasttext</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/0*0mXqK0f7iKRrtgSo.png" /><figcaption>Learning representation for “loves” by predicting context words “the man — his son”. <a href="https://d2l.ai/chapter_natural-language-processing-pretraining/word2vec.html">src</a></figcaption></figure><p><strong>3. Advantages for OOV and Noisy Spelling</strong></p><p>Subword embeddings accommodate unseen or misspelled words, providing meaningful representations even for out-of-vocabulary or noisy spelling queries.</p><p>Skip-gram model’s ability to capture semantic information enhances the robustness and relevance of embeddings, further aiding in handling variations in vocabulary.</p><h3>B. Neural Network Classifier</h3><p>We create a custom neural network text classifier inspired from <a href="https://arxiv.org/pdf/1811.09386.pdf">EXAM</a>.</p><p>The model utilises an interaction mechanism to incorporate word-level matching signals into the text classification task</p><p>User query “black drop shoulder” goes through the following transformations:</p><ol><li>Generate word embedding using fasttext.</li><li>Bidirectional Gated Recurrent Unit sequence to sequence layer to create contextual word embedding</li><li>Calculating interaction of contextual word embedding with class level embeddings.</li><li>Aggregating interaction of each contextual word embedding across classes</li><li>Transforming interaction space vector to classification vector.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4_cU1WD_MqpQBFbI" /><figcaption>Search Query Journey in the Model</figcaption></figure><p>The interaction used here is cosine for its simplicity and efficiency. We use sigmoid as output activation for its utility in multi-label scenarios. The activation doesn’t squash output probabilities for classes if more than 1 suitable output class occurs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/0*WTIcKv0MUZO_-E5j.png" /><figcaption>Interaction mechanism as described in the src: <a href="https://arxiv.org/pdf/1811.09386.pdf">EXAM</a>.</figcaption></figure><p>Above figure demonstrates the interaction mechanism between the learnt class representations and the text embeddings. Word level representation from Bi-GRU is interacted with the class representation vectors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J5wKmuCwc0YMYuPd" /><figcaption>Radial decision boundaries / clusters (labelled in magenta) in product category representations learnt in training demonstrating semantic coherence amongst categories</figcaption></figure><h3>Conclusions</h3><p>The model is integrated in search query understanding and an A/B experiment is ran against existing behaviour. Results show decrease in query abandonment, improvement in click through rate and revenue per user.</p><p>Following head queries show improvements in production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IqWutfjgLilkpEf_.png" /><figcaption>Approaching general language understanding on traffic</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RrVl6U-03isGgg_Q.png" /><figcaption>Improved discoverability of athletic wear, previous experience showed sneakers and casual shoes</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AtRFZJYS9jg-LOrT.png" /><figcaption>Showing only protein powder for “whey” and not makeup and beauty products</figcaption></figure><h3>Next</h3><p>There is room for exploration across using modern language models which leverage massive knowledge from internet scale pre-training and the groundbreaking transformer architectures. Proof of concepts utilising fine-tuning on pre-trained Roberta and DeBERTa-v3 show tremendous promise.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f46283151c92" width="1" height="1" alt=""><hr><p><a href="https://medium.com/myntra-engineering/category-prediction-for-search-query-understanding-f46283151c92">Category Prediction for Search Query Understanding</a> was originally published in <a href="https://medium.com/myntra-engineering">Myntra Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LoReFT | Tune concepts, not weights]]></title>
            <link>https://medium.com/@pushkaraggrawal/loreft-tune-concepts-not-weights-65aed65c6ccd?source=rss-3ce58770b334------2</link>
            <guid isPermaLink="false">https://medium.com/p/65aed65c6ccd</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[fine-tuning]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[music and waves]]></dc:creator>
            <pubDate>Mon, 08 Apr 2024 21:57:00 GMT</pubDate>
            <atom:updated>2024-04-08T22:51:57.285Z</atom:updated>
            <content:encoded><![CDATA[<p>Fine-tune Llama in under 10 mins on single A100!*</p><p>Traditional PEFT techniques : Lora, Dora finetune weights in an attempt changing model representation.</p><p>ReFT edits concept representations themselves!</p><p>Activation steering and representation engineering has shown that adding fixed steering vectors to the states in models can enable a degree of control over pretrained LM generations without the need for resource-intensive finetuning.</p><p>ReFT is a drop-in replacement for existing PEFTs and learns interventions that are 10x–50x more parameter-efficient than prior state-of-the-art PEFTs.</p><p><strong>Methodology</strong></p><p>Combining ReFT and low rank projections gives LoReFT.</p><p>LoReFT intervenes on hidden representations in the linear subspace spanned by a low-rank projection matrix.</p><p>The core idea is as follows</p><p><strong>Distributed Interchange Interventions</strong></p><p>It is proven that a causal concept is encoded in a linear subspace of hidden representations.</p><p>LoReFT finds a transformation which changes current hidden states to target behaviour’s hidden states, consistently.</p><p>When a neural network is provided a ‘base’ input, sets of neurons are forced to take on the values they would have if different ‘source’ inputs were processed using our transformation.</p><p>Distributed Alignment Search is used to find this transformation.</p><p><a href="https://arxiv.org/pdf/2303.02536.pdf"><strong>Distributed Alignment Search</strong></a></p><ul><li>DAS uses gradient descent to find the best alignment — a transformation between high level (hidden states) and low level states (concept) with same causal behaviours.</li><li>These interventions involve rotating neuron values using a matrix, fixing specific dimensions, and then rotating back.</li><li>By looking at neural representations in a different way, we can find meaningful hidden states and their causally controlled behaviours.</li></ul><p>Above techniques give us a way to learn interventions.</p><p>Next step is to select the interventions</p><p>An intervention I is defined as a tuple ⟨Φ,P,L⟩.</p><ul><li>Φ : Intervention function which maps hidden state to its intended hidden state value.</li><li>P, L : position (first-n &amp;/or last-n), layer of the hidden representation the Φ is applied to. This parameter is subject to finetuning.</li><li>Rank</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H2_3aBEy4g6OJRg52WgojA.png" /><figcaption>Green hidden state are the ones where intervention is applied. Taken from source paper.</figcaption></figure><p><strong>Task suitability</strong></p><p>Arithmetic (Lora wins)&lt; GLUE (smaller LMs) &lt; GLUE (larger LMs) &lt; Commonsense &lt; Instruct Tuning (beats full finetuning!)</p><p>Checkout their github repo for reproducing results.</p><p>Source : <a href="https://arxiv.org/pdf/2303.02536.pdf">https://arxiv.org/pdf/2303.02536.pdf</a></p><p>*On a 1K training set.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65aed65c6ccd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[General Named Entity Recognitio using : GLiNER]]></title>
            <link>https://medium.com/@pushkaraggrawal/general-named-entity-recognitio-using-gliner-ec0778d93cd7?source=rss-3ce58770b334------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec0778d93cd7</guid>
            <category><![CDATA[search]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[named-entity-recognition]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[music and waves]]></dc:creator>
            <pubDate>Fri, 05 Apr 2024 03:38:35 GMT</pubDate>
            <atom:updated>2024-04-05T04:05:04.110Z</atom:updated>
            <content:encoded><![CDATA[<h3>General Named Entity Recognitio using GLiNER</h3><h3>General Named Entity Recognition better than LLMs?</h3><p>Named Entity Recognition (NER) is a powerful tool in language understanding, identifying and categorizing entities like names, locations, organizations, and more within text. In e-commerce, NER plays a crucial role in deciphering user queries, extracting key details such as product names, brands, sizes, colors, etc., to provide accurate search results.</p><p>From <a href="https://solr.apache.org/guide/8_0/the-tagger-handler.html">original lexical taggers</a> to context-aware systems, our ability to understand language nuances has improved significantly. For instance, in the phrase “shirt by white,” earlier systems might ambiguously interpret “white” as both a color and a brand. However, modern NER models consider contextual cues to discern that, in this case, “white” likely refers to a brand rather than a color, leading to more accurate search outcomes and enhanced user experiences.</p><p>Traditional NER models were limited to work on constrained space of entites such as <a href="https://huggingface.co/dslim/distilbert-NER">distilbert-NER</a>.</p><p>Going towards foundational models like GPT-4 and Gemini it was proven that language models can work on general zero shot scenarios very well. The caveat was that you will probably need an absurd amount of compute and data to arrive at your use case.</p><p>GLiNER achieves general entity recognition using models with &lt;100 million parameters compared to ~1.26 Trillion parameters of GPT-4. The model is trained on ChatGPT annotated corpus in a supervised fashion.</p><h4>Components</h4><p>i) Pre-trained textual encoder (a BiLM such as DeBERTa-v3)</p><p>ii) Span representation module which computes substring embeddings from token embeddings</p><p>iii) Entity representation module which computes entity embeddings that the model seeks to extract.</p><h4><strong>Input / Output</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*pL7H1kjDyALngqVC55i-1A.png" /><figcaption>Model Input : Entities + Query Text for NER</figcaption></figure><h3>Model Transformations</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UwC0hCJBLM3zw2Rs55ZEgg.png" /></figure><ol><li>The token encoder processes the unified input to compute interactions between all tokens (both entity types and input text), producing contextualized representations for both entites (<strong>Entity Type Embeddings</strong>) and words (first token for multi-token words). Namely <strong>Token/Word representation.</strong></li><li>Span representations are created by concatenating span’s edge word representations and a feed forward pass.<br> Sij = FFN[hi :hj] <br>Where Sij is the <strong>Span Embedding</strong>, FFN is a feedforward layer and hi, hj are contextual word representations.</li><li>Finally a cosine similarity + sigmoid activation (treating as a multi-label span classification) is done between span representations and entity representations. This yields a probability score for each span to belong to an input entity.</li></ol><h3>Loss</h3><p>The loss is an aggregate of negative log probabilities probability score of correct span classification across spans and entities.</p><p>Further a negative sampling is done on entities which helps push away irrelevent entities’ and span’s representations.</p><p><em>L = —A log ϕ(s) + B log (1 − ϕ(s))</em></p><p>Where A represents positive pairs, B represents negative pairs and <em>ϕ(s) </em>represents probability score from step (3).</p><h3>Regularisation</h3><p>Authors leverage certain learnings which help in training:</p><ol><li>Include negative entity types during training by sampling random entities from other examples in the same batch.</li><li>Shuffling entity order</li><li>Randomly dropping entities</li></ol><h3>Decoding Output</h3><p>Once the Entites x Spans Matrix of matching scores is obtained in step (3) Then, there are 3 steps to decode them into final tags.</p><ol><li>Filtered to keep just the ≥ 0.5 values.</li><li>Pushing (Span,Entity) tuples into a priority queue with matching score as priority.</li><li>Constructing final tags<br>a. Flat NER<br>The algorithm chooses the highest scoring non-overlapping span and continues this process until all spans are evaluated.<br>b. Nested NER<br>Flat NER + selection of fully nested spans within other entities while still avoiding partial overlaps.</li></ol><pre>!pip install gliner<br><br>from gliner import GLiNER<br><br># Initialize GLiNER with the base model<br>model = GLiNER.from_pretrained(&quot;urchade/gliner_base&quot;)<br><br># Sample text for entity prediction<br>text = &quot;&quot;&quot;<br>Cristiano Ronaldo dos Santos Aveiro (Portuguese pronunciation: [kɾiʃˈtjɐnu ʁɔˈnaldu]; born 5 February 1985) is a Portuguese professional footballer who plays as a forward for and captains both Saudi Pro League club Al Nassr and the Portugal national team. Widely regarded as one of the greatest players of all time, Ronaldo has won five Ballon d&#39;Or awards,[note 3] a record three UEFA Men&#39;s Player of the Year Awards, and four European Golden Shoes, the most by a European player. He has won 33 trophies in his career, including seven league titles, five UEFA Champions Leagues, the UEFA European Championship and the UEFA Nations League. Ronaldo holds the records for most appearances (183), goals (140) and assists (42) in the Champions League, goals in the European Championship (14), international goals (128) and international appearances (205). He is one of the few players to have made over 1,200 professional career appearances, the most by an outfield player, and has scored over 850 official senior career goals for club and country, making him the top goalscorer of all time.<br>&quot;&quot;&quot;<br><br># Labels for entity prediction<br>labels = [&quot;person&quot;, &quot;award&quot;, &quot;date&quot;, &quot;competitions&quot;, &quot;teams&quot;]<br><br># Perform entity prediction<br>entities = model.predict_entities(text, labels, threshold=0.5)<br><br># Display predicted entities and their labels<br>for entity in entities:<br>    print(entity[&quot;text&quot;], &quot;=&gt;&quot;, entity[&quot;label&quot;])<br><br>Cristiano Ronaldo dos Santos Aveiro =&gt; person<br>5 February 1985 =&gt; date<br>Al Nassr =&gt; teams<br>Portugal national team =&gt; teams<br>Ballon d&#39;Or =&gt; award<br>UEFA Men&#39;s Player of the Year Awards =&gt; award<br>European Golden Shoes =&gt; award<br>UEFA Champions Leagues =&gt; competitions<br>UEFA European Championship =&gt; competitions<br>UEFA Nations League =&gt; competitions<br>Champions League =&gt; competitions<br>European Championship =&gt; competitions</pre><p>Refer : <a href="https://github.com/urchade/GLiNER">https://github.com/urchade/GLiNER</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec0778d93cd7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ML in Production 1/n : Drift and Bias]]></title>
            <link>https://medium.com/@pushkaraggrawal/ml-in-production-1-n-drift-and-bias-ee27898ec68c?source=rss-3ce58770b334------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee27898ec68c</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[bias]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[mlops]]></category>
            <dc:creator><![CDATA[music and waves]]></dc:creator>
            <pubDate>Sat, 23 Mar 2024 20:29:19 GMT</pubDate>
            <atom:updated>2024-03-26T06:30:24.172Z</atom:updated>
            <content:encoded><![CDATA[<h3>ML in Production 1/n : Drift and Bias</h3><p>In the dynamic realm of machine learning (ML) deployment, sustaining peak model performance over time presents a formidable challenge. ML systems are prone to subtle degradation and the reinforcement of biases, which can significantly impact their efficacy. This article explores the nuances of detecting drift and bias in ML models and proposes actionable solutions to mitigate their effects.</p><h4>Detecting Degradation</h4><p><em>ML-Specific Failures:</em> ML systems are susceptible to a spectrum of failures, ranging from inadequate hyper-parameters to shifts in data distributions. For instance, changes in user behavior or system dynamics can lead to a divergence between training and production data distributions, resulting in degraded model performance. Consider the case of an e-commerce platform where the term “jumper” refers to a sleeveless dress in some regions and a knitted sweater in others. Failure to account for such vernacular variations can hinder model generalisation, impacting recommendation accuracy. Uber tackles such issues by employing multiple models categoring to different user segments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/0*bRlLXiRcYtZwkmp-.png" /><figcaption>Types of drift : <a href="https://www.datacamp.com/tutorial/understanding-data-drift-model-drift">src</a></figcaption></figure><p>Periodic training of models can help realign model distribution to traffic</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NDiIkKE9jMfOctmi.png" /><figcaption>Model Performance with Regular Updates : <a href="https://www.evidentlyai.com/blog/machine-learning-monitoring-data-and-concept-drift">src</a></figcaption></figure><h4><strong>The Filter Bubble Phenomenon</strong></h4><ol><li><strong><em>Understanding Bias in ML</em> </strong><br>The amalgamation of clickstream feedback with training data introduces biases that reinforce existing filter bubbles. Picture a scenario where an e-commerce platform prioritizes popular items in its recommendations, perpetuating a cycle where only mainstream products gain visibility. This phenomenon limits the diversity of recommendations and overlooks emerging trends.</li><li><strong><em>Detecting Bias</em></strong><em><br></em>One effective method to detect bias is by measuring the recommendation hit rate against item popularity. For example, if a recommender system consistently favors popular items over less-known ones, it likely suffers from popularity bias. This disparity in recommendation accuracy highlights underlying biases embedded within the system.</li></ol><p><strong><em>Solution</em></strong></p><ol><li><strong><em>Exploration Strategies</em></strong><br>Platforms like TikTok employ randomized traffic allocation to evaluate content quality objectively. By randomly assigning initial traffic to each video, TikTok can gauge its unbiased appeal before promoting it further. However, this approach comes at the expense of user experience, as some users may encounter irrelevant content during the exploration phase.</li><li><strong><em>Positional Features</em></strong><em><br></em> Augmenting training data with positional features enables models to understand the impact of recommendation placement on user engagement. For instance, during training, the model learns whether being a top recommendation influences click likelihood. However, during inference, the model prioritizes recommendations based on user preferences, disregarding predefined positions.</li><li><strong><em>Bias Normalization</em> </strong><br>A sophisticated approach involves using two separate models to address bias. The first model predicts the probability of a user viewing and considering a recommendation, considering its position. The second model predicts the probability of a user clicking on the item, irrespective of its position. This dual-model setup effectively normalizes bias without compromising recommendation relevance.</li></ol><p>Navigating the intricacies of ML models in production necessitates proactive measures to combat drift and bias. By implementing robust detection mechanisms and adopting bias-mitigation strategies, organizations can uphold the longevity and fairness of their ML-powered solutions. Embracing dynamic adaptation and transparency in algorithmic decision-making are pivotal steps towards fostering trust and efficacy in AI-driven systems.</p><p>SRC : <a href="https://huyenchip.com/2022/02/07/data-distribution-shifts-and-monitoring.html">https://huyenchip.com/2022/02/07/data-distribution-shifts-and-monitoring.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee27898ec68c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>