Token Embeddings — what they are, why they matter, and how to build them (with working code)

Introduction Token embeddings (aka vector embeddings) turn tokens — words, subwords, or characters — into numeric vectors that encode meaning. They’re the essential bridge between raw text and a neural network. In this post, below we will run a small demos (Word2Vec-style analogies, similarity checks), and provide concrete PyTorch code that demonstrates how an embedding layer works, I also include a tiny toy training loop so you see embeddings updated by backprop. ...

September 28, 2025 · 7 min · Nitin

Byte Pair Encoding (BPE): the tokenizer that made GPTs practical

Introduction Byte Pair Encoding (BPE) is a subword tokenization scheme that gives us the best of both worlds: compact vocabulary sizes (not the full wordlist), the ability to represent any unknown word (by falling back to subwords/characters), and meaningful shared pieces (roots, suffixes) that help models generalize. GPT-2 used a BPE tokenizer with a vocabulary of ≈50,257 tokens, and OpenAI’s tiktoken is a fast Rust-backed implementation you can use today. Below I explain the why, the how (intuition + algorithm), and a short hands-on demo using tiktoken. ...

September 27, 2025 · 4 min · Nitin

Tokenization in Large Language Models: A Hands-On Guide

Introduction In this blog post, we dive deep into tokenization, the very first step in preparing data for training large language models (LLMs). Tokenization is more than just splitting sentences into words—it’s about transforming raw text into a structured format that neural networks can process. We’ll build a tokenizer, encoder, and decoder from scratch in Python, and walk through handling unknown tokens and special context markers. By the end, you’ll not only understand how tokenization works but also have working Python code you can adapt for your own projects. ...

September 27, 2025 · 4 min · Nitin

Unlocking Deeper AI: The Power of Thinking in LLM Models

Ever wondered how advanced AI models can tackle truly complex problems with a depth of analysis that seems to mimic human thought? The secret lies in a groundbreaking capability known as “thinking.” This fascinating development is designed to unblock key bottlenecks on the path to greater intelligence in AI. Moving Beyond Fixed Compute Historically, powerful large language models (LLMs) were designed to respond immediately to requests. This meant they applied a constant amount of computing power at “test time”—the moment you ask a question or give a command—to generate a response. This fixed compute budget restricted how deeply the model could “think” about a problem, limiting its ability to handle extremely hard or challenging tasks. Imagine if your brain only spent a fixed millisecond on every problem, no matter its complexity! ...

July 13, 2025 · 5 min · Nitin

Resolving CORS Errors When Fetching Images from AWS S3 with Signed URLs

If you’re displaying images stored in an AWS S3 private bucket using signed URLs, you might have encountered a confusing scenario: images display perfectly in your web pages but throw CORS errors when you try to download them using JavaScript’s fetch API. Let’s break down the issue and explore a practical solution. Understanding the Problem Imagine you have your images securely stored in a private S3 bucket, and you’re using pre-signed URLs to grant temporary access: ...

June 29, 2025 · 3 min · Nitin

ComfyUI API Endpoints Guide: Complete Reference for Image Generation Workflows

Introduction ComfyUI is a powerful, open-source, node-based interface for generative AI workflows, majorly for image and video workflows. While it’s primarily known for its visual interface, ComfyUI also offers robust API capabilities, enabling developers to integrate and automate workflows programmatically. This guide will walk you through using ComfyUI in API mode. ComfyUI offers a suite of RESTful and WebSocket API endpoints that enable developers to programmatically interact with its workflow engine. These endpoints facilitate tasks such as queuing prompts, retrieving results, uploading images, and monitoring system status. ...

June 1, 2025 · 3 min · Nitin

Building Robust Systems: Key Lessons from Designing Data-Intensive Applications Chapter 1

Introduction If you’re involved in building software today, chances are you’re dealing with data. Lots of it. Maybe it’s user activity, sensor readings, financial transactions, or something else entirely. Martin Kleppmann’s phenomenal book, “Designing Data-Intensive Applications” (often called DDIA), is practically required reading for navigating this landscape. Let’s dive into some key takeaways from this essential chapter. The Shift: It’s About the Data, Not Just the CPU The chapter opens by highlighting a crucial distinction: many modern applications are data-intensive, not compute-intensive. While CPU power is abundant, the real challenges often lie in: ...

May 4, 2025 · 5 min · Nitin

Tokenization

Natural Language Processing (NLP) has revolutionized the way machines understand human language. But before models can learn from text, they need a way to break it down into smaller, understandable units. This is where tokenization comes in — a critical preprocessing step that transforms raw text into a sequence of meaningful components, or tokens.## 🧠 What is Tokenization? Tokenization is the process of splitting text into smaller units called tokens. These tokens can be as large as words, or as small as characters or subwords. ...

April 18, 2025 · 3 min · Nitin

Model Context Protocol (MCP) – A Technical Guide to Understanding and Building MCP Servers

Introduction to MCP The Model Context Protocol (MCP) is an open standard for connecting AI assistants (like large language models) to the systems where data and tools live​ In essence, MCP aims to bridge the gap between isolated AI models and real-world data sources – think of it as a “USB-C for AI applications”, providing a universal way to plug an AI model into various databases, file systems, APIs, and other tools​. ...

March 24, 2025 · 15 min · Nitin

WebRTC Signaling & Connection Establishment

What is Signaling in WebRTC, and Why is it Needed? WebRTC allows direct peer-to-peer (P2P) communication, but before two peers can connect, they need to exchange network and media information. This process is called signaling. Signaling is needed for: Exchanging session descriptions (SDP – Session Description Protocol) between peers. Sharing ICE candidates to determine the best network path. Handling NAT traversal by identifying public and private network addresses. Establishing data channels for text, files, and other non-media communication. WebRTC does not define a signaling protocol. Developers must implement their own using available technologies like WebSockets, WebRTC Data Channels, or existing protocols like SIP. ...

February 7, 2025 · 4 min · Nitin