Fave (@0xfav3) header
Fave (@0xfav3) profile picture

Rust engineer 🦀. product engineer... messing go around with models learning model perf

Joined November 2024
Photo by Fave (@0xfav3)Photo by Fave (@0xfav3)Photo by Fave (@0xfav3)Photo by Fave (@0xfav3)Photo by Fave (@0xfav3)Photo by Fave (@0xfav3)Photo by Fave (@0xfav3)Photo by Fave (@0xfav3)Photo by Fave (@0xfav3)Photo by Fave (@0xfav3)
Does anyone have anything like backend from first principles but for inference engineering? 🤔
105
Fave retweeted
Today is for the programmers 🍻
99
765
78
4,156
164,424
eu acho que essa foi a primeira propaganda contra o suicídio que eu achei bonitinha na vida
it's world suicide prevention day findahelpline.com/ please stay
5
1,944
3
31,832
290,909
Yesterday, I shared this inference engineering system design question. Here is my solution. 🧵👇🏿
I am preparing for inference engineering interview as I work on my mini inference engine project. To practice I asked Claude to create a realistic system design question, this is what I got - Design an inference API that serves LLM completions to thousands of concurrent users, where some requests are latency-sensitive (chat) and others are throughput-sensitive (batch jobs). I will share my solution tomorrow.
1
5
831
When a request comes in through the API gateway, it is tagged with a priority level based on the API key. This is more reliable than trusting a client-side flag. The request is then placed into a single priority-aware queue with an aging mechanism, so lower-priority batch requests never starve, even under continuous chat traffic. For serving, I use continuous batching. As requests finish, they leave the batch and new ones take their place immediately. No request waits behind a slower one. To support this at scale, I use paged KV cache. Instead of reserving the maximum memory up front, each request claims additional memory pages only when it needs them. This allows more concurrent requests to fit into the same GPU memory. Tokens are streamed back to the client with Server-Sent Events (SSE). The server only needs to push tokens to the client, so SSE is a good fit. For horizontal scaling, I run multiple GPU replicas behind a load balancer. Instead of round robin, I route each request to the replica with the lowest GPU memory usage. GPU replicas keep in-flight KV cache state, so load-aware routing is a better choice. For observability, I would track Time to First Token (TTFT), tokens per second, queue depth, and GPU memory utilization with Prometheus and Grafana. These metrics help detect performance problems before they affect users. In short, scheduling provides fairness between chat and batch traffic, paged KV cache improves memory efficiency, and load-aware routing improves horizontal scaling. What would you change in this design?
88
I am preparing for inference engineering interview as I work on my mini inference engine project. To practice I asked Claude to create a realistic system design question, this is what I got - Design an inference API that serves LLM completions to thousands of concurrent users, where some requests are latency-sensitive (chat) and others are throughput-sensitive (batch jobs). I will share my solution tomorrow.
1
1
4
1,068
7.9x speedup. CPU only. 1.17 tok/s to 9.30 tok/s on an Intel Core i3-5005U (4 cores, 11GB RAM). Model: SmolLM2-135M. One change: KV cache.
1
1
101
Batching 4 sequences added only 55% more throughput. The memory bus was already saturated at batch size 1. The bottleneck is memory bandwidth, not compute. On GPU, throughput scales near-linearly with batch size. On this CPU, the bus is the ceiling.
1
27
Next: paged KV cache. New requests join a running batch without waiting for it to finish.
12
I am betting on Rust for my software and firmware journey. I hope it pays off
Use this tweet as a life update tweet for your mutuals❤️🥹.
3
123
Everyone told me I needed Redis for my inference job queue. I didn't. Here's what I used instead and why it worked 🧵
1
1
57
I spent most of my time on the state machine. The Heartbeat logic, retry logic, dead-letter handling where real system design lives. The claiming and notification plumbing took an afternoon. Getting state transitions right under failure took days.
1
11