AI agents live and die by their context windows. The system prompt, tool schemas, conversation history, retrieved documents — everything the model sees during a single request shapes what it does next. Context engineering is the art of deciding what goes in, where it goes, and when it gets removed. 
 Good context engineering makes agents more reliable, faster, and cheaper. This post explores…
In this post, we implement GPT-OSS-20B inference from scratch in PyTorch. Building GPT-OSS shares a lot of common ground with building the Qwen3 family — if you haven’t read my Qwen3 Inference from Scratch and Qwen3 MoE from Scratch posts, I recommend starting there. 
 GPT-OSS is also a sparse MoE transformer with RMSNorm + GQA + RoPE + SwiGLU experts — the shared components work the…
In this post, we implement Qwen3 MoE inference from scratch in PyTorch. It builds on the Qwen3 dense architecture — if you haven’t read my Qwen3 Inference from Scratch post, I recommend starting there, as it covers the full dense transformer pipeline (tokenizer, RMSNorm, RoPE, GQA, SwiGLU FFN, KV cache, generation). This post covers the key architectural advancement from dense to MoE:…
Better late than never — I’ve started a repo called llm-from-scratch , where I reimplement popular open-source LLMs piece by piece, with a focus on making every component’s structure clear and easy to follow. It’s meant to be a hands-on tutorial for beginners and a personal reference for myself. The first entry is a from-scratch implementation of Qwen3-0.6B in pure PyTorch — no…
Today I revisit the classic LRU cache problem in my playground repo. The standard answer comes to my mind immediately: HashMap + Doubly Linked List. Cool, I remember that. But then I ask myself, what about LFU, B+Tree, and other complex data structures? I can barely remember and have to look up the script I developed when I’m at school. 
 Yeah, the real problem is that I’m…
Background 
 Our team planned to upgrade one of our MySQL instance from 8.0.28 to 8.0.36 through AWS RDS blue/green deployment. The whole process includes 4 steps: 
 
 set up a new MySQL 8.0.36 instance (slave), recover data from snapshot 
 new MySQL instance (8.0.36) subscribe to old MySQL instance (8.0.28) 
 once there’s no replication lags, do switch-over. The downtime is…
Background 
 When I tried to run a big range query on mysql using aiomysql ‘s SSDictCursor , everything looks fine at first but after a period of time (15min to 20min), the query stopped with error.
The error message is: 
 Error Code 2013: Lost connection to MySQL server during query.
 Environment 
 Database
MySQL version:…
Background 
 One of the pipelines I maintained failed last week. The first try failed but the second try was successful. The pipeline’s structure is quite simple, it contains 3 steps, like most of the ETL pipelines: 
 
 Load data from database 
 Boardcast join a 2GiB dataset 
 Write to delta table 
 
 Error message is There is not enough memory to build the hash map .…
Background 
 As what is explained in my pervious post , B+ tree depth decides the worst case of MySQL’s query performance, only considering those use index. And with the help of SSD, that should be fine to have a B+ tree deeper than 4 layers. 
 So the next question is: how bad the performance is possible to be? Here I intentionally design a table using very long string as primary key and…
Rumor 
 There’s rumor around the internet that we should avoid having > 20M rows in a single MySQL table. Otherwise, the table’s performance will be downgraded, you will find SQL query much slower than usual when it’s above the soft limit. These judgements were made on HDD many years ago. I’m wondering if it’s still true for MySQL on SSD in 2023, and if true, why…
send/receive buffer 
 Goal 
 Get a better understanding of how send/receive buffer size may affect the network rtt and throughput. Usually send/receive buffer size is managed by kernal and application should not hardcode these values. However, real world cases are more rare and complicated. Inapporiate buffer size may be the root case of some network issues. Rare but possible. 
 Method…
packet delay, loss, duplicate, corrupt, out-of-order and bandwidth limit 
 Goal 
 The goal of packet capture experiment here is to get a better understanding of TCP protocol. Besides, by reproducing the common network issues in the real world like packet delay, loss, out-of-order and brandwidth limit and saving a snapshot of packet capture result of circumstances above, we can identify and…
Observation 
 Spark Job runtime is not stable 
 
 As what can see from the screenshot, the pipeline (spark job) runtime is not quite stable. However, the pipeline deals with almost fixed amount data everyday, the runtime should not be so quite unstable like this. 
 Besides, the pipeline runtime is quite stable at around 15min before migration to databricks. 
 Analysis 
…
Observation 
 
 
 Queue client performance went down 
 Everything worked well in the morning until we got monitoring alarm at 12:45 PM EST: <topic_name> Queue lag is too big . The issue happened in a service which is responsible for consuming message from message queue, processing message and writing it to database. The service also uses Redis to cache some objects which can be…
Observation 
 CronJob is taking more than 1h to complete 
 My colleagues told me that one of the cron job stuck in the middle after a random day. They received the warning: CronJob is taking more than 1h to complete. And the pod kept stucking there after a day, which is abnormal. However, another cron job which almost uses the same code works well. No database failure was reported during…
Observation 
 Signal file is widely used in Hadoop ecosystem. If you have experience with MapReduce, you’ll notice that by default MapReduce runtime writes an empty _SUCCESS file to mark successful completion of a job to the output folder. AWS DataPipeline and Databricks also support “file arrival” to trigger a downstream job. 
 Question 
 Is signal file a good architecture design?…

 

 My name is Yisheng Gong. 
 Software Engineer@ YipitData 
 Based in Santa Clara, California. 
 Recently working on Agent / RL Infra 
 I love open source and I’m a committer of sglang , miles and verl 
 And here’s some personal projects I built during my spare time: 
 
 playground - Learning by breaking things 
 llm-from-scratch - Build…