Code examples:

RAG Chunking Strategies Compared — A Reproducible Benchmark

By Jaffar Kazi
Real-World AI Engineering RAG Retrieval Evaluation
C# Python Azure

What You'll Learn

  • Why chunk boundaries decide retrieval quality before any embedding model runs
  • How to implement fixed-size, paragraph and packed chunking with overlap and page metadata
  • How to label evidence and measure recall, context size and cost per strategy
  • What a small reproducible benchmark showed, and what it can't show
  • How to test chunkers like ordinary code

The Problem

Most RAG tutorials pick a chunk size, say 500 tokens, and move on. I built this benchmark because that choice quietly decides what your model can ever see. If the evidence for an answer is cut in half, no embedding model and no prompt can put it back together.

Here's the case that makes it concrete. A policy says meals are reimbursed up to 85 dollars per day. The next paragraph says the limit rises to 120 dollars in high-cost cities, including London. The question is "What is the meal allowance per day when I travel to London?" The answer needs both paragraphs.

The naive fixes fail in different ways. Fixed-size windows ignore structure, so they cut mid-sentence and sometimes split the very sentence you need. Paragraph chunks respect structure, but the rule and its exception land in separate chunks, and retrieval has to return both. Bigger chunks keep evidence together but bury it in text the model has to read, and you pay for every token of it.

In practice, you'll find that chunk size also caps what every later stage can do. A retriever returns whole chunks, so the chunk is the smallest unit of evidence the model can ever receive. Whatever you decide here sets a ceiling on recall that reranking and better prompts can't raise.

The Shape of a Real Solution

The fix is to stop treating chunking as a setting and start treating it as an experiment. Hold everything constant except the chunker:

  • Same documents, with page numbers preserved.
  • Same questions, each with its evidence labelled at sentence level.
  • Same retriever and top-k, so any difference comes from chunk boundaries.
  • Several metrics, not one: whether the evidence was retrieved, whether one chunk held all of it, how much text came back, and what the index costs to build.

One decision needs defending. My retriever is plain TF-IDF cosine, not an embedding model. That is deliberate: it runs offline, needs no API key, and makes the results reproducible byte for byte. It also means the numbers below are about chunk boundaries, not about embedding quality. The harness only needs something that returns ranked chunks, so swapping in an embedding retriever is a one-class change.

Architecture Overview

Every strategy produces chunks that carry the same metadata, so they flow through the same index and the same evaluation.

Architecture diagram showing documents with page numbers and labelled questions feeding four chunking strategies, an index with metadata, a top-3 retriever, three groups of metrics, and a results file

Two details matter. Chunks keep their document ID, index and page range, so a retrieved chunk can always be traced to its source (the foundation for citations later). And the evaluation never asks a model whether the answer "looks right". It checks whether the labelled evidence sentences appear verbatim in the retrieved text, which is deterministic and free.

Core Implementation: Fixed-Size Chunking

The fixed-size chunker slides a window of N words over the document and ignores paragraph boundaries entirely. Overlap makes consecutive windows share their edge words. The tricky part is metadata: because a window can straddle a page break, each word remembers its page, and a chunk reports the first and last page it touches.

Chunkers.cs / chunkers.py

public record Paragraph(string Text, int Page);

public record Chunk(string DocId, int Index, string Text, int PageStart, int PageEnd, int WordCount);

public static class Chunkers
{
    public static string[] Words(string s) =>
        s.Split((char[]?)null, StringSplitOptions.RemoveEmptyEntries);

    // Slide a window of `size` words over the document, ignoring paragraph boundaries.
    public static List<Chunk> FixedSize(string docId, IReadOnlyList<Paragraph> paragraphs,
                                        int size, int overlap = 0)
    {
        if (size <= 0 || overlap < 0 || overlap >= size)
            throw new ArgumentException("size must be positive and 0 <= overlap < size");

        var words = new List<string>();
        var pages = new List<int>();
        foreach (var p in paragraphs)                      // keep the page of every word
            foreach (var w in Words(p.Text)) { words.Add(w); pages.Add(p.Page); }

        var chunks = new List<Chunk>();
        int step = size - overlap;
        for (int start = 0; start < words.Count; start += step)
        {
            int end = Math.Min(start + size, words.Count);
            chunks.Add(new Chunk(docId, chunks.Count,
                string.Join(' ', words.Skip(start).Take(end - start)),
                pages[start], pages[end - 1], end - start));
            if (end == words.Count) break;                 // no tail chunk made only of overlap
        }
        return chunks;
    }
}

from dataclasses import dataclass


@dataclass(frozen=True)
class Paragraph:
    text: str
    page: int


@dataclass(frozen=True)
class Chunk:
    doc_id: str
    index: int
    text: str
    page_start: int
    page_end: int
    word_count: int

Two small decisions are easy to get wrong. The loop stops as soon as a window reaches the end, otherwise you emit a final chunk made only of overlap, which duplicates text for no gain. And invalid parameters fail loudly, because an overlap equal to the size would never advance.

Paragraph-Based Chunking

The paragraph chunker keeps sentences whole. In its simplest form every paragraph is a chunk. The packed variant fills a chunk with consecutive paragraphs up to a word limit, and can repeat the last paragraph or two at the start of the next chunk. That repeated paragraph is the overlap, measured in structure instead of words.

ParagraphChunker.cs / chunkers.py

public static class ParagraphChunker
{
    // One paragraph per chunk, or consecutive paragraphs packed up to `maxWords`.
    public static List<Chunk> Split(string docId, IReadOnlyList<Paragraph> paragraphs,
                                    int maxWords = 0, int overlapParagraphs = 0)
    {
        var chunks = new List<Chunk>();
        int i = 0, n = paragraphs.Count;
        while (i < n)
        {
            int j = i + 1, words = Chunkers.Words(paragraphs[i].Text).Length;
            while (maxWords > 0 && j < n)
            {
                int next = Chunkers.Words(paragraphs[j].Text).Length;
                if (words + next > maxWords) break;
                words += next;
                j++;
            }
            var group = paragraphs.Skip(i).Take(j - i).ToList();
            chunks.Add(new Chunk(docId, chunks.Count,
                string.Join("\n\n", group.Select(p => p.Text)),
                group[0].Page, group[^1].Page, words));
            if (j >= n) break;
            i = Math.Max(j - overlapParagraphs, i + 1);    // always make progress
        }
        return chunks;
    }
}

def _word_count(p: Paragraph) -> int:
    return len(p.text.split())


def fixed_size_chunks(doc_id: str, paragraphs: list[Paragraph],
                      size: int, overlap: int = 0) -> list[Chunk]:
    """Slide a window of `size` words over the document, ignoring paragraph boundaries."""
    if size <= 0 or not 0 <= overlap < size:
        raise ValueError("size must be positive and 0 <= overlap < size")

    words: list[str] = []
    pages: list[int] = []
    for p in paragraphs:                      # keep the page of every word
        for w in p.text.split():
            words.append(w)
            pages.append(p.page)

    step = size - overlap
    chunks: list[Chunk] = []
    for start in range(0, len(words), step):
        end = min(start + size, len(words))
        chunks.append(Chunk(doc_id, len(chunks), " ".join(words[start:end]),
                            pages[start], pages[end - 1], end - start))
        if end == len(words):                 # no tail chunk made only of overlap
            break
    return chunks


def paragraph_chunks(doc_id: str, paragraphs: list[Paragraph],
                     max_words: int = 0, overlap_paragraphs: int = 0) -> list[Chunk]:
    """One paragraph per chunk, or consecutive paragraphs packed up to `max_words`."""
    chunks: list[Chunk] = []
    i, n = 0, len(paragraphs)
    while i < n:
        j, words = i + 1, _word_count(paragraphs[i])
        while max_words and j < n and words + _word_count(paragraphs[j]) <= max_words:
            words += _word_count(paragraphs[j])
            j += 1
        group = paragraphs[i:j]
        chunks.append(Chunk(doc_id, len(chunks), "\n\n".join(p.text for p in group),
                            group[0].page, group[-1].page, words))
        if j >= n:
            break
        i = max(j - overlap_paragraphs, i + 1)   # always make progress
    return chunks

The trade-off is chunk-size variance. Paragraphs in real documents range from one line to a full page, so a pure paragraph strategy produces some chunks too short to carry meaning and some too long to retrieve precisely. Packing smooths that out.

Measuring Retrieval, Not Impressions

I label evidence as exact sentences. For a question like the London one, the gold set is two sentences, one from each paragraph. Then the metric is a string containment check, which makes four numbers cheap to compute:

  • Evidence recall: the share of gold sentences present anywhere in the retrieved chunks.
  • Full hit: whether all gold sentences were retrieved.
  • Single-chunk hit: whether one retrieved chunk contains all of them. This tells you if the model gets the evidence as a coherent unit or has to join fragments.
  • Evidence density: gold words divided by retrieved words. It measures how much of what you pay for is the answer.

Writing the gold labels is the expensive part, and it's worth being strict. I wrote each question after locating its evidence, kept the evidence to one or two sentences, and made half the questions deliberately span a paragraph boundary. Ordinary questions rarely expose a chunking weakness, and a benchmark made only of easy questions will rank every strategy the same.

Evidence.cs / bench.py

public record EvidenceResult(double Recall, bool Full, bool SingleChunk, int ContextWords, double Density);

public static class Evidence
{
    // Did the retrieved chunks contain each gold evidence sentence verbatim?
    public static EvidenceResult Evaluate(IReadOnlyList<Chunk> retrieved, IReadOnlyList<string> gold)
    {
        var present = gold.Select(g => retrieved.Any(c => c.Text.Contains(g))).ToList();
        int goldWords = gold.Where((g, i) => present[i]).Sum(g => Chunkers.Words(g).Length);
        int ctxWords = retrieved.Sum(c => c.WordCount);

        return new EvidenceResult(
            Recall: present.Count(p => p) / (double)gold.Count,
            Full: present.All(p => p),
            SingleChunk: retrieved.Any(c => gold.All(g => c.Text.Contains(g))),
            ContextWords: ctxWords,
            Density: ctxWords == 0 ? 0 : goldWords / (double)ctxWords);
    }
}

def evaluate(retrieved: list[Chunk], gold: list[str]) -> dict:
    present = [any(g in c.text for c in retrieved) for g in gold]
    gold_words = sum(len(g.split()) for g, p in zip(gold, present) if p)
    ctx_words = sum(c.word_count for c in retrieved)
    return {
        "recall": sum(present) / len(gold),
        "full": all(present),
        "single_chunk": any(all(g in c.text for g in gold) for c in retrieved),
        "ctx_words": ctx_words,
        "density": gold_words / ctx_words if ctx_words else 0.0,
    }

A sentence cut by a chunk boundary is not contained in any chunk, so a boundary that splits evidence shows up as a miss, which is exactly the failure I want to count.

What the Benchmark Showed

The corpus is five invented policy documents totalling 1,438 words, with 12 questions: six whose evidence sits in one paragraph and six whose evidence spans two adjacent paragraphs. Retrieval takes the top 3 chunks. This is small on purpose, so treat it as a demonstration of the method. One question is worth 8.3 percentage points.

StrategyChunksIndexed wordsFull hitSpanning: one chunkContext wordsDensity
Fixed 100151,43875%67%2860.071
Fixed 100, overlap 20201,738100%67%2570.090
Fixed 250101,43892%100%5220.043
Fixed 250, overlap 50101,688100%100%5440.043
Paragraph401,43892%0%1100.199
Paragraph packed 150, overlap 1151,801100%100%3650.064

Here's what surprised me and what didn't:

  • Small fixed windows lose evidence. Fixed 100 missed three of twelve questions. In one, a single sentence about the on-call phone allowance straddled a boundary and neither half was retrievable as evidence. A 20-word overlap fixed all three, at the cost of 21% more indexed words.
  • Paragraph chunks are the most precise and the least self-contained. Density was highest (0.199) with the smallest context (110 words), but no chunk ever held both halves of a spanning answer. It missed one spanning question where the top 3 returned only one half.
  • Large windows keep evidence together by carrying everything else too. Fixed 250 held every spanning answer in one chunk, yet returned about 4.7 times the text of paragraph chunking. Its one miss was a boundary that cut through one of the two gold sentences.
  • Packed paragraphs with one paragraph of overlap hit everything, with 365 words of context and 25% more indexed words.

I wouldn't read anything into the timing columns of the raw results. Every query took well under a tenth of a millisecond on this corpus. Latency will track chunk count at scale, since index size grows with it, but that's reasoning, not something this run measured.

If I had to pick from this table, I'd pick packed paragraphs. They were the only strategy that was both complete and self-contained without carrying the largest context. That depends on this corpus having reasonably sized paragraphs, though. On documents with one-line paragraphs, packing does most of the work, and on documents with page-long paragraphs you'd need to split inside them, which brings fixed windows back as the fallback. The value of the benchmark is that you can see this on your own documents instead of guessing.

What Chunking Actually Costs

Strategy changes two bills. Embedding cost scales with indexed words, so overlap is a direct multiplier: here 21% to 25% more. Generation cost scales with the context you send per question. I use about 1.3 tokens per English word as a rough conversion, so check your own tokenizer.

StrategyContext words per questionApprox. tokensRetrieved-context input cost per 100,000 questions
Paragraph110143about $11
Paragraph packed 150, overlap 1365475about $36
Fixed 250522679about $51

Cost Reality

These figures use OpenAI's published list prices at the time of writing: $0.75 per million input tokens for GPT-5.4 mini, and $0.02 per million for text-embedding-3-small. They count retrieved context only, not the question, instructions or output. Embedding a 10-million-word corpus is roughly 13 million tokens, about $0.26, or $0.31 with 21% overlap overhead. Embedding is cheap. Re-embedding is the real cost, because changing strategy means rebuilding the whole index. Azure prices can differ, and prices change, so check current pricing.

Observability

For a chunking pipeline, the useful record is which configuration produced which retrieval. Log the chunking config ID, the document ID, page range and rank of each retrieved chunk, and the retrieval score. In production, also track how often the top result scores low and how many chunks you return per question.

What not to log is the chunk text or the user's question by default. Documents and questions can contain personal or confidential data, and chunk IDs are enough to reconstruct what happened. If you need text for debugging, sample it behind access controls and a retention limit.

Version the chunking config like a schema. Every stored chunk should record the config that produced it, because a change means re-embedding the corpus, and until that finishes you have two incompatible indexes. A config ID on every chunk lets you run both side by side and compare them on live traffic before cutting over.

Testing

Chunking is deterministic, so it needs no mocking at all. Every test below runs against real chunkers and a real evaluator. Once generation is added on top, mock only the LLM call and keep testing everything else the same way.

The tests cover the properties that quietly break: no word lost, overlap equals the previous chunk's tail, page metadata survives a straddling chunk, paragraphs are never split, and invalid parameters are rejected. The last two tests are the scenario from the problem statement. Evidence spanning two paragraphs is split by a 100-word window, and a 20-word overlap puts both sentences back in one chunk.

ChunkerTests.cs / test_chunkers.py

using Xunit;

public class ChunkerTests
{
    const string S1 = "Meals cost 85 dollars.";
    const string S2 = "London raises it to 120 dollars.";

    static string Words(int n, string prefix = "w") =>
        string.Join(' ', Enumerable.Range(1, n).Select(i => $"{prefix}{i}"));

    // The answer is S1 (end of paragraph 1) plus S2 (start of paragraph 2).
    static List<Paragraph> SpanningDoc() => new()
    {
        new Paragraph(Words(92) + " " + S1, 1),
        new Paragraph(S2 + " " + Words(60, "x"), 1),
    };

    [Fact]
    public void FixedSize_KeepsEveryWordAndRespectsSize()
    {
        var chunks = Chunkers.FixedSize("d", new[] { new Paragraph(Words(250), 1) }, 100);
        Assert.Equal(new[] { 100, 100, 50 }, chunks.Select(c => c.WordCount));
        Assert.Equal(Words(250), string.Join(' ', chunks.Select(c => c.Text)));
    }

    [Fact]
    public void Overlap_RepeatsTheTailOfThePreviousChunk()
    {
        var chunks = Chunkers.FixedSize("d", new[] { new Paragraph(Words(250), 1) }, 100, 20);
        Assert.Equal(Chunkers.Words(chunks[0].Text).TakeLast(20), Chunkers.Words(chunks[1].Text).Take(20));
        Assert.EndsWith("w250", chunks[^1].Text);              // nothing lost at the tail
    }

    [Fact]
    public void PageMetadata_SurvivesAChunkThatStraddlesPages()
    {
        var doc = new[] { new Paragraph(Words(60), 1), new Paragraph(Words(60, "x"), 2) };
        var chunks = Chunkers.FixedSize("d", doc, 100);
        Assert.Equal((1, 2), (chunks[0].PageStart, chunks[0].PageEnd));
        Assert.Equal((2, 2), (chunks[1].PageStart, chunks[1].PageEnd));
    }

    [Fact]
    public void ParagraphChunks_NeverSplitAParagraph()
    {
        var paras = new[] { new Paragraph(Words(80, "a"), 1), new Paragraph(Words(80, "b"), 1) };
        Assert.Equal(paras.Select(p => p.Text), ParagraphChunker.Split("d", paras).Select(c => c.Text));
    }

    [Fact]
    public void PackedParagraphs_OverlapByOneParagraph()
    {
        var paras = "abcd".Select(c => new Paragraph(Words(60, c.ToString()), 1)).ToList();
        var chunks = ParagraphChunker.Split("d", paras, 130, 1);
        Assert.Equal(new[] { 2, 2, 2 }, chunks.Select(c => c.Text.Split("\n\n").Length));
        Assert.StartsWith(paras[1].Text, chunks[1].Text);
    }

    [Fact]
    public void InvalidOverlap_IsRejected() =>
        Assert.Throws<ArgumentException>(() =>
            Chunkers.FixedSize("d", new[] { new Paragraph("a b c", 1) }, 10, 10));

    [Fact]
    public void SpanningEvidence_IsSplitWithoutOverlap()
    {
        var chunks = Chunkers.FixedSize("d", SpanningDoc(), 100);
        Assert.DoesNotContain(chunks, c => c.Text.Contains(S1) && c.Text.Contains(S2));
        Assert.Equal(0.5, Evidence.Evaluate(chunks.Take(1).ToList(), new[] { S1, S2 }).Recall);
    }

    [Fact]
    public void Overlap_KeepsSpanningEvidenceInOneChunk()
    {
        var chunks = Chunkers.FixedSize("d", SpanningDoc(), 100, 20);
        Assert.True(Evidence.Evaluate(chunks, new[] { S1, S2 }).SingleChunk);
    }
}

import pytest

from bench import evaluate
from chunkers import Paragraph, fixed_size_chunks, paragraph_chunks


def words(n, prefix="w"):
    return " ".join(f"{prefix}{i}" for i in range(1, n + 1))


S1, S2 = "Meals cost 85 dollars.", "London raises it to 120 dollars."


def spanning_doc():
    # The answer is S1 (end of paragraph 1) plus S2 (start of paragraph 2).
    return [Paragraph(words(92) + " " + S1, 1), Paragraph(S2 + " " + words(60, "x"), 1)]


def test_fixed_size_keeps_every_word_and_respects_size():
    chunks = fixed_size_chunks("d", [Paragraph(words(250), 1)], size=100)
    assert [c.word_count for c in chunks] == [100, 100, 50]
    assert " ".join(c.text for c in chunks) == words(250)


def test_overlap_repeats_the_tail_of_the_previous_chunk():
    chunks = fixed_size_chunks("d", [Paragraph(words(250), 1)], size=100, overlap=20)
    assert chunks[1].text.split()[:20] == chunks[0].text.split()[-20:]
    assert chunks[-1].text.endswith("w250")             # nothing lost at the tail


def test_page_metadata_survives_a_chunk_that_straddles_pages():
    doc = [Paragraph(words(60), 1), Paragraph(words(60, "x"), 2)]
    first, second = fixed_size_chunks("d", doc, size=100)
    assert (first.page_start, first.page_end) == (1, 2)
    assert (second.page_start, second.page_end) == (2, 2)


def test_paragraph_chunks_never_split_a_paragraph():
    paras = [Paragraph(words(80, "a"), 1), Paragraph(words(80, "b"), 1)]
    assert [c.text for c in paragraph_chunks("d", paras)] == [p.text for p in paras]


def test_packed_paragraphs_overlap_by_one_paragraph():
    paras = [Paragraph(words(60, c), 1) for c in "abcd"]
    chunks = paragraph_chunks("d", paras, max_words=130, overlap_paragraphs=1)
    assert [c.text.count("\n\n") + 1 for c in chunks] == [2, 2, 2]
    assert chunks[1].text.startswith(paras[1].text)


def test_invalid_overlap_is_rejected():
    with pytest.raises(ValueError):
        fixed_size_chunks("d", [Paragraph("a b c", 1)], size=10, overlap=10)


def test_evidence_spanning_two_paragraphs_is_split_without_overlap():
    chunks = fixed_size_chunks("d", spanning_doc(), size=100)
    assert not any(S1 in c.text and S2 in c.text for c in chunks)
    assert evaluate(chunks[:1], [S1, S2])["recall"] == 0.5   # the first chunk holds half the answer


def test_overlap_keeps_spanning_evidence_in_one_chunk():
    chunks = fixed_size_chunks("d", spanning_doc(), size=100, overlap=20)
    assert evaluate(chunks, [S1, S2])["single_chunk"]

There is no retry loop in this pipeline, so there is no call-count assertion to write. When you add one around the generation step, assert the call count there as well.

Technology Choices

C#/.NET Implementation

Why choose C#: If your backend is .NET, you get first-party Microsoft support and enterprise patterns.

  • Native Azure integration — first-party SDKs for the services that sit behind retrieval
  • Enterprise patterns — dependency injection and records that make chunks immutable and comparable
  • Production-ready — ingestion fits naturally into a background service

Python Implementation

Why choose Python: If your team writes Python, you get access to the richest AI/ML ecosystem.

  • Library ecosystem — evaluation tooling, tokenizers and notebooks for exploring results
  • Rapid prototyping — quick iteration on strategies before committing to one
  • Community — most chunking and retrieval examples are Python-first

The Bottom Line

C#/.NET team? Use C#. Python team? Use Python. Don't fight your stack. I ran both implementations on the same corpus and compared all 110 chunks field by field: IDs, page ranges, word counts and text lengths matched exactly.

Engineering Trade-offs

Chunking tuning pays off when your documents are long, answers are scattered across paragraphs, and you can label even a dozen realistic questions. It is the cheapest quality lever you have, because it needs no model change.

When to Skip or Rethink This

  • The corpus fits in the context window. Send the document and skip retrieval.
  • Your documents are highly structured. Headings, tables and clauses are better chunk boundaries than word counts. Split on structure first.
  • You tune on too few questions. With 12 questions, one flipped answer moves a metric by 8 points. Use more questions before trusting a small gap.
  • You assume these results transfer. This corpus is synthetic and the retriever is lexical. An embedding retriever can rank differently, so rerun the harness on your own documents.

Semantic chunking, which splits where the meaning shifts, is the next step up. It needs an embedding call per sentence just to decide the boundaries, so benchmark it against packed paragraphs before paying for it.

Metadata deserves the same care as boundaries. Page ranges and document IDs cost nothing to store at chunking time and are painful to recover later. They make citations, filtering by document and debugging bad retrievals possible, so I keep them on every chunk even in a benchmark.

Key Takeaways

  • Chunk boundaries decide whether the evidence for an answer is retrievable at all.
  • Treat chunking as an experiment: same documents, same questions, one variable.
  • Label evidence as sentences so a split answer registers as a miss.
  • Small chunks give precision; large chunks give self-contained evidence at a token cost. Packed paragraphs with overlap were the balance here.
  • Overlap repairs boundary cuts but multiplies embedding volume, 21% to 25% in this benchmark.
  • Chunkers are deterministic, so test them like ordinary code.

Interview Questions

How do you choose a chunk size? I start from the shape of the answers, not a default. Small chunks raise precision and lower cost per question, large chunks keep evidence together, and the right size is whichever one a labelled benchmark on your documents says it is.

What does overlap do, and what does it cost? It repeats the edge of one chunk in the next so evidence cut by a boundary appears whole in at least one chunk. It costs extra indexed text, about 21% to 25% in my benchmark, and it can return near-duplicate chunks.

Why consider semantic boundaries? Fixed windows ignore meaning, and paragraph or heading boundaries approximate it. Semantic chunking finds the boundaries from the text itself, but costs embedding calls and extra complexity, so it has to beat a simpler structural split to be worth it.

How do you measure retrieval precision and recall for chunking? Label the evidence sentences for each question, then check which appear in the retrieved chunks. Recall is the share of evidence retrieved; precision is how much of the retrieved text is evidence, which I report as density.

Want More Practical AI Tutorials?

I write about building production AI systems with Azure, Python, and C#. Subscribe for practical tutorials delivered twice a month.

Subscribe to Newsletter →

Written by Jaffar Kazi, a software engineer in Sydney building AI-powered applications. Connect on LinkedIn.