<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aditya Pawar on Medium]]></title>
        <description><![CDATA[Stories by Aditya Pawar on Medium]]></description>
        <link>https://medium.com/@notadityapawar?source=rss-f5506dbd5236------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*iYONQ6wOXzgBudTe.jpg</url>
            <title>Stories by Aditya Pawar on Medium</title>
            <link>https://medium.com/@notadityapawar?source=rss-f5506dbd5236------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 03:19:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@notadityapawar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Would System Design My AI-Powered Application]]></title>
            <link>https://notadityapawar.medium.com/how-i-would-system-design-my-ai-powered-application-361d1d380c3a?source=rss-f5506dbd5236------2</link>
            <guid isPermaLink="false">https://medium.com/p/361d1d380c3a</guid>
            <dc:creator><![CDATA[Aditya Pawar]]></dc:creator>
            <pubDate>Sun, 20 Sep 2026 13:15:23 GMT</pubDate>
            <atom:updated>2026-09-20T13:15:23.848Z</atom:updated>
            <content:encoded><![CDATA[<p>So you want to develop your AI/LLM-powered application.</p><p>Let’s get started with a simple RAG application.</p><p>Nothing fancy. A simple AI-powered document Q&amp;A application.</p><p><strong>User uploads PDF → system processes it → user asks questions → AI answers using the document.</strong></p><p>Pretty straightforward.</p><p>Before jumping into the architecture, let’s define the scope of our application.</p><h3>Functional Requirements</h3><p>Our application should allow users to:</p><ul><li>Upload documents</li><li>Extract document contents</li><li>Ask questions about their documents</li><li>Retrieve relevant information</li><li>Generate answers using an LLM</li><li>See citations/references for the generated answers</li></ul><h3>Non-Functional Requirements</h3><p>The system should provide:</p><ul><li>Low response latency</li><li>High availability</li><li>Secure document storage</li><li>Scalable document processing</li><li>Cost control</li><li>Observability</li></ul><h3>Let’s Start With a Simple Architecture</h3><p>Nothing fancy, just a simple architecture.</p><pre>Client<br>   │<br>   ▼<br>Backend<br>   │<br>   ├── Document Parser<br>   ├── Vector DB<br>   └── LLM</pre><p>This seems simple enough, doesn’t it?</p><p>But now imagine <strong>10,000 users</strong> start using the application.</p><p>Will this architecture survive?</p><p>What happens when thousands of users upload documents at the same time?</p><p>What happens if document processing takes 30 seconds?</p><p>What happens if the LLM takes several seconds to respond?</p><p>What happens if the vector database becomes a bottleneck?</p><p>And most importantly:</p><blockquote><strong><em>Should the user request have to wait for the entire document-processing pipeline to finish?</em></strong></blockquote><p>Let’s find out.</p><h3>Understanding the AI Pipeline</h3><p>Before we start scaling the system, let’s understand what actually happens inside it.</p><p>When a user uploads a document, we have something like this:</p><pre>PDF<br> │<br> ▼<br>Text Extraction<br> │<br> ▼<br>Chunking<br> │<br> ▼<br>Embedding Model<br> │<br> ▼<br>Vector Database</pre><p>The extracted document is divided into smaller chunks.</p><p>Each chunk is converted into an embedding — a numerical representation of the semantic meaning of that piece of text.</p><p>These embeddings are then stored in the vector database.</p><p>Now the document is ready for querying.</p><p>When the user asks a question:</p><pre>User Question<br>      │<br>      ▼<br>Query Embedding<br>      │<br>      ▼<br>Vector Search<br>      │<br>      ▼<br>Relevant Chunks<br>      │<br>      ▼<br>Prompt Construction<br>      │<br>      ▼<br>LLM<br>      │<br>      ▼<br>Answer</pre><p>The important thing to notice here is that <strong>document ingestion and question answering are two different workloads.</strong></p><p>And that distinction is going to become very important when we start designing the production system.</p><h3>The First Problem: Synchronous Processing</h3><p>Let’s go back to our original architecture.</p><p>Suppose the user uploads a 200-page PDF.</p><p>Our backend receives it and starts doing:</p><pre>Upload<br>  ↓<br>Extract text<br>  ↓<br>Split into chunks<br>  ↓<br>Generate embeddings<br>  ↓<br>Store embeddings<br>  ↓<br>Return response</pre><p>If all of this happens inside the HTTP request, the user might have to wait several seconds — or even minutes.</p><p>That’s not something we want.</p><p>Instead, we should separate <strong>request handling</strong> from <strong>document processing</strong>.</p><h3>Introducing Asynchronous Processing</h3><p>We can introduce a queue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*AFQyjhD7tZj_N7Yr70xG1w.png" /><figcaption>Asynchronous Document Processing Pipeline</figcaption></figure><p>Now the API doesn’t have to perform the entire processing pipeline.</p><p>It can accept the document, store it, create a processing job, and immediately return something like:</p><pre>{<br>  &quot;document_id&quot;: &quot;doc_123&quot;,<br>  &quot;status&quot;: &quot;PROCESSING&quot;<br>}</pre><p>The workers can process the document asynchronously.</p><p>This gives us several benefits:</p><ul><li>API servers remain responsive.</li><li>Heavy workloads can be processed independently.</li><li>Workers can scale horizontally.</li><li>Failed jobs can be retried.</li><li>We can control how much work is sent to the embedding service.</li></ul><p>And now we’ve made our first significant system-design improvement.</p><h3>But Where Do We Store the PDF?</h3><p>Our first architecture also doesn’t tell us where the actual document is stored.</p><p>We shouldn’t necessarily put large PDF files directly into our relational database.</p><p>Instead, we can use object storage.</p><p>For example:</p><pre>User<br> │<br> ▼<br>API<br> │<br> ├──────────────► Object Storage<br> │                   │<br> │                   │ PDF<br> │                   │<br> ▼                   ▼<br>Metadata DB       Processing Queue<br>                       │<br>                       ▼<br>                    Workers<br>                       │<br>                       ▼<br>                  Vector Database</pre><p>The object storage contains the actual document.</p><p>The database can contain metadata:</p><pre>documents<br>--------------------------------<br>document_id<br>user_id<br>file_name<br>storage_key<br>status<br>created_at<br>updated_at</pre><p>This separation is useful because <strong>document storage and document metadata have different access patterns.</strong></p><h3>Now Let’s Talk About the Query Path</h3><p>Document ingestion is only half of our system.</p><p>The other half is answering the user’s question.</p><p>A typical request looks like this:</p><pre>User<br> │<br> ▼<br>API<br> │<br> ▼<br>Query Embedding<br> │<br> ▼<br>Vector Search<br> │<br> ▼<br>Top-K Chunks<br> │<br> ▼<br>Prompt Builder<br> │<br> ▼<br>LLM<br> │<br> ▼<br>Response</pre><p>But now we have another question.</p><blockquote><strong><em>What happens when 10,000 users ask questions at the same time?</em></strong></blockquote><p>Our LLM becomes a potential bottleneck.</p><p>And unlike a normal database query, an LLM request can be expensive and relatively slow.</p><p>This brings us to one of the most important questions in an AI system:</p><blockquote><strong><em>How do we scale the model layer?</em></strong></blockquote><h3>Scaling the LLM Layer</h3><p>There isn’t one solution.</p><p>We have several options depending on our requirements.</p><h3>Option 1 — Use a Managed LLM API</h3><pre>Application<br>     │<br>     ▼<br>LLM Provider</pre><p>This removes a lot of infrastructure complexity.</p><p>We don’t need to manage GPUs, model deployments, or inference servers ourselves.</p><p>But we have less control over:</p><ul><li>Cost</li><li>Latency</li><li>Model availability</li><li>Data processing</li><li>Rate limits</li></ul><h3>Option 2 — Self-Host the Model</h3><p>We can deploy the model ourselves.</p><pre>Application<br>     │<br>     ▼<br>Inference Server<br>     │<br>     ▼<br>GPU Workers<br>     │<br>     ▼<br>LLM</pre><p>Now we have more control, but we’ve introduced an entirely new infrastructure problem.</p><p>We need to think about:</p><ul><li>GPU utilization</li><li>GPU memory</li><li>Autoscaling</li><li>Model loading</li><li>Batching</li><li>Quantization</li><li>Cold starts</li><li>Inference latency</li></ul><p>This is where <strong>AI system design starts to differ from traditional system design.</strong></p><h3>Can We Reduce LLM Calls?</h3><p>Before simply adding more GPUs, we should ask another question:</p><blockquote><strong><em>Do we actually need to call the LLM for every request?</em></strong></blockquote><p>Suppose 500 users ask essentially the same question.</p><p>Instead of generating 500 answers independently, we could potentially cache responses.</p><pre>User Query<br>    │<br>    ▼<br>  Cache?<br>  /   \<br>Yes    No<br> │      │<br> ▼      ▼<br>Answer  RAG Pipeline<br>         │<br>         ▼<br>        LLM<br>         │<br>         ▼<br>       Cache</pre><p>This can reduce both latency and cost.</p><p>But caching AI responses introduces its own challenges.</p><p>For example:</p><ul><li>When should the cache expire?</li><li>What happens when the document changes?</li><li>Should the cache key include the document ID?</li><li>Should user permissions be part of the cache key?</li></ul><p>Now we’re doing actual system design rather than simply adding components.</p><h3>Retrieval Is Another Bottleneck</h3><p>So far we’ve assumed that vector search always returns the correct chunks.</p><p>In reality, retrieval quality can become one of the biggest problems in a RAG system.</p><p>Imagine the document contains:</p><pre>Page 10:<br>Revenue for 2025 = $20M</pre><pre>Page 87:<br>Projected revenue for 2026 = $35M</pre><p>The user asks:</p><blockquote><em>What was the revenue in 2025?</em></blockquote><p>If our retrieval system returns the wrong chunk, even a highly capable LLM may generate the wrong answer.</p><p>So we need to improve the retrieval layer.</p><p>A more sophisticated pipeline might look like:</p><pre>Question<br>   │<br>   ▼<br>Query Processing<br>   │<br>   ▼<br>Hybrid Search<br> ┌─┴─────────────┐<br> ▼               ▼<br>Keyword Search   Vector Search<br> └───────┬───────┘<br>         ▼<br>      Candidates<br>         │<br>         ▼<br>      Reranker<br>         │<br>         ▼<br>   Relevant Chunks<br>         │<br>         ▼<br>        LLM</pre><p>Now we have additional design decisions:</p><ul><li>How large should chunks be?</li><li>How much overlap should chunks have?</li><li>What should top-k be?</li><li>Should we use semantic search?</li><li>Should we use keyword + semantic search?</li><li>Do we need a reranker?</li><li>Should metadata filtering happen before or after retrieval?</li></ul><h3>What About Security?</h3><p>At this point, our architecture is becoming more complex.</p><p>But there’s one question we absolutely cannot ignore:</p><blockquote><strong><em>Can User A access User B’s documents?</em></strong></blockquote><p>Suppose we have:</p><pre>User A<br> └── document_A</pre><pre>User B<br> └── document_B</pre><p>The retrieval layer must respect those boundaries.</p><p>A query shouldn’t simply search the entire vector database.</p><p>It should effectively perform something like:</p><pre>Search(<br>    query_embedding,<br>    user_id = current_user<br>)</pre><p>Or, in a multi-tenant system:</p><pre>Search(<br>    query_embedding,<br>    tenant_id = current_tenant<br>)</pre><p>This is why authorization isn’t just an API-layer problem.</p><p><strong>The authorization boundary needs to extend into the retrieval layer.</strong></p><h3>What Happens If the System Fails?</h3><p>Let’s assume our embedding service fails while processing a document.</p><p>Do we lose the document?</p><p>Do we ask the user to upload it again?</p><p>Ideally, no.</p><p>Because we introduced asynchronous processing, we can make our pipeline retryable.</p><pre>Queue<br>  │<br>  ▼<br>Worker<br>  │<br>  ├── Success ──► Vector DB<br>  │<br>  └── Failure<br>         │<br>         ▼<br>       Retry<br>         │<br>         ▼<br>    Max retries?<br>       /     \<br>     No       Yes<br>     │         │<br>     ▼         ▼<br>   Retry      DLQ</pre><p>Now we have another production concept:</p><p><strong>Dead Letter Queue.</strong></p><p>Jobs that repeatedly fail can be moved there for investigation instead of continuously retrying them.</p><h3>Observability</h3><p>At this point, we have many moving pieces:</p><pre>API<br>Queue<br>Workers<br>Object Storage<br>Embedding Model<br>Vector DB<br>LLM<br>Cache</pre><p>If a user says:</p><blockquote><em>“The application is slow.”</em></blockquote><p>Where do we start?</p><p>We need visibility into the entire request.</p><p>For example:</p><pre>Request<br>  │<br>  ├── API latency<br>  ├── Retrieval latency<br>  ├── LLM latency<br>  ├── Token usage<br>  ├── Queue wait time<br>  └── Error rate</pre><p>For AI applications, traditional metrics aren’t enough.</p><p>We should also think about AI-specific metrics:</p><ul><li>Retrieval quality</li><li>Answer quality</li><li>Token usage</li><li>Model latency</li><li>Hallucination/grounding failures</li><li>Failed generations</li><li>Cache hit rate</li></ul><p>This gives us the ability to answer not just:</p><blockquote><em>“Is the system running?”</em></blockquote><p>but also:</p><blockquote><strong><em>“Is the AI actually producing useful answers?”</em></strong></blockquote><h3>Cost Becomes a System-Design Problem</h3><p>Imagine our application becomes successful.</p><p>We now have:</p><ul><li>Millions of documents</li><li>Millions of embeddings</li><li>Millions of queries</li><li>Expensive LLM inference</li></ul><p>Our architecture may work perfectly — but the economics may not.</p><p>So we need to think about cost at every layer.</p><pre>Cost<br>                     │<br>       ┌─────────────┼─────────────┐<br>       ▼             ▼             ▼<br>   Storage       Retrieval        LLM<br>       │             │             │<br>      S3         Vector DB      Inference</pre><p>We can reduce cost through techniques such as:</p><ul><li>Caching</li><li>Smaller models</li><li>Model routing</li><li>Batching</li><li>Quantization</li><li>Prompt optimization</li><li>Efficient chunking</li><li>Avoiding unnecessary LLM calls</li></ul><p>This leads to another important system-design principle:</p><blockquote><strong><em>Don’t optimize only for performance. Optimize for performance, reliability, and cost together.</em></strong></blockquote><h3>Our Production Architecture</h3><p>Now we can combine everything we’ve discussed.</p><pre>                         ┌──────────────┐<br>                         │    Client    │<br>                         └──────┬───────┘<br>                                │<br>                                ▼<br>                         ┌──────────────┐<br>                         │ API Gateway  │<br>                         └──────┬───────┘<br>                                │<br>                                ▼<br>                         ┌──────────────┐<br>                         │ Application  │<br>                         │   Servers    │<br>                         └───┬──────┬───┘<br>                             │      │<br>                 ┌───────────┘      └─────────────┐<br>                 ▼                                ▼<br>          ┌─────────────┐                  ┌─────────────┐<br>          │ Object      │                  │ Metadata DB │<br>          │ Storage     │                  └─────────────┘<br>          └──────┬──────┘<br>                 │<br>                 ▼<br>              ┌───────┐<br>              │ Queue │<br>              └───┬───┘<br>                  │<br>                  ▼<br>          ┌───────────────┐<br>          │ Document      │<br>          │ Workers       │<br>          └───────┬───────┘<br>                  │<br>                  ▼<br>           ┌─────────────┐<br>           │ Embeddings  │<br>           └──────┬──────┘<br>                  │<br>                  ▼<br>           ┌─────────────┐<br>           │ Vector DB   │<br>           └──────┬──────┘<br>                  │<br>                  │<br>User Query ───────┘<br>                  │<br>                  ▼<br>           ┌─────────────┐<br>           │ Retrieval   │<br>           │ + Reranking │<br>           └──────┬──────┘<br>                  │<br>                  ▼<br>             ┌─────────┐<br>             │   LLM   │<br>             └────┬────┘<br>                  │<br>                  ▼<br>               Answer</pre><p>And around all of this we have:</p><pre>Authentication<br>Authorization<br>Rate Limiting<br>Caching<br>Monitoring<br>Logging<br>Tracing<br>Security<br>Cost Controls</pre><h3>But Is This Really the Final Architecture?</h3><p><strong>Probably not.</strong></p><p>And that’s actually the point.</p><p>System design isn’t about drawing the biggest architecture possible.</p><p>It’s about starting with the simplest architecture and asking:</p><blockquote><strong><em>What breaks first?</em></strong></blockquote><p>Then we solve that problem.</p><p>Then we ask:</p><blockquote><strong><em>What breaks next?</em></strong></blockquote><p>And we continue iterating.</p><p>Our architecture evolved roughly like this:</p><pre>Simple RAG<br>    │<br>    ▼<br>Synchronous Processing<br>    │<br>    ▼<br>Async Document Processing<br>    │<br>    ▼<br>Scalable Workers<br>    │<br>    ▼<br>Better Retrieval<br>    │<br>    ▼<br>LLM Scaling<br>    │<br>    ▼<br>Caching<br>    │<br>    ▼<br>Security + Isolation<br>    │<br>    ▼<br>Observability<br>    │<br>    ▼<br>Cost Optimization<br>    │<br>    ▼<br>Production AI System</pre><p>And that’s how I would approach system designing an AI-powered application.</p><p><strong>Don’t start with 20 microservices.</strong></p><p>Start simple.</p><p>Understand the workload.</p><p>Find the bottleneck.</p><p>Then introduce complexity only when the requirements justify it.</p><p>That, in my opinion, is the interesting part of designing AI systems.</p><blockquote><strong><em>At every step, we’re not adding complexity because we can. We’re adding it because the previous design has a problem.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=361d1d380c3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How does the ANN (Approximate Nearest Neighbor) works?]]></title>
            <link>https://notadityapawar.medium.com/how-does-the-ann-approximate-nearest-neighbor-works-735ef2c2d4bf?source=rss-f5506dbd5236------2</link>
            <guid isPermaLink="false">https://medium.com/p/735ef2c2d4bf</guid>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[ann]]></category>
            <dc:creator><![CDATA[Aditya Pawar]]></dc:creator>
            <pubDate>Fri, 05 Jun 2026 14:30:04 GMT</pubDate>
            <atom:updated>2026-06-05T14:30:04.952Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are working with the RAG applications then you would have heard this terminology a lot, but what exactly is ANN.</p><p><strong>ANN stands for Approximate Nearest Neighbor</strong></p><p>It is a technique which is used to find the points which are “close” to the given point in a high-dimensional space.</p><p>Let’s start with an example,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCkav8JcwewKDtKXICt3Aw.png" /></figure><p>Imagine a number line:</p><ul><li>Adi is standing at 1</li><li>Arvind is standing at 4</li><li>Ankur is standing at 5.</li></ul><p>If Ankur wants to find the nearest person, he will find that Arvind is closer than Adi because.</p><ul><li>Distance between Ankur and Arvind = |5 - 4| = 1</li><li>Distance between Ankur and Adi = |5–1 |= 4</li></ul><p>In this scenario finding the nearest neighbor is easy because we are dealing with only one dimension.</p><p>Now imaging instead of the number line we have have the documents represent as vectors.</p><p>A sentence such as:</p><p>“Cats are pets.”</p><p>might be converted as an embedding model into something like:</p><p>[0.54, -0.76, 0.45, .....]</p><p>Similarly</p><p>“Dogs are not pets.” will be another vector.</p><p>Modern embedding models produces the vectors of 768, 1024, 1536, or even more dimensions which can be pretty hard for us to visualize but mathematically we can calculate ‘How close which vector is to each other’.</p><p><strong>The problem with Exact Search</strong></p><p>Let’s say we have a vector database which contains</p><ul><li>1000 vectors</li><li>100000 vectors</li><li>10 million vectors</li></ul><p>When a user asks a question then the embedding of the question will be generated and system tries to find the most similar vectors.</p><p>The common approach will be .</p><ol><li>Compare the query vector with every vector in the db.</li><li>Calculate the similarity score.</li><li>Return the closest match.</li></ol><p>This is called<strong> Exact Nearest Neighbor Search</strong></p><p>The issue with this as the number of vectors grows, the search becomes more expensive.</p><p>For a db with millions of vector this will be absolute nightmare to compare every vector against the query. It will lead to the slow and costly computation.</p><h4><strong>Enters ANN</strong></h4><p>ANN solves this exact problem by trading a tiny amount of accuracy for a huge gain in speed.</p><p>Instead of checking every vector, ANN uses specialized algo and data structure to quickly narrow down the space search.</p><p>Think of something like finding a book in the library.</p><h4><strong>Exact Search</strong></h4><p>You inspect every book one by one until you find the best book.</p><h4><strong>ANN Search</strong></h4><p>You first go the correct floor of the library. Then go the correct section then go the self, and then inspect the few books.</p><p>You may or may not find the exact match, but will find the extremely close match at much faster speed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kdfUNQ02lDsoovCLCvvQYQ.png" /></figure><h4>But why <strong>Approximate</strong>??</h4><p>Because ANN does not guarantee the returned vector is the closest one.</p><p>Instead it guarantee like, “I found a vector which is extremely close to the nearest neighbor with 99% confidence, but I did at much faster speed.”</p><p>For most of the RAG application this tradeoff is acceptable.</p><h4><strong>Popular ANN Algorithms</strong></h4><p><strong>HNSW</strong> (<strong>Hierarchical Navigable Small Worlds)</strong></p><p>One of the most popular ANN algo today.</p><p>It creates multiple graph layers where vectors are connected to the nearby vectors.</p><p>When searching:</p><ol><li>Start from the high level overview graph</li><li>Move towards the similar nodes</li><li>Descend to the more detailed layers</li><li>Reach the closest candidates quickly.</li></ol><p>There are others such as IVF (Inverted File Index) and Product Quantization (PQ)</p><h4>How ANN Fits into RAG</h4><p>A typical RAG pipeline looks like this:</p><pre>User Query<br>    ↓<br>Embedding Model<br>    ↓<br>Query Vector<br>    ↓<br>ANN Search<br>    ↓<br>Top Relevant Chunks<br>    ↓<br>LLM<br>    ↓<br>Final Response</pre><pre>when a user asks:</pre><blockquote><em>“What is the refund policy?”</em></blockquote><p>the system:</p><ol><li>Converts the question into an embedding.</li><li>Uses ANN to find similar document chunks.</li><li>Retrieves the top-k relevant chunks.</li><li>Sends them to the LLM as context.</li><li>Generates the answer.</li></ol><p>Without ANN, retrieval over millions of chunks would be too slow for real-time applications.</p><h4>Why ANN Matters</h4><p>ANN is one of the key technologies that makes modern RAG systems practical.</p><p>Without it:</p><ul><li>Vector databases would be slower.</li><li>Retrieval latency would increase.</li><li>Costs would rise significantly.</li><li>User experience would suffer.</li></ul><p>With ANN, we can search through millions (or even billions) of embeddings in milliseconds while maintaining high-quality retrieval.</p><p>In the next blog we will be exploring the <strong>ANN algos</strong> individually.</p><p>Untill then cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=735ef2c2d4bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Global Secondary Index in AWS DynamoDB]]></title>
            <link>https://notadityapawar.medium.com/what-is-global-secondary-index-in-aws-dynamodb-72ad200f9390?source=rss-f5506dbd5236------2</link>
            <guid isPermaLink="false">https://medium.com/p/72ad200f9390</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[dynamodb]]></category>
            <dc:creator><![CDATA[Aditya Pawar]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 14:00:54 GMT</pubDate>
            <atom:updated>2025-07-15T14:00:54.000Z</atom:updated>
            <content:encoded><![CDATA[<p>Global Secondary index in AWS DynamoDB is the index which provides the alternative way to query in the dynamoDB table. It allows the user to have the different partition key and optional sort key than the table’s primary key.</p><p>So why do we need the GSI?</p><p>Let’s say you have defined the db in which the partition key is msg_id, the remaining columns are group_id, user_id and details.</p><p>Now you need to query in the data in table with the particular msg_id. It will be easy, you can filter the data using the msg_id.</p><p>But now the question arises when you need to filter the data on the basis of the group_id or user_id. How you will do it?</p><p>In that scenario the GSI comes to rescue. You can easily define the Global Secondary Index in the DynamoDB and can query on the basis of the group_id or user_id.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72ad200f9390" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How does the ChatGPT Ghibli filter works?]]></title>
            <link>https://notadityapawar.medium.com/how-does-the-chatgpt-ghibli-filter-works-eef0ffccdab8?source=rss-f5506dbd5236------2</link>
            <guid isPermaLink="false">https://medium.com/p/eef0ffccdab8</guid>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[image-gen]]></category>
            <category><![CDATA[ghibli]]></category>
            <dc:creator><![CDATA[Aditya Pawar]]></dc:creator>
            <pubDate>Mon, 31 Mar 2025 14:01:03 GMT</pubDate>
            <atom:updated>2025-03-31T14:01:03.521Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*QLRjacxCdAS6xxn_" /><figcaption>Ghibli Style Picture of our trip</figcaption></figure><p>The ChatGPT Studio Ghibli filter works by leveraging GPT-4o’s advanced multimodal capabilities to generate images. The AI constructs the images pixel by pixel using an <strong>autoregressive </strong>method, which ensures the detailed and coherent outputs.</p><p>Now the question arises, What is autoregressive method?</p><blockquote>An autoregressive (AR) model predicts the current value of a time series based on its past values. It assumes that the future is influenced by past behavior, making it useful for time series forecasting.</blockquote><blockquote>AWS has written a beautiful blog for this, check that out.</blockquote><p><a href="https://aws.amazon.com/what-is/autoregressive-models/">https://aws.amazon.com/what-is/autoregressive-models/</a></p><p>Why did the <strong>OpenAI </strong>choose the Autoregressive model when they have the diffusion based model <strong>Dall-E</strong> to generate the images?</p><blockquote>The answer lies in the details. The autoregressive model generates the pictures one pixel at a time, whereas the diffusion model generates the image all at once. The autoregressive model captures the sequential dependency of pixels, meaning it’s great in modeling local pixel interactions as well as long range dependencies. This helps in providing edge when precision is required.</blockquote><h3>Key Technical Distinctions between DALL-E and ChatGPT-4o</h3><p><strong>Text Rendering</strong></p><ul><li><strong>DALL·E 3:</strong> Struggles with legible text</li><li><strong>ChatGPT-4o Image Generation:</strong> Accurately generates stylized, readable text via autoregression</li></ul><p><strong>Object Binding</strong></p><ul><li><strong>DALL·E 3:</strong> Often confuses multiple objects/colors</li><li><strong>ChatGPT-4o Image Generation:</strong> Handles up to 20 distinct objects per prompt</li></ul><p><strong>Training Approach</strong></p><ul><li><strong>DALL·E 3:</strong> Uses CLIP for evaluation</li><li><strong>ChatGPT-4o Image Generation:</strong> Trained on unified multimodal data (text, images, audio)</li></ul><p><strong>Iterative Refinement</strong></p><ul><li><strong>DALL·E 3:</strong> Limited to standalone prompts</li><li><strong>ChatGPT-4o Image Generation:</strong> Supports multi-turn generation with conversational adjustments</li></ul><p><strong>Speed</strong></p><ul><li><strong>DALL·E 3:</strong> Faster (diffusion-based)</li><li><strong>ChatGPT-4o Image Generation:</strong> Slower due to autoregressive sequencing</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eef0ffccdab8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering useEffect in React]]></title>
            <link>https://notadityapawar.medium.com/mastering-useeffect-in-react-ce298ee70da4?source=rss-f5506dbd5236------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce298ee70da4</guid>
            <category><![CDATA[useeffect]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[hooks]]></category>
            <dc:creator><![CDATA[Aditya Pawar]]></dc:creator>
            <pubDate>Tue, 30 Jan 2024 04:42:08 GMT</pubDate>
            <atom:updated>2024-01-30T04:42:08.255Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W9Sf4PdqQSN9Mjf-" /><figcaption>Photo by <a href="https://unsplash.com/@lautaroandreani?utm_source=medium&amp;utm_medium=referral">Lautaro Andreani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>React is one of the most used Javascript libraries for building the UI. It provides a powerful tool called useEffect to manage the side effects of the functional components.</p><p>At its core, useEffect is a function that enables you to perform side effects in your functional components. These side effects may include data fetching, subscriptions, or manually changing the DOM. The basic syntax of useEffect looks like this:</p><pre>import React, { useEffect } from &#39;react&#39;;<br><br>function MyComponent() {<br>  useEffect(() =&gt; {<br>    // Side effect code goes here<br>    return () =&gt; {<br>      // Cleanup code (optional)<br>    };<br>  }, [/* Dependency array */]);<br><br>  // Rest of the component code<br>}</pre><p>The second argument, i.e. dependency array is optional. It allows you to specify the dependency for the effect. If any changes in the dependency array, the effect will run again.</p><p>Common Use-cases:</p><ol><li>Data Fetching: One of the most common things that I use is for the data fetching from the API when the component mounts. Here is an example of that:</li></ol><pre>useEffect(() =&gt; {<br>  const [post, setPost] = useState(null);  <br>  const fetchData = async () =&gt; {<br>    axios.get(baseURL).then((response) =&gt; {<br>      setPost(response.data);<br>    });<br>    // Do something with the data<br>  };<br><br>  fetchData();<br>}, []);</pre><p>2. Subscriptions: can be useful for managing the subscription like connecting to a WebSocket.</p><pre>useEffect(() =&gt; {<br>  const socket = new WebSocket(&#39;wss://example.com/socket&#39;)<br>  // Add event listeners, handle incoming data, etc.<br>  return () =&gt; {<br>    // Cleanup - close the socket when the component unmounts<br>    socket.close();<br>  };<br>}, []);</pre><p>3. DOM Manipulation: While React encourages a declarative approach to UI, there are cases where you might need to interact with the DOM imperatively. useEffect can be used for such scenarios:</p><pre>useEffect(() =&gt; {<br>  // Perform DOM manipulation here<br><br>  return () =&gt; {<br>    // Cleanup if needed<br>  };<br>}, [/* Dependencies */]);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce298ee70da4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leaders in an array]]></title>
            <link>https://notadityapawar.medium.com/leaders-in-an-array-70b7c9ac5c1?source=rss-f5506dbd5236------2</link>
            <guid isPermaLink="false">https://medium.com/p/70b7c9ac5c1</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Aditya Pawar]]></dc:creator>
            <pubDate>Sat, 25 Mar 2023 11:46:31 GMT</pubDate>
            <atom:updated>2023-03-25T11:46:31.474Z</atom:updated>
            <content:encoded><![CDATA[<p>Leaders in the array referees to the elements which are strictly greater than the elements present on the right-hand side of the array elements</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4dXfSYDxkQMzAof2cTi9Gg.png" /></figure><p>For example in the given array [16, 17, 4, 3, 5, 2], the leaders are 17, 5, and 2.</p><p>There are various ways to find the leaders in the array some of them are as follows</p><ol><li>Brute force:- This method involves comparing each element of the array to the right-hand side of the element and finding if it is strictly greater than the element. The worst-case time complexity will be O(n²)</li></ol><pre>def find_leaders(arr):<br>    n = len(arr)<br>    leaders = []<br>    for i in range(n):<br>        is_leader = True<br>        for j in range(i+1, n):<br>            if arr[i] &lt; arr[j]:<br>                is_leader = False<br>                break<br>        if is_leader:<br>            leaders.append(arr[i])<br>    return leaders</pre><ol><li>Iterating the elements from the last:- This problem can be solved by tracing the elements from the last and comparing it with the global max seen so far</li></ol><pre>def find_leaders(arr):<br>    n = len(arr)<br>    leaders = []<br>    max_so_far = float(&#39;-inf&#39;)<br>    for i in range(n-1,-1,-1):<br>        if arr[i]&gt;max_so_far:<br>            max_so_far = arr[i]<br>            leaders.append(max_so_far)<br>            <br>    <br>    return leaders[::-1]<br>    </pre><ol><li>First, we define a function find_leaders that takes an array arr as input.</li><li>We initialize a variable n to the length of the array, and create an empty list leaders to store the leaders in the array.</li><li>We also initialize a variable max_so_far to negative infinity. This variable will keep track of the maximum element seen so far while iterating the array.</li><li>We start iterating the array from the last element to the first element using a for loop with a step of -1. For each element in the array, we check if it is greater than max_so_far.</li><li>If the current element is greater than max_so_far, we update max_so_far to the current element and append it to the leaders list.</li><li>Finally, we return the leaders list in reverse order, as we appended the leaders to the list while iterating the array from the last element to the first element.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70b7c9ac5c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why do people use C++ in the competitive programming?]]></title>
            <link>https://notadityapawar.medium.com/why-do-people-use-c-in-the-competitive-programming-d2c6b14c28d6?source=rss-f5506dbd5236------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2c6b14c28d6</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[competitive-programming]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[c-plus-plus-language]]></category>
            <category><![CDATA[c-programming]]></category>
            <dc:creator><![CDATA[Aditya Pawar]]></dc:creator>
            <pubDate>Sun, 11 Apr 2021 11:03:21 GMT</pubDate>
            <atom:updated>2021-04-11T11:08:39.014Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C4SccvODYv4SBypJFmYAEw.png" /><figcaption>C++ logo</figcaption></figure><p>C++ or c plus plus was invented in year 1985 by the well known programmer Bjarne Stroustrup. It was made above the old language C with some more “capabilities” or classes, better known as C with classes.</p><p>Even today most of the fellows use this C++ in their competitive programming and in this post we will find the answers of the same.</p><ol><li>Most of the kids (at least here in India) starts theirs coding journey with the C++ language, so you go in the war with your best weapon!</li><li>Most of the Universities prefer explaining topics in C and C++, this could be another reason.</li><li>Fast and efficient , C++ is both fast and efficient in memory management</li><li>Simple learning curve, it’s easy and human friendly(well atleast in my case)</li><li>More libraries, certain libraries like STL provides greater flexibility to the coders to compete with one another.</li></ol><p>There can also be many reasons, feel free to discuss in the comment section.</p><p>Till then Cheers!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2c6b14c28d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>