Coders In Hoods
  • Courses
  • Roles
  • Blog
  • Setup

Coders In Hoods AI Academy

Every course is free. Sign in to start, and your progress, quiz scores and bookmarks follow you.

AI Academy

  • Courses
  • Paths
  • Setup guides
  • How we teach

Role roadmaps

  • AI Engineer
  • Forward Deployed Engineer
  • Machine Learning Engineer
  • All roles

Coders In Hoods

  • The agency
  • Coaching for teams
  • Blog
  • LinkedIn
  • X (Twitter)

Contact

codersinhoods@gmail.com

© Coders In Hoods · since 2019

Course overview

Serving Open-Weight Models

Free · sign in to start and track progress

1 · What the server does with your GPU

  • 1Inside an inference engine
  • 2GPU sizing arithmetic
  • 3Serving your adapter

    Exercise answers

    • Answer: Two adapters, one server
    • Answer: A model card, a registry entry and a start guard

2 · Smaller, faster, still correct

  • 4Quantisation with evidence
  • 5Latency, throughput and honest benchmarks
  • 6Speculative decoding in practice
  • 7Structured outputs and tool calls

3 · Ship it and run it

  • 8What self-hosting makes you responsible for
  • 9Deployment and rollout
  • 10Observability and operations
CapstoneShip the triage endpointReference implementation

Module 1 · What the server does with your GPU · Lesson 3

Serving your adapter

A LoRA adapter can be merged into the base weights or served beside them with per-request selection; either way it needs a pinned base revision, the right chat template and a registry entry, because the two classic failures load cleanly and answer wrongly.

85 min 1 video 3 exercises 7-question quiz Answers
Setup for the exercises:Install Claude CodePython with uvServe a model with vLLMRun GPU code on ModalHugging Face account and CLIInstall llama.cppThe Quillmoor triage kit

By the end of this lesson you can

  • Merge a LoRA adapter into its base with PEFT, export it, and explain when merging is the wrong choice
  • Serve one or many adapters on one base with vLLM or SGLang, select one per request, and state the memory and latency cost of multi-LoRA serving
  • Convert an adapter to GGUF and run it on a CPU beside the base with llama.cpp
  • Version model artefacts with a pinned base revision, an adapter revision, a chat-template hash, a model card and a served-name policy
  • Diagnose the two classic failures, a wrong chat template or tokeniser and an adapter trained on a different base revision

On this page

  • What an adapter is, in bytes
  • Two ways to serve it
  • vLLM, SGLang and the per-request switch
  • The CPU path: GGUF and llama.cpp
  • Artefacts, versions and the two classic failures
  • Quillmoor's canary
  • Connections
  • Summary
  • Sources & further reading
  • Quiz

In this lesson

  1. 01What an adapter is, in bytes
  2. 02Two ways to serve it
  3. 03vLLM, SGLang and the per-request switch
  4. 04The CPU path: GGUF and llama.cpp
  5. 05Artefacts, versions and the two classic failures
  6. 06Quillmoor's canary
  7. 07Connections
  8. 08Summary

Sources & further reading

  • S-LoRA: Serving Thousands of Concurrent LoRA AdaptersPaper · Sheng, Cao, Li, Hooper, Lee et al. · UC Berkeley · 2023Keeping the base in GPU memory and paging adapter weights in and out beside the KV cache, with batched kernels for heterogeneous adapters. Sections 3 to 5 are the design the engines implement.
  • Punica: Multi-Tenant LoRA ServingPaper · Chen, Ye, Wu, Zhuo, Ceze, Krishnamurthy · University of Washington · 2023The segmented gather matrix-vector kernel that lets one batch mix requests for different adapters at close to base-model cost. MLSys 2024.
  • LoRA Land: 310 Fine-tuned LLMs that Rival GPT-4, A Technical ReportPaper · Zhao et al. · Predibase · 2024Hundreds of task adapters on one base, served from one GPU; the operational case for multi-LoRA rather than one merged model per task.
  • LoRA AdaptersDocs · vLLM`--enable-lora`, `--lora-modules`, `--max-loras`, `--max-lora-rank`, per-request selection through the `model` field, the `/v1/models` lineage, and the security warning on runtime loading.
  • LoRA ServingDocs · SGLang`--enable-lora --lora-paths`, `--max-loras-per-batch` (which includes the base model's slot), the `base:adapter` model syntax, pinning and the two kernel backends.
  • LoRA developer guideDocs · Hugging FaceThe post-training section: `merge_and_unload()` versus `merge_adapter()` and `unmerge_adapter()`, and `add_weighted_adapter()` for combining adapters.
  • llama.cpp HTTP serverDocs · ggml`--lora`, `--lora-scaled`, the `/lora-adapters` endpoints, the per-request `lora` field with its batching caveat, and `-a` for served names.
Free · sign in to start

Sign in to keep reading.

Free, no card. We use your account to save progress, quiz scores, bookmarks and occasionally send updates from our team.

  • 8 more sections
  • 3 hands-on exercises
  • A 7-question quiz
  • Progress, quiz scores and bookmarks