Siva Madhavan

Backend Engineer specializing in healthcare SaaS platforms, real-time audio pipelines, and AI integrations. Writing about distributed systems, transformer models, and backend architecture.

Backend

Designing Resilient Webhook Ingestion with FastAPI, Celery, and Redis

Third-party webhooks from payment gateways (Stripe), communication providers (Twilio, RingCentral), or healthcare EHR integrations are notoriously unpredictable. Providers will retry aggressively during network blips, send duplicate payloads, or blast thousands of events within seconds during batch syncs. If your webhook endpoint directly executes database queries or third-party downstream calls, your backend will quickly encounter connection exhaustion, cascading timeouts, and 504 Gateway errors. Here is the architectural blueprint I use to design high-throughput, idempotent webhook ingestion pipelines. ...

September 12, 2026 · 3 min · Siva Madhavan
Math

The Essence of Vector Embeddings: High-Dimensional Cosine Similarity Explained

In Retrieval-Augmented Generation (RAG) and vector databases (Pinecone, Qdrant, pgvector), text is converted into high-dimensional numerical vectors (e.g., 1,536 dimensions for OpenAI’s text-embedding-3-small). To compare how semantically related two paragraphs are, we calculate their Cosine Similarity. But why cosine similarity instead of Euclidean distance? What actually happens in 1,536 dimensions? 1. The Geometry of Angle vs. Distance Suppose we have two vectors, $\mathbf{A}$ and $\mathbf{B}$, in $n$-dimensional Euclidean space: $$\mathbf{A} = [a_1, a_2, \dots, a_n], \quad \mathbf{B} = [b_1, b_2, \dots, b_n]$$ ...

September 12, 2026 · 3 min · Siva Madhavan
Science

From Sound Waves to Spectrograms: The Physics & Signal Processing of Speech AI

When a clinician speaks during a telehealth consultation, the microphone diaphragm converts vibrating air molecules into a continuous electrical voltage signal. Yet neural networks (like Whisper or Azure Speech Services) do not operate on raw 1D audio waveforms. Instead, they “look” at audio as 2D images called Mel Spectrograms. How does physical sound transform into a frequency visual? Here is the journey through acoustic physics and signal processing. 1. The Physics of Sound: Pressure Perturbations Sound is a mechanical longitudinal wave. When vocal cords vibrate, they compress and rarify surrounding air molecules, producing periodic fluctuations in atmospheric pressure: ...

September 12, 2026 · 3 min · Siva Madhavan
CS

How Large Language Models (LLMs) Actually Work: An Interactive Guide

Large Language Models (LLMs) like GPT-4, Claude, and LLaMA appear to understand reasoning, humor, code, and nuance. Yet under the hood, every LLM operates on a single core objective: given a sequence of tokens, predict the probability distribution for the very next token. In this guide, we demystify how LLMs transform human language into math, process context through the Transformer architecture, and generate coherent text. You can interact with the live demos below to see the math in action. ...

September 12, 2026 · 5 min · Siva Madhavan
Life

Five Years in Production: Engineering Trade-offs, Systems Thinking, and Longevity

Five years ago, I entered software engineering believing that great engineers were the ones who wrote the most intricate algorithms, mastered every esoteric language feature, and adopted every cutting-edge framework on day one. After shipping multiple healthcare SaaS platforms, maintaining 24/7 high-throughput streaming systems, and being woken up by PagerDuty at 2:30 AM on a Saturday, my perspective on what “good software” means has transformed completely. Here are the guiding principles I now carry with me into every architecture review and every line of code. ...

September 12, 2026 · 2 min · Siva Madhavan