20 comments

  • kgeist8 minutes ago
    I&#x27;m currently trying to write an inference engine that combines the benefits of llama.cpp (one binary deployment, good support for heterogenous non-dataserver compute, wide quantization support) with the benefits of vLLM&#x2F;SGlang (things like proper paged attention for better VRAM utilization and high concurrency).<p>Datacenter hardware is expensive and there&#x27;s shortage of it but llama.cpp is slow&#x2F;unoptimized for concurrent use, while vLLM&#x2F;SGLang easily crash on non-common setups (things like, if you do pipeline parallelism for RTX5090+RTX4090, they will randomly crash with RAM caching enabled or select wrong kernels because they usually assume that every rank is the same device type; they also don&#x27;t support Q5-Q6).<p>For me what&#x27;s most interesting is to optimize inference for lack of good datacenter hardware and how to optimize for it best. I&#x27;ve been running an AI server in the office, and so far I&#x27;ve find these techniques most important for concurrent use on cheap hardware: pipeline parallelism (to accomodate for PCie), RAM caching (to quickly restore contexts into VRAM), speculative decoding (including domain-specific ngrams, they already can speed up code generation considerably without the overhead of a draft model), good kernels highly optimized for a specific device, support for Q5-Q6 (almost as good as Q8), FP8 contexts (more context to fit), paged attention (for better VRAM utilization), prefix caching, continuous batching (this is the default everywhere).<p>So far the main bottlenecks have been llama.cpp&#x27;s poor VRAM utilization for contexts (you either have fixed-size slots, or use unified KV cache where each request attends to attention from all other requests and then unnecessary portions of attention are masked out), and lack of decode&#x2F;prefill segregation: when a request starts prefilling a long context, all decoding threads slow down to like 5 tok&#x2F;sec. On the other hand, vLLM&#x2F;SGLang feel superbuggy if you don&#x27;t run them on some officially approved node like 8xH200
  • jumploops4 hours ago
    &gt; Speculative decoding is the process of guessing which tokens a model might generate, then validating those guesses.<p>As a computer engineer, it’s always interesting to see optimizations applied at different levels of the stack.<p>Speculative execution became pretty popular in the 90s, eventually used in basically every x86 design.<p>Then in the mid-2000s the Speculator[0] paper brought that concept to distributed systems, which we’re still seeing work on[1][2].<p>Everything old is new again (:<p>[0]<a href="https:&#x2F;&#x2F;www.cs.princeton.edu&#x2F;courses&#x2F;archive&#x2F;fall07&#x2F;cos518&#x2F;papers&#x2F;spec-execution.pdf" rel="nofollow">https:&#x2F;&#x2F;www.cs.princeton.edu&#x2F;courses&#x2F;archive&#x2F;fall07&#x2F;cos518&#x2F;p...</a><p>[1]<a href="https:&#x2F;&#x2F;www.usenix.org&#x2F;system&#x2F;files&#x2F;osdi25-shen-weihai.pdf" rel="nofollow">https:&#x2F;&#x2F;www.usenix.org&#x2F;system&#x2F;files&#x2F;osdi25-shen-weihai.pdf</a><p>[2] <a href="https:&#x2F;&#x2F;www.microsoft.com&#x2F;en-us&#x2F;research&#x2F;publication&#x2F;distributed-speculative-execution-for-resilient-cloud-applications&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.microsoft.com&#x2F;en-us&#x2F;research&#x2F;publication&#x2F;distrib...</a>
    • bessbd1 hour ago
      &gt; guessing which tokens a model might generate<p>A transformer that generates tokens based on pre-training? We could call it a GPT for short.
    • freakynit3 hours ago
      Can we expect similar issues such as spectre and meltdown that intel experienced with speculative execution.. but, in the form of prompt injection&#x2F;poisoning?
      • rf153 hours ago
        Ok, I&#x27;ll bite: no, considering these are very different domains and you don&#x27;t get system access by getting the wrong speculative branch for your next text token, you just get a slightly different (but probably still related enough) text.
    • mathisfun1233 hours ago
      &gt; optimizations applied at different levels of the stack<p>That&#x27;s because it&#x27;s just &quot;guess and check&quot; not some deep universal insight.
      • wongarsu1 hour ago
        It&#x27;s closer to &quot;we can make this highly parallel for not that much cost, but we struggle to use that concurrency. So what if we just guess what the next step is going to be? If we are right we get a big speedup, if we are wrong we just throw that work away&quot;. Which I would classify as a notable insight. Doing work that you are 50% certain is useless is not the most obvious thing
      • jumploops1 hour ago
        Simple optimizations are often the best :)
  • ttoinou6 hours ago
    <p><pre><code> Inference techniques either move a deployment along the latency–throughput frontier or push the entire frontier out, creating more efficiency to allocate. </code></pre> This is a tautology. You can say that with anything. Gastronomy techniques will make a previous recipe better, or create a new recipe better than others, or a mix of both.
    • Ifkaluva5 hours ago
      The point is to classify them into two kinds. The kind that shifts the frontier is more powerful, since improves capabilities without incurring tradeoffs.
      • philipkiely4 hours ago
        I also wrote this as somewhat of a defense of the techniques that don&#x27;t move the frontier -- there is a lot of value in being able to pick a point on the curve.
  • bit_rot7358 minutes ago
    My RTX 3090 is still laughing at my attempts to run 70B models efficiently.
  • clem_rw1 hour ago
    My daily struggle is trying to make a 7B model respond in under 500ms without breaking the bank. This hits home.
  • brrrrrm7 hours ago
    this is a nice and concise writeup. what&#x27;s striking to me is that these techniques really have not changed in &#x2F;years&#x2F;. sure, precision has become slightly lower, spec decoding acceptance has gotten slightly better and the complexity of parallelism is trickier with mixture of experts. but no new concepts in a very long time!<p>the absolute most impactful improvements for inference comes at architecture design time. I firmly believe everyone who cares about impacting model efficiency should look there
    • philipkiely7 hours ago
      I think the biggest net new recent technique is P&#x2F;D disaggregation. And that spec dec is very different now especially post DSpark&#x2F;DFlash.<p>But overall yes the fundamentals of LLM performance optimization have been remarkably stable over the last few years.
      • brrrrrm6 hours ago
        perhaps its unfair to say this in hindsight, but it&#x27;s a fairly straightforward application of little&#x27;s law that&#x27;s been around for some time<p><a href="https:&#x2F;&#x2F;arxiv.org&#x2F;html&#x2F;2401.09670v2" rel="nofollow">https:&#x2F;&#x2F;arxiv.org&#x2F;html&#x2F;2401.09670v2</a>
    • Ozzie-D6 hours ago
      [flagged]
  • censor252 hours ago
    Nice read. I was wondering what can one do to get into inference engineering as simple theoretical knowledge is not sufficient and switching profiles is tough for someone with years of experience.
  • arjie3 hours ago
    You know what <i>I&#x27;m</i> curious about? Whether you have brand guidelines inside the company, a Claude skillset, or the blog post author makes the charts in line with the brand colours and so on.
    • philipkiely2 hours ago
      I draw my diagrams on notecards and send them to our designer who brings them to life.<p>The images start out looking like this: <a href="https:&#x2F;&#x2F;philipkiely.com&#x2F;images&#x2F;blogs&#x2F;how-to-write-a-book&#x2F;design.JPG" rel="nofollow">https:&#x2F;&#x2F;philipkiely.com&#x2F;images&#x2F;blogs&#x2F;how-to-write-a-book&#x2F;des...</a>
      • arjie2 hours ago
        Makes perfect sense. The classic way!
  • qingcharles2 hours ago
    &gt; A model is a “frontier model” if it offers the highest degree of intelligence at a given cost or size.<p>I would define a &quot;frontier model&quot; as offering the highest degree of intelligence at <i>any</i> cost, or <i>without regard</i> to cost. The frontier today is clearly Fable&#x2F;Mythos, with the &quot;efficient frontier&quot; at Opus&#x2F;Sol.
    • orangeboats2 hours ago
      Your partial quote is quite misleading. The article obviously talks about &quot;efficient frontier&quot;, not &quot;intelligent frontier&quot;.<p>&gt;In the AI industry, we borrowed the term “efficient frontier” from economists. We use it to talk about managing tradeoffs, most often the tradeoff between cost and capabilities for models. A model is a “frontier model” if it offers the highest degree of intelligence at a given cost or size.
  • datadrivenangel6 hours ago
    The author does not deeply mention that quality&#x2F;intelligence is a third dimension here in addition to throughput and latency, and the frontier is jagged so quality and intelligence require bespoke benchmarks to evaluate tradeoffs for speed and cost.
    • philipkiely6 hours ago
      These are both good points that I attempted to cover, quotes:<p>&gt; In practice, the efficient frontier is very jagged. Rather than a smooth, continuous line between outcomes, small changes can have big impacts. These cutoff points are often unintuitive and must be discovered empirically through sweeps.<p>&gt; However, quantization introduces a new set of tradeoffs between quality and serving efficiency. This is a particularly jagged frontier, where a large degree of improvement to serving efficiency is possible with little-to-no reduction in model quality, especially when using microscaling floating-point number formats like MXFP4 and NVFP4.<p>Would appreciate ideas on how to explain in greater depth
  • calclavia6 hours ago
    good recap on the recent inference techniques!
  • fsckboy3 hours ago
    &quot;the efficient frontier&quot; is an important landmark of (investment) portfolio theory. It proves&#x2F;explains&#x2F;illustrates how you can combine selections from a diffuse cloud of individual investments and still land on a frontier that is better than any of your individual choices. It&#x27;s the entire basis of &quot;diversify your portfolio&quot;.<p>The efficient frontier of LLM inference is a line, not a frontier.<p>this is a frontier:<p><a href="https:&#x2F;&#x2F;upload.wikimedia.org&#x2F;wikipedia&#x2F;commons&#x2F;e&#x2F;e1&#x2F;Markowitz_frontier.jpg?utm_source=en.wikipedia.org&amp;utm_campaign=imageinfo&amp;utm_content=thumbnail_unscaled" rel="nofollow">https:&#x2F;&#x2F;upload.wikimedia.org&#x2F;wikipedia&#x2F;commons&#x2F;e&#x2F;e1&#x2F;Markowit...</a><p>no matter how good is something a smart person writes down, a pleb will come along and try to hang on its coattails.<p>If you want to steal an idea for this, steal indifference curves, they&#x27;d make more sense.
  • juggle7314 minutes ago
    [flagged]
  • pan_lid49 minutes ago
    [dead]
  • yeasin-arafat3 hours ago
    [flagged]
  • soricus2 hours ago
    [dead]
  • paidx6 hours ago
    [flagged]
  • jing099286 hours ago
    [dead]
  • nedo_var7 hours ago
    [dead]
  • killerdog105 hours ago
    [dead]