<?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 ujjwal basnyat on Medium]]></title>
        <description><![CDATA[Stories by ujjwal basnyat on Medium]]></description>
        <link>https://medium.com/@asujjwalbasnyat?source=rss-1afb58791dea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*lgMEYruBe6gkZMx9</url>
            <title>Stories by ujjwal basnyat on Medium</title>
            <link>https://medium.com/@asujjwalbasnyat?source=rss-1afb58791dea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 02:46:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@asujjwalbasnyat/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[A Simple Intuition for Double Integrals]]></title>
            <link>https://medium.com/@asujjwalbasnyat/double-integrals-finally-made-simple-the-intuition-i-wish-someone-had-told-me-b0fa8402473b?source=rss-1afb58791dea------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0fa8402473b</guid>
            <dc:creator><![CDATA[ujjwal basnyat]]></dc:creator>
            <pubDate>Sat, 18 Jul 2026 16:28:34 GMT</pubDate>
            <atom:updated>2026-07-18T17:13:59.257Z</atom:updated>
            <content:encoded><![CDATA[<p><em>“Don’t memorize the formulas. Build the picture in your mind.”</em></p><p>When I first encountered double integrals, I felt the same confusion that many university students experience.</p><ul><li>What does the function (f(x,y)) actually do?</li><li>Why are there two integrals?</li><li>Why do the limits look so strange?</li><li>What are we even calculating?</li></ul><p>Most textbooks immediately start solving problems involving parabolas, circles, and changing limits of integration. Students often learn how to solve questions without understanding what they are actually doing.</p><p>This article is different.</p><p>By the end, you won’t just know how to evaluate a double integral — you’ll understand what it represents and why mathematicians invented it in the first place.</p><h3>Before Learning Double Integrals, Understand Ordinary Integrals</h3><p>This is the biggest mistake many students make.</p><p>They jump into double integrals before fully understanding ordinary integration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*lK6tcF1-8_5Zw_9PSN48RA.png" /><figcaption>definite integral</figcaption></figure><p>Most books says,</p><blockquote>“Its gives the area under the curve.”</blockquote><p>While this is correct, it doesn’t explain <strong>why</strong>.</p><p>Let’s build the intuition.</p><p>Imagine the interval from <strong>(a) </strong>to <strong>(b) </strong>divided into millions of tiny pieces.</p><p>Each tiny piece has width <strong>dx</strong></p><p>Now ask yourself one question:</p><blockquote><strong>How much should this tiny interval contribute to the final answer?</strong></blockquote><p>The answer comes from the function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*z9h9OWzBnwJcJx4nT5F0RA.png" /><figcaption>area under curve</figcaption></figure><h3>A different Way to Visualize It</h3><p>Here’s a mental model that helped me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*aTxJaHMvs9i6rXk4CNG6bg.png" /></figure><p>Instead, the function tells us</p><blockquote>How tall should the column be at this location?</blockquote><p>This is the first important idea.</p><p><strong>The function determines the contribution of each tiny interval.</strong></p><h3>Now we are Ready for Double Integrals</h3><p>Instead of a line, imagine an entire region on the plane.</p><p>For example, a rectangle.</p><p>Instead of dividing a line into pieces, divide the region into millions of tiny squares.</p><p>Each tiny squares has dimensions.</p><ul><li>width = dx</li><li>height = dy</li></ul><p>So its tiny area is</p><p>[ dA=dxdy]</p><p>Now ask the same question again.</p><blockquote><strong>How much should this tiny square contribute?</strong></blockquote><p>Again, the answer comes from the function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*kKRVogRGKwuTNwSbArIpiA.png" /></figure><h3>What Does the Double Integral Actually Add?</h3><p>Every tiny square contributes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/130/1*ksNsDRUwwUVse3XqwOhn8A.png" /></figure><p>Notice something interesting.</p><p>The base is now a tiny rectangle.</p><p>The function supplies the height</p><p>Therefore, [ f(x,y), dx, dy] is actually the volume of one tiny column.</p><p>The double integral simply adds millions of these tiny columns together. This leads to one of the beautiful interpretations in</p><p><strong>Double Integral = Sum of tiny Volumes</strong></p><h3>Then Why Does (1 x dA) Give Area?</h3><p>Students often wonder:</p><p>“If double integrals add volumes, why do we sometimes get area?”</p><p>The answer is surprisingly simple.</p><p>Suppose [ f(x,y) = 1. ]</p><p>Every tiny column has height 1.</p><p>The volume of each tiny column is <em>1 </em>x <em>dxdy = dxdy</em></p><p>Adding them gives <em>1 x Area.</em></p><p>Since every column has unit height, the numerical value equals the area of the region.</p><h3>Understanding the Two Integrals</h3><p>Another common confusion is:</p><p>“Why are there two integrals?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*IyLiog2PlE1kUsmGh2kCXg.png" /></figure><p>Eventually every strip has been counted.</p><p>Think of it like painting a wall.</p><p>First,</p><p>you paint one vertical strip.</p><p>Then another.</p><p>Then another.</p><p>Eventually the whole wall is covered.</p><p>Double integration works exactly the same way.</p><h3>Why Students Find Double Integrals Difficult</h3><p>In my opinion, students don’t struggle because double integrals are difficult.</p><p>They struggle because they are introduced in the wrong order.</p><p>Many courses immediately begin with</p><ul><li>changing limits,</li><li>reversing the order of integration,</li><li>polar coordinates,</li><li>complicated algebra.</li></ul><p>Students end up asking,</p><blockquote><em>“Which limit goes where?”</em></blockquote><p>instead of asking</p><blockquote><em>“What is this integral actually doing?”</em></blockquote><p>Once you understand that every tiny rectangle becomes a tiny column, most formulas suddenly make sense.</p><p>The limits simply describe <strong>which tiny rectangles belong to the region</strong>.</p><p>Nothing more.</p><h3>A Simple Recipe for Every Double Integral</h3><p>Whenever you see</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*rgkTWvTnyVw5d1_sXitBKw.png" /></figure><p>think about these four questions.</p><ol><li><strong>What is the region?<br></strong>Where are all the tiny rectangles located?</li><li><strong>What is one tiny rectangle?<br></strong>Its area is [ dx, dy.]</li><li><strong>How tall is the column above that rectangle?<br></strong>The answer is [ f(x,y)]</li><li><strong>What is one tiny contribution?<br></strong>Multiply them. [f(x,y),dx,dy]<br>Now simply add every tiny contribution.<br>That is the double integral.</li></ol><h3>Why Double Integrals Matter</h3><p>Double integrals are much more than a chapter in calculus.</p><p>They appear throughout science and engineering.</p><p>They allow us to compute</p><ul><li>area of irregular regions,</li><li>volume under surfaces,</li><li>mass of non-uniform objects,</li><li>center of mass,</li><li>electric charge,</li><li>probability over two-dimensional distributions,</li><li>heat and energy distributions.</li></ul><p>The same mathematical idea appears again and again.</p><h3>A Glimpse into Data Science and Machine Learning</h3><p>If you’re studying data science or machine learning, you may wonder,</p><blockquote><em>“Will I ever use double integrals?”</em></blockquote><p>The answer is yes — but often behind the scenes.</p><p>For example:</p><ul><li>In probability theory, continuous joint probability distributions are defined using double integrals.</li><li>Expected values of two random variables involve double integration.</li><li>Gaussian distributions in two dimensions rely on double integrals.</li><li>Bayesian inference often requires integrating probability density functions.</li><li>Many optimization and statistical models are built upon concepts from multivariable calculus.</li></ul><p>You may not manually compute complicated double integrals every day as a data scientist, but understanding the underlying idea helps you understand probability, statistics, and many machine learning algorithms at a deeper level.</p><h3>The One Sentence That Changed Everything for Me</h3><p>If I had to summarize the entire concept in one sentence, it would be this:</p><blockquote><strong><em>A double integral adds the contributions of millions of tiny columns built on tiny rectangles covering a region.</em></strong></blockquote><p>The function determines the height.</p><p>The tiny rectangle provides the base.</p><p>The integral adds every tiny volume.</p><p>Once you see this picture in your mind, the notation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/1*A95Aogf1_5RNQmOHErmWLQ.png" /></figure><p>stops looking mysterious.</p><p>It simply becomes a beautiful way of saying,</p><blockquote><em>“Take every tiny piece of the region, compute its contribution, and add everything together.”</em></blockquote><h3>Final Thoughts</h3><p>Calculus becomes much easier when you stop treating formulas as symbols and start seeing them as pictures.</p><p>A single integral builds rectangles.</p><p>A double integral builds columns.</p><p>A triple integral builds tiny boxes.</p><p>The underlying philosophy never changes:</p><ol><li>Divide something into tiny pieces.</li><li>Find the contribution of one tiny piece.</li><li>Add all the tiny contributions.</li></ol><p>Once you understand that philosophy, you are no longer memorizing calculus — you are thinking like the mathematicians who invented it.</p><p>And that’s when double integrals finally begin to make sense.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0fa8402473b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better PDF Parsing for the LLM Era with Marker]]></title>
            <link>https://medium.com/@asujjwalbasnyat/the-death-of-the-bad-pdf-how-datalabs-marker-is-rewriting-document-parsing-for-the-llm-era-6e8a7af33ced?source=rss-1afb58791dea------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e8a7af33ced</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[ujjwal basnyat]]></dc:creator>
            <pubDate>Wed, 08 Jul 2026 18:58:18 GMT</pubDate>
            <atom:updated>2026-07-18T17:12:59.695Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine training a multi-million dollar Large Language Model (LLM) or building an advanced Retrieval-Augmented Generation (RAG) pipeline, only to have it hallucinate wildly because your PDF parser turned a beautifully structured three-column financial table into a garbled string of numbers.</p><p>For years, PDFs have been the data engineer’s worst nightmare. They aren’t designed to hold semantic structure; they are designed to look consistent on a printer. Traditional open-source tools like Tesseract or native PDF text extractors strip away headers, footers, tables, and mathematical formulas, leaving behind an unusable mess.</p><p>Enter <strong>Marker</strong>, an open-source tool developed by the team at <strong>Datalab</strong> (datalab-to/marker). It promises to convert PDFs, images, slides, and spreadsheets into clean Markdown, HTML, and structured JSON with blistering speed and high layout fidelity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*NwHoWt7VXz6sGVzE1M1brQ.png" /></figure><p>But does it live up to the hype? In this guide, we will unpack how Marker works under the hood, analyze real benchmark data where it beats GPT-4o, look at explicit code implementations, and objectively weigh its pros and cons.</p><h3><strong>The Core Innovation: Beyond Simple Text Scraping</strong></h3><p>Marker doesn’t just read strings of text from a coordinate space. It treats document parsing as a multi-stage machine learning orchestration problem.</p><p>When you pass a document into Marker, it passes through a sophisticated pipeline that replaces brittle heuristics with deep learning models (powered by Datalab’s underlying engines like <em>Surya</em> and <em>Chandra</em>).</p><h4>The Internal Pipeline:</h4><ol><li><strong>Layout &amp; Reading Order Analysis: </strong>It automatically segments the page, identifying what constitutes a header, footer, table, or main body paragraph. It dynamically calculates the reading order, ensuring that multi-column academic papers don’t get read across the pages lines.</li><li><strong>Advanced OCR: </strong>For scanned documents or low-quality text layers, it leverages custom models to handle over 90 languages, deciphering grainy font faces and handwritten annotations.</li><li><strong>Artifact Stripping</strong>: It intelligently scrubs out redundant elements that would poison vector embeddings, such as running headers, page numbers, and decorative page rules.</li><li><strong>Semantic Re-formatting: </strong>It maps tables back to Markdown pipes, recreates block code syntax, and translates complex mathematical notations straight into fully rendering LaTeX Blocks.</li></ol><h3>Real Facts &amp; Hard Numbers: The Benchmarks</h3><p>Let’s look at the actual data. In community benchmarks like the olmOCR-Bench (a standardized dataset containing thousands of complex PDF test cases covering math, tables, old scans, and multi-column documents), Marker sets a new standard.</p><p>Here is how Datalab’s Marker stacks up against proprietary LLMs and competitive open-source models on overall document conversion accuracy:</p><pre>- **Datalab Marker (Balanced Mode)**<br>  - **Overall Accuracy Score:** 82.7% ± 0.9<br>  - **Key Strengths:** Masterful with multi-column text &amp; tables<br><br>- **Datalab Marker (Fast Mode)**<br>  - **Overall Accuracy Score:** 76.5% ± 1.0<br>  - **Key Strengths:** Extremely low latency, highly efficient<br><br>- **Deepseek OCR**<br>  - **Overall Accuracy Score:** 74.2% ± 1.0<br>  - **Key Strengths:** Robust text recognition<br><br>- **GPT-4o (Anchored)**<br>  - **Overall Accuracy Score:** 69.9% ± 1.1<br>  - **Key Strengths:** Great contextual understanding, poor raw layout reconstruction<br><br>- **Gemini 2.0 Flash (Anchored)**<br>  - **Overall Accuracy Score:** 63.8% ± 1.2<br>  - **Key Strengths:** Speed, but struggles with multi-column fragmentation</pre><h4>The Speed Fact:</h4><p>Marker processes standard digital PDF pages locally in roughly <strong>0.18 seconds per page</strong>. When scaled across optimized batch architectures on a dedicated GPU cluster, it can scale up to <strong>120 pages per second</strong>.</p><h3>Real Code Examples: From Local CLI to Cloud API</h3><p>Marker is highly versatile. You can run it fully open-source on your own hardware or leverage managed versions like Replicate or Datalab’s hosted endpoints.</p><p><strong>The Local Python Implementation:<br></strong>To parse non-PDF files alongside regular PDFs, you can use Marker’s full suite locally via Python:</p><pre>pip install marker-pdf[full]</pre><pre>import os<br>from marker.convert import convert_single_pdf<br>from marker.models import load_all_models<br><br># Optional: Force execution using specific hardware configurations<br># Peak VRAM usage hits ~5GB per worker process<br>os.environ[&quot;CUDA_VISIBLE_DEVICES&quot;] = &quot;0&quot; <br><br># Pre-load required structural and OCR models into VRAM<br>model_lst = load_all_models()<br><br>pdf_path = &quot;./reports/q2_financials.pdf&quot;<br><br># Convert the document<br>markdown_text, images, metadata = convert_single_pdf(<br>    pdf_path, <br>    model_lst,<br>    force_ocr=False # Automatically uses OCR only when needed<br>)<br><br># Save your clean markdown<br>with open(&quot;./output/q2_financials.md&quot;, &quot;w&quot;, encoding=&quot;utf-8&quot;) as f:<br>    f.write(markdown_text)<br><br>print(f&quot;Successfully processed. Total pages extracted: {metadata.get(&#39;pages&#39;)}&quot;)</pre><p><strong>High-Fidelity JSON &amp; Schema Extraction (Cloud API):</strong></p><p>Marker also allows you to supply a strict JSON Schema, forcing the engine to extract target fields directly from unstructured layouts. Here is how you execute structured extraction via the Replicate client using gemini-2.0-flash or Ollama backends:</p><pre>import json<br>import replicate<br><br># Define the target schema for your document type<br>invoice_schema = {<br>    &quot;type&quot;: &quot;object&quot;,<br>    &quot;properties&quot;: {<br>        &quot;vendor&quot;: {&quot;type&quot;: &quot;string&quot;},<br>        &quot;invoice_number&quot;: {&quot;type&quot;: &quot;string&quot;},<br>        &quot;date&quot;: {&quot;type&quot;: &quot;string&quot;},<br>        &quot;total_due&quot;: {&quot;type&quot;: &quot;number&quot;}<br>    },<br>    &quot;required&quot;: [&quot;vendor&quot;, &quot;total_due&quot;]<br>}<br><br># Run Marker in the cloud with strict formatting preferences<br>output = replicate.run(<br>    &quot;datalab-to/marker&quot;,<br>    input={<br>        &quot;file&quot;: &quot;https://example.com/assets/unstructured_invoice.pdf&quot;,<br>        &quot;mode&quot;: &quot;balanced&quot;,<br>        &quot;page_schema&quot;: json.dumps(invoice_schema),<br>        &quot;use_llm&quot;: True,  # Leverages an LLM anchor to handle inline values &amp; form checkboxes<br>        &quot;paginate&quot;: False<br>    }<br>)<br><br># Marker gives you back BOTH the raw markdown and the schema matched JSON<br>print(&quot;--- EXTRACTED DATA ---&quot;)<br>print(output.get(&quot;extraction_schema_json&quot;))</pre><h3>The Double-Edged Sword: An Objective Assessment</h3><p>No piece of software is a silver bullet. To determine whether Marker belongs in your enterprise data pipeline, you must balance its strengths against its infrastructure real estate costs.</p><h4>The Pros: Why Marker is Winning</h4><ul><li><strong>Native Math &amp; Code Block Parsing:</strong> If you deal with technical papers or textbook uploads, its ability to output clean LaTeX inline math structures ($E=mc^2$) and multi-line code blocks is unparalleled.</li><li><strong>Granular Artifact Eraser:</strong> It saves massive token costs in LLM pipelines by scrubbing repeatable, non-informative data like page footers and headers.</li><li><strong>Schema Enforcement:</strong> The hybrid LLM-assisted schema approach merges multi-page tables and outputs production-grade JSON alongside document markdown.</li><li><strong>True Multilingual Breadth:</strong> Out-of-the-box support for over 90 languages means you don’t need a separate localized parsing pipeline for global documents.</li></ul><h4>The Cons: The Hidden Trade-offs</h4><ul><li><strong>Heavy Compute Footprint:</strong> Running Marker locally is memory intensive. It typically requires an average of 3.5GB of VRAM per worker, peaking at <strong>5GB of VRAM</strong>. If you don’t have access to modern NVIDIA GPUs, processing large datasets via CPU will bottleneck your system.</li><li><strong>Complex Setup Overhead:</strong> Installing dependencies like PyTorch, torchvision, and handling system-level PDF extraction binaries can become complex inside multi-architecture Docker environments.</li><li><strong>Vulnerability to Highly Custom Forms:</strong> While it outperforms standard OCR, deeply nested tax forms, highly erratic hand-drawn diagrams, or low-contrast scanned documents can still degrade the structure, occasionally requiring explicit --force_ocr overrides that dramatically slow down throughput.</li></ul><h4>The Verdict: Should You Use It?</h4><p>If your current document workflows rely on simple text dumpers like PyPDF2 or pdfplumber, upgrading to <strong>Marker</strong> is night and day.</p><p>For engineers building <strong>RAG architectures or training LLMs</strong>, Marker acts as a vital translation layer. It transforms messy visual layouts into structured, highly contextual, and token-efficient Markdown that LLMs actually understand.</p><p>While its heavy hardware dependencies demand real infrastructure planning, its sheer speed and layout accuracy make it one of the most vital open-source tools in the modern AI engineer’s toolkit.</p><p><a href="https://github.com/datalab-to/marker">GitHub - datalab-to/marker: Convert PDF to markdown + JSON quickly with high accuracy</a></p><p><em>Have you used Marker in your AI workflows? Let me know in the comments how it compares to your current document parsing solutions!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e8a7af33ced" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>