Working Notes: a commonplace notebook for recording & exploring ideas.
Home. Site Map. Subscribe. More at expLog.
— Kunal
Infercon
Inferact / VLLM / Simon
- 26 models added to vllm in 23 weeks
- I don’t see inlking small 2 in the list :(
- vllm’s complexity explosion with the number of abstractions needed for models, hardware, use cases, etc.
- chips are also diversifying
- pareto curve: throughput vs latency (tokens/user/s) tradeoff
- deepinfer brings optimization into production system
- 60k throughput enhancement at the same tps on VRs (cost difference?)
- TPU megakernel 408tok/s for K3 2.8T
- inferact / autonmous inference system
- agents continuously optimize the system
- hill-climbing loop
- even supporting new models autonomously
- agent-v in-house harness, look at datadog warnings, etc.
- correctness validation / abstraction management seems really important
Anthropic / Katelyn
- Platform engineering: developer infrastructure
messages api – relatively more complex; sandboxing fleet, etc.
- running agents in sandboxes: latency, reliability, cpu efficiency & security
- generic platform for agentic systems
- python monolith + mtls as security becomes more important
- validating that guardrails are working?
- disabling the ability of agents to modify audit logs & traces
- what does an anomaly look like -> hitting circuit breakers
- eg. agent tries too many times to hit a domain not on its allowlist
- eg. classifiers around all agent tool calls
- eg. classifiers for egress
- put in a lot of deterministic software around the agent
- understanding
- understand one layer outside what you need to understand to do your job
- agents need a lot of compute/we’re constrained
Latency bound inference / Decagon, Cyrus Asari
- token inflation from images
- every second of audio is a lot more than plain text
- have to manage kv cache
- transcription
- turn taking detection – is the user done speaking?
- transcription
- cut reasoning tokens by specializing the model to the harness and tasks
- rl
- representative environments – synthetic data
- stateful tool world
- work harness
- full trajectory of the agent
- rl bias/variance
- top p to fix variance in rollout engine
- also apply token level mask to the trainer
- importance sampling
- mitigate bias
- reweight by ratio of trainer over rollout to mitigate bias
- clip ratio / CISPO
- bounded variance
- score centering
- full duplex
- tradeoff: can handle audio much better
- but generally these models aren’t very smart
- can delegate to the brain
- latency opportunities?
- largest bottleneck is still the core llm stage
- do reasoning asynchronously
KV Cache as a distributed system
- Nick, MorphLLM; Charles, Modal, Zhijian Inco.ai
- it is reconstructible, but critical to system health
- 200k token deepseek kv cache will take several seconds to recompute
- “ephemeral database”
- providers should have an SLA for kv cache
- pricing is also based off their own ability to cache things
- bringing up a new model with a cold cache
- start new customers with limited throughput
- very high tpm at 99% vs 94% is very different on cost
- do rate limits on uncached token basis
- (aside: looks like they do token fairness)
- what’s kept in kv cache
- some models remove thinking tokens in next runs
- those with thinking trace keep cache, but lose context way faster
- draft tokens are not put; accepted tokens will go in
- hit rate
- tpm, raw tokens is a vanity metric; big number
- similar to tps at 1 batch size
- cache hit rate – monitor and track this
- understand speed of light equivalent of cache hit rate
- if I had an infinitely sized cache, what would my cache hit rate be
- is my cache hit rate of 94% a skill issue or inherent to the workload
- other metrics
- ttl in cache – great north star metric
- deepseek has 3.5 days median
- ttft –
- will be much higher if cache is good
- ideal cache rate – traffic bound or retention bound
- shift in traffic can cause eviction
- may need to realign prefill / decode
- if ttft has a spike – switch a decode worker to prefill worker
- economic consequences –
- session id of a user is pinned on openrouter/opencode
- routing algorithms can take sessions away if there’s a spike in ttft
- pull session away to another region
- makes it very hard to be an inference provider / reduces monetization
- can make cache more expensive and allocate capacity to prefill
- modal has done this a little bit – for data labelling etc. – with more prefill capacity
- maintain a separate endpoint
- the more the users can express their intent, the more you can optimize
- moving cache outside the datacenter
- need 800gig north south connection
- 16 million to lay that fiber down for an ISP
- use weka, vast – move kv cache across the datacenter as a supplemental cache
- as a new inference startup
- differentiate, deepseek style is very saturated
- look at weirder opportunities
- treat kv cache as first class citizen
- can get 2x improvements going from 95 to 99%
- several terabytes, 400gig interconnect between gpu and storage
RL inference
- sami, prime intellect; vibhu, latent space
- get final solution – model should do the same
- lots of budget is going to RL for inference
- inference is mostly memory bound, going to compute bound
- kv cache is most memory bound these days; specially long running agents changing the space
- 10 requests – 10 kv cache of the same size
- inference for RL has been 80% of the compute
- can we do specdec on rl inference
- have bubbles in standard rl, going into long horizon RL cannot do this
- distributed RL across datacenters
- was working on distributed pretraining
- much easier to do in post training; off policy is much easier to handle
- going across datacenters is 10 times slower; can hide this in async rl
- can broadcast from trainer to inference pods, can be on different on/off policy
- account for this in the RL
- can scale inference RL a lot with really big batch size
- offloading kv cache, scaling context lengths is a big bottleneck
- can we prune rollouts?
- dangerous to make assumptions on the current state of the rollout
- classify easy problems and take less attempts at them
- grpo lets you to spend compute and skip probelms
- swarms may force a need to prune searches
- but dangerous
- trajectory of RL availability
Economics
- Dima, Fireworks
- speed/cost/quality tradeoff in 2025
- now: self improving engines: “ultraloop” / RSI
- each workload is unique
- given workload, set target, engine is automatic
- agents: cost per token is unimportant, look at cost per task
- long context
- prompt tokens have gone 1000x, requests went 25x
- expect this trend to continue
- long context dominates the requests, 1% to 94%
- most of it is cached tokens; greatly affects cache
- agents need cache across long periods of time
- multi day cache lifetime is really important for this
- less chatty models can significantly drop cost per task
- small inference issues can make the model think much more withs slightly different numerics
- efficient vs fast – interactivity vs cost per task tradeoff, is it worth paying
- things are nonlinear; cost / speed need not be obvious
- background agents may still need speed to reduce secondary costs like sandboxes
- swarm can spam a lot of requests rapidly
- fireworks is great at running large batches rapidly, invested in autoscaling
- time to start model is <1 min
- latency compounds across multiple turns
ultrafast: 8x speed
- serving tricks
- prefill decode disagg
- can have multiple prefill tiers; short and long prompts
- go wide on decode – wide expert parallel
- pull traffic into a single use case to have massive decode demand
- prompt cache
- distributed: gpu -> cpu -> local ssd -> cluster storage
- should stick around for hours and days
- router should be smart; same traffic -> same replica, but maintain efficiency
- also need a global router to route across clusters
- run a very distributed system
- tune this across with ultraloop, and is across types of silicon
- expect many more chips in the markets

- agents for self-improvement
- need a lot of constraints and tests
- kernels, bencmarks & numerics
- drafter -> acceptance rate
- sharding -> cost model -> predictions -> test deployment -> synthetic traffic, correctness
- scheduling -> new routing -> simulator -> predictions -> shadow deplpoyment -> real cost
- prevent reward hacking
- harness must be set up correctly
- cheap feedback first, cost models, knowledge base – seed the search
- ci/cd & evals are really important, along with basic infra
- security
- make the environment robust
- don’t expose it externally
Customizing open models
- Yiwei Song, Crusoe
- crusoe: neocloud, and a token api for inference
- customers: lighter, cheaper and better on specific task
- started with base open source models
- do midtraining and post training and distillation on customer specific data
- getting started
- business problem -> evaluation metrics
- start with evals – understand the task & business objectives
- training improves metrics – work backwards
- have a robust way to reflect business gains
- ecosystem
- baseline is always rising
- evaluation method / reward design to prevent reward hacking – on customer side
- infrastructure – still tricky to understand the architecture
- large model has very different shape, doing that bugfree is still pretty challenging
- loss function goes down – but can still have bugs
- tinker was the first one in there to abstract this away
- had a lot of accuracy bugs
- for companies
- find product market fit, find out your cost is really high from oai/ant
- then finetune a model after the product market fit
- prompt distillation
- closing the loop with production
- how frequently can we update model weights in production
- as distribution changes over data – online serving
- this is an old concept
- reducing thinking / tool calls?
- inference tricks to suppress thinking
- reduce thinking on easy tasks – strike the balance for penalizing overthinking
- when do you upgrade base model vs just continue post training
Open source engines
- (probably my favorite session)
- Richard, Modal
- the most valuable metrics
- need
- measurement driven configuration
- closing gaps around engine (routing, kv-cache)
- co design with infrastructure
- numbers that can look wrong
- async scheduling
- schedule next batch while running the current batch
- but this needs results of the first decode batch
- write a lot of engine code ~10k lines of sglang to prepare the next batch
- profiling and timing are really important
- find the slowest kernels, configure to fuse the kernels
- timing: can have a few gpus running slower consistently – eg. because of numa pinning
- concurrency sweeps
- slowly increase load and look at tps / throughput maxima
- kv cache eviction with cache hit rate – make sure cache hit ratio is tracked
- enable hi-cache to spill to host dram, and then desk
- get more hbm, eg. optimize specdec
- high cache doesn’t deduplicate
- measure when doing multiple replicas
- sign a contract with the right numbers
- monitor requests per replica, don’t overload a single replica; need cache & load aware routing
- implemented custom heuristic: alpha * uncached tokens + beta * load – chooset he lowest cost as a weighted average
- choose alpha and beta with experiments & simulations
- pd disagg isn’t always better
- request tracing – trace is very important
- lots of queueing time waiting on the prefill
- colocated wasn’t queueing as much
- because burst of requests would get stuck on prefill
- if prefill nodes can transfer kv – queue wait reduces
- power of n choices: choose any of the usptreams if you can move the kv outside
- then pd becomes much better
- productionizing open source
- operational cost of using open source engines
- takes months to go from research to production: async scheduling took 2 years, dflash took 6 months, hicache tooke 1.5 years, pd disagg takes 1.5 years to get to stability
- use version pinned images + patches, and review the generated serving configuration
- use stable, version pinned serving setup
- rebase onto upstream with large updates – team will need to have the ability to maintain the code and the patches to make things stable
- best performance will come from maintaining some of the tricks from the frontier
- maintain a stable database – run a whole suite of tests to establish new golden recipes
- then fdes can go and apply to different customers
- open source teams need production feedback
- give them feedback on what’s working on
- get the fixes in to open source
- k3 rank desync at high tp
- next few years – co design with infrastructure
- model weight transfer over rdma
- custom router that understands autoscaling, cache aware routing
- pooled host dram; cluster wide rdma via nixl; mooncake struggles with replicas
- cache should handle replicas coming in / leaving
- only apply solutions when they make sense
- 6$/hr for a b300
- Summary
- Measure carefully.
- Stable recipes & Infra for production serving.
- separate systems to pool memory & disk
- have a custom distributed filesystem
- use overlayfs to transparently pool the disk
- mooncake wasn’t stable; modal will open source starlight – that will work on some system at least
- releases are slow: bake for a day with mirroring, then a day with canaries before releasing samplers
Beyond token generation
- Erik, Typesafe
- llm reliability isn’t great
- serving decision models
- system reliability
- llms aren’t great for integrating for software based on how they’re set up and how stochastic they are
- long term support of the model – in distribution things shouldn’t change
- automation software should run for a long time
- will add fine tuning support for this
- build a general core for common sense understanding
- don’t put too much knowledge, ask people not to rely on it like llms (knowledge expires)
- can do infinite amounts of work cheaply but the engineer designing the system must put in knowledge
- eg. laws are changing – state machine of microdecisions to pull in information