Serving & Deployment
Hands-on lab with starter code you can copy + run, and guided steps to produce the artifact for this module.
Setup
- Open a fresh terminal in a new folder, e.g.
mkdir lab-10 && cd lab-10. - Create a Python 3.11 venv:
python -m venv .venv && source .venv/bin/activate. - Install the dependencies noted on each starter snippet (the small pip install … line above the code).
- Copy each starter into a file with the suggested name, then run it and capture the output.
Starter code
pip install vllm
vllm serve Qwen/Qwen2.5-1.5B-Instruct \
--port 8000 --max-model-len 8192 \
--gpu-memory-utilization 0.9 \
--enable-prefix-cachingbash 10_01_lab.shfrom openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
out = client.chat.completions.create(
model="Qwen/Qwen2.5-1.5B-Instruct",
messages=[{"role":"user","content":"What is KV cache?"}],
max_tokens=200, temperature=0.2,
)
print(out.choices[0].message.content)python 10_02_lab.pyGuided steps
Work through each step in order. Stop when your output matches the expected artifact — then push your work to your lab folder.
- 1Serve with vLLM
Do — Launch vLLM with your merged model and hit /v1/chat/completions from a Python client.
Expected artifact — 200 OK response; tokens/sec printed from a 100-token completion benchmark.
Run free: - 2Throughput benchmark
Do — Send 64 concurrent requests and measure p50/p95 latency and total tokens/sec.
Expected artifact — bench.csv with columns concurrency, p50, p95, tps; a 3-line conclusion in bench.md.
Run free: - 3Prefix-cache win
Do — Compare throughput with and without --enable-prefix-caching for a workload that shares a long system prompt.
Expected artifact — ≥2× tokens/sec improvement with prefix caching, documented in cache.md.
Run free:
Authoritative sources
Independent primary sources used to check and corroborate the guidance on this page.
- NIST National Initiative for Cybersecurity Education (NICE)
US national framework for cybersecurity work roles and competencies.
- Financial Action Task Force (FATF)
Global AML/CFT standards referenced by financial-crime curricula.
- FBI Internet Crime Complaint Center — Annual Reports
Primary loss and typology data used in fraud-investigation training.
- US Federal Trade Commission — Consumer Sentinel Data Book
Official complaint statistics for teaching fraud trend analysis.
