Remix.run Logo
k__ 4 hours ago

I was yesterday years old when I learned that those open weight models need custom code to run.

Somehow I expected inference engines are generic LLM runtimes that can execute any weight.

So, to get this right.

Someone trains a model.

They release the weights and a reference implementation of the model architecture.

Then a provider has to host this model either by running inference via the reference implementation, an open source implementation, or build their own.

Does this mean, providers don't just differ in quantisation and configuration, but also in inference engine implementation?

ipieter 4 hours ago | parent | next [-]

The implementation of a language model is usually good enough for running _a single forward pass_ through the model, but to host it via an inference engine you typically need to convert a few operations. For instance the MLP can be easily split across GPUs (tensor parallelism) and MoEs also have a way of parallelizing.

Most of it is pretty standard, since not that many different layers and primitives are used in LLM architectures, but once in a while something new comes along that needs more effort. MoEs are one example, they are sparse and allow for completely different inference patterns, which takes a while to figure out.

Last year I started a blogpost series about this topic (that I hope to update some time). I start from a minimal gpt implementation by Karpathy and build the engine around it, you might like it: https://pieter.ai/blog/2025/nanogpt-inference/

anuj0456 3 hours ago | parent [-]

yes. this is just raw implementation of the model arch as described in papers. for complete model training with back propogation we need training pipeline with optmizer and loss calculation.

stymaar 21 minutes ago | parent | prev | next [-]

> Somehow I expected inference engines are generic LLM runtimes that can execute any weight.

In fact, this was close to be true until last year: almost every open model except DeepSeek had a very similar architecture that was pretty close to the GPT-2 one with very few variations on top (and sometimes an MoE architecture, which itself was a few year old at that point).

But a year ago there's been a cambrian explosion, first in attention mechanism but also in a bunch of other directions, mostly coming from China, and now there's a very massive diversity today's space.

anuj0456 15 minutes ago | parent [-]

yes, that is correct. after chinca came into picture the advancement in this field sky rockted

dguest 2 hours ago | parent | prev | next [-]

Makes me feel better as a guy who tries to get O(1000) times smaller models working for scientific applications. Writing a backend that works for all the models people train is quite a chore, so the common refrain is "why don't we just do what industry does?" (he answer is that "industry" has billions of dollars). You also get "no one uses X backend any more" to which the reply is also "yes, but they have billions of dollars and a team of software engineers".

philipportner 3 hours ago | parent | prev | next [-]

Yes. https://inferencex.semianalysis.com provides some comparisons wrt. certain cost metrics. Some commonly used ones are vLLM, TensorRT-LLM, and SGLang. These three at least are open source, and all come with an Apache 2.0 license.

Some providers also have to implement their own engines, e.g., Cerebras has their own inference serving stack for their wafer-scale chips, as does Google for their TPUs (XLA compiler).

anuj0456 2 hours ago | parent [-]

Thanks for sharing

ismailmaj 3 hours ago | parent | prev [-]

FYI Mistral at launch just dropped the weights without any model architecture mentioned.

Most of the OSS models follow the same architecture which is Llama +- a few things, so it wasn't too hard for people to make it work.

stymaar 19 minutes ago | parent | next [-]

> Most of the OSS models follow the same architecture which is Llama +- a few things, so it wasn't too hard for people to make it work.

It used to be the case until last year, but now almost every Chinese model come with their own linear attention mechanism.

anuj0456 2 hours ago | parent | prev [-]

yes, most of them are similar. but implementation of GQA, MLA, mHC, Sliding Window changes the implementation drastically because of which the overall model effeciency changes.