<?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 Pralhad Teggi on Medium]]></title>
        <description><![CDATA[Stories by Pralhad Teggi on Medium]]></description>
        <link>https://medium.com/@pralhad2481?source=rss-d23ca72419ac------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*5KH9RDey99rXhWSBIzpG6Q.jpeg</url>
            <title>Stories by Pralhad Teggi on Medium</title>
            <link>https://medium.com/@pralhad2481?source=rss-d23ca72419ac------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 14:05:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pralhad2481/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[Caught in the Data Torrent - What Is a “Watermark” and Why Is It the Savior of Modern Data…]]></title>
            <link>https://medium.com/@pralhad2481/caught-in-the-data-torrent-what-is-a-watermark-and-why-is-it-the-savior-of-modern-data-477c6099c93d?source=rss-d23ca72419ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/477c6099c93d</guid>
            <category><![CDATA[incremental-loading]]></category>
            <category><![CDATA[watermark]]></category>
            <category><![CDATA[late-arriving-data]]></category>
            <category><![CDATA[idempotent-upserts]]></category>
            <category><![CDATA[atomic-transaction]]></category>
            <dc:creator><![CDATA[Pralhad Teggi]]></dc:creator>
            <pubDate>Tue, 24 Nov 2026 07:05:31 GMT</pubDate>
            <atom:updated>2026-11-24T07:05:31.307Z</atom:updated>
            <content:encoded><![CDATA[<h3>Caught in the Data Torrent - What Is a “Watermark” and Why Is It the Savior of Modern Data Pipelines ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyO63I_miNa1GwtFKjDh9Q.png" /></figure><p>Imagine you’re managing the logistics for a massive, bustling online marketplace. Thousands of package orders are rolling in every minute. To make sure your dashboard knows which orders have been shipped, you decide to import order records into your database.</p><blockquote>On day one, you scan all the order files. Perfect. On day two, you don’t want to waste hours re-scanning the thousands of files you already processed yesterday, right? You only want <em>new</em> packages. So, how do you make sure you grab exactly what’s new without missing a single delivery — or re-scanning yesterday’s freight?</blockquote><p>In the world of data engineering, this is the challenge of <strong>incremental loading</strong> — and the hero that saves the day is called a <strong>watermark</strong>.</p><p>Let’s dive into what a watermark is, how it keeps your pipeline efficient, and why it is the unsung savior of modern data pipelines!</p><h3>The Metaphor: How Did It Get Its Name?</h3><p>Think of a physical watermark on a riverbank or the side of a bridge. It marks the highest point the water has reached. In data engineering, a watermark is a digital marker — usually a timestamp or a sequential ID — that tells the pipeline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*prpjqDiextvmfFHia5bLgA.png" /></figure><blockquote><strong><em>“We have already processed everything up to this exact point. Only inspect things that have arrived or changed </em>after<em> this mark.”</em></strong></blockquote><p>Instead of scanning your entire historic database over and over (which is slow, expensive, and scales horribly), your pipeline reads the watermark, grabs the “incremental” updates, and moves the watermark forward to the new high-water mark.</p><h3>1. How a Watermark Works in Practice</h3><p>Let’s trace a real example using <strong>SupportIQ’s support tickets</strong>.</p><p>Every time a user submits or updates a ticket, it gets an updated_at timestamp. Here is our incoming stream of ticket updates on a busy Tuesday afternoon:</p><ul><li><strong>12:00 PM:</strong> Ticket #101 created</li><li><strong>12:05 PM:</strong> Ticket #102 created</li><li><strong>12:15 PM:</strong> Ticket #103 created</li><li><strong>12:30 PM (Pipeline Run 1):</strong> The pipeline runs. It looks for everything. It processes #101, #102, and #103.</li><li><strong>The Watermark sets to:</strong> 12:15 PM (the highest timestamp processed).</li></ul><p>Now, what happens next?</p><ul><li><strong>12:40 PM:</strong> Ticket #104 created.</li><li><strong>12:50 PM:</strong> Ticket #102 gets updated (e.g., solved by a support agent).</li><li><strong>01:00 PM (Pipeline Run 2):</strong> Instead of scanning the entire database from scratch, the pipeline asks: <em>“Give me everything with </em><em>updated_at &gt; 12:15 PM.&quot;</em></li><li>This query immediately grabs #104 (new) and #102 (updated), but skips #101 and #103 (which haven’t changed).</li><li><strong>The new Watermark sets to:</strong> 12:50 PM</li></ul><p>By checking only the watermark, your pipeline stays blazing fast, processing just two rows instead of five!</p><h3>2. When Watermarks Fail: The Nightmare of the “Late-Arriving Data”</h3><p>Using updated_at seems flawless, right? But the digital world is messy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aE5MiPhlNvEvDTxUmb1yew.png" /></figure><p>Imagine it’s 12:15 PM, and your system has an active watermark of 12:15 PM. Suddenly, the internet blips, or a database server gets delayed. Ticket #105 was actually updated by an offline agent at 12:10 PM, but because of a network delay, it doesn&#39;t actually hit your raw database until 12:20 PM.</p><p>When the pipeline runs again at 12:30 PM, it asks for anything with updated_at &gt; 12:15 PM.</p><ul><li><strong>The disaster:</strong> Ticket #105 (timestamp 12:10 PM) is older than your watermark of 12:15 PM. <strong>It is missed forever.</strong></li></ul><p>This is the nightmare of <strong>late-arriving data</strong>. How do data engineers solve this?</p><h4>The Solution: The “Overlap” Strategy</h4><p>To survive network delays and data “drift”, smart data engineers don’t just look <em>strictly</em> after the watermark. They introduce a grace period — say, one hour.</p><p>Instead of querying updated_at &gt; watermark, they query updated_at &gt; (watermark - 1 hour). They pull in a little bit of previously seen data to capture latecomers, and rely on <strong>idempotent upserts</strong> (like PostgreSQL&#39;s ON CONFLICT DO UPDATE)to insert the late-arriving data while safely ignoring duplicates of files they’ve already processed!</p><h3>3. Watermarks must be “Atomic”</h3><p>To guarantee no row is left behind, your watermark must update in the <strong>exact same database transaction</strong> as your data load. This is called <strong>atomicity</strong>.</p><p>Imagine you write a script that does this:</p><ol><li>Load 500 new rows to the database.</li><li>Update the watermark to 12:50 PM.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6xyQsQP2T4KznLVvjf9IUw.png" /></figure><p>If step 1 succeeds, but your database server crashes or loses power before step 2 can run, you’ve got a serious problem. The data is in, but the watermark is still stuck at 12:15 PM. The next time your pipeline runs, it will attempt to insert those same 500 rows again!</p><p>Conversely, if you update the watermark <em>before</em> successfully inserting the data, and a crash occurs, your pipeline will assume those 500 rows are already processed, skipping them forever.</p><p>By wrapping both the insert and the watermark update inside a single SQL transaction (BEGIN ... COMMIT), you ensure they either both succeed together or fail together—leaving your pipeline&#39;s tracking perfectly accurate, even during crashes.</p><h3>Wrapping Up: Respect the Watermark</h3><p>Watermarks are the invisible rails that keep data pipelines on track. They turn slow, heavy daily workloads into efficient, incremental streams of fresh information.</p><p>The next time you view a real-time reporting dashboard or track a live shipment, remember that behind the scenes, a digital watermark is tirelessly monitoring the flow — ensuring you get exactly what’s new, exactly when you need it, with not a single byte wasted.</p><h3>4. Sample Exercise</h3><p>This Python script demonstrates an <strong>incremental data pipeline</strong> using an atomic watermark and idempotent upserts in an in-memory SQLite database.</p><p>First, it sets up three tables:</p><ul><li>source_tickets (incoming data),</li><li>target_tickets (the destination), and</li><li>etl_watermark (which tracks the latest processed timestamp, initialized to midnight).</li></ul><p>It then inserts three initial tickets into the source table.</p><p>The run_incremental_load function executes four key steps:</p><ol><li><strong>Read Watermark:</strong> Fetches the last saved timestamp from etl_watermark.</li><li><strong>Apply Overlap:</strong> Subtracts one hour from the watermark to create a safety window, ensuring late-arriving updates are not missed.</li><li><strong>Extract:</strong> Queries source_tickets for rows updated after that overlap window.</li><li><strong>Atomic Upsert:</strong> Inside a single BEGIN...COMMIT transaction, it inserts new rows or updates existing ones (ON CONFLICT DO UPDATE) <em>only</em> if the incoming updated_at is newer. In the same transaction, it advances the watermark to the highest timestamp processed. If an error occurs, rollback() cancels both changes.</li></ol><p>Finally, the script runs twice. Run 1 loads the initial three tickets and advances the watermark to 11:00:00. After simulating a late update (10:45:00) and a new ticket (11:30:00), Run 2’s one-hour overlap catches both without duplicating unchanged data.</p><pre>import sqlite3<br>from datetime import datetime, timedelta<br><br># 1. Setup an in-memory SQLite database for demonstration<br>conn = sqlite3.connect(&quot;:memory:&quot;)<br>cur = conn.cursor()<br><br># Create tables: source_tickets, target_tickets, and etl_watermark<br>cur.executescript(&quot;&quot;&quot;<br>    CREATE TABLE source_tickets (<br>        ticket_id INTEGER PRIMARY KEY,<br>        status TEXT,<br>        updated_at TEXT<br>    );<br>    CREATE TABLE target_tickets (<br>        ticket_id INTEGER PRIMARY KEY,<br>        status TEXT,<br>        updated_at TEXT<br>    );<br>    CREATE TABLE etl_watermark (<br>        source TEXT PRIMARY KEY,<br>        wm TEXT<br>    );<br>    INSERT INTO etl_watermark (source, wm) VALUES (&#39;tickets&#39;, &#39;2026-11-24T00:00:00&#39;);<br>&quot;&quot;&quot;)<br><br># Insert initial batch of source data<br>cur.executemany(<br>    &quot;INSERT INTO source_tickets VALUES (?, ?, ?)&quot;,<br>    [<br>        (101, &quot;open&quot;, &quot;2026-11-24T10:00:00&quot;),<br>        (102, &quot;open&quot;, &quot;2026-11-24T10:30:00&quot;),<br>        (103, &quot;closed&quot;, &quot;2026-11-24T11:00:00&quot;),<br>    ],<br>)<br>conn.commit()<br><br><br>def run_incremental_load(connection: sqlite3.Connection) -&gt; None:<br>    cursor = connection.cursor()<br><br>    # Step 1: Read the current watermark<br>    cursor.execute(&quot;SELECT wm FROM etl_watermark WHERE source = &#39;tickets&#39;&quot;)<br>    current_wm_str = cursor.fetchone()[0]<br>    current_wm = datetime.fromisoformat(current_wm_str)<br><br>    # Step 2: Apply a 1-hour overlap window to catch late-arriving data<br>    extract_since = (current_wm - timedelta(hours=1)).isoformat()<br><br>    # Step 3: Extract only rows updated since the overlap window<br>    cursor.execute(<br>        &quot;SELECT ticket_id, status, updated_at FROM source_tickets WHERE updated_at &gt; ?&quot;,<br>        (extract_since,),<br>    )<br>    rows = cursor.fetchall()<br><br>    if not rows:<br>        print(&quot;No new or updated rows found.&quot;)<br>        return<br><br>    # Step 4: Upsert data and advance watermark ATOMICALLY in one transaction<br>    try:<br>        cursor.execute(&quot;BEGIN&quot;)<br><br>        # Idempotent upsert: only overwrite if incoming updated_at is newer<br>        cursor.executemany(<br>            &quot;&quot;&quot;<br>            INSERT INTO target_tickets (ticket_id, status, updated_at)<br>            VALUES (?, ?, ?)<br>            ON CONFLICT(ticket_id) DO UPDATE SET<br>                status = excluded.status,<br>                updated_at = excluded.updated_at<br>            WHERE excluded.updated_at &gt; target_tickets.updated_at<br>            &quot;&quot;&quot;,<br>            rows,<br>        )<br><br>        # Advance watermark to the max updated_at processed (never move backward)<br>        max_batch_wm = max(row[2] for row in rows)<br>        new_wm = max(current_wm_str, max_batch_wm)<br><br>        cursor.execute(<br>            &quot;UPDATE etl_watermark SET wm = ? WHERE source = &#39;tickets&#39;&quot;,<br>            (new_wm,),<br>        )<br><br>        connection.commit()<br>        print(f&quot;Loaded {len(rows)} rows. Watermark advanced: {current_wm_str} -&gt; {new_wm}&quot;)<br>    except Exception as e:<br>        connection.rollback()<br>        print(f&quot;Load failed, rolled back transaction: {e}&quot;)<br><br><br># --- Run 1: Initial load ---<br>run_incremental_load(conn)<br><br># --- Simulate new data + a late-arriving update ---<br>cur.executemany(<br>    &quot;INSERT OR REPLACE INTO source_tickets VALUES (?, ?, ?)&quot;,<br>    [<br>        (102, &quot;resolved&quot;, &quot;2026-11-24T10:45:00&quot;),  # Late-arriving update (before 11:00 watermark!)<br>        (104, &quot;open&quot;, &quot;2026-11-24T11:30:00&quot;),      # Brand new ticket<br>    ],<br>)<br>conn.commit()<br><br># --- Run 2: Incremental load catches both the late update and the new ticket ---<br>run_incremental_load(conn)<br><br># Verify final state<br>print(&quot;Final target_tickets:&quot;, cur.execute(&quot;SELECT * FROM target_tickets ORDER BY ticket_id&quot;).fetchall())</pre><p>Thanks for reading …</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=477c6099c93d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your CSV Passed the Pipeline — Your Data Didn’t: Building Trustworthy Data with Contracts…]]></title>
            <link>https://medium.com/@pralhad2481/your-csv-passed-the-pipeline-8444325e63a3?source=rss-d23ca72419ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/8444325e63a3</guid>
            <category><![CDATA[data-contract]]></category>
            <category><![CDATA[pandera-framework]]></category>
            <category><![CDATA[data-quarantine]]></category>
            <category><![CDATA[data-quality-validation]]></category>
            <category><![CDATA[error-handling]]></category>
            <dc:creator><![CDATA[Pralhad Teggi]]></dc:creator>
            <pubDate>Mon, 23 Nov 2026 07:47:36 GMT</pubDate>
            <atom:updated>2026-11-23T10:06:44.145Z</atom:updated>
            <content:encoded><![CDATA[<h3>Your CSV Passed the Pipeline — Your Data Didn’t: Building Trustworthy Data with Contracts, Validation &amp; Quarantine</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VhwqAU1OHODadQAqiBx_IA.png" /></figure><blockquote><em>What happens when a data pipeline runs successfully, but the information it delivers is wrong? Welcome to one of the most overlooked challenges in production data engineering.</em></blockquote><h4>Imagine this —</h4><p>It’s 9:00 AM on a Monday. The Head of Customer Support opens the company’s operational dashboard, expecting to see the latest ticket volumes, customer complaints, and order statistics.</p><p>Instead, something looks terribly wrong.</p><p>The dashboard reports a negative order value of ₹50,000. A customer-support ticket appears to have been created in the year 2099. Several hundred tickets are missing from the previous day’s report.</p><p>The data engineering team checks the overnight pipeline.</p><blockquote>Pipeline execution: SUCCESS</blockquote><p><strong>No server crashed. No database connection failed. The scheduler completed its job.</strong></p><p>Yet the business is looking at incorrect information.</p><p><strong>This is the uncomfortable reality of data engineering — a technically successful pipeline does not guarantee trustworthy data.</strong></p><p>And if that same data feeds an AI model, the consequences can extend far beyond a broken dashboard.</p><blockquote>In this article, we’ll explore how <strong>data contracts, Pandera validation, PostgreSQL quarantine tables, and idempotent upserts</strong> work together to solve this problem using a simulated enterprise platform called SupportIQ.</blockquote><h3>1. Meet SupportIQ: The Business Behind the Engineering</h3><p>SupportIQ is a simulated enterprise customer-support analytics and triage platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CkF_Zd9wqgSr5TfgRiNIkg.png" /></figure><p>Think about a large e-commerce company receiving thousands of customer interactions every day. Customers want to know why orders are delayed. Some request refunds. Others complain about damaged products, incorrect deliveries, or failed payments. These interactions arrive through email, live chat, phone calls, and social media.</p><p>The company wants to answer questions such as:</p><ul><li>How many critical support tickets arrived today?</li><li>Which customers are repeatedly reporting delivery problems?</li><li>What percentage of high-priority tickets remain unresolved?</li><li>Which orders are associated with the most complaints?</li><li>Can machine learning automatically identify and prioritize urgent tickets?</li></ul><p>To answer these questions reliably, SupportIQ needs a trustworthy data foundation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*_-jIzoG-iOWYKPUtHXzEmw.png" /></figure><p>The SupportIQ Engineering Stack is the practical curriculum behind this journey. Rather than studying Python, YAML, PostgreSQL, and workflow automation as disconnected technologies, learners build components of a realistic data platform.</p><p>In this article, the focus is on one essential question:</p><blockquote><strong>How can we ensure that every incoming record is either accepted as valid or preserved for investigation ?</strong></blockquote><h3>2. The Golden Rule: No Row Left Behind</h3><p>Imagine SupportIQ receives a CSV containing 10,000 customer-support tickets.</p><p>During validation, the pipeline discovers:</p><ul><li>150 records with missing customer IDs.</li><li>80 records with unsupported support channels.</li><li>40 records with negative order values.</li></ul><blockquote>30 records with invalid timestamps.</blockquote><p>For this example, assume the errors occur in distinct rows.</p><blockquote>A poorly designed pipeline might silently drop all 300 invalid records. The database would contain 9,700 tickets, and the dashboard might still look perfectly normal.</blockquote><p><strong>But what happened to the other 300 ?</strong></p><p>Were they duplicate records? Genuine customer complaints? High-priority issues that needed immediate attention ?</p><p>Nobody knows. A trustworthy pipeline follows a simple accounting principle:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*TIkTUBqw8TWWK3Wrnrszag.png" /></figure><p>The important principle is not that every record must be perfect. It is that <strong>every record must have an explainable outcome</strong>. This is where our three engineering building blocks enter the picture.</p><h3>3. Data Contracts: Agree on the Rules Before Writing Code</h3><p>Think about ordering a package from an online retailer. The courier company has rules about package dimensions, weight, labeling, and delivery addresses. A package without a destination address cannot simply be treated as a normal shipment.</p><p>Data contracts serve a similar purpose.</p><blockquote>A <strong>data contract</strong> is an explicit agreement between a data producer and a data consumer defining what valid data looks like, when it should arrive, and who is responsible when it violates expectations.</blockquote><p>In SupportIQ, the customer-support operations team produces ticket exports. The data engineering team consumes them.</p><blockquote>Without a contract, the producer might suddenly rename customer_id to client_reference, change timestamps to a different format, or introduce a new priority value such as urgent.</blockquote><p>The pipeline might break, or worse, accept the changes incorrectly.</p><h4>A real SupportIQ data contract</h4><p>Let’s create contracts/tickets.yaml</p><pre>dataset: tickets<br>owner:<br>  producer: client-support-ops<br>  consumer: data-engineering<br>freshness:<br>  max_age_hours: 24<br>  check_time: &quot;06:00&quot;<br>  timezone: &quot;Asia/Kolkata&quot;<br>primary_key: ticket_id<br>columns:<br>  ticket_id:<br>    type: int<br>    required: true<br>    unique: true<br>  customer_id:<br>    type: str<br>    required: true<br>    references: customers.customer_id<br>  channel:<br>    type: str<br>    required: true<br>    allowed:<br>      - email<br>      - chat<br>      - phone<br>      - social media<br>  priority:<br>    type: str<br>    allowed:<br>      - low<br>      - medium<br>      - high<br>      - critical<br>  order_value:<br>    type: float<br>    min: 0<br>  created_at:<br>    type: timestamptz<br>    format: ISO 8601<br>    not_in_future: true<br>on_violation:<br>  action: quarantine<br>  reason_code_required: true<br>  minimum_validity: 0.80</pre><p>Notice that the contract is readable even by someone who doesn’t write Python. A support operations manager can understand that priority must contain one of four allowed values and that order values cannot be negative.</p><p>The contract also establishes accountability.</p><p>If the support team sends invalid data, the engineering team does not have to silently invent corrections. The producer can be notified with the exact reason for rejection.</p><h3>Why data contracts matter beyond validation</h3><p>Data contracts deliver three business benefits.</p><ul><li><strong>First, they prevent surprise changes.</strong> A renamed column or unsupported value becomes a visible contract violation rather than an unexplained downstream failure.</li><li><strong>Second, they protect machine learning systems.</strong> If SupportIQ eventually trains an AI model to prioritize customer tickets, inconsistent or invalid records can undermine training and predictions.</li><li><strong>Third, they establish operational boundaries.</strong> A validity threshold of 80% can act as a circuit breaker. If a batch falls below the agreed threshold, the system can stop promotion into production and raise an alert.</li></ul><p>One important distinction: YAML is the contract’s representation, not the validation engine itself. Python code or another enforcement mechanism must interpret and apply those rules.</p><h3>4. Pandera: The Quality Inspector That Finds More Than One Mistake</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lk-jS_XHWQa-s1plz907GQ.png" /></figure><p>Now imagine a customs officer inspecting 100 incoming shipments.</p><p>The first shipment has an invalid label. The officer stops immediately and sends everyone home. That would be a terrible inspection process.</p><p>Yet many beginner Python validation scripts behave exactly this way. They encounter the first invalid record, raise an exception, and stop processing.</p><p>For data engineering, we often need to discover <strong>all relevant validation failures in a batch</strong>, not just the first one. This is where Pandera becomes useful.</p><blockquote>Pandera lets developers define schemas and validation checks for pandas DataFrames.</blockquote><h3>Building a SupportIQ validation schema</h3><pre><br>import pandas as pd<br>import pandera.pandas as pa<br><br>CHANNELS = [<br>    &quot;email&quot;,<br>    &quot;chat&quot;,<br>    &quot;phone&quot;,<br>    &quot;social media&quot;<br>]<br><br>TICKETS = pa.DataFrameSchema(<br>    {<br>        &quot;ticket_id&quot;: pa.Column(<br>            int,<br>            nullable=False,<br>            unique=True<br>        ),<br><br>        &quot;channel&quot;: pa.Column(<br>            str,<br>            pa.Check.isin(<br>                CHANNELS,<br>                error=&quot;BAD_ENUM&quot;<br>            )<br>        ),<br><br>        &quot;order_value&quot;: pa.Column(<br>            float,<br>            pa.Check.ge(<br>                0,<br>                error=&quot;OUT_OF_RANGE&quot;<br>            ),<br>            nullable=True<br>        ),<br><br>        &quot;created_at&quot;: pa.Column(<br>            &quot;datetime64[ns, UTC]&quot;,<br>            pa.Check(<br>                lambda s: s &lt;= pd.Timestamp.now(<br>                    tz=&quot;UTC&quot;<br>                ),<br>                error=&quot;FUTURE_DATE&quot;<br>            )<br>        ),<br>    },<br>    coerce=True,<br>    strict=False<br>)</pre><p>This is an illustrative subset of the YAML contract. A complete implementation must also enforce customer_id, priority, referential integrity, and the batch freshness requirement.</p><h4>The importance of lazy=True</h4><p>Suppose the following records arrive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*JrbZ45SxupJyJgL-iKwrqg.png" /></figure><p>Rather than stopping at the first error, Pandera can collect multiple validation failures.try: TICKETS.validate(df, lazy=True)except pa.errors.SchemaErrors as exc: print(exc.failure_cases)</p><pre>try:<br>    TICKETS.validate(df, lazy=True)<br>except pa.errors.SchemaErrors as exc:<br>    print(exc.failure_cases)</pre><p>The resulting failure information can be transformed into a report like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*YxuKvjLXT0qWC7-gWskA-g.png" /></figure><p>The source-row numbers assume a CSV header and zero-based DataFrame indexing.</p><blockquote>This makes validation actionable. Instead of receiving a vague message saying <em>“Data validation failed”</em>, the operations team knows exactly which record and field need attention.</blockquote><h4>The tricky case: Invalid dates</h4><p>Dates are particularly troublesome.</p><p>One record might contain 2026-11-20, another 20/11/2026, and a third not-a-date.</p><p>A practical approach is to normalize timestamps before schema validation.</p><pre>df[&quot;created_at&quot;] = pd.to_datetime(<br>    df[&quot;created_at&quot;],<br>    errors=&quot;coerce&quot;,<br>    utc=True,<br>    format=&quot;mixed&quot;<br>)</pre><p>Unparseable values become NaT, which can be identified and tagged as BAD_FORMAT before the remaining checks run.</p><p>However, mixed-format parsing should only be allowed if the contract permits it. Otherwise, accepting multiple date formats could hide a producer-side contract violation.</p><p>Also, Pandera’s collected failures need to be mapped into your application’s standardized reason codes. The library does not automatically create a complete quarantine workflow.</p><h3>5. Quarantine Tables: Why Bad Data Shouldn’t Disappear</h3><p>Let’s return to the 300 invalid SupportIQ tickets.</p><p>We know they should not enter the production analytics table. But deleting them would destroy valuable evidence. Instead, we create a quarantine table.</p><blockquote>Think of quarantine as the lost-and-found desk at an airport.</blockquote><p>A suitcase with an unreadable tag is not placed on a random flight. It is moved to a controlled area, where staff record its origin, identify the problem, and investigate.</p><p>The same principle applies to invalid data.</p><h4>Designing a PostgreSQL quarantine table</h4><pre>CREATE TABLE IF NOT EXISTS quarantine_tickets (<br>    run_id UUID NOT NULL,<br>    source_file TEXT NOT NULL,<br>    source_row INT NOT NULL,<br>    reason_code TEXT NOT NULL<br>    CHECK (<br>        reason_code IN (<br>            &#39;NULL_REQUIRED&#39;,<br>            &#39;BAD_ENUM&#39;,<br>            &#39;OUT_OF_RANGE&#39;,<br>            &#39;BAD_TYPE&#39;,<br>            &#39;BAD_FORMAT&#39;,<br>            &#39;FUTURE_DATE&#39;,<br>            &#39;DUPLICATE_STALE&#39;,<br>            &#39;ORPHAN_FK&#39;<br>        )<br>    ),<br>    payload JSONB NOT NULL,<br>    quarantined_at TIMESTAMPTZ<br>        NOT NULL DEFAULT now()<br>);</pre><p>The payload column is especially important. It preserves the original invalid record as JSON, making it possible to investigate what was actually received.</p><p>For example:</p><pre>{<br>  &quot;ticket_id&quot;: 103,<br>  &quot;customer_id&quot;: &quot;C502&quot;,<br>  &quot;channel&quot;: &quot;chat&quot;,<br>  &quot;priority&quot;: &quot;high&quot;,<br>  &quot;order_value&quot;: -250,<br>  &quot;created_at&quot;: &quot;2026-11-20T09:30:00Z&quot;<br>}</pre><p>The corresponding reason code would be OUT_OF_RANGE.</p><p>A production implementation should also enforce a stable row identifier and idempotent quarantine writes, so retrying the same batch does not create duplicate quarantine entries.</p><h4>Why the original row number matters</h4><p>When using pandas, the first data row typically has index 0. But in a CSV file with one header line, that record appears on physical line 2.</p><p>For a simple CSV with no embedded line breaks:</p><pre>source_row = dataframe_index + 2</pre><p>This helps operations teams locate the offending record. For CSVs containing multiline quoted fields, use an ingestion-generated source identifier rather than assuming the DataFrame index matches the physical line number.</p><h4>The business benefit</h4><p>Quarantine transforms a technical failure into an operational workflow.</p><p>The data engineering team can send the producer a report showing the invalid records, reason codes, and original source references. The producer can fix the source and resubmit it.</p><p>No data needs to disappear silently.</p><h3>6. Idempotent Upserts: Why Running a Pipeline Twice Shouldn’t Change the Result</h3><p>Now imagine the SupportIQ pipeline loads 10,000 records successfully. Five minutes later, an engineer realizes that the scheduled job was triggered twice.</p><p>What happens?</p><p>In a poorly designed system, the database might contain 20,000 rows. Ticket counts double. Dashboards become misleading. Downstream reporting breaks.</p><blockquote>This is why production pipelines need <strong>idempotency</strong>.</blockquote><p>An idempotent operation produces the same intended final state when repeated with the same input, assuming no relevant external changes.</p><blockquote>For database ingestion, PostgreSQL’s INSERT ... ON CONFLICT is a useful building block.</blockquote><h4>The stale-record problem</h4><p>Consider a ticket with ID 42.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*QQP7JH6TZ0cZ3nfPfxtMJg.png" /></figure><p>A timestamp-guarded upsert solves this.</p><pre>INSERT INTO tickets AS t (<br>    ticket_id,<br>    customer_id,<br>    channel,<br>    priority,<br>    created_at,<br>    updated_at<br>)<br>SELECT<br>    ticket_id,<br>    customer_id,<br>    channel,<br>    priority,<br>    created_at,<br>    updated_at<br>FROM staging_tickets<br>ON CONFLICT (ticket_id)<br>DO UPDATE SET<br>    channel = EXCLUDED.channel,<br>    priority = EXCLUDED.priority,<br>    updated_at = EXCLUDED.updated_at<br>WHERE EXCLUDED.updated_at &gt; t.updated_at;</pre><p>The most important line is:</p><pre>WHERE EXCLUDED.updated_at &gt; t.updated_at;</pre><p><strong>This tells PostgreSQL to update the existing record only if the incoming version is newer.</strong></p><p>If the incoming record is older or has the same timestamp, the existing row remains unchanged.</p><p>For this to work, ticket_id needs an appropriate unique constraint or primary key. The staging data must also be deduplicated before the upsert, and the update statement must include every field that should be refreshed.</p><p>In SupportIQ, older duplicate records can be routed to quarantine with the reason code DUPLICATE_STALE.</p><p>The result is a pipeline that can safely handle retries, delayed exports, and repeated ingestion attempts.</p><h3>7. Bringing Everything Together: The SupportIQ Quality Gate</h3><p>By now, we have three essential mechanisms.</p><ul><li><strong>Data contracts</strong> define the expectations.</li><li><strong>Pandera </strong>checks incoming data against those expectations.</li><li><strong>PostgreSQL </strong>stores valid records, preserves invalid ones, and prevents stale updates.</li></ul><blockquote>But how do we know the complete pipeline works?</blockquote><p>The answer is to test the system as a whole.</p><h4>The final verification checklist</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6EuCdw5W3OnoeU5I7OcUsA.png" /></figure><ul><li>The image illustrates the <strong>SupportIQ Data Quality Test Matrix</strong>, showing ten essential validation scenarios in a production data pipeline.</li><li>Valid CSV records move into PostgreSQL staging and production tables, while invalid records are quarantined with specific reason codes such as BAD_ENUM, OUT_OF_RANGE, FUTURE_DATE, and ORPHAN_FK.</li><li>Duplicate stale tickets are rejected to protect newer records.</li><li>Idempotent processing ensures repeated batch loads do not create duplicates.</li><li>A quality gate blocks production updates when data validity falls below 80%.</li><li>Finally, audit reconciliation ensures every input record is accounted for, establishing <strong>data integrity, traceability, reliability, and accountability</strong> throughout the pipeline.</li></ul><h3>8. The Bigger Picture: Data Quality Is an AI Reliability Problem</h3><p>Why should AI engineers care about data contracts and quarantine tables?</p><blockquote>Because modern AI systems depend on more than powerful models.</blockquote><p>Imagine SupportIQ introduces a machine learning model that predicts whether a customer-support ticket should receive high-priority attention.</p><p><strong>The model learns from historical support tickets.</strong> But what if the historical data contains incorrect priority labels, missing customers, duplicated tickets, or negative order values?. Even a sophisticated model cannot automatically distinguish every data-entry error from a genuine business pattern.</p><blockquote>Poor data quality can create unreliable predictions, misleading evaluations, and costly operational decisions.</blockquote><p><strong>A trustworthy AI pipeline therefore begins before model training</strong>.</p><blockquote>It starts with clear data ownership, consistent schemas, validation, traceability, and repeatable ingestion.</blockquote><ul><li><strong>Data contracts protect the meaning of the data.</strong></li><li><strong>Validation protects its integrity.</strong></li><li><strong>Quarantine protects its traceability.</strong></li><li><strong>Idempotency protects its consistency.</strong></li></ul><p>Together, these practices create the foundation for reliable analytics and AI systems.</p><h3>Conclusion: A Green Pipeline Is Not the Same as Good Data</h3><p>Remember the broken SupportIQ dashboard from the beginning?</p><p>The pipeline completed successfully, but nobody had verified whether the data was trustworthy.That is the distinction between simply moving data and engineering a reliable data platform.</p><p>A production-grade pipeline should not merely answer, <em>“Did the job finish?”</em></p><p>It should also answer:</p><ul><li>Did the data meet the agreed contract?</li><li>Which records were accepted or rejected?</li><li>Why did each rejection happen?</li><li>Can we safely replay the same input?</li><li>Can we explain every change made to production data?</li></ul><p>When a pipeline can answer those questions, data quality becomes an observable, testable engineering capability rather than an assumption.</p><p>And that is the real lesson behind SupportIQ:</p><blockquote><strong>Don’t just build pipelines that run. Build pipelines that deserve to be trusted.</strong></blockquote><p>Thanks for reading ..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8444325e63a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 2— From Zero to Live: Inside the Forward Deployed Engineer (FDE) Operating Model]]></title>
            <link>https://medium.com/@pralhad2481/day-2-from-zero-to-live-inside-the-forward-deployed-engineer-fde-operating-model-d558a6f538db?source=rss-d23ca72419ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/d558a6f538db</guid>
            <category><![CDATA[forward-deployed-engineer]]></category>
            <category><![CDATA[enterprise-ai-deployment]]></category>
            <category><![CDATA[fde-operating-model]]></category>
            <dc:creator><![CDATA[Pralhad Teggi]]></dc:creator>
            <pubDate>Sun, 22 Nov 2026 05:40:43 GMT</pubDate>
            <atom:updated>2026-11-22T05:40:43.110Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YfRfiq5YNU6IaEDa8dFGXA.png" /></figure><p>If Day 1 of learning about Forward Deployed Engineering (FDE) is about understanding <em>what</em> the role is, Day 2 is : <strong>how an FDE actually operates inside a customer’s business from day one to launch</strong>.</p><p>Unlike traditional software engineers who build features from a headquarters backlog, an FDE steps directly into a customer’s world — often with a messy problem, a tight deadline, and high stakes. To survive and succeed, you need a repeatable playbook.</p><p>Here is a breakdown of the <strong>FDE Operating Model</strong> — taking an idea from initial discovery all the way to production, complete with real-world examples.</p><h3>1. The 5-Stage FDE Lifecycle</h3><p>When an FDE joins a customer engagement from scratch (often called a <strong>“0→1” engagement</strong>), they don’t just start coding. They follow a clear five-step lifecycle, producing specific deliverables (<strong>artifacts</strong>) at every stage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aRb0OX15OVIOTpsolLXaEA.png" /></figure><p><strong>1 — Discovery (Finding the Real Problem):</strong> Customers often ask for a specific tool, when what they actually need is a solution to a workflow bottleneck. During discovery, you interview end-users, shadow their daily work, and map out where time or money is being lost.</p><p><em>Artifact produced:</em> A <strong>Problem Statement &amp; Workflow Map</strong>.</p><p><strong>2 — Scoping (Drawing the Finish Line):</strong> You cannot solve everything at once — especially under a strict business deadline. Scoping defines the <strong>Minimum Viable Product (MVP)</strong>: the smallest, simplest version of the solution that solves the core pain point on time.</p><p><em>Artifact produced:</em> A <strong>1-Page Engagement Plan</strong> (with milestones, risks, and clear boundaries).</p><p><strong>3 — Prototype (Building Fast to Learn Fast):</strong> Instead of spending months building a polished product in the dark, an FDE builds a working prototype in days. You put real customer data into it early to see if it actually works.</p><p><em>Artifact produced:</em> A <strong>Working Demo / Proof of Concept (PoC)</strong>.</p><p><strong>4 — Production (Making It Bulletproof):</strong> A prototype works on your laptop; a production system works reliably at 2:00 AM when 500 employees depend on it. Moving from prototype to production requires strict <strong>handoff gates</strong> — security approvals, error handling, and performance testing.</p><p><em>Artifact produced:</em> <strong>Production Readiness Checklist &amp; Live System</strong>.</p><p><strong>5 — Enablement (Handing Over the Keys):</strong> An FDE’s goal isn’t to stay forever; it’s to make the customer self-sufficient. Enablement means training the customer’s team, writing clear documentation, and setting up support channels.</p><p><em>Artifact produced:</em> <strong>User Playbooks, Training Guides &amp; Handover Docs</strong>.</p><blockquote><strong><em>The Ownership Mindset:</em></strong><em> In a 0→1 engagement, an FDE doesn’t say, </em>“That’s not my ticket.”<em> If the database access is blocked or a legal team hasn’t reviewed a form, you own the outcome — meaning you unblock it, escalate it, or find a workaround until the solution goes live.</em></blockquote><h3>2. Embedding Inside a Customer Org: Norms, Boundaries &amp; Cadence</h3><p>Being “embedded” means working shoulder-to-shoulder with the client — whether on-site at their office or inside their Slack/Teams channels.</p><ul><li><strong>Respecting Norms &amp; Boundaries:</strong> Every company has its own culture. A Wall Street bank moves differently than a fast-paced logistics startup. You adapt to their communication style while maintaining healthy boundaries — making sure you remain a trusted technical partner rather than getting pulled into unrelated IT support tasks.</li><li><strong>On-Site vs. Remote Cadence:</strong> High-stakes moments (like kickoff workshops or launch week) usually happen <strong>on-site</strong> so you can read the room and build trust fast. Routine building and iteration often happen <strong>remotely</strong> with regular daily standups.</li><li><strong>The Real-Time Product Feedback Loop:</strong> Because you are sitting next to real users, you spot product gaps before anyone else. If three different customers struggle with the same data-upload step, you feed that insight straight back to your core product engineering team so they can build a permanent feature on the <strong>product roadmap</strong>.</li></ul><h3>3. Putting It Into Practice: The FDE’s 21-Day Race Against a Regulatory Audit</h3><p>Imagine it’s Monday morning. You’ve just joined a large financial services company as a Forward Deployed Engineer (FDE).</p><p>At 9:15 AM, the Head of Legal walks into your kickoff meeting and says:</p><blockquote><em>“We have a regulatory audit in three weeks. Our legal team needs to review thousands of contracts for compliance. We cannot do this manually. Can you build an AI system that checks our contracts before the auditors arrive?”</em></blockquote><p>You have <strong>21 calendar days, a small engineering team, limited access to legal documents, and almost no room for mistakes.</strong></p><p>A traditional engineering approach might begin with architecture discussions, infrastructure planning, and a comprehensive requirements document.</p><p>An FDE asks a different question:</p><p><strong>“What is the smallest reliable solution we can put into the legal team’s hands before the audit?”</strong></p><h4>Day 1: Discover the problem behind the request</h4><p>The customer initially wants an AI system capable of reading 10,000 contracts. But after interviewing two senior lawyers and observing their review process, you discover something important.</p><p>The audit does not require every contract to be analyzed for every possible legal issue. The legal team is primarily concerned about three high-risk clause categories:</p><ol><li><strong>Data protection:</strong> Does the contract contain the required data-handling and confidentiality provisions?</li><li><strong>Termination rights:</strong> Are mandatory termination conditions included?</li><li><strong>Regulatory compliance:</strong> Does the contract include the required compliance obligations?</li></ol><p>The lawyers are currently opening PDFs, searching for relevant clauses, comparing them with approved templates, and recording findings in spreadsheets.</p><p>Each contract takes approximately 15 minutes to review.</p><p>Illustrative manual review workload</p><blockquote>200 Priority contracts</blockquote><blockquote>50 hours Manual review effort</blockquote><blockquote>3 weeks Audit deadline</blockquote><p>The FDE identifies the real business problem: <strong>Reduce the time lawyers spend locating and comparing high-risk clauses, while preserving human review and defensible evidence.</strong></p><p>That is a much more achievable objective than automating the entire legal department.</p><h4>Day 2: Define the MVP and draw the boundaries</h4><p>The FDE creates a one-page engagement plan that everyone can understand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*Tdm5bhHbFTCUGB5_nPhYJA.png" /></figure><p>The FDE also makes a crucial distinction: <strong>the system will identify potential compliance issues, not make final legal determinations.</strong></p><h4>Week 1: Build something lawyers can actually test</h4><p>The first week is about learning quickly, not producing a perfect application.</p><p>The FDE builds a working prototype that accepts a contract PDF, extracts its text, searches for the three required clause categories, and presents the findings in a simple dashboard.</p><p>Prototype workflow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kP8RgZILKUMdtgu-zVG5LA.png" /></figure><p>The lawyers test the prototype against 20 contracts. They immediately discover that some agreements use different wording for the same legal obligation.</p><p>For example, a termination clause might say <em>“Either party may terminate this agreement”</em>, while another says <em>“The agreement may be brought to an end by either contracting party.”</em></p><p>A simple keyword search might miss the second version.</p><p>This is where the FDE earns their value: observing the failure, collecting examples, and improving the detection approach with the lawyers rather than guessing from an engineering desk.</p><h4>Week 2: Move from a demo to a dependable workflow</h4><p>The FDE expands testing to 200 contracts and begins addressing difficult cases.</p><p><strong>Some PDFs are scanned. Others contain tables, amendments, or multiple clauses spread across pages</strong>. A few contracts contain the required words but not the required legal obligations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B64bNl1rrFjrvSlZmMofcw.png" /></figure><p>The team now introduces several safeguards:</p><ul><li><strong>Evidence traceability:</strong> Every finding links to the source document, page, and supporting passage.</li><li><strong>Confidence handling:</strong> Uncertain findings are routed for manual review rather than silently marked compliant.</li><li><strong>Evaluation:</strong> Lawyers label representative examples, allowing the team to measure detection quality.</li><li><strong>Error handling:</strong> Corrupted files and failed OCR jobs are reported clearly.</li><li><strong>Audit logs:</strong> The application records which documents were processed, when, and with which rule version.</li></ul><p>The FDE also tracks false negatives, because missing a genuinely noncompliant clause can be more consequential than flagging a compliant one for review.</p><h4>Week 3: Cross the production gate</h4><p>The prototype looks impressive. But can the legal team safely depend on it?</p><p>Before deployment, the FDE establishes three non-negotiable production gates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uLnYFNu7Lja17h3zro5tXw.png" /></figure><p><strong>Gate 1 — Demonstrated accuracy</strong></p><p>The system must meet the agreed target of greater than 95% clause-detection accuracy on an independently labeled test set. Recall, precision, and false negatives must also be reviewed by clause category.</p><p><strong>Gate 2 — Security approval</strong></p><p>Contract data remains within the customer’s approved secure environment, with appropriate access controls, encryption, retention rules, and security sign-off.</p><p><strong>Gate 3 — Customer independence</strong></p><p>Two paralegals must be able to upload contracts, interpret findings, export reports, and handle common errors without FDE assistance.</p><p>If any gate fails, the FDE does not declare success simply because the software runs. The team narrows the release scope, adds human review, or resolves the blocker before go-live.</p><h4>The final handover: What does success look like?</h4><p>At the end of the engagement, the customer should receive more than an application.</p><p>The deliverables include a working contract-review system, a documented evaluation report, security approval evidence, a user playbook, an operations runbook, and a prioritized backlog for future improvements.</p><p>The business impact can be illustrated with a simple scenario.</p><p>If the new workflow reduces average human review time from 15 minutes to 5 minutes across 200 contracts, the estimated saving is:</p><p>Illustrative potential time saving</p><blockquote>33.3 hours</blockquote><blockquote>200 contracts × 10 minutes saved ÷ 60</blockquote><p>This is a projected scenario, not a measured result. Actual savings would need to account for exceptions, manual verification, and operational overhead.</p><p>The most important outcome is that the legal team can complete its priority review with greater consistency, traceability, and confidence.</p><p><strong>That is the essence of forward deployment: not merely shipping AI software, but turning a time-sensitive business problem into a working, trusted operational capability.</strong></p><h3>Why This Model Works</h3><p>The magic of the FDE operating model is speed paired with discipline. By moving smoothly from <strong>discovery to enablement</strong>, enforcing clear <strong>production gates</strong>, and keeping an <strong>ownership mindset</strong>, FDEs turn vague, high-pressure business requests into real software that people actually use.</p><p>Thanks for reading …</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d558a6f538db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond OCR: How Automated Consistency Checks Catch Hidden Document Fraud and Errors]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@pralhad2481/beyond-ocr-how-automated-consistency-checks-catch-hidden-document-fraud-and-errors-658d596e757b?source=rss-d23ca72419ac------2"><img src="https://cdn-images-1.medium.com/max/1754/1*DwtQKcOnE0V_kf2FEIZU-Q.png" width="1754"></a></p><p class="medium-feed-snippet">Extracting text from a document is only half the battle. Optical Character Recognition (OCR) and AI data extraction tools can read dates&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@pralhad2481/beyond-ocr-how-automated-consistency-checks-catch-hidden-document-fraud-and-errors-658d596e757b?source=rss-d23ca72419ac------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@pralhad2481/beyond-ocr-how-automated-consistency-checks-catch-hidden-document-fraud-and-errors-658d596e757b?source=rss-d23ca72419ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/658d596e757b</guid>
            <category><![CDATA[intelligentdocumentproces]]></category>
            <category><![CDATA[fraud-detection]]></category>
            <category><![CDATA[ocr]]></category>
            <category><![CDATA[document-validation]]></category>
            <category><![CDATA[financial-reconciliation]]></category>
            <dc:creator><![CDATA[Pralhad Teggi]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 15:58:20 GMT</pubDate>
            <atom:updated>2026-11-18T15:58:20.497Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Day 1 — Forward Deployed Engineer: Welcome to the “Last Mile” of AI]]></title>
            <link>https://medium.com/@pralhad2481/day-1-forward-deployed-engineer-welcome-to-the-last-mile-of-ai-e6e9dc4b6561?source=rss-d23ca72419ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6e9dc4b6561</guid>
            <category><![CDATA[tech-career]]></category>
            <category><![CDATA[ai-deployment]]></category>
            <category><![CDATA[applied-ai]]></category>
            <category><![CDATA[forward-deployed-engineer]]></category>
            <category><![CDATA[enterprise-ai]]></category>
            <dc:creator><![CDATA[Pralhad Teggi]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 07:14:05 GMT</pubDate>
            <atom:updated>2026-11-18T07:14:05.013Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*caefsEgQjRyPTQcM_JqrYg.png" /></figure><p>Imagine buying the world’s most expensive commercial espresso machine, setting it on your kitchen counter, and realizing you have no plumbing hookup, no coffee beans, and no idea how to turn it on.</p><p>In 2026, that is the exact problem most major companies have with Artificial Intelligence. They have access to the smartest AI models ever built, yet <strong>roughly 95% of enterprise AI pilots stall before they ever reach real users</strong>. Why? Because the bottleneck isn’t the AI model anymore — it’s the <strong>deployment</strong>.</p><p>Welcome to <strong>Day 1</strong> of our deep dive into one of the fastest-growing, highest-impact careers in tech right now: the <strong>Forward Deployed Engineer (FDE)</strong>. Here is a breakdown of what this role actually is, why the market is exploding, and how you can position yourself right at the center of it.</p><h3>1. What on Earth is a Forward Deployed Engineer?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DYUDKz0qW0lTfpVtM51vHw.png" /></figure><p>If you take a traditional Software Engineer (SWE) and drop them directly into the trenches with a customer to solve their messiest, highest-stakes problems using code, you get an FDE.</p><p>The role was originally pioneered by <strong>Palantir</strong> (where it was called the Forward Deployed Software Engineer, or FDSE). Instead of sitting at headquarters building generic features for millions of users, Palantir sent engineers directly to hospitals, factories, and government agencies to build custom solutions on top of their core platform.</p><p>Today, in the “deployment-company era,” AI giants like <strong>OpenAI, Anthropic, Google Cloud, Databricks, and Scale AI</strong> have realized they can’t just hand over an API key and walk away. They need engineers on the front lines making the AI actually work inside messy corporate systems.</p><h3>Clearing Up the Confusion: FDE vs. Everybody Else</h3><p>Because the role is so cross-functional, people often confuse FDEs with other customer-facing tech roles. Here is how they differ:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PkvG-PO-4GnfJZcJ20azZQ.png" /></figure><blockquote><strong>Crucial takeaway:</strong> An FDE is an <strong>engineering role, not a sales role</strong>. You don’t carry a sales quota. Your job is to ship working software that makes the customer successful.</blockquote><h3>2. The “Last-Mile” Thesis: Why 95% of AI Pilots Fail</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_73vT1FIMhOYbgYHIlN10Q.png" /></figure><p>Think about how online shopping works. Getting a package from a massive warehouse in another country to your local city hub is fast and automated. The hardest, most expensive part is the <strong>“last mile”</strong> — getting that box from the local truck onto your specific front porch, past your locked gate, and out of the rain.</p><p>Enterprise AI has the exact same problem:</p><ul><li><strong>The Easy Part (The Model):</strong> Calling an LLM API to summarize a PDF or answer a question in a clean Jupyter notebook takes 10 minutes.</li><li><strong>The Hard Part (The Last Mile):</strong> Connecting that AI to a 20-year-old banking database, ensuring it doesn’t leak private customer data, handling messy handwritten invoices, and making sure it responds in under two seconds when 10,000 employees use it at once.</li></ul><p>Companies don’t fail at AI because GPT or Claude isn’t smart enough. They fail because nobody bridged the gap between the AI model and their messy reality. <strong>FDEs are the bridge.</strong></p><h3>3. Decoding the 2026 Market &amp; Job Titles</h3><p>If you go looking for these jobs today, you won’t just see the title “Forward Deployed Engineer.” Different tech giants use different names for the exact same DNA:</p><ul><li><strong>Palantir:</strong> Forward Deployed Software Engineer (FDSE)</li><li><strong>Anthropic:</strong> Applied AI Engineer</li><li><strong>OpenAI / Scale AI:</strong> Forward Deployed Engineer (FDE)</li><li><strong>Google Cloud / Databricks:</strong> Solutions Architect — AI / Specialist Engineer</li></ul><h3>Why Everyone is Hiring FDEs Right Now</h3><p>The market signals in 2026 are impossible to ignore:</p><ol><li><strong>800%+ Surge in Job Postings:</strong> As companies shift budgets from “AI experiments” to “AI production,” demand for engineers who can deploy has skyrocketed.</li><li><strong>NYC is Overtaking San Francisco:</strong> While SF builds the foundational models, New York City — home to finance, media, healthcare, and Fortune 500 headquarters — has become the epicenter for FDE hiring because that’s where the customers are.</li><li><strong>Top-Tier Compensation:</strong> Because you need both deep coding chops and high emotional intelligence to talk to executives, FDE compensation bands sit right alongside top-tier core SWE roles.</li></ol><h3>4. The Secret Weapon: The “T-Shaped” Profile</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QfERuiex_mNZdSNp_ycoWg.png" /></figure><p>To thrive as an FDE, you can’t just be a hyper-specialized coder who hates talking to people, nor can you be a smooth talker who can’t debug a broken Docker container. You need to be <strong>T-Shaped</strong>:</p><ul><li><strong>The Vertical Bar (Deep Skill):</strong> You have undeniable technical depth in at least one core area — such as backend systems, data pipelines, or LLM orchestration and evaluation.</li><li><strong>The Horizontal Bar (Broad Execution):</strong> You know enough about everything else to get a product out the door without waiting on ten different teams. You can whip up a quick frontend UI, configure cloud permissions, talk to a non-technical VP about ROI, and debug a SQL query all in the same afternoon.</li></ul><h3>Day 1 Action Plan: Hands-On Lab &amp; Deliverable</h3><p>Theory is great, but FDEs are builders. Here is how we put Day 1 into practice:</p><ul><li><strong>The Lab (Role Teardown):</strong> Pull up 5 live FDE job descriptions from companies like <strong>Palantir, OpenAI, Anthropic, Databricks, and a Fortune 500 enterprise</strong>. Highlight the recurring keywords, tech stacks, and soft skills, and map them into a one-page <strong>“Role DNA” matrix</strong>.</li><li><strong>The Deliverable (Your Baseline):</strong> Create a <strong>Personal FDE Skills-Gap Scorecard</strong>. Rate yourself honestly from 1 to 5 on core coding, AI/RAG architecture, data engineering, and client communication. This is your starting line for the next 39 days.</li></ul><p><em>Ready to build your Role DNA matrix? Let me know if you’d like to analyze a specific FDE job description together or set up the template for your skills-gap scorecard!</em></p><p>Thank you for reading …</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6e9dc4b6561" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chapter 1 — Introduction to LangChain: Connecting Language Models with Data, Tools, and Workflows]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@pralhad2481/chapter-1-introduction-to-langchain-connecting-language-models-with-data-tools-and-workflows-88908207ef8d?source=rss-d23ca72419ac------2"><img src="https://cdn-images-1.medium.com/max/1672/1*7dRzIaVwg4EQj7vQIWJYTw.png" width="1672"></a></p><p class="medium-feed-snippet">An introduction to the architecture and core concepts shown in the accompanying image.</p><p class="medium-feed-link"><a href="https://medium.com/@pralhad2481/chapter-1-introduction-to-langchain-connecting-language-models-with-data-tools-and-workflows-88908207ef8d?source=rss-d23ca72419ac------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@pralhad2481/chapter-1-introduction-to-langchain-connecting-language-models-with-data-tools-and-workflows-88908207ef8d?source=rss-d23ca72419ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/88908207ef8d</guid>
            <category><![CDATA[ai-workflow]]></category>
            <category><![CDATA[integration-tool]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Pralhad Teggi]]></dc:creator>
            <pubDate>Sat, 31 Oct 2026 07:48:13 GMT</pubDate>
            <atom:updated>2026-10-31T07:48:13.273Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Chapter 2 — Agent Architecture and Core Components]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@pralhad2481/chapter-2-agent-architecture-and-core-components-da5bb3b692fa?source=rss-d23ca72419ac------2"><img src="https://cdn-images-1.medium.com/max/1536/1*iM8mtjSyANO7ZeeU2d2VEw.png" width="1536"></a></p><p class="medium-feed-snippet">Learning objectives</p><p class="medium-feed-link"><a href="https://medium.com/@pralhad2481/chapter-2-agent-architecture-and-core-components-da5bb3b692fa?source=rss-d23ca72419ac------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@pralhad2481/chapter-2-agent-architecture-and-core-components-da5bb3b692fa?source=rss-d23ca72419ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/da5bb3b692fa</guid>
            <category><![CDATA[planning-feedback-loops]]></category>
            <category><![CDATA[memory-state-management]]></category>
            <category><![CDATA[architecture-agent]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Pralhad Teggi]]></dc:creator>
            <pubDate>Fri, 30 Oct 2026 09:22:27 GMT</pubDate>
            <atom:updated>2026-10-30T09:22:27.719Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Chapter 1 — Introduction to Agentic AI]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@pralhad2481/chapter-1-introduction-to-agentic-ai-b63bc48d424c?source=rss-d23ca72419ac------2"><img src="https://cdn-images-1.medium.com/max/1536/1*tHQxujL_0stqzqEctIyIyw.png" width="1536"></a></p><p class="medium-feed-snippet">Learning objectives</p><p class="medium-feed-link"><a href="https://medium.com/@pralhad2481/chapter-1-introduction-to-agentic-ai-b63bc48d424c?source=rss-d23ca72419ac------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@pralhad2481/chapter-1-introduction-to-agentic-ai-b63bc48d424c?source=rss-d23ca72419ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/b63bc48d424c</guid>
            <category><![CDATA[goal-directed-autonomy]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[reasoning-and-planning]]></category>
            <category><![CDATA[human-oversight]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Pralhad Teggi]]></dc:creator>
            <pubDate>Fri, 30 Oct 2026 09:15:14 GMT</pubDate>
            <atom:updated>2026-10-30T09:15:14.983Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[From DevOps to MLOps Engineer: A Simple Guide to Skills, Projects, and Career Opportunities]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@pralhad2481/from-devops-to-mlops-engineer-a-simple-guide-to-skills-projects-and-career-opportunities-6fd61634c8c0?source=rss-d23ca72419ac------2"><img src="https://cdn-images-1.medium.com/max/1672/1*XuER4gD6UlQB9kqE_MOebA.png" width="1672"></a></p><p class="medium-feed-snippet">Let us understand &#x2014; what this article covers &#x2014; It outlines how DevOps professionals can transition into MLOps. It emphasizes leveraging&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@pralhad2481/from-devops-to-mlops-engineer-a-simple-guide-to-skills-projects-and-career-opportunities-6fd61634c8c0?source=rss-d23ca72419ac------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@pralhad2481/from-devops-to-mlops-engineer-a-simple-guide-to-skills-projects-and-career-opportunities-6fd61634c8c0?source=rss-d23ca72419ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fd61634c8c0</guid>
            <category><![CDATA[ai-career]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[ml-deployment]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Pralhad Teggi]]></dc:creator>
            <pubDate>Wed, 28 Oct 2026 06:07:54 GMT</pubDate>
            <atom:updated>2026-10-28T06:07:54.117Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Tokenization in LLMs: How “I Love Machine Learning” Becomes Numbers]]></title>
            <link>https://medium.com/@pralhad2481/tokenization-in-llms-how-i-love-machine-learning-becomes-numbers-6aeed036b1ed?source=rss-d23ca72419ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/6aeed036b1ed</guid>
            <category><![CDATA[tokenization]]></category>
            <category><![CDATA[context-window]]></category>
            <category><![CDATA[subword-tokenization]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[byte-pair-encoding]]></category>
            <dc:creator><![CDATA[Pralhad Teggi]]></dc:creator>
            <pubDate>Fri, 16 Oct 2026 13:43:24 GMT</pubDate>
            <atom:updated>2026-10-16T13:43:24.647Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>By Dr. Pralhad P. Teggi</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QzlThl-nMJOWyQfqxS3f8w.png" /></figure><blockquote>Explore the concepts in this blog through the <a href="https://testtokenizer.datamindslab.in/"><strong>DataMindsLab Tokenization Lab</strong></a>. Experiment to compare tokenizers, animate BPE merges, inspect Unicode bytes and special tokens, and experiment with context budgets using your own examples.</blockquote><p>When you send a sentence to a large language model, it first passes through a tokenizer. Before the model can process your request, that text must become a sequence of numerical identifiers.</p><p>This step is called <strong>tokenization</strong>. It helps explain why a short sentence can contain several tokens, why an unfamiliar word can still be represented, and why long documents consume a model’s context budget.</p><p>Let’s follow a simple example:</p><blockquote><em>“I love machine learning!”</em></blockquote><h3>1. What Is Tokenization?</h3><p>Tokenization breaks text into smaller units called <strong>tokens</strong>. Depending on the tokenizer, a token may represent a whole word, part of a word, punctuation, whitespace together with nearby text, or bytes.</p><p>For illustration, our sentence could be split like this:</p><p>[I] [love] [machine] [learn] [ing] [!]</p><p>This is a teaching example, not the output of a particular tokenizer. Another tokenizer might keep “learning” together or attach a leading space to a word token.</p><p>Each token is mapped to an integer ID in that tokenizer’s vocabulary. Suppose our imaginary vocabulary contains these entries:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*09Wy4qfVdIT3MEZG1Ot93g.png" /></figure><p>The sentence would become:</p><p>[314, 1024, 5678, 432, 298, 0]</p><p>These numbers are invented for explanation. <strong>IDs are vocabulary labels: a larger ID does not mean greater importance, and nearby IDs do not necessarily have similar meanings</strong>.</p><p>The model then looks up learned <strong>embedding vectors</strong> for these IDs. Tokenization supplies the discrete pieces; embeddings supply numerical representations used in subsequent computation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jq-oD-Vxue2FscYJpPwtkg.png" /></figure><h3>2. Why Not Use One Token for Every Word?</h3><p>A word-only vocabulary faces a difficult choice. It can grow very large to cover many words, or stay smaller and struggle with words it has never seen. Names, spelling variations, technical terms, and multiple languages make this harder.</p><p>Subword tokenization offers a practical compromise: keep useful frequent units together and represent other words using smaller pieces.</p><p>Consider:</p><blockquote><em>“The result was unbelievable.”</em></blockquote><p>An illustrative split for the final word is:</p><p>[un] [believ] [able]</p><p>Even if the complete word is absent from the vocabulary, available pieces may still represent it. The same vocabulary can reuse pieces across many words. Subword tokenization balances vocabulary size with the ability to represent varied text. [1]</p><p>However, these pieces are learned from text patterns. They do not have to correspond to grammatical roots or meaningful syllables. “Unbelievable” might split differently under another tokenizer.</p><p>Unknown input also needs a qualification: some tokenizers can emit an unknown token. Byte-level methods or byte fallback can represent unfamiliar characters through bytes instead, depending on the tokenizer’s configuration. [2]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jHjUQ0KrJxXaI6Ou5mp-Hg.png" /></figure><h3>3. BPE, WordPiece, Unigram — and Where SentencePiece Fits</h3><p>Tokenizers differ in how they learn and apply their vocabularies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0lh32XlVmsikUrD2mZDqJA.png" /></figure><p>These distinctions are documented in the Hugging Face tokenizer guide and SentencePiece project. [1][2]</p><p>A small BPE-style illustration shows the intuition. Suppose the training data repeatedly contains “low.” Starting with character units, a training process might learn:</p><p>[l] [o] [w] → [lo] [w] → [low]</p><p>These merges would depend on pair frequencies across the training corpus. They are not guaranteed simply because “low” appears once. After training, a tokenizer applies its learned rules to new input; it does not rebuild its vocabulary for each prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UYdFF0uoeZhyir_1jmQYvQ.png" /></figure><h3>4. Special Tokens: Adding Structure Beyond Ordinary Text</h3><p>Some tokens mark boundaries or task structure rather than ordinary words. Their exact spelling and behavior depend on the model and tokenizer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*UPdb7k8ShIBQ66jo2xsagA.png" /></figure><p>For example, a BERT-style sentence-pair input may look like:</p><p>[CLS] I love machine learning! [SEP] It helps solve problems. [SEP]</p><p>This is an illustration of that model family’s input structure, not a universal chat format. Chat models may use other dedicated tokens to mark message roles and boundaries. [1]</p><p>Padding also needs careful handling: attention masks commonly identify padded positions so they do not act like ordinary content during attention.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HoYHlp_z12C95aek7Ynpng.png" /></figure><h3>5. Why Tokenization Matters in Real Applications</h3><p>Tokenization affects how much text fits into a request and, in token-metered services, how usage is counted. It also affects sequence length, which influences processing work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9vn_2kkTm-JxcNYf8siIRA.png" /></figure><h3>Leave space for the response</h3><p>A useful planning example is a hypothetical application with an 8,000-token shared budget:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*vsWZw6hh6NNwb3EWKT2W3Q.png" /></figure><p><strong>These are planning numbers, not a real model specification.</strong> Actual systems may have separate input and output limits, message-format overhead, and additional accounting rules. Check the target model’s documentation and measure with its tokenizer.</p><h3>Retrieve useful passages</h3><p>In a retrieval-augmented generation application, token counts provide a concrete way to budget document chunks. A sensible workflow retrieves relevant passages, removes duplication, preserves necessary context, and leaves room for an answer. Filling the available context with loosely related text does not guarantee a better response.</p><h3>Measure your own content</h3><p>Two texts with similar character counts can produce different token counts. Language, spelling, punctuation, code, and the tokenizer’s vocabulary all matter. Test representative inputs instead of assuming one word equals one token.From Text Pieces to Context</p><p>Tokenization gives a language model a consistent way to represent text as vocabulary IDs. Embeddings turn those IDs into vectors, and later layers combine information across positions to build context-sensitive representations.</p><p>For “I love machine learning!”, the tokenizer supplies the pieces. The model’s subsequent computation determines how those pieces interact. Understanding that boundary is a useful first step toward understanding embeddings, self-attention, and the rest of the transformer.</p><h4>Lets do some practical exercise -</h4><p>Use <strong>tiktoken</strong>, OpenAI’s real byte-pair encoding (BPE) tokenizer. This example uses o200k_base, rather than a simple word-splitting demonstration.</p><p>Different LLMs require their own matching tokenizer.</p><pre>pip install tiktoken</pre><pre>import tiktoken<br><br>tokenizer = tiktoken.get_encoding(&quot;o200k_base&quot;)<br><br><br>def inspect_tokens(text):<br>    # Treat any special-token-looking strings as ordinary input text.<br>    token_ids = tokenizer.encode(text, disallowed_special=())<br><br>    print(f&quot;\nInput: {text!r}&quot;)<br>    print(f&quot;Words (whitespace split): {len(text.split())}&quot;)<br>    print(f&quot;Tokens: {len(token_ids)}&quot;)<br>    print(f&quot;Token IDs: {token_ids}&quot;)<br><br>    print(&quot;\nPosition | Token ID | Token bytes&quot;)<br>    print(&quot;-&quot; * 55)<br><br>    for position, token_id in enumerate(token_ids):<br>        # Bytes preserve exact token boundaries, including spaces.<br>        # Some tokens contain only part of a UTF-8 character.<br>        token_bytes = tokenizer.decode_single_token_bytes(token_id)<br>        print(f&quot;{position:8} | {token_id:8} | {token_bytes!r}&quot;)<br><br>    reconstructed = tokenizer.decode(token_ids)<br><br>    print(f&quot;\nDecoded text: {reconstructed!r}&quot;)<br>    print(f&quot;Exact round trip: {reconstructed == text}&quot;)<br><br>    assert reconstructed == text<br><br><br>examples = [<br>    &quot;I love machine learning!&quot;,<br>    &quot;machine&quot;,<br>    &quot; machine&quot;,  # Leading space can affect tokenization.<br>    &quot;Machine&quot;,  # Capitalization can affect it.<br>    &quot;unbelievably&quot;,<br>    &quot;print(&#39;Hello, world!&#39;)&quot;,<br>    &quot;ನಮಸ್ಕಾರ&quot;,  # Kannada.<br>    &quot;Hello 👋&quot;,<br>]<br><br>for example in examples:<br>    inspect_tokens(example)<br><br>while True:<br>    text = input(&quot;\nEnter text to tokenize, or &#39;quit&#39;: &quot;)<br><br>    if text.lower() == &quot;quit&quot;:<br>        break<br><br>    inspect_tokens(text)</pre><pre>Input: &#39;I love machine learning!&#39;<br>Words (whitespace split): 4<br>Tokens: 5<br>Token IDs: [40, 3047, 7342, 7524, 0]<br><br>Position | Token ID | Token bytes<br>-------------------------------------------------------<br>       0 |       40 | b&#39;I&#39;<br>       1 |     3047 | b&#39; love&#39;<br>       2 |     7342 | b&#39; machine&#39;<br>       3 |     7524 | b&#39; learning&#39;<br>       4 |        0 | b&#39;!&#39;<br><br>Decoded text: &#39;I love machine learning!&#39;<br>Exact round trip: True<br><br>Input: &#39;machine&#39;<br>Words (whitespace split): 1<br>Tokens: 1<br>Token IDs: [48082]<br><br>Position | Token ID | Token bytes<br>-------------------------------------------------------<br>       0 |    48082 | b&#39;machine&#39;<br><br>Decoded text: &#39;machine&#39;<br>Exact round trip: True<br><br>Input: &#39; machine&#39;<br>Words (whitespace split): 1<br>Tokens: 1<br>Token IDs: [7342]<br><br>Position | Token ID | Token bytes<br>-------------------------------------------------------<br>       0 |     7342 | b&#39; machine&#39;<br><br>Decoded text: &#39; machine&#39;<br>Exact round trip: True<br><br>Input: &#39;Machine&#39;<br>Words (whitespace split): 1<br>Tokens: 1<br>Token IDs: [25519]<br><br>Position | Token ID | Token bytes<br>-------------------------------------------------------<br>       0 |    25519 | b&#39;Machine&#39;<br><br>Decoded text: &#39;Machine&#39;<br>Exact round trip: True<br><br>Input: &#39;unbelievably&#39;<br>Words (whitespace split): 1<br>Tokens: 3<br>Token IDs: [373, 9880, 153516]<br><br>Position | Token ID | Token bytes<br>-------------------------------------------------------<br>       0 |      373 | b&#39;un&#39;<br>       1 |     9880 | b&#39;bel&#39;<br>       2 |   153516 | b&#39;ievably&#39;<br><br>Decoded text: &#39;unbelievably&#39;<br>Exact round trip: True<br><br>Input: &quot;print(&#39;Hello, world!&#39;)&quot;<br>Words (whitespace split): 2<br>Tokens: 7<br>Token IDs: [1598, 706, 13225, 11, 2375, 0, 1542]<br><br>Position | Token ID | Token bytes<br>-------------------------------------------------------<br>       0 |     1598 | b&#39;print&#39;<br>       1 |      706 | b&quot;(&#39;&quot;<br>       2 |    13225 | b&#39;Hello&#39;<br>       3 |       11 | b&#39;,&#39;<br>       4 |     2375 | b&#39; world&#39;<br>       5 |        0 | b&#39;!&#39;<br>       6 |     1542 | b&quot;&#39;)&quot;<br><br>Decoded text: &quot;print(&#39;Hello, world!&#39;)&quot;<br>Exact round trip: True<br><br>Input: &#39;ನಮಸ್ಕಾರ&#39;<br>Words (whitespace split): 1<br>Tokens: 4<br>Token IDs: [3835, 7913, 108917, 5982]<br><br>Position | Token ID | Token bytes<br>-------------------------------------------------------<br>       0 |     3835 | b&#39;\xe0\xb2\xa8&#39;<br>       1 |     7913 | b&#39;\xe0\xb2\xae&#39;<br>       2 |   108917 | b&#39;\xe0\xb2\xb8\xe0\xb3\x8d\xe0\xb2\x95&#39;<br>       3 |     5982 | b&#39;\xe0\xb2\xbe\xe0\xb2\xb0&#39;<br><br>Decoded text: &#39;ನಮಸ್ಕಾರ&#39;<br>Exact round trip: True<br><br>Input: &#39;Hello 👋&#39;<br>Words (whitespace split): 2<br>Tokens: 3<br>Token IDs: [13225, 61138, 233]<br><br>Position | Token ID | Token bytes<br>-------------------------------------------------------<br>       0 |    13225 | b&#39;Hello&#39;<br>       1 |    61138 | b&#39; \xf0\x9f\x91&#39;<br>       2 |      233 | b&#39;\x8b&#39;<br><br>Decoded text: &#39;Hello 👋&#39;<br>Exact round trip: True<br><br>Enter text to tokenize, or &#39;quit&#39;:</pre><p>References</p><ol><li>Hugging Face. <a href="https://huggingface.co/docs/transformers/tokenizer_summary">Tokenization algorithms</a>.</li><li>SentencePiece project. <a href="https://github.com/google/sentencepiece">Tokenizer and detokenizer documentation</a>.</li></ol><p>Thanks for reading …</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6aeed036b1ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>