<?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 Michael B. Cizmar on Medium]]></title>
        <description><![CDATA[Stories by Michael B. Cizmar on Medium]]></description>
        <link>https://medium.com/@michaelcizmar?source=rss-42b3d842d9a0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*IDwg7M3vFxGVrRuD.jpg</url>
            <title>Stories by Michael B. Cizmar on Medium</title>
            <link>https://medium.com/@michaelcizmar?source=rss-42b3d842d9a0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:12:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@michaelcizmar/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 Create a Sizing Formula for Your Elasticsearch Queries]]></title>
            <link>https://michaelcizmar.medium.com/how-to-create-a-sizing-formula-for-your-elasticsearch-queries-3b56e2899869?source=rss-42b3d842d9a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b56e2899869</guid>
            <category><![CDATA[sharding]]></category>
            <category><![CDATA[sizing]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <dc:creator><![CDATA[Michael B. Cizmar]]></dc:creator>
            <pubDate>Sun, 07 Dec 2025 20:13:52 GMT</pubDate>
            <atom:updated>2025-12-08T14:40:35.162Z</atom:updated>
            <content:encoded><![CDATA[<p>This article dives into Elasticsearch Cluster Query Performance and explains the Math behind the Latency.</p><h3>TLDR</h3><p>Calculate the number of shards your query hits with the average query time and the number of threads available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7D6eR87kZjfPJkEQ-zqYRQ.jpeg" /><figcaption>The basic query sizing formula to start with</figcaption></figure><p>When you hit an index pattern or alias, Elasticsearch sends your query to <strong>every shard</strong> in that set. This fact is amplified because many many organizations accidentally end up with hundreds of shards per search because they:</p><ul><li>Have not updated their default index settings and create 5 shards per index</li><li>Query indexes that are not relevant to the intended purpose of the search</li><li>Can’t segment their index to the query (i.e. i really need only the last 4 hours of data but my index is created daily)</li><li>Ignore basic maintenance of their Elasticsearch (haven’t updated it, no one administrators it)</li></ul><p>Each of these are fine until more data is added or more queries. Once this happens, <strong>latency increases linearly</strong> with almost no escape hatch.</p><h3>“Elastic Sizing For Dummies”</h3><pre>|Parameter               |Explanation                                     |<br>|------------------------|------------------------------------------------|<br>|Shards per search       |The number of shards are queried in a search.   |<br>|Threads per node.       |The number of search threads available on a node|<br>|Time per shard.         |The time a search executes on a shard.          |</pre><h3>Your Simple Sizing Formula</h3><p>On a recent engagement, a client was calling 711 shards a search with 8 vCPUs per instance.</p><p>Let:</p><ul><li>N_nodes = number of 8-vCPU data nodes (≈13 search threads each)</li><li>S = 711 shards/search</li><li>C = 13 threads/node</li><li>t_shard from above</li></ul><p>Then:</p><ul><li><strong>Average latency</strong>: T ≈ (S / (C × N_nodes)) × t_shard</li><li><strong>Queries Per Second (QPS) capacity</strong>: QPS ≈ (C × N_nodes) / (S × t_shard)</li></ul><p>Solve for nodes given a QPS target:</p><pre>N_nodes ≈ QPS_target × t_shard × S / C</pre><h3>Example — 3 Nodes with 711 shards (8 vCPU / 64 GB RAM, search-only)</h3><p>Using above sample inputs, particularly in the number of shards and the observed latency to set t_shard. You’d need the following amount of data nodes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*9oZmvwLm_RmMKdhcP1vN3w.png" /></figure><p>To improve this you can:</p><ol><li>Improve the query which will make it execute faster (reducing t_shard)</li><li>Reduce the number of shards</li></ol><h3>Why this is difficult to test</h3><p>The formula is academic but the world is not. Once you consume all of your search threads, the requests will begin to queue. Once they queue, the average T will increase and they will be executed in “waves” so long as your thread queue is not exceeded. So this measuring has to be done iteratively because if you are properly sized your average T will be reduced.</p><h3>API calls you can make to get the big picture</h3><pre># Big picture<br>GET /_cluster/stats<br><br># Indices by size<br>GET /_cat/indices?v&amp;s=store.size:desc<br><br># Shard sizes &amp; placement<br>GET /_cat/shards?h=index,shard,prirep,state,docs,store,node&amp;s=store:desc<br><br># Search threadpool pressure (during load)<br>GET /_cat/thread_pool/search?v&amp;h=node,active,queue,rejected,completed</pre><h3>Some Other References:</h3><ul><li><a href="https://www.elastic.co/blog/benchmarking-and-sizing-your-elasticsearch-cluster-for-logs-and-metrics">https://www.elastic.co/blog/benchmarking-and-sizing-your-elasticsearch-cluster-for-logs-and-metrics</a></li><li><a href="https://www.elastic.co/blog/maximizing-elasticsearch-performance-when-adding-nodes-to-a-cluster">https://www.elastic.co/blog/maximizing-elasticsearch-performance-when-adding-nodes-to-a-cluster</a></li><li><a href="https://mcplusa.com/insights/2023/11/is-your-elasticsearch-cluster-right-sized">https://mcplusa.com/insights/2023/11/is-your-elasticsearch-cluster-right-sized</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b56e2899869" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Auto-Generating Related Articles with QDrant and Local Embeddings]]></title>
            <link>https://michaelcizmar.medium.com/auto-generating-related-articles-with-qdrant-and-local-embeddings-6c7cb51a4f6a?source=rss-42b3d842d9a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c7cb51a4f6a</guid>
            <category><![CDATA[related-items]]></category>
            <category><![CDATA[qdrant]]></category>
            <dc:creator><![CDATA[Michael B. Cizmar]]></dc:creator>
            <pubDate>Thu, 09 Oct 2025 13:00:30 GMT</pubDate>
            <atom:updated>2025-10-09T13:00:30.285Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U61LCc0dTAkS1QZUFHXpCQ.jpeg" /></figure><p>We are working on a new website at <a href="https://mcplsua.com/">MC+A</a>, and we’re always looking for ways to incorporate our tradecraft externally and we thought of a way to do that as well as improve our reader experience across our blog, which we call Insights (and Insight Articles). One recent improvement is the automatic generation of <strong>three related articles</strong> for every blog post — powered by <a href="https://qdrant.tech/"><strong>QDrant</strong></a> and <strong>local embeddings</strong>.</p><p>This post walks through how we built a fully local, API-free pipeline to enrich our blog content with intelligent recommendations.</p><h3>The Problem</h3><p>Our blog goes back to 2008 and covers a wide range of topics — from search modernization to AI transformation. With over a hundred posts, the first option would be to manually create each’s blogs list of related artiles but who wants to do that? In addition to being time consuming it’s potentialy inconsistent.</p><p>I wanted a scalable way to:</p><ul><li>Analyze the semantic content of each post</li><li>Identify similar articles</li><li>Update the frontmatter with related slugs</li></ul><h3>The Stack</h3><p>I chose:</p><ul><li><strong>QDrant</strong>: A blazing-fast vector database with simple support for local running and inference (A single docker container)</li><li><strong>Xenova/all-MiniLM-L6-v2</strong>: A free, open-source embedding model that works well with Javascript</li><li><strong>Node.js</strong>: For scripting and automation as the blog is written in NextJS</li></ul><p>No API keys. No cloud dependencies. Just local inference and state stored ultimately on disk.</p><h3>How It Works</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jn6u9XlTtCpsge3rm6HQeg.jpeg" /></figure><p><strong>Step 1 — Load Blog Posts</strong><br>I iterated all Markdown files in our article directory and extracted metadata and content.</p><p><strong>Step 2 — Generate Embeddings Locally</strong><br>Using @xenova/transformers, I generate embeddings for each post—weighted by title, description, tags, and body content. Ranking alone could be several articles on its own because I could boost articles that have more views or recentcy.</p><p><strong>Step 3 — Push into QDrant</strong><br>Each post is then indexed into a QDrant collection using a deterministic UUID based on its slug or file name.</p><p><strong>Step 4 — Search by ID</strong><br>Iterating again for each post, I query QDrant using its stored vector to find the top 4 similar posts (excluding itself). This is a nice out of the box features of QDrant</p><p><strong>Step 5 — Update the existing article</strong><br>I write the top 3 related slugs back into the post’s frontmatter under a related: field.</p><h3>Running the Script</h3><p>The script is is available on <a href="https://github.com/michaelcizmar/blogs/blob/main/2025/10/similar-posts/generate-related-insights.mjs">github</a> and can be modified to your content.</p><pre><br>$ docker run -p 6333:6333 qdrant/qdrant<br>$ node generate-related.js</pre><p>You’ll see something like:</p><pre>✓ Indexed 120 insights<br>✓ Complete! Updated 120/120 insights with related articles</pre><h3>The Result</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UzLyDAxAX1BKE_wtafvc8Q.png" /></figure><p>Once the article is displayed there’s automatically 3 related articles that are updated everytime we republish the website. The entire process takes only a few seconds with the 100–200 articles that we have.</p><h3>What’s Next</h3><p>We’re exploring:</p><ul><li>Using richer models like BGE or E5</li><li>Adding semantic search to the blog</li><li>Surfacing related content in newsletters and social posts</li><li>Knowledge graphs, because they’re cool.</li></ul><p>If you’re building something similar or want to collaborate, let’s connect.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c7cb51a4f6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Drive Requirements to Testing with BDD to Deliver AI]]></title>
            <link>https://michaelcizmar.medium.com/drive-requirements-to-testing-with-bdd-to-deliver-ai-718f72c2faf7?source=rss-42b3d842d9a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/718f72c2faf7</guid>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[bdd]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[llm-evaluation]]></category>
            <dc:creator><![CDATA[Michael B. Cizmar]]></dc:creator>
            <pubDate>Tue, 10 Dec 2024 16:33:10 GMT</pubDate>
            <atom:updated>2024-12-10T16:33:10.834Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wg4iyeBU39XaOT-jtJqcxg.png" /></figure><h3>Successful AI Projects are Focused on Outcomes, Not Simply Outputs</h3><p>We have been using Behavior-Driven Development (BDD) over the past several years to test microservices developed as part of our consulting engagements. Initially, these were for Enterprise Search projects, but more recently, they have been for AI-injected endpoints driving Copilots and Agents.</p><p>We chose BDD because it helps bridge the gap between various stakeholders by allowing us to express requirements in a simple form that focuses on purpose. BDD’s natural language scenarios (e.g., Given-When-Then) translate perfectly into an LLM transaction.</p><ul><li>Given — Context</li><li>When — Action</li><li>Then — Result</li></ul><p>BDD’s notion of living documentation is quite useful for maintaining project requirements and performing regression testing as models and data change, causing changes to the AI inference responses.</p><p>This approach provides the basis for your requirements and live documentation in the ever-evolving AI project. Given AI’s somewhat chatty nature, it can also be interwoven into this process to revise and expand test coverage.</p><h3>Requirements to Testing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/0*nwovcj5Sb3q8NMnM" /></figure><p>A top-down approach to scoping and breaking down a project</p><p>As the diagram displays there is a logical breakdown of the scope of the SOW (or an initiative) to BDD features. Features are “User Story” or “Use Cases”.</p><h3>Step 1 — Organizing the Approach</h3><p>A <a href="https://en.wikipedia.org/wiki/Scenario_%28computing%29">Scenario</a> is defined in Wikipedia as:</p><p>“In computing, a scenario is a narrative of foreseeable interactions of user roles (known in the Unified Modeling Language as ‘actors’) and the technical system, which usually includes computer hardware and software.</p><p><a href="https://en.wikipedia.org/wiki/Actor_%28UML%29">Actors</a> are defined in Wikipedia as:</p><p>“Actors may represent roles played by human users, external hardware, or other subjects. Actors do not necessarily represent specific physical entities but merely particular facets (i.e., “roles”) of some entities that are relevant to the specification of their associated use cases. A single physical instance may play the role of several different actors, and a given actor may be played by multiple different instances.</p><p>For one of our projects, we have focused on the following themes:</p><ul><li>Indexing</li><li>Interfaces</li><li>Analytics</li><li>Relevancy</li><li>Operations</li></ul><h3>Step 2 — Write the Features</h3><p>Features can be written in <a href="https://cucumber.io/docs/gherkin/reference/">Gherkin</a>. An example of a simple feature is below. This is what our requirements would be written in (A feature + scenarios). A simple way to write a feature to remember the following:</p><ol><li>A feature is a user story or a use case</li><li>A Scenario should describe an observed behavior from the user’s (or actor’s) perspective</li><li>A Given statement should set up the Context</li><li>A When is the Action</li><li>A Then is the outcome that should be tested</li></ol><p>Final Form:</p><pre># -- FILE: features/objective_coding.feature<br>Feature: Objective Coding<br><br>Objective coding tags documents &#39;objectively&#39; or factually as opposed to subjectively.  As documents are processed, structured data is extracted and added to the document before indexing in the vector database.<br><br>Rule: The original author should not come from metadata if the PDF declares an author<br>  Scenario: Identify the original author for a document for a pdf<br>  Given an &lt;document&gt;<br>    And the extension is &quot;.pdf&quot;<br>    When the document is processed<br>    Then the asset has a metadata field &quot;metadata.oc.author&quot; with the value of &quot;&lt;name&gt;&quot; <br>    And the author is not the &quot;author&quot; field of the document<br><br>    Examples:<br>      | asset                                              | name  |<br>      | Electronic Media/Folder 1/001_Technical_Report.pdf | David Rhodes       |      |</pre><h3>Step 3 — Refactor to match previous steps</h3><p>With Gerkin and Cucumber. The text of each step is matched against a function. There should be existing functions that can be drawn from which are in a well-defined testable form. Additionally using functions is a best practice.</p><h3>Step 4 Write The Steps</h3><p>For all of the Steps that have not been completed, write the implementation.</p><h3>Why Use BDD for AI Testing?</h3><h3>1 — Behavior Drives Development (Pun)</h3><p>As the name implies, focusing on the Behavior you want to replicate an automate with a structured form will help your project team focus. AI projects often involve diverse teams, including data scientists, developers, business stakeholders, and domain experts. BDD’s natural language scenarios (e.g., Given-When-Then) help:</p><ul><li>Align stakeholders on AI system goals and behaviors.</li><li>Ensure requirements are clear, measurable, and understood by all parties.</li></ul><h3>2 — Test Outcomes, Not Just Outputs</h3><p>Your entire business is focused on producing improved outcomes. The challenge in doing with AI is that it can do “anything”. As we discussed in our <a href="https://mcplusa.com/webinar-practical-ai-notes-from-the-field/">recent webinar</a>, there are characteristics of successful projects that you want to emulate. Your projects and outcomes are not a simple “is this a cat?”. AI systems, being probabilistic, often deliver outcomes rather than deterministic results. BDD is well-suited for:</p><ul><li>Describing the desired behavior in terms of business outcomes.</li><li>Defining acceptance criteria that account for variability, such as thresholds for accuracy.</li></ul><h3>3 — Ensure Explainability</h3><p>BDD scenarios can incorporate explainability requirements, ensuring the AI behaves in ways that are interpretable and align with business objectives.</p><h3>Challenges and Considerations</h3><p>While BDD is powerful, applying it to AI has unique challenges:</p><ul><li>Probabilistic Nature of AI: Defining deterministic behaviors for non-deterministic systems can be complex.</li><li>Dynamic Changes: AI models evolve over time, requiring constant updates to scenarios.</li><li>Metric-Based Verification: Verifying thresholds (e.g., accuracy) requires robust metric tracking and reporting.</li></ul><h3>Tools for BDD in AI Testing</h3><p>Several tools can support the implementation of BDD for AI systems:</p><ul><li>Cucumber/Behave/SpecFlow: Popular BDD frameworks that can be adapted for AI testing.</li><li>PyTest-BDD: A Python-based BDD framework with flexibility for AI projects.</li></ul><h3>Conclusion</h3><p>Using BDD to test AI systems is an innovative approach that combines the collaborative nature of BDD with the need for rigorous AI testing. By defining clear, understandable scenarios, BDD makes AI testing more accessible, structured, and aligned with business goals. While there are challenges, adopting BDD for AI testing is a step toward making AI systems more reliable, ethical, and effective.</p><p>As AI continues to integrate into software systems, leveraging methodologies like BDD ensures that these systems behave as intended, fostering trust and delivering real value. As always, reach <a href="https://mcplusa.com/contact/">out to our team</a> if you would like assistance in your AI initiatives.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=718f72c2faf7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Judging LLM Performance By Synthetic Data Is A Failing Approach — Part 1]]></title>
            <link>https://michaelcizmar.medium.com/judging-llm-performance-by-synthetic-data-is-a-failing-approach-part-1-ba2d5096ef80?source=rss-42b3d842d9a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba2d5096ef80</guid>
            <category><![CDATA[vision-transformer]]></category>
            <category><![CDATA[graphrag]]></category>
            <category><![CDATA[llmops]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[document-intelligence]]></category>
            <dc:creator><![CDATA[Michael B. Cizmar]]></dc:creator>
            <pubDate>Wed, 04 Dec 2024 13:23:35 GMT</pubDate>
            <atom:updated>2024-12-04T13:23:35.386Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Judging LLM Performance By Synthetic Data Is A Failing Approach — Part 1</strong></h3><p><strong>Knock-offs are never as good as the real thing</strong></p><h3>TLDR</h3><p>In this article, we explored the limitations of using synthetic data to judge the performance of large language models (LLMs). We highlighted that while synthetic data is necessary for training models, it often fails to replicate real-world scenarios accurately. This discrepancy can lead to models that perform well in controlled environments but struggle in practical applications. We mention of how models like AIMv2 and PHI 3.5 Vision Instruct fall short in classifying documents correctly. Additionally, we discussed the challenges faced by relevancy engineers and the importance of understanding user interactions to improve model performance. As we continue to delve into these issues, we aim to provide valuable insights to help you navigate the complexities of artificial intelligence.</p><h3><strong>Overview</strong></h3><p>Determining the most valuable model for your function needs to be a methodological approach, and many of the off-the-shelf models used do not ‘scale well’ with the realities of the diverse amount of data typically handled in a production scenario. If your Artificial Intelligence initiative is failing, one reason could be that your models are not performing as expected. <strong>One of the reasons for that is that knock-offs are never as good as the real thing</strong>, and models are trained and their performance quoted based on that (synthetic data = knock off data). That performance is based on “lab work” derived from synthetic data. Synthetic data is necessary because, in order to make computing resources mimic human intelligence, a significant number of scenarios have to be presented in the training of the models in their interactions. But that is flawed if it’s not fine-tuned for its application, and the process that you should be mimicking is a “chicken and the egg” scenario. <strong>(User interactions guide the system and the system guides user interactions)</strong></p><p>To put this in a real-world context, look at the many models that have been recently promoted as “zero-shot” classification models. Apple’s recent release of <a href="https://arxiv.org/pdf/2411.14402">AIMv2</a> boasts an “89.5% on ImageNet using a frozen trunk.” The statement suggests that the pre-trained model performed well even without additional updates to its core feature extraction layers. <a href="https://huggingface.co/microsoft/Phi-3.5-vision-instruct">PHI 3.5 Vision Instruct </a>boasts similar capabilities and performance.</p><p>Our recent tests of both of these models, as well as a few others, show that their ability to classify the difference between a ‘memorandum’, an email, and a letter is not sufficient on its own to allow for automation. <strong>They fail 70% of the time. </strong>Repeatedly, they <strong>fail</strong> to classify memos even though the biggest and <strong>boldest text says “Memorandum”</strong>. Because an orange is an orange and not an apple based on prominent features (like…it’s orange). We will be releasing some insights into this shortly.</p><p>This is only further amplified when the agent or workflow interacts with actual humans.</p><blockquote>“People are often unreasonable, illogical, and self-centered. Forgive them anyway.”</blockquote><blockquote>Mother Teresa</blockquote><p><strong>We do forgive them</strong>. You need only to ask any relevancy engineer how Mother Teresa’s statement is reflected in their daily challenges. A couple of examples of this from the field are:</p><ul><li>A project we worked on quite some time ago, the top search term on the intranet of a company with over 20,000 employees was “Britney Spears” because the search technology used was a Google Search Appliance.</li><li>Industrial versus non-industrial terms. In the wholesale food industry, thin plastic wrap (aka saran wrap) is called plastic foodservice film.</li><li>Making synthetic data from content yields the most optimal way to retrieve that content, but it doesn’t mimic how your users will interact with your system.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VvSHfsAm4R8gsxLuwmr0cQ.jpeg" /><figcaption>Plastic Foodservice File != Saran Wrap</figcaption></figure><blockquote>“It is impossible to make anything foolproof because fools are so ingenious.”</blockquote><p>This quote, also known as Conway’s Law, reflects Murphy’s Law’s inherent skepticism about the reliability of systems and procedures.</p><p>This article is a continuation of our Notes from the Field in Artificial Intelligence. We’ll continue to expand on some of the challenges we’ve identified here in the coming articles in the hope that you can leverage some of our experience in your initiatives.</p><p>As always, we are ready to engage with you to help you achieve your goals. Reach out to us at <a href="https://mcplusa.com/contact/">mcplusa.com</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba2d5096ef80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting AEM to a Vector Database]]></title>
            <link>https://michaelcizmar.medium.com/connecting-aem-to-a-vector-database-ac799ad278c0?source=rss-42b3d842d9a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac799ad278c0</guid>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[qdrant]]></category>
            <category><![CDATA[vespa]]></category>
            <category><![CDATA[coveo]]></category>
            <dc:creator><![CDATA[Michael B. Cizmar]]></dc:creator>
            <pubDate>Thu, 21 Nov 2024 00:15:35 GMT</pubDate>
            <atom:updated>2024-11-21T00:18:51.025Z</atom:updated>
            <content:encoded><![CDATA[<p>Search is how users find content, and to reap the benefits of your investment in Adobe Experience Manager (AEM), you need the ability to retrieve content for various purposes, including Retrieval Augmented Generation (RAG). Integrating AEM with a vector database like <a href="https://www.coveo.com/">Coveo</a>, <a href="https://qdrant.tech/">Qdrant</a>, Elasticsearch, OpenSearch, or <a href="https://vespa.ai/">Vespa</a> can significantly improve search functionality. The initial method you could consider doing this might be a web crawler might be the first and only method you consider to this but there are better methods to address the content indexing.</p><p><strong>Challenges of Web Crawling AEM Sites</strong></p><p>Web crawling an AEM site might seem like a straightforward approach to indexing content, but it presents several challenges:</p><ol><li><strong>Dynamic Content and Personalization</strong>: AEM sites often deliver personalized content based on user profiles, behaviors, or preferences. Web crawlers may not access all content variations, leading to incomplete indexing and suboptimal search results.</li><li><strong>Access Control and Permissions</strong>: AEM implements robust access control lists (ACLs) to manage user permissions. Web crawlers lack the ability to retrieve these and crawl, at best, with a single permission, resulting in gaps in the indexed data. This can be mitigated by multiple crawls but that has the burden of additional traffic on your site and additional documents in your index for effectively redundant content.</li><li><strong>Content Structure and Metadata</strong>: AEM’s content repository is rich with metadata and structured content that web crawlers may not fully interpret. This limitation can lead to inadequate indexing and retrieval of content. Utilizing AEM’s native indexing capabilities ensures that the content structure and metadata are accurately represented in search results3.</li><li><strong>Performance and Load Considerations</strong>: Web crawling can impose significant load on the server, potentially affecting site performance. AEM’s built-in indexing mechanisms are optimized to handle content efficiently without overloading the system.</li><li><strong>Latency of changes</strong>: Web crawling is a ‘pull method’. It’s difficult to understand changes and require recrawls. Further complicating this are things like changes to metadata and security which may not result in changes that a web crawler can easily detect. The work around is full recrawls which further escalate points 3 and 4.</li></ol><p><strong>Integrating AEM with a Vector Database</strong></p><p>To address these challenges, integrating AEM with a vector database through a dedicated connector is advisable. Such connectors are designed to interact directly with AEM’s content repository and can receive event record changes ensuring comprehensive and accurate indexing while respecting access controls and content structures. This approach leads to more reliable and efficient search functionality compared to traditional web crawling methods.</p><p>(A company I work for has a connector. See their <a href="https://mcplusa.com/technology/connectors/">connectors page</a>.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3NR9sTPEDQ1krRMv7i7f3w.png" /><figcaption>Simple diagram of Connector</figcaption></figure><p><strong>Benefits of Using a Vector Database</strong></p><p>Search and retrieval aren’t typically what draws folks to AEM and going back to the DayCMS days, you didn’t really want to look at or breath on the CMS for fear of crashing it. While that has changed, what hasn’t changed is that Vector DBs are built with retrieval in mind and do this efficiently and are easy to scale. By connecting AEM to a vector database, organizations can leverage the following benefits:</p><ul><li><strong>Enhanced Search Accuracy</strong>: Vector databases can handle complex queries and provide more accurate search results by considering the context and relationships between different pieces of content.</li><li><strong>Scalability</strong>: Vector databases are designed to handle large volumes of data, making them suitable for organizations with extensive content repositories.</li></ul><p><strong>Real-Time Updates</strong>: Changes in the content repository can be reflected in the search index in real-time, ensuring that users always have access to the most up-to-date information</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac799ad278c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using AI to Improve Objective Coding]]></title>
            <link>https://michaelcizmar.medium.com/using-ai-to-improve-objective-coding-6b5622d54daa?source=rss-42b3d842d9a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b5622d54daa</guid>
            <category><![CDATA[large-vision-models]]></category>
            <category><![CDATA[graphrag]]></category>
            <dc:creator><![CDATA[Michael B. Cizmar]]></dc:creator>
            <pubDate>Wed, 11 Sep 2024 22:17:50 GMT</pubDate>
            <atom:updated>2024-09-12T18:59:00.717Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Summary</strong></h3><p>Large language models (LLMs) excel at general-purpose tasks, but if you have a specific and repeatable use case, a fine-tuned model will outperform them. This results in more accurate outputs, faster inferences, and lower costs.</p><p>If you’re interested in a demonstration, feel free to reach out to me.</p><h3><strong>Background</strong></h3><p>Jocko Willink was once asked what exercise someone should do if they wanted to improve the number of pull-ups they could do. His response was, simply, “Pull-ups.” This direct answer emphasized doing the very thing the individual was avoiding. The same principle applies to diet and exercise — if you want to lose weight, you need to diet and exercise. There’s no way around that fact (though new medications may aid the diet aspect).</p><p>Carrying this principle forward, there is no free lunch when it comes to using AI in your processes. In the legal world, tasks like objective coding in eDiscovery processing can cost between $3 to $4 per 1,000 pages. This may tempt you to simply wrap your own process around an LLM call, but doing so is not free and potentially will cost you more time and money.</p><h3><strong>What is Objective Coding</strong></h3><p>Objective coding (according to Wikipedia) is the process of generating summary or keyword data from a document. Unlike subjective coding, objective coding deals with factual information, such as the document’s original date, author, and type. This is especially crucial in litigation, where each party must efficiently organize vast volumes of data. Objective coding is a critical step in a law firm’s organizational process during discovery.</p><p>Search (now AI) consultants have frequently performed this task, and with the rise of LLMs, it might seem like a solved problem. While LLMs offer powerful ad-hoc capabilities through zero-shot questions, achieving high accuracy requires fine-tuning with specific data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*wWoVM2x52JIScCNOjKIsqw.png" /><figcaption>An example of an email coded</figcaption></figure><h3><strong>Prompting your way to Objective Coding</strong></h3><p>Recently, we experimented with using Microsoft’s <a href="https://github.com/microsoft/graphrag">GraphRag</a> for this process. GraphRag performs tasks like entity extraction on unstructured text and stores it in a knowledge graph. While we’ll explore knowledge graphs in future posts, our focus here is on the challenges we encountered.</p><p>It quickly became evident that LLMs were not sufficiently accurate enough for the task. Moreover, the prompts generated by GraphRag totaled around 3,000 tokens before the text was even processed. To put this in perspective:</p><p>When you process a document, it is tokenized and split into chunks — typically 500 tokens per chunk. If 500 tokens of your document are wrapped in 3,000 tokens of prompt, that results in 3500 input tokens sent to the LLM. The LLM’s response forms the output tokens. Ideally, it is a concise answer, but you are paying for both input and output tokens.</p><p>Let’s break down the potential costs using the Enron dataset as our example (using GPT4):</p><ul><li>The Enron dataset contains approximately 500, emails, estimated at 500 million to 1 billion tokens</li><li>1,000,000 API calls * 3,500 tokens / 1,000 tokens * $0.025 = $87,500 inbound</li><li>1,000,000 API calls * 500 tokens outbound / 1,000 tokens * $0.01 = $5,000 outbound</li><li>Estimated Total Cost: $92,500</li></ul><p>In our case, with GraphRag, we used multiple methods, including Ollama with various models, and Azure’s OpenAI. With Azure, we encountered a limit on tokens per minute that slowed down the integration. I am sure as you use Azure more the limit would be increased but it did slow our ingestion down and limits the advantages of the “on demand cloud”</p><p>Regardless of the number of tokens you can process a minute, with 500 million tokens and 500 tokens per call, you are looking at processing a lot of tokens. This is a substantial cost for a single task, that in our tests achieved around 50% accuracy. Add to that the processing time for each call.</p><h3><strong>A Better Approach</strong></h3><p>Given the limitations of the native LLM approach, we began exploring vision models to improve performance. As Supreme Court Justice Stewart famously said about obscenity, “I Know It When I See It”. Reproducing that human intuition is the key to making AI effective in this process.</p><p>Many legal documents have structure which is extremely useful in context, which is often lost when converted to plain text and tokenized for LLMs. By switching to a vision model and sending both text and the image of the document, we achieved remarkable improvements.</p><p>This approach leverages the visual cues and layout of documents, mimicking how humans process information and leading to more accurate and efficient coding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*cKnbVy6DQtclbI-iynGIPQ.png" /><figcaption>Sample sampling of tested predictions</figcaption></figure><p>Closing Thoughts</p><p>While general-purpose LLMs offer powerful capabilities, specialized tasks like objective coding benefit significantly from more tailored approaches. Our vision model-based solution demonstrates that by combining AI with domain-specific knowledge, we can achieve higher accuracy, faster processing times, and lower costs. If you’re facing similar challenges in document processing or other specialized tasks, we invite you to reach out and explore how our innovative AI solutions can benefit your organization.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b5622d54daa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Going Beyond Vector Search to Help Match Jobs to People]]></title>
            <link>https://michaelcizmar.medium.com/going-beyond-vector-search-to-help-match-jobs-to-people-a073342c7a71?source=rss-42b3d842d9a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a073342c7a71</guid>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[graph-neural-networks]]></category>
            <category><![CDATA[vector-search]]></category>
            <dc:creator><![CDATA[Michael B. Cizmar]]></dc:creator>
            <pubDate>Tue, 13 Aug 2024 11:24:41 GMT</pubDate>
            <atom:updated>2024-08-13T11:24:41.227Z</atom:updated>
            <content:encoded><![CDATA[<p>Hint: Artificial Intelligence has to be biased to be effective.</p><p>In today’s job market, finding the right candidate for a role is essential for organizations aiming to thrive. Traditional keyword-based search methods often miss the subtle connections between job descriptions and applicant profiles. While vector search has improved candidate matching by considering semantic similarities, we can go even further. In traditional e-Commerce search, the ranking (i.e. Relevancy) is tuned based on past purchases. Given analytic data like add-to-cart and checkouts, we can create a feedback loop and implement <a href="https://en.wikipedia.org/wiki/Learning_to_rank">learning to rank</a> to favor what someone is looking to buy when they search for a particular query term.</p><p>In this way, we are adding <a href="https://en.wikipedia.org/wiki/Bias">bias</a> to the search experience. This is often an organization’s “special sauce” or secret formula. By embracing the idea that artificial intelligence must be biased to be effective, we can refine the process of matching jobs to people. After all, matching candidates is about more than just aligning tokens — it’s about understanding the unique blend of skills, experiences, and potential each individual brings.</p><h3>Not all tokens are equal and embrace ‘bias’ for Effective AI</h3><p>The notion that AI must be biased might seem counterintuitive, but when you examine larger amounts of data, you must create some weighting algorithm. In past projects, this has been expressed in the form of <strong>Recency</strong>, <strong>Frequency</strong>, and some measure of strength.</p><p>Effective AI should be designed to prioritize certain characteristics and experiences that align with the goals and culture of an organization. This purposeful bias helps filter out irrelevant candidates and focuses on those more likely to succeed and thrive in specific roles.</p><h3>Understanding the Limitations of Vector Search</h3><p>Vector search transforms text data into mathematical representations, allowing systems to identify semantic similarities. This technique has enhanced applicant searching by enabling recruiters to find candidates whose resumes align more closely with job descriptions, even if they don’t use the same keywords. However, vector search has limitations:</p><ol><li><strong>Contextual Misunderstandings:</strong> Vector search can misinterpret context, particularly in specialized fields where similar terms may have different meanings.</li><li><strong>Lack of “Page Rank”:</strong> The general vectors are designed to match and predict sentences. They are not designed to weight a particular sentence or passage.</li><li><strong>Scalability Issues:</strong> Handling large volumes of data with vector search can be computationally expensive and may require significant infrastructure investments.</li></ol><h3>Better Strategies for Matching Jobs to People</h3><p>The focus should be a ranking in addition to retrieval. Vectors can help with retrieval by increasing recall.</p><p><strong>So this may return a candidate or a job, but if the recruiter or candidate isn’t aware of why these matches occur, it may cause them to be passed up.</strong></p><p>I remember having to plead with a recruiter to submit my resume because T-Sql (the SQL language of Microsoft SqlServer) was not on my resume but SqlServer was.</p><h3>1. Custom Scoring Models</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/0*NV_DzYGESx9j0xxd.png" /><figcaption>Multi-Stage Ranking — From docs.vespa.com</figcaption></figure><p>Implementing a system of multiple ranking phases can help sift through he results. In Vespa, for example, there is a means to <a href="https://docs.vespa.ai/en/phased-ranking.html">phased ranking</a> where the results are recomputed before returning. This allows you to reduce the ‘haystack’ before adding custom scores and weights.</p><h3>2. Knowledge Graphs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gt5rvd5rFzyN-DTZuvhVEA.png" /><figcaption>Example Knowledge Graph</figcaption></figure><p>Knowledge graphs represent information in a network of entities and relationships, providing a more structured way to capture complex data. By integrating knowledge graphs into applicant searching, recruiters can visualize connections between candidates’ skills, experiences, and job requirements. This approach can highlight indirect relationships that vector search might miss, such as complementary skills or industry-specific expertise.</p><h3>3. Using AI to Normalize Candidates</h3><p>AI can be used to reformat a candidate’s CV into a more structured representation. Once in a more structured form, it can be converted into a vector graph more easily.</p><h3>4. Machine Learning and AI Models</h3><p>Incorporating machine learning and AI models can further enhance applicant searching by predicting candidate success and cultural fit. These models can analyze historical hiring data to identify patterns and trends, enabling recruiters to focus on candidates who are more likely to thrive in a given role. AI-driven recommendations can also suggest potential candidates who may have been overlooked by traditional search methods.</p><h3>Conclusion</h3><p>While vector search has brought significant improvements to Applicant and Job searching, there is still potential for further enhancement by integrating advanced technologies and methodologies. By leveraging hybrid search models, knowledge graphs, NLP enhancements, machine learning, and personalized experiences, recruiters can refine their search processes and uncover candidates who are not only qualified but also well-suited to their organizational culture and goals. As the job market continues to evolve, staying ahead of the curve with innovative search strategies will be key to attracting and retaining top talent.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a073342c7a71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sparse Versus Dense Vectors]]></title>
            <link>https://michaelcizmar.medium.com/sparse-versus-dense-vectors-3a1e22cea66a?source=rss-42b3d842d9a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a1e22cea66a</guid>
            <category><![CDATA[elser]]></category>
            <category><![CDATA[splade]]></category>
            <category><![CDATA[qdrant]]></category>
            <category><![CDATA[sparse-vectors]]></category>
            <dc:creator><![CDATA[Michael B. Cizmar]]></dc:creator>
            <pubDate>Tue, 30 Jul 2024 01:28:39 GMT</pubDate>
            <atom:updated>2024-07-30T01:28:39.601Z</atom:updated>
            <content:encoded><![CDATA[<h3>What are Sparse Vectors</h3><p>Sparse vectors are a type of vector that contains mostly zeros as opposed to dense vectors which store all their elements with values. In dense vectors, each element is represented by a number, whereas in sparse vectors, only the non-zero elements are represented by numbers, and the zero elements are not stored at all. This means that sparse vectors can be more efficient in terms of storage and computation than dense vectors, but may also lose some information (if the data is too sparse).</p><p>TDIF &amp; BM25 are sparse vectors. Their basic method of transforming a count matrix into a set of numerical features that can be used as input into a machine learning algorithm. Its resulting vector contains non-zero values only for terms that are present in the document and zero values for all other terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*8YryUJMmPGEmIc0XIRnSnA.png" /></figure><p>Combining a method like this with search is computationally efficient for information retrieval. They aren’t very ‘forgiving’ though when it comes to missing values and they don’t capture the relationship or order. This makes them less useful for systematic retrieval.</p><h3>How does this relate to AI and ELSER</h3><p>ELSER (Elastic’s custom model), <a href="https://github.com/naver/splade">SPLADE</a>, and others perform <em>term weighting</em> and <em>expansion</em>. As you can see in Elastic’s <a href="https://www.elastic.co/search-labs/blog/text-expansion-pruning">Search Lab Blog</a>. If you request an inference for “Is Pluto a Planet?”, the inference results are:</p><pre>{<br>  &quot;inference_results&quot;: [<br>    {<br>      &quot;predicted_value&quot;: {<br>        &quot;pluto&quot;: 3.014208,<br>        &quot;planet&quot;: 2.6253395,<br>        &quot;planets&quot;: 1.7399588,<br>        &quot;alien&quot;: 1.1358738,<br>        &quot;mars&quot;: 0.8806293,<br>        &quot;genus&quot;: 0.8014013,<br>        &quot;europa&quot;: 0.6215426,<br>        &quot;a&quot;: 0.5890018,<br>        &quot;asteroid&quot;: 0.5530223,<br>        &quot;neptune&quot;: 0.5525891,<br>        &quot;universe&quot;: 0.5023148,<br>        &quot;venus&quot;: 0.47205976,<br>        &quot;god&quot;: 0.37106854,<br>// Shortened for brevity<br>      }<br>    }<br>  ]<br>}</pre><p>These can be stored in the index in a similar manner to normal tokens. When you combine the expansion on the query side and the index side you can see significantly improved recall for your queries.</p><h3>The advantages</h3><p>The reason all of this is important is because you can use these techniques to improve your search results. You get the semantic capabilities of dense vector search but with the traditional lexical search performance characteristic.</p><h3>Memory usage</h3><p>Qdrant published an <a href="https://qdrant.tech/articles/sparse-vectors/">article</a> on the benefits of sparse vectors and noted the size improvements. This table is copied from that article:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*cYeyo3tfnSvbcX9Y_U48TA.png" /></figure><p>As you can see, the Sparse Vectors are much smaller than the other two. This means that you can store a lot more data in a single index. Additionally, Sparse Vectors are CPU friendly.</p><p>MC+A also published an <a href="https://mcplusa.com/navigating-the-vector-embedding-maze-cost-effective-strategies-for-elasticsearch/">article</a> detailing the differences in vector size. The key is that dense vectors are stored in memory in Elasticsearch outside of the JVM which adds significant resource requirements.</p><h3>Relevance</h3><p>Both SPLADE and Elastic have been published demonstrating the benefits of using sparse vectors. You can see Elastic’s article <a href="https://www.elastic.co/search-labs/blog/introducing-elser-v2-part-2">here</a>.</p><p>It’s important to test your queries and data before deciding which approach works for you. At <a href="https://mcplusa.com/b2b-relevancy-improvements-with-vector-search/">MC+A</a> we did not see the improvement that others have claimed so it is going to be use case by use case.</p><h3>Take away</h3><p>Sparse vectors like ELSER integrate into Elasticsearch to perform text expansion. Doing this gives you a ‘semantic light’ approach that can provide some significant improvements. You have to test your use case and the typical queries your users are running but it is worth looking into.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a1e22cea66a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>