← All AI Engineer talks

AI Engineer World's Fair 2025

The Small Model Infrastructure Nobody Built (So We Did) — Filip Makraduli, Superlinked

Read the talk

Small-model inference needs more than a fast forward pass

Small models can make agent context more useful, but serving them efficiently requires architecture-aware execution, shared GPU capacity, and a production cluster that works with both.

From a talk by Filip Makraduli

Before you start: Familiarity with embeddings, transformer attention, and basic GPU serving will help with the runtime and infrastructure details.

What makes a model fast in production?

What is missing between understanding how a model computes and making it run efficiently in production? That is the problem behind Filip Makraduli’s work on small-model inference. He introduces it with a second, visual question: the patterned background of his slides represents something from machine learning. He offers a reward for identifying it, leaving the answer until the end.

The infrastructure question began with a Substack article. Makraduli had explained FlashAttention, model execution, and the difference between memory-bound and compute-bound work. Feedback exposed something the explanation had overlooked: inference as an operational system. His experience with vLLM, training, fine-tuning, applied ML, and academic research had not covered the whole path to production. GPU scheduling, routing, and automation are separate engineering problems from understanding the model.

Two boxes contrast training, evaluation and AI research with production inference, GPU scheduling, routing and deployment. Below: “Join the team building it.”
Model expertise versus the infrastructure blind spot.

To learn that part, he joined Superlinked’s infrastructure team and helped build the open-source Superlinked Inference Engine, or SIE. The soft launch presented here targets small models for AI search and document processing. Makraduli reports testing with Chroma, Qdrant, Weaviate, and LanceDB. The project connects model execution to the machinery needed to operate it.

0:160:33
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

0:16 · section reference included

Small models before and inside the agent

The first question is why search and document-processing inference matters to agents. The next is what serving a model leaves unfinished. Those lead to the two halves of SIE’s design: model support and infrastructure, which Makraduli calls the yin and yang of inference.

The agent problem starts with context. Chroma’s Context Rot research shows that longer inputs can degrade performance under tested conditions; the effect varies across models and tasks. Small models provide a way to manage what reaches the agent: preprocess documents, select useful information, or expose a focused operation as a tool call. This also answers the objection that Claude Code and grep can already search files. Preprocessing can improve the files and information those tools search.

Slide titled “Why it matters for your agents” shows declining performance curves alongside boxes for context management, tool calling and “Why not just Opus 4.6?”
Context rot motivates context management and small-model tool calling.

Several approaches fit this pattern:

  • Structured knowledge: Makraduli points to Andrej Karpathy’s graph-based knowledge-base work. Named entity recognition can supply entities for ontology and knowledge-graph construction, or help organize a filesystem.
  • Input filtering: He cites a Chroma model that preprocesses and filters input to manage context, alongside community tools that reduce token volume.
  • Model-backed tools: In a production e-commerce use case, Makraduli reports using SIE for taxonomy classification. Small models become tools that retrieve and process data during the workflow, rather than only preparing it beforehand.

The common mechanism is to give the agent a more focused representation of the data it needs.

3:424:04
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

3:42 · section reference included

More GPUs do not solve idle capacity

Adding compute is an incomplete answer when each model uses only a small part of a GPU. Makraduli describes Stella embedding models, rerankers, and the GLiNER named entity recognition model as occupying only a few gigabytes each, without specifying variants, precision, or workload memory. Giving every model its own GPU can leave both memory capacity and compute underused.

SIE instead supports swapping models on a shared GPU. A workflow can switch from one model-backed tool to another without reserving a separate GPU for each. Its least recently used eviction policy chooses which resident model to remove when capacity is needed: a model that has gone unused longer is evicted before a more recently used one. Makraduli reports higher utilization, lower costs, and quick switching, but supplies no measured utilization, cost, or switching-latency comparison.

Sharing a GPU still leaves the operational work around the server. TEI, vLLM, or an API wrapper can provide a starting point for inference, while the surrounding system needs routing, autoscaling, queues, GPU provisioning, and monitoring through Prometheus metrics and Grafana. Makraduli describes a gap in the open-source options available for connecting these pieces at the intended scale. SIE’s response is to supply the production infrastructure together with model serving.

7:037:19
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

7:03 · section reference included

The yin: models worth serving

Infrastructure is useful only if it supports the models a workload needs. Makraduli therefore starts the first half of the design with model breadth. He cites millions of models on Hugging Face in a March snapshot and estimates that the count could be approaching three million by the talk. That is an ecosystem-size argument: the available choices keep expanding, and users want access to them.

Makraduli cites MTEB and other benchmarks as evidence that open models can outperform managed services on narrow tasks. He also points to small Gemma models achieving higher Elo scores than much larger models. The presentation does not identify the tasks, model versions, baselines, or scores for these comparisons. Their role here is to motivate support for specialized models: choosing a smaller open model can be about suitability and quality as well as deployment control.

9:249:45
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

9:24 · section reference included

A shared API still needs different forward passes

Supporting hundreds of models is not simply a matter of loading different weights. BERT, Qwen, and ModernBERT differ in their architectures, attention implementations, and positional representations. SIE’s approach is to reimplement forward passes with the adaptations each architecture needs: attention handling, padding, variable-length execution, and query/key/value projection fusion where appropriate.

The output contract also changes what the runtime must preserve. ColBERT is a late-interaction model that produces multiple vectors, retaining token-level representations for subsequent matching. Cross-encoders and rerankers instead return scores rather than embedding vectors. A common serving layer therefore has to accommodate different result structures, not just different tensor sizes.

Implementation concernDifference the runtime must handle
NormalizationModel-specific normalization behavior
Q/K/V projectionsFusion choices and attention-head layout
PositionBERT absolute lookup; Qwen rotary embeddings
AttentionArchitecture-specific execution and masking
OutputEmbedding vectors, per-token vectors, or scores

Makraduli’s comparison works through these differences across BERT, Qwen, and ColBERT. One qualification matters: he attributes a Qwen projection-fusion limitation to grouped-query attention, but grouped-query attention does not inherently prevent combined QKV projections. The Qwen2 implementation in vLLM v0.8.5 uses QKVParallelLinear. The relevant engineering task is adapting fusion to the model’s head layout and runtime, rather than assuming one fusion strategy works unchanged everywhere.

Comparison table covers normalization, Q/K/V, position, attention and output for BERT, Qwen2 and ColBERT, highlighting architectural differences and ColBERT’s per-token vectors.
BERT, Qwen2 and ColBERT differ across five implementation steps.

These differences require a consistent implementation process. SIE uses both agents and humans to implement the adapted forward passes, turning architectural knowledge into efficient model execution. Broad model support depends on preserving each model’s semantics while changing how its computation runs.

11:1011:27
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

11:10 · section reference included

Stop spending attention work on padding

Variable-length FlashAttention addresses a concrete batching problem. Put a short request and a long request into a rectangular batch, and the short one may be padded to match the long one. Computation then includes empty positions introduced for the batch layout. Token-based batching needs an execution path that respects the actual sequence lengths, so padding does not consume unnecessary attention work.

For a small illustrative batch, take request A with token IDs [11, 12] and request B with [21, 22, 23, 24]. A rectangular representation gives A two padding slots. A packed representation retains [11, 12, 21, 22, 23, 24] and sequence boundaries [0, 2, 6]. Those boundaries are essential: removing padding must not allow one request’s tokens to attend to another request. The token contents stay the same; their storage and execution layout change.

Preserve request tokens while removing padding

Constructed example: Request names, token IDs, lengths, PAD notation, and boundary offsets are teaching values. Packed storage and boundaries illustrate the variable-length mechanism; they are not a captured SIE execution.

Two requests — unchanged
A = [11, 12]; B = [21, 22, 23, 24]

Operation: Replace the padded rectangular representation with packed tokens and sequence boundaries.

Request A tokens

Before: Padded batch
[11, 12]
After: Packed variable-length batch · Unchanged
[11, 12]

Request B tokens

Before: Padded batch
[21, 22, 23, 24]
After: Packed variable-length batch · Unchanged
[21, 22, 23, 24]

Token storage

Before: Padded batch
[[11, 12, PAD, PAD], [21, 22, 23, 24]]
After: Packed variable-length batch · Changed
[11, 12, 21, 22, 23, 24]

Padding positions

Before: Padded batch
Request A: slots 2 and 3
After: Packed variable-length batch · Removed
Not present

Packed sequence boundaries

Before: Padded batch
Not present
After: Packed variable-length batch · Added
[0, 2, 6]
Packing removes padding while preserving each request’s tokens and separate sequence boundaries.
13:4814:11
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

13:48 · section reference included

The yang: a cluster that can operate the models

The second half of the system is the cluster. Makraduli introduces a detailed architecture diagram but concentrates on the path through it rather than explaining every component. At this soft launch, the API is organized around three primitives: encode, score, and extract. Current SIE documentation includes additional generation capabilities; the three-operation interface is the one presented in the recording.

Requests pass through a router and a load-dependent queuing mechanism, which distribute work across pools of GPUs and other resources. Those pools can include spot instances and larger GPUs. KEDA autoscaling, driven by Prometheus metrics, connects observed demand to capacity changes. Hardware provisioning and model switching work together to keep available resources useful rather than leaving GPUs idle.

The integration is the product: users receive model support and cluster infrastructure together, instead of having to connect an inference engine to a separately assembled production stack. In the deployment workflow Makraduli describes, the operator selects models through configuration and applies the infrastructure:

bash

terraform apply

Published Helm charts and Docker images provide additional deployment artifacts. The command is the final application step for the configured infrastructure, not a replacement for selecting and configuring the deployment.

The release includes both sides of SIE: the adapted model execution code, including attention and forward-pass work, and the cluster machinery for provisioning and operating GPUs. This closes the gap that started with the FlashAttention article. Understanding how computation becomes fast inside a model now connects to controlling where that computation runs and how requests reach it.

14:2314:36
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

14:23 · section reference included

The pattern behind the slides

With the infrastructure explanation complete, Makraduli returns to the background puzzle. His hints point toward embeddings, attention, and transformer foundations. An audience member tentatively recalls a visualization in which embeddings clustered in part of the space because of positional encoding. Makraduli accepts the positional-encoding connection as the answer.

The reveal identifies the background as a vector visualization of sinusoidal positional encodings. The final slide pairs a green-and-blue heatmap with the orange striped pattern seen in the background. Makraduli connects the pattern to the way transformers represent token positions during training. In the original Transformer formulation, these sinusoidal encodings are fixed functions used during training, distinct from learned positional embeddings. The visual puzzle ends on the same architectural detail that mattered in model serving: how a model represents position is part of what its implementation must preserve.

Projected slide shows a green-and-blue sinusoidal positional encoding heatmap above an orange striped pattern, with a QR code at right and the speaker at the lectern.
The closing reveal pairs a sinusoidal positional encoding heatmap with the patterned background.
16:4717:01
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

16:47 · section reference included

Resources

From the talk

Read the complete timestamped transcript
  1. 0:00

    [on-hold electronic music] Hello, everyone.

  2. 0:16

    Um, welcome to this talk. I'll be speaking about small model inference and a gap that we've recognized in the market, and what we did about it, and why we kind of made this approach.

  3. 0:33

    And as you can see, this background slide here, um, this is no accident. So if you can guess what this is, I'll prompt you at the end of the slides.

  4. 0:42

    You win a little reward, so you can catch me at the break afterwards. So think about this, but also listen to me, so don't think too hard.

  5. 0:53

    So the story starts with me posting an article a few months ago on Substack that got a bit of traction, got a few people interested, and I explained FlashAttention, I explained how models worked, how processes can be memory-bound, compute-bound.

  6. 1:11

    And I felt really good 'cause I kind of went deep into this, and as a person who's been in AI for a few years, I felt very confident. And that was true.

  7. 1:23

    But then some people pointed out that actually I had overlooked one key aspect around what, uh, makes these models fast in the real world.

  8. 1:36

    And that aspect that I overlooked was inference. So as someone who kind of wants to understand things in first principles and work to understand the problems and the solutions deep, I realized, okay, I need to figure this out.

  9. 1:53

    I need to know kind of where I've made my mistake, and as a AI researcher and engineer, I need to find more about inference. So I've done a lot of work with vLLM, training models, fine-tuning, kind of doing applied, uh, ML and AI.

  10. 2:12

    Did a bit of also research in academia as well. But this part around kind of how models run in production, scheduling GPUs, routing, and automation, I guess, was a bit of a b-blind spot for me.

  11. 2:26

    So I realized, okay, this is the time I have to now figure this out, learn and make it work. And what better way to do this than to actually build stuff?

  12. 2:38

    So I decided to join a team, um, a team at Superlinked, uh, comprised of very good, uh, infrastructure engineers and actually work with them and build something around inference.

  13. 2:54

    And that something is, um, this, uh, repo, the Superlinked Inference Engine that we have open-sourced, and this is kind of like the soft launch that I'm doing today, so you can have a look at that later.

  14. 3:06

    So basically, it's inference for small models around AI search and document processing. And we've tested this out, as you can see, with some of our partners. So we've tested it out with Chroma, Qdrant, Viviyi, so a lot of the vector DBs, uh, as well as LensDB.

  15. 3:23

    And as you can see, they've tried it out a bit. Sounds fun, sounds interesting, so this is working. And, uh, it was the right step for me to kind of figure this out and learn where inference, um, kind of truly is and how that combines with my ML experience.

  16. 3:42

    So the three key points I want you to, uh, go away with from this talk are these. So first, I want to tell you why this matters, so why doing inference for AI search and document processing actually matters when you're building agents or when you're building workflows that involve, uh, agents.

  17. 4:04

    So this is very important, the why. Then I want to talk to you about the second thing, which is what inference is not about. So there are some misconceptions or ideas of how inference looks like, but it's not all about those things.

  18. 4:20

    And the third thing is how we see inference, and I call this as like the yin and yang of model inference, and it's a way of combining a few things around model support and infrastructure.

  19. 4:35

    So why this matters for your agentic workflow. Well, what you have encountered for sure is context rot. And as we probably all know, this research paper from Chroma from some time ago, um, showcases this effect that no matter what you do, there is this effect of context rot.

  20. 4:55

    So quality degrades as context increases. So being able to manage this context and do some context management is very important and a useful way to solve this. So using small models that can pre-process your data so that then you can actually use your agents and build your workflows is a very powerful technique.

  21. 5:18

    You can also use the small models for tool calling to, again, do similar things and tackle this, uh, problem of context management. And you might say, "Okay, why would I not use like Claude Code and grepping?"

  22. 5:31

    And that's a valid point. However, you can still do that, and having your data being pre-processed is actually making the grepping and file systems that you build even better.

  23. 5:44

    And it's not just me saying this, so this is how the community has responded to this problem. So Andrej Karpathy is building knowledge bases, graph-based. So for example, you can use named entity recognition models, um, to generate ontologies and then build knowledge graphs.

  24. 6:00

    Or- You generate your file systems in that way. Chroma have also, uh, shipped their own model that actually does this. It kind of pre-processes and filters the input, manages the context in order to tackle and achieve the same problem.

  25. 6:17

    And there's also people in the community building a lot of solutions that, um, lower this, um, context and kind of reduce the token amount so that the agents can be even more effective.

  26. 6:32

    And we've done this in production as well. We have a use case where this repo that I showcased, the, um, Superlinked Inference Engine, um, we've used it as a tool calling basically, uh, solution where it was around taxonomy classification for like an e-commerce store.

  27. 6:50

    So going directly, uh, with tool calling, where the small models are tools that can retrieve and go through your data is also a powerful way to approach this.

  28. 7:03

    So now I'll go about inference and what inference doesn't look like. So the traditional maybe perspective is, okay, I will just chuck in more GPUs, get more compute, all good, I've solved inference.

  29. 7:19

    However, um, with small models, where actually each model, um, takes up only a small space in memory. So you can see, for example, Stella, which is an embedding model, then other rerankers, um, the named entity recognition GLiNER model, they only occupy like a few gigabytes of memory, and if you provision a GPU for each model, you're wasting

  30. 7:43

    a lot of, um, idle space. Your GPU stays idle, and it's not used. So in this case of small model inference, it's very important to be able to hot-swap models.

  31. 7:54

    So what we've done is we've built the ability for you to swap all of these models in one GPU so that per GPU, you get much higher utilization. So this lowers your costs, but also enables you to hot-swap and switch around between models quickly.

  32. 8:10

    If you want to have one tool that's one reranker or another tool that's another model, you can switch them around quickly, and we have this least recently used eviction policy that we've built in.

  33. 8:23

    And also, what inference is not about is, um, only the server or only kind of the production situation. So we have solutions for both the server and the production, but building something, so for example, like using Te or vLLM or having even, uh, some API wrapper, in order to get that in production where you actually do routing,

  34. 8:48

    autoscaling, um, you do kind of monitoring with Prometheus metrics and Grafana, you have to write that code yourself. And on the market currently, there is no open source solution that leads you from creating the model inference to actually productionizing this at a scale, um, of this size.

  35. 9:09

    So that's why we've kind of wanted to fill this gap as well. So, um, we've included a lot of stuff around ri- uh, routing, autoscaling, queuing mechanisms, and provisioning GPUs.

  36. 9:24

    So I've talked about what inference isn't, why this is important, and let me tell you now about, um, what actually inference is about. And I call this the yin and yang of inference because I feel like this is a holistic approach that has to combine two key things.

  37. 9:45

    So first, the yin is model support. So your inference is worthless if you're not supporting the right models or you're not offering enough breadth of, um, options for your users.

  38. 10:01

    And open source models, so on Hugging Face currently there are millions of models. Um, this is from March. Now there might be even more like close to three million models.

  39. 10:12

    And open source is moving very quickly, both in size but also in accuracy. So you need to support these models because people want to use them, people want to work with open source, and the performance is also getting better and better.

  40. 10:26

    So it's not even a sacrifice anymore. It's actually you're being able for specific tasks. So if you look at MTEB or different benchmarks, you can see that for very narrow tasks, um, open source models are beating managed services.

  41. 10:43

    And we see this even with more general purpose models like, uh, what Gemma have done. So they've released very low parameter models that have ELO scores that are higher than, um, much, much bigger models.

  42. 10:58

    So open source small models are very relevant, and you need an infra, um, to support, to support them.

  43. 11:10

    And we decided to do exactly this. Okay, let's do it. We'll build and support hundreds of models. However, uh, that's not as straightforward as it might sound because all of these models have different runtimes.

  44. 11:27

    So for example, with if you use BERT and Qwen as, um, models, they have different implementation of FlashAttention, they have different positional embeddings, and you need to adjust this in order to make, um, make this kind of applicable to your case and, uh, make it more general.

  45. 11:47

    So there is no universal engine that can handle BERT, Qwen, and modern BERT as well because the architectures are different. So what, what we've done is we've set up, um, a way of re-reimplementing this forward pass in order to adapt attention, in order to do padding where needed, so have variable length attention as well.

  46. 12:09

    Uh, work with kind of fuse- fusion of the, uh, query key and value, um, and this is kind of an underrated component, especially if, um, you look at supporting models like ColBERT that has multiple vectors as output, so latent direction models.

  47. 12:27

    Also, cross encoders and re-rankers that do not output a vector at all, but they output kind of scores. So it's very important to, um, figure this out, and one example of this is, for example, this, which is, um, a comparison of a few models that are totally different in this five aspects.

  48. 12:49

    So normalization is done differently in BERT and Qwen, so that needs to be accounted for. In ColBERT, um, it's also totally different. Uh, the q- uh, the query key and values are also can be fused somewhere.

  49. 13:06

    In others, um, for example, in Qwen, it cannot be because there is, um, grouped query attention, so that's another problem. The positioning- positional embeddings are also different. You can do in BERT absolute lookup where at w- with Qwen, there is, uh, rotary positional embeddings.

  50. 13:24

    So these are problems that maybe, uh, people don't think about straight away, but if you want to support a lot of models, there needs to be a consistent way of doing this.

  51. 13:34

    So we've set up this with kind of working with agents as well as with humans to be able to support this and re-implement this forward pass in order to make, um, the, the inference of this model sufficient.

  52. 13:48

    And we've also worked, uh, to do FlashAttention, um, where it's variable-length FlashAttention so that you can do, uh, padding and that there is no waste. Because what happens is if you wanna do token-based batching, you can have tokens that are kind of, um, lower number of tokens, one request, and then another is a higher amount, and then

  53. 14:11

    if both are padded at the higher amount, you basically are wasting compute on empty tokens. So you need to adapt this in order to make the models, uh, work even better and quicker.

  54. 14:23

    Um, and that's a key differentiator in our way of approaching inference. The other part, the yang, is around

  55. 14:36

    infrastructure. So this is the complex plot. Um, it's kind of this is the deep dive. We have this in our website and in our repo. I won't go into each component here.

  56. 14:46

    But basically, what's up there is the three primitives of our A- API, so encode, score, and extract. And then the infrastructure layer happens, and this is kind of the summary of it.

  57. 14:57

    So basically, we have the three primitives of the API, and then we have a router and also a queuing mechanism depending on, uh, the load, so we're adjusting between, uh, these and also different pools of different GPUs and resources that, um, we use in order to kind of distribute the workload.

  58. 15:18

    And we, we use spot instances but also bigger GPUs. So it's about being able to provision the hardware and also have the metrics to autoscale this. So we're doing KEDA autoscaling with Prometheus metrics in order to be able to kind of switch models around, not keep GPUs idle and kind of waste resources.

  59. 15:41

    So the key driver here is that we want you to have the cluster as well as the model support. So not just one or the other, and then you have to merge them together and write all that code.

  60. 15:54

    But we want to give you the whole end-to-end thing so that you can work with these models quickly, and the models are basically just a config that you can switch around and then do Terraform apply, and that's it, and we also have published Helm charts and Docker images as well.

  61. 16:11

    And that's how I learned my lesson. Um, uh, we've built Sie, so this is kind of our soft launch in a way. And we've open sourced both the model inference that I talked about with kind of adapting this forward pass, working with attention, re-implementing different aspects on the model, but also the cluster so that you can actually

  62. 16:31

    use this straight away without having to think about hardware, provisioning GPUs, and all of those problems that arise in, in the real world. Um, you can scan the QR code to look at the repo, and it's called Sie, so S-I-E.

  63. 16:47

    Um, and the company is Superlinked. And also now we have the, the background as well, so a quick reminder on that. Um, does anyone have any ideas maybe from the audience?

  64. 17:01

    I'll reveal it in the next slide, but yeah, I don't want to maybe do it too quickly. If anyone knows what this is, think of it machine learning a bit, kind of, uh, foundational knowl- I was talking about attention and all that, so it's a bit around embeddings, but also how transformers work.

  65. 17:21

    Okay. No, no, no reward, I guess, for you, sadly. Or yeah, yeah. Sorry?

  66. 17:28

    Can't remember exactly, but there was one with, like, all the embeddings were clustering on, like, one area and wasn't using most of the embedding space-

  67. 17:36

    Okay

  68. 17:36

    ... because of the way we were doing the positional encoding. As much as I remember.

  69. 17:43

    So I will take that as a correct answer. So it was around positional, uh, encodings, and yes, this is basically... Yeah. Congrats. [audience applauding] So yes, this is a- around vector visualization of positional encoding.

  70. 17:57

    So this is done when transformers are trained. This is how positions are encoded, and it's sinusoidal. That's why you get this pattern because it- they're embeddings. And yeah. Thank you very much. [audience applauding] [upbeat music]