Blog

Notes on the work.

A working notebook on agents, retrieval, small and on-prem models, LLM internals, and production ML — a selection from 100+ technical articles, grouped by topic.

Agents & agentic systems

11
AI Agents in ProductionIsaac Kargar

Before an AI Agent Touches Customer Data: Six Production Gates It Must Pass

A demo proves an agent can sometimes do the job. Production requires evidence it can operate safely, predictably, and recoverably. Six gates every team should pass before letting an agent near real data.

Read →
Context Compaction in LLM AgentsIsaac Kargar

Context Compaction in LLM Agents: Part 1 - The Fundamentals

An exploration of context management and compaction strategies in LLMs — why they matter, how they work, and what to consider for production systems.

Read →
Context Compaction in LLM AgentsIsaac Kargar

Context Compaction in LLM Agents: Part 2 - Learning to Compact

The next frontier of context compaction is not a better heuristic but a model that decides for itself when, what, and how to compress. A look at SelfCompact, CompactionRL, and ACON.

Read →
Context Compaction in LLM AgentsIsaac Kargar

Context Compaction in LLM Agents: Part 3 - Post-Hoc Compilation

Every compaction method we have covered so far works within a single run. Lerim takes a different approach: wait until the run is done, then compile durable signal for the next agent.

Read →
Context Compaction in LLM AgentsIsaac Kargar

Context Compaction in LLM Agents: Part 4 - Theory and Safety

Is there a unified way to think about all compaction methods, from KV cache eviction to agent memory? And what happens when compaction silently erases safety constraints?

Read →
AI Agents in ProductionIsaac Kargar

One Line of Code, 41% Better Memory: When One AI Agent Optimizes Another

Using Claude Code to systematically optimize Lerim's memory agents — an AI agent improving another AI agent's prompts, tools, and extraction logic.

Read →
AI AgentsIsaac Kargar

Agent Teams with Claude Code and Claude Agent SDK

Building multi-agent teams using Claude Code and the Claude Agent SDK for collaborative AI workflows.

Read →
AI AgentsIsaac Kargar

Exploring the smolagents Library: A Deep Dive into MultiStepAgent, CodeAgent, and ToolCallingAgent

A deep dive into the smolagents library, exploring MultiStepAgent, CodeAgent, and ToolCallingAgent for building AI agents that interact with environments.

Read →
AI ResearchIsaac Kargar

The AI Scientist: Towards Fully Automated Open-Ended Scientific Discovery

An exploration of AI Scientist — a system that uses LLMs to conduct open-ended scientific research, from idea generation to paper writing.

Read →
AI AgentsIsaac Kargar

Agents Are Not Enough

An analysis of AI agents — when they work, when they fail, and what else is needed beyond autonomous programs to build reliable AI systems.

Read →
LLM EvaluationIsaac Kargar

Verifying LLM Outputs: The Evolution from Simple Consensus to Step-by-Step Analysis

How verification techniques for LLM outputs have evolved from simple consensus methods to detailed step-by-step analysis for more reliable AI systems.

Read →

RAG & knowledge systems

6
RAG OptimizationIsaac Kargar

Building and Optimizing Multi-Agent RAG Systems with DSPy and GEPA

A deep dive into building and optimizing multi-agent RAG systems using DSPy and GEPA for better retrieval and generation.

Read →
Graph Neural NetworksIsaac Kargar

Graphs to Graph Neural Networks: RDF vs LPG Knowledge Graphs

Comparing RDF and LPG approaches to knowledge graphs — two major ways to store and query complex, interlinked data for AI and RAG systems.

Read →
RAGIsaac Kargar

HybridRAG: Integrating Knowledge Graphs and Vector Retrieval Augmented Generation for Efficient Information Retrieval

Exploring HybridRAG — an approach that combines knowledge graphs with vector retrieval augmented generation for more accurate and efficient information retrieval.

Read →
RAGIsaac Kargar

Enhancing Large Language Models with Self-Reflective Retrieval-Augmented Generation (Self-RAG)

How Self-RAG improves LLM responses by letting the model decide when to retrieve, reject, or reformat evidence — making RAG more accurate and trustworthy.

Read →
RAG FundamentalsIsaac Kargar

The Art of Text Splitting: From Basic to Advanced Techniques for Language Models

A comprehensive guide to text splitting techniques for language models — from basic chunking to advanced semantic splitting strategies.

Read →
AI in ProductionIsaac Kargar

Building an Enterprise-Grade Customer Support Chatbot: A RAG Architecture with AWS and LlamaIndex

A case study of how we transformed a retail startup's overwhelmed support system into an AI-powered solution using LLMs, RAG, LlamaIndex, and AWS.

Read →

Small models, distillation & inference

8
Small-Model DistillationIsaac Kargar

Small-Model Distillation — Part 1: Offline Teacher-Trace SFT for a 0.8B SQL Agent

I wanted to see whether a very small language model could learn to act inside a real SQL tool-use loop. The model was not asked to only write a final answer.…

Read →
Small-Model DistillationIsaac Kargar

Small-Model Distillation — Part 2: Off-Policy Soft-Label KD for a 0.8B SQL Agent

The last post took a 0.8B SQL agent from 1/220 to 46/220 by copying a big teacher one token at a time. This one asks a simpler question: what if the student…

Read →
Small-Model DistillationIsaac Kargar

Small-Model Distillation — Part 3: DAgger-Style Expert-Correction SFT for a 0.8B SQL Agent

Before this experiment, the best 0.8B SQL agent came from top-k soft-label distillation and reached 55/220 on the fixed eval. That student was already much b…

Read →
Small-Model DistillationIsaac Kargar

Small-Model Distillation — Part 4: On-Policy Probability Distillation for a 0.8B SQL Agent

I started this post from the best hard-token correction-family SQL agent I had so far: unsloth/Qwen3.5-0.8B, evaluated at 67/220 on the fixed eval set. That…

Read →
Small-Model DistillationIsaac Kargar

Small-Model Distillation — Part 5: On-Policy Self-Distillation for a 0.8B SQL Agent

I had a 0.8B SQL agent scoring 69/220 on the fixed eval split, built through four stages of distillation from larger teacher models. The question was whether…

Read →
LLM Inference OptimizationIsaac Kargar

MEDUSA: Making Large Language Models Generate Text Faster

How MEDUSA uses multiple heads to predict multiple tokens in parallel, speeding up LLM text generation without sacrificing quality.

Read →
LLM Inference OptimizationIsaac Kargar

Speculative Decoding and Self-Speculative Decoding: Faster Approaches to Large Language Model Generation

How speculative decoding uses a smaller draft model to speed up large LLM generation, and how self-speculative decoding eliminates the need for a separate draft model.

Read →
Knowledge DistillationIsaac Kargar

Knowledge Distillation: Empowering Efficient AI Models

An introduction to knowledge distillation — what it is, why it matters, and how it helps create efficient AI models that retain the power of larger ones.

Read →

LLM internals, training & reasoning

13
LLM ReasoningIsaac Kargar

Chain of Draft Prompting: A Simple Way to Make LLMs Think Faster

How Chain of Draft prompting reduces token usage and speeds up LLM reasoning by generating concise draft thoughts instead of full chain-of-thought traces.

Read →
RL & LLMsIsaac Kargar

Some Thoughts on Reinforcement Learning in Large Language Models

Reflections on the rising prominence of reinforcement learning in large language model training and alignment, from an RL background perspective.

Read →
LLM ReasoningIsaac Kargar

How DeepSeek-R1 Uses Reinforcement Learning to Supercharge Reasoning

How DeepSeek-R1 uses reinforcement learning to improve LLM reasoning capabilities, creating a model that rivals OpenAI's o1 through RL-driven training.

Read →
LLM Training MethodsIsaac Kargar

REFT: Reasoning with Reinforced Fine-Tuning

How Reinforced Fine-Tuning (ReFT) uses reinforcement learning to improve LLM reasoning capabilities during training.

Read →
LLM Training MethodsIsaac Kargar

Reinforcement Learning Fine-Tuning by OpenAI

OpenAI's reinforcement fine-tuning announcement — a new method for training LLMs on domain-specific reasoning tasks using RL.

Read →
Inside TransformersIsaac Kargar

Inside Transformers: An In-depth Look at the Game-Changing Machine Learning Architecture — Part 1

A deep dive into the Transformer architecture — the foundation of modern AI — covering attention mechanisms, embeddings, and how transformers process language.

Read →
Inside TransformersIsaac Kargar

Inside Transformers: An In-depth Look at the Game-Changing Machine Learning Architecture — Part 2

Continuing the deep dive into Transformers — covering positional encoding, multi-head attention, and the encoder-decoder structure.

Read →
Inside TransformersIsaac Kargar

Inside Transformers: An In-depth Look at the Game-Changing Machine Learning Architecture — Part 3

Continuing the deep dive into Transformers — covering feed-forward networks, layer normalization, and residual connections.

Read →
Inside TransformersIsaac Kargar

Inside Transformers: An In-depth Look at the Game-Changing Machine Learning Architecture — Part 4

Continuing the deep dive into Transformers — covering the decoder side, masked attention, and output generation.

Read →
Inside TransformersIsaac Kargar

Inside Transformers: An In-depth Look at the Game-Changing Machine Learning Architecture — Part 5

The final part of the Transformers deep dive — covering training, optimization, and how Transformers evolved into modern LLMs.

Read →
LLM Training MethodsIsaac Kargar

Mixture of Memory Experts: Lamini Memory Tuning

How Lamini's Mixture of Memory Experts approach enables precise fact injection into LLMs without retraining, using memory tuning for high-accuracy domain-specific knowledge.

Read →
Model ArchitectureIsaac Kargar

KAN: Kolmogorov-Arnold Networks — A Short Summary

A summary of Kolmogorov-Arnold Networks (KAN) — a new neural network architecture based on the Kolmogorov-Arnold representation theorem that challenges traditional MLPs.

Read →
Lifelong LearningIsaac Kargar

Expert Gate: Lifelong Learning with a Network of Experts

How Expert Gate uses a network of expert models for lifelong learning — dynamically routing tasks to specialized experts while preventing catastrophic forgetting.

Read →

MLOps & data engineering

11
MLOpsIsaac Kargar

MLOps Project — Part 4a: Machine Learning Model Monitoring

How to monitor deployed machine learning models in production — detecting data drift, model degradation, and performance issues as part of an MLOps pipeline.

Read →
MLOpsIsaac Kargar

MLOps Project — Part 3: Machine Learning Model Deployment

Strategies for deploying machine learning models to production — covering batch, real-time, and edge deployment patterns as part of an MLOps pipeline.

Read →
MLOpsIsaac Kargar

MLOps Project — Part 2b: Machine Learning Workflow Orchestration Using ZenML

How to use ZenML for workflow orchestration in ML pipelines — an alternative to Prefect for creating portable, reproducible machine learning workflows.

Read →
MLOpsIsaac Kargar

MLOps Project — Part 1: Machine Learning Experiment Tracking Using MLflow

How to use MLflow for experiment tracking in machine learning model development — the first step in building an end-to-end MLOps pipeline.

Read →
MLOpsIsaac Kargar

MLOps Project — Part 2a: Machine Learning Workflow Orchestration Using Prefect

How to use Prefect for workflow orchestration in ML pipelines — scheduling, running, and monitoring training workflows as part of an MLOps pipeline.

Read →
MLOpsIsaac Kargar

Setting Up MLflow on GCP for Experiment Tracking

A step-by-step guide to setting up MLflow on Google Cloud Platform for distributed experiment tracking — enabling remote tracking of machine learning experiments across teams.

Read →
Data EngineeringIsaac Kargar

Data Engineering — Week 3a: Data Warehouse

Building a data warehouse with BigQuery — understanding OLTP vs OLAP, dimension modeling, and querying large datasets with SQL.

Read →
Data EngineeringIsaac Kargar

Data Engineering — Week 3b: Data Warehouse and BigQuery ML

Continuing the data warehouse deep dive — BigQuery ML for machine learning in the warehouse, partitioning, clustering, and advanced SQL for analytics.

Read →
Data EngineeringIsaac Kargar

Data Engineering — Week 2a: Data Ingestion

Data ingestion fundamentals — building data lakes with Google Cloud Storage, ingesting data with Airflow and Prefect, and understanding data pipeline architecture.

Read →
Data EngineeringIsaac Kargar

Data Engineering — Week 2b: Data Ingestion with Airflow

Continuing data ingestion — orchestration with Apache Airflow, building DAGs for data pipelines, and scheduling data workflows.

Read →
Data EngineeringIsaac Kargar

Data Engineering — Week 1: Introduction and Prerequisites

Introduction to the Data Engineering Zoomcamp — setting up Docker, Terraform, and Google Cloud Platform for building data pipelines.

Read →