{"@attributes":{"version":"2.0"},"channel":{"title":"Blog on Rajat Patel","link":"https:\/\/rajathpatel23.github.io\/posts\/","description":"Recent content in Blog on Rajat Patel","generator":"Hugo -- 0.167.0","language":"en-us","managingEditor":"rpatel12@umbc.edu (Rajat Patel)","webMaster":"rpatel12@umbc.edu (Rajat Patel)","lastBuildDate":"Sun, 27 Sep 2026 00:00:00 +0000","item":[{"title":"Pretrain, SFT, then the DPO run that held","link":"https:\/\/rajathpatel23.github.io\/posts\/tiny-shakespeare-sft-dpo\/","pubDate":"Sun, 27 Sep 2026 00:00:00 +0000","author":"rpatel12@umbc.edu (Rajat Patel)","guid":"https:\/\/rajathpatel23.github.io\/posts\/tiny-shakespeare-sft-dpo\/","description":"A 15M-parameter model pretrained on tiny-shakespeare, fine-tuned to stop after one line, then aligned with DPO. The same learning rate that worked for SFT broke generation. A tenfold cut fixed it."},{"title":"Small ML Sub-Problems Inside Agents","link":"https:\/\/rajathpatel23.github.io\/posts\/small-ml-subproblems-inside-agents\/","pubDate":"Mon, 22 Jun 2026 00:00:00 +0000","author":"rpatel12@umbc.edu (Rajat Patel)","guid":"https:\/\/rajathpatel23.github.io\/posts\/small-ml-subproblems-inside-agents\/","description":"<p>When you build an agent, you&rsquo;re not building one system. You&rsquo;re building several small ML problems composed together, each one making a quality judgment, each one capable of failing silently.<\/p>\n<p>I learned this while building a deep research agent. At a high level, the system takes a question, breaks it into smaller research questions, searches for sources, extracts claims, and keeps a structured record of what it has found. A planner reads that record after every search and decides whether to investigate a new question, challenge an existing claim, or stop.<\/p>"},{"title":"Evidence-Driven Deep Research Agent","link":"https:\/\/rajathpatel23.github.io\/posts\/deep-research-agent\/","pubDate":"Sun, 07 Jun 2026 00:00:00 +0000","author":"rpatel12@umbc.edu (Rajat Patel)","guid":"https:\/\/rajathpatel23.github.io\/posts\/deep-research-agent\/","description":"How I built visibility into the research process itself: an explicit evidence state, step-level reward signals, and a planner that uses those signals deliberately. Without retraining."},{"title":"GPT OSS Style Architectures","link":"https:\/\/rajathpatel23.github.io\/posts\/gpt_oss_architecture\/","pubDate":"Sat, 29 Nov 2025 00:00:00 +0000","author":"rpatel12@umbc.edu (Rajat Patel)","guid":"https:\/\/rajathpatel23.github.io\/posts\/gpt_oss_architecture\/","description":"A personal deep-dive into modern open-source GPT-style language models, covering tokenization, positional embeddings (RoPE), attention optimizations (GQA, SWA, attention sinks), normalization (RMSNorm), feed-forward variants (SwiGLU, MoE), and KV caching."},{"title":"Attention Mechanisms in Transformers: MHA vs MQA vs GQA","link":"https:\/\/rajathpatel23.github.io\/posts\/attention_mechanism\/","pubDate":"Sat, 20 Sep 2025 00:00:00 +0000","author":"rpatel12@umbc.edu (Rajat Patel)","guid":"https:\/\/rajathpatel23.github.io\/posts\/attention_mechanism\/","description":"A comprehensive guide to attention variants in modern transformers: Multi-Head Attention (MHA), Multi-Query Attention (MQA), and Grouped-Query Attention (GQA), exploring their architectural differences and trade-offs."},{"title":"Understanding Tokenization: From Text to Integers","link":"https:\/\/rajathpatel23.github.io\/posts\/tokenizers\/","pubDate":"Sat, 20 Sep 2025 00:00:00 +0000","author":"rpatel12@umbc.edu (Rajat Patel)","guid":"https:\/\/rajathpatel23.github.io\/posts\/tokenizers\/","description":"<h2 id=\"introduction\">Introduction<\/h2>\n<p>Language models are mathematical functions; they operate on numbers, not raw text. Tokenization is the crucial first step in converting human-readable text into a sequence of integers (tokens) that a model can process. These tokens are then mapped to embedding vectors.<\/p>\n<hr>\n<h3 id=\"1-naive-approaches-and-their-flaws\">1. Naive Approaches and Their Flaws<\/h3>\n<h4 id=\"word-level-tokenization\">Word-Level Tokenization<\/h4>\n<p>The most intuitive approach: split text by spaces and punctuation.<\/p>\n<ul>\n<li><strong>Problems<\/strong>:\n<ol>\n<li><strong>Vocabulary Explosion<\/strong>: A language like English has hundreds of thousands of words. The model&rsquo;s vocabulary would be enormous, making the final embedding and output layers computationally massive.<\/li>\n<li><strong>Out-of-Vocabulary (OOV) Words<\/strong>: If the model encounters a word not seen during training (e.g., a new slang term, a typo, or a technical name), it has no token for it. It typically maps it to an <code>&lt;UNK&gt;<\/code> (unknown) token, losing all semantic meaning.<\/li>\n<li><strong>Poor Generalization<\/strong>: The model treats <code>eat<\/code>, <code>eating<\/code>, and <code>eaten<\/code> as three completely separate, unrelated tokens. It fails to capture the shared root <code>eat<\/code>, making it harder to learn morphological relationships.<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<h4 id=\"character-level-tokenization\">Character-Level Tokenization<\/h4>\n<p>The opposite extreme: split text into individual characters.<\/p>"},{"title":"Reinforcement Learning Foundations: From MDPs to Deep Q-Learning","link":"https:\/\/rajathpatel23.github.io\/posts\/reinforcement-learning-foundations\/","pubDate":"Wed, 13 Aug 2025 00:00:00 +0000","author":"rpatel12@umbc.edu (Rajat Patel)","guid":"https:\/\/rajathpatel23.github.io\/posts\/reinforcement-learning-foundations\/","description":"<h2 id=\"introduction\">Introduction<\/h2>\n<p>Reinforcement Learning (RL) has exploded in popularity: first in game-playing agents, and now in large language models via methods like RLHF (Reinforcement Learning from Human Feedback). These approaches don&rsquo;t just help models learn context better; they also improve reasoning by teaching them to &ldquo;think in steps.&rdquo;<\/p>\n<p>My fascination with RL began when the GPT-3 paper was published and ChatGPT emerged as the so-called &ldquo;tool of the decade.&rdquo; I wanted to go beyond using these models: I wanted to understand <em>how<\/em> they work under the hood. That meant building RL concepts from the ground up: deriving equations, implementing toy solutions in environments like CartPole and FrozenLake, and seeing theory come alive in code.<\/p>"}]}}