Fine-Tuning a Small Model to Triage Kubernetes Alerts
From the publisher’s feed, collected in the ZeroLabs newsroom.
A step-by-step recipe for teaching Qwen3–1.7B to triage your cluster’s alerts, on a free GPU. It beat Opus 5 by 12 points and never sends your data outside the cluster.Lately I’ve been working with agents pretty much every day, and one of the jobs I keep seeing companies hand to agents is troubleshooting. An alert fires, someone has to work out what broke, and that someone is usually expensive and tired. I’ve built a couple of agents for this myself, and all of them called a large model behind an API.That works, but a few things kept me wondering whether it really scales:Cost. Every call is billed, and on a noisy night you pay for the same PodNotReady a few hundred times, per cluster.Privacy. Every alert leaves the cluster, together with the logs, events and config around it, and lands on someone else’s servers.Accuracy. The large models aren’t even that good at it: on IBM’s ITBench, agents powered by state-of-the-art models resolved only 13.8% of the SRE scenarios.So in this experiment I wanted to see how far a small model can go. I took Qwen3–1.7B, a model small enough to run on two CPU cores inside the cluster, and taught it one narrow job: read an alert and the state around it, and name the fault that caused it. On 124 alerts it had never seen, the tuned model scored 79.8%, against 67.7% for Claude Opus 5.This article is the recipe, step by step, so you can do the same with your own cluster. Each step explains the concept first, then shows the code I used. Everything runs on a laptop plus a free Colab GPU. The full harness is on GitHub, and the trained model is on Hugging Face if you want to try it before training your own.Where the model lives: one small model per cluster, and only verdicts leaveThe framework at a glanceThe recipe has nine steps in three groups: decide and collect, train and measure, then ship. Most of the work is in the first group. The training run itself took nine minutes.The nine steps in three groupsThe arrows only go forward here, but in practice step 7 sends you back to step 3 more than once. The evaluation is where you find out what the dataset is missing.Step 1: Choose the approachThere are three ways to make a general model good at your task, and they solve different problems. Pick by asking what the model is missing.Four ways to adapt a model, and where your data goesThe short version: RAG adds facts, fine-tuning adds skills.Triage is a skill. The model doesn’t need to look anything up. It needs to learn that ServiceHasNoEndpoints with every pod healthy usually means the Service's selector is wrong, and that the same alert with a crashing pod means something else. I tried prompting first. The untuned model, given the full list of faults and clear instructions, answered none to almost everything and scored 10.5%. No retrieved document would teach it that pattern either, so I fine-tuned.These also combine. A fine-tuned triage model can later get a RAG step that attaches the right runbook to its verdict. That’s a separate problem, and I left it out here.Agent skills, an open format now read by many agent tools, sound close to fine-tuning, but they sit on the prompting side. A skill never changes the weights: it’s instructions and code that get loaded into the context when the task calls for them, so it can teach an agent a procedure but not a pattern the model can’t already see. The two fit together well. A skill could tell a large troubleshooting agent to ask the small in-cluster model for a fault id first, then follow the matching runbook.Privacy is the strongest argument in that last column. Prompting, RAG and agent skills all still run on a large model, so whatever they read to troubleshoot, your logs, configs, topology and code, ends up on a third party’s servers. The risk isn’t theoretical. In July 2026 a researcher found that xAI’s Grok Build coding agent uploaded entire Git repositories to xAI’s cloud storage, including unredacted .env credentials and files the agent had been told not to open: 5.1 GiB sent for a task that read about 192 KiB. Production troubleshooting is exactly the case where the context is your most sensitive data, and a model running inside the cluster keeps all of it there.Code: the system prompt, the prompt builder and the scorer used for the untuned baseline and the API models are in eval/baseline.py.Step 2: Choose and size the base modelThere’s no official line between small and large models. NVIDIA’s position paper on small models for agents defines a small model as one that fits on a common consumer device and answers fast enough to serve one user, and counts most models under 10 billion parameters. It’s the same Transformer architecture as a frontier model, trained the same way, just sized for hardware you own.For an in-cluster job I looked at four things:Size. It has to run on a CPU node next to everything else, without a GPU.License. It has to be open enough to fine-tune and ship inside your own infrastructure.Instruction following. A base that already follows a system prompt learns a narrow task from far fewer examples.Context length. The prompt carries the alert, the pods, the services and recent events, which comes to about 700 tokens.I picked Qwen3–1.7B, the second-smallest model in Alibaba’s Qwen3 family. It’s Apache 2.0, it handles a 40,960-token context, and it’s recent enough to follow instructions well. Qwen3 also has a thinking mode, where it writes out its reasoning before answering. For a one-word answer that only burns time, so I turned it off everywhere: in training, in scoring and in the server.How much memory it needsA model’s weights take the number of parameters times the bytes per parameter. Qwen3–1.7B has 1,738,007,552 parameters, so:Memory for Qwen3–1.7B’s weights at each precisionServing needs more than the weights. The KV cache stores the attention keys and values for every token in the context, so the model doesn’t recompute them for each new token. Its size per token is:2 × layers × KV heads × head size × bytes= 2 × 28 × 8 × 128 × 2 = 114,688 bytesAt a 2,048-token context that’s about 224 MiB. A common rule of thumb adds 20% on top of the weights for the cache and runtime buffers. In practice the 8-bit model peaked at 4.14 GiB in its container, well above what the arithmetic predicts, so measure your own and set limits from the measurement.For training, a 16-bit copy of the model (3.2 GiB) plus LoRA’s gradients and optimizer state fits comfortably on the free Colab T4, which has 16 GB.Code: the whole pipeline, from cluster to serving, is summarised in the repo’s README.Step 3: Build a labelled dataset by breaking a clusterFine-tuning needs examples of the input and the right answer. For alert triage, the hard part is the right answer: someone has to decide what caused each alert, and doing that by hand is slow and inconsistent. So I made the answers known in advance. I broke a cluster on purpose, one fault at a time, and labelled every alert that fired with the fault I had just injected.Start from what you already haveIn this example I used a local kind cluster, because I needed labels I could trust and a cluster I was free to break. In your own environment you probably don’t need to break anything to get started. You already have most of the raw material:Alerts you’ve already seen. Prometheus keeps every firing alert as the ALERTS series, and Alertmanager can forward every notification to a webhook you control. That gives you the inputs.Incidents you’ve already resolved. Tickets and postmortems usually record the root cause. Joining them to the alerts that fired during the incident gives you the labels.Logs and events. Kubernetes events, pod status and application logs from around each alert are the context the model reads, the same way a person on call would.Runbooks. Your runbook names are often a good starting label set, because they’re already the categories your team thinks in.Where your history has gaps, inject faults on purpose in a staging cluster, either with a small harness like the one below or with a chaos tool such as Chaos Mesh or LitmusChaos. Real incidents give you realism, and injected faults give you clean labels and enough examples of the rare classes. A mix of both is a good place to be.The setupA local kind cluster with three nodes.kube-prometheus-stack for Prometheus and Alertmanager.A small demo app: an nginx frontend that proxies to a backend, plus a load generator so the services see traffic.A fault catalogue, where each fault has an injector and an undo.Each injector is a couple of kubectl calls that return their own undo. Here is the one that breaks a Service selector:if fid == "wrong_service_selector": kubectl("patch", "service", workload, "-n", namespace, "--type=merge", "-p", '{"spec":{"selector":{"app":"nothing-matches-this"}}}') return [["patch", "service", workload, "-n", namespace, "--type=merge", "-p", '{"spec":{"selector":{"app":"' + workload + '"}}}']]The collection loopWait until the cluster is healthy and no alerts are firing.Record which fault is about to be injected, and when.Inject it.For five minutes, capture every alert that fires, together with the context an engineer would open first: the pods in the namespace, their phase, readiness, restarts and waiting reasons, the Services and their selectors, and the recent events.Revert, and wait for healthy again.Every alert inside a window gets that window’s fault as its label. The noise class, none, comes from windows where nothing was injected, so the model also learns what routine churn looks like.Fifteen minutes of real capture: three injection windows and their alertsMake the alerts fire fastThe default rules in kube-prometheus-stack wait up to fifteen minutes before firing. That’s sensible in production and slow for collecting data, so I wrote my own rules that fire after one to two minutes. Check that each rule can actually fire. A Service whose selector matches nothing doesn’t report zero endpoints, its series simply disappears, so a rule written as == 0 never triggers. This one subtracts the Services that have ready endpoints from the Services that exist:- alert: ServiceHasNoEndpoints expr: > kube_service_info{service!="kubernetes"} unless on (namespace, service) label_replace( sum by (namespace, endpointslice) (kube_endpointslice_endpoints{ready="true"}), "service", "$1", "endpointslice", "(.*)-[a-z0-9]+" ) for: 1m labels: { severity: critical }What the data looks likeThe same alert name can mean very different things, and the context is what tells them apart. Here are two real captured records:Two real alerts: a crashlooping pod explains itself, a broken Service hides behind healthy podsIn the first, the pod has restarted five times with an error exit, so the answer is on the pod. In the second, every pod is healthy, and the only thing wrong is one line in the Service. The event log even shows leftover warnings from an earlier fault. This is why the capture records Services and selectors, and not only pods.The catalogueI ended up with twelve faults plus the noise class, and 426 alerts from 156 injection windows:The twelve faults and the noise classCheck the data before you train on itA labelled dataset built by automation is only as good as its checks. These four caught real problems in mine:Filter to the namespace you broke. Alertmanager sees the whole cluster. An alert from the monitoring stack that happens to fire during a window will otherwise get that window’s label.Confirm each fault actually broke something. Probes aimed at a missing path look like a failure, but nginx answers 200 on every path. Aim them at a closed port, and check that the expected symptom shows up before you keep the window.Keep one list of labels. The label list builds the prompt, and it’s used again when scoring. Define it once and import it everywhere, so a new fault can’t be silently dropped.Read samples by hand. Pick a few records per class and ask yourself whether you could answer them from what’s in the record. If you can’t, the model can’t either.Code: the cluster is harness/kind-cluster.yaml, the monitoring stack harness/prometheus-values.yaml, the fast alert rules harness/alert-rules.yaml and the demo app harness/demo-app.yaml. The faults are in faults/catalogue.yaml and faults/inject.py. Capture is harness/capture.py, the resumable collection loop harness/collect.py, and the steps to run it all harness/RUN.md.Step 4: Split the data by incidentA model has to be judged on examples it never trained on, or the score only tells you how well it memorized. So the data is split before any training:Training set. The examples the model learns from.Validation set. An optional slice used while you tune settings such as the learning rate or the number of epochs, and for stopping training early.Test set. Held back until the end and used once, to report the result. If you make decisions by looking at it, it stops being a fair exam.Two more rules matter for this kind of data.Stratify by class. A plain random split can leave a rare class with no test examples at all, and then nobody notices the model never learned it. Stratifying keeps each class’s share the same on both sides. Every class here has at least 18 training examples.Group by incident. This is the rule that’s easy to miss. One injected fault produces several alerts within a few minutes, and they describe the same pods with nearly the same events. If you split alert by alert, the test set ends up full of alerts whose near-twins are in training, and the score measures recall rather than understanding. The unit of independence is the injection window, not the alert.Split by alert versus split by windowThe window key is the fault, its target and the minute it started, which you can recover from each alert’s capture time and its delay after injection:def window(row: dict) -> tuple: """One injection: its alerts share a fault, a target and a start time.""" seen = dt.datetime.fromisoformat(row["captured_at"].replace("Z", "+00:00")) start = seen - dt.timedelta(seconds=float(row.get("seconds_since_injection") or 0)) return (row["fault"], str(row.get("fault_target")), start.strftime("%Y-%m-%dT%H:%M"))Whole windows go to one side or the other, drawn per class so the test set stays stratified. The result was 302 training alerts and 124 test alerts, from 42 test windows, with no window on both sides. The export script asserts that last part every time it runs, because a split that leaks gives you a good-looking number and nothing else.If you’d rather not write the grouping yourself, scikit-learn’s StratifiedGroupKFold does stratified, grouped splits with the window key as the group.What about the validation set?I didn’t keep one. With 426 alerts, a third slice would have left some classes with very few training examples. Instead I fixed the training recipe up front, using the defaults the tooling recommends, and never adjusted it after looking at test results. That keeps the test score honest, at the cost of not knowing whether other settings would do better. With more data, hold out 10 to 15% of the training windows for validation and use it for early stopping or a small hyperparameter search.Code: the grouped, stratified split is eval/make_grouped_split.py, and the check that no window lands on both sides is in models/export_training.py.Step 5: Format the data as chatAn instruction-tuned model was trained on conversations, so the easiest way to teach it something new is to write your examples as conversations too. Each example becomes three messages:system: the job and the rules, the same for every example;user: one alert and its context;assistant: the answer, a single fault id.Here is one real example. The system message lists every allowed answer, so the model only has to choose, and the user message is built from the captured record in the order an engineer would read it:One training example: system, user and assistant messagesAnd the three together are one line of a JSONL file:def chat(row: dict) -> dict: return {"messages": [ {"role": "system", "content": SYSTEM}, {"role": "user", "content": prompt_for(row)}, {"role": "assistant", "content": row["fault"]}, ]}One rule saves a lot of trouble: build the prompt in one function and import it everywhere, in the training export, in the evaluation and in the service that runs in the cluster. If the model is trained on one wording and served another, you’re measuring a model you don’t deploy.Chat templates and tokensThe model doesn’t read messages, it reads one long string of tokens, the word pieces a model works with. Every model family has a chat template that flattens the messages into that string, with special markers for where each turn starts and ends. For Qwen3 it looks like this:The chat template flattens the messages into one string of tokensNever write this by hand. The tokenizer ships the template, and tokenizer.apply_chat_template(messages, tokenize=False) produces it. The empty block is what Qwen3's template writes when thinking is turned off, and the same template has to be used at serving time, or the model sees a format it wasn't trained on.A typical example here is about 700 tokens of prompt and a few tokens of answer. During training, the model learns to predict each next token of that string. You can mask the loss so it only learns from the answer; I trained on the whole string, which is the default and worked fine for a task this narrow.Code: models/export_training.py writes train.jsonl and eval.jsonl, importing SYSTEM and prompt_for from eval/baseline.py.Step 6: Fine-tune with LoRAFull fine-tuning keeps training a pretrained model on your examples and updates every weight. For 1.7 billion weights that needs a lot of GPU memory for gradients and optimizer state, and every version you train is another full copy of the model.Parameter-efficient fine-tuning updates only a small part of the model. The model already knows the language, so a small change is enough to teach it a narrow task. The most common method is LoRA, low-rank adaptation.How LoRA worksLoRA freezes every original weight matrix W and trains two small matrices beside it, B and A. Their product is a correction added to W’s output:h = W x + (α/r) B A xIf W is d × d, then B is d × r and A is r × d, where r, the rank, is small. B starts at zero, so at the first step the model behaves exactly like the base, and training moves it only as far as the data asks. α (alpha) scales the correction.Full fine-tuning updates the whole matrix; LoRA trains two thin matrices beside a frozen oneFor one attention matrix in Qwen3–1.7B, 2048 × 2048, full fine-tuning updates 4,194,304 weights. LoRA at rank 16 trains 2048 × 16 + 16 × 2048 = 65,536 of them. The original LoRA paper reported 10,000 times fewer trainable parameters when adapting GPT-3 175B. At 1.7B the ratio is smaller, but the idea is the same.Where to put the adaptersEach Transformer layer has two parts. Attention decides which earlier tokens matter, using four projections: query, key, value and output (q_proj, k_proj, v_proj, o_proj). The MLP then transforms each token, using three more (gate_proj, up_proj, down_proj). I put an adapter on all seven, in all 28 layers. That comes to 17,432,576 trainable weights out of 1,738,007,552, or 1.00%. The trained adapter is about 66 MB.A 16-bit base or a 4-bit oneQLoRA loads the frozen base in 4 bits to save memory and trains the adapter on top. It’s the right choice when the base won’t fit in your GPU otherwise. But the adapter then learns corrections to rounded 4-bit weights, and if you later merge it into the ordinary 16-bit model for deployment, those corrections land on weights they weren’t meant for. In one comparison I ran, a QLoRA adapter lost 41 points of accuracy when merged. The same data trained over a 16-bit base lost nothing, and the run was faster. A 1.7B model fits on a T4 in 16 bits, so train in 16 bits if you plan to merge.The training codeI used Unsloth, which wraps Hugging Face’s PEFT and TRL libraries and makes LoRA training faster and lighter on a small GPU. In a Colab notebook with a T4 runtime, after pip install unsloth and uploading train.jsonl:from unsloth import FastLanguageModelfrom datasets import Datasetfrom trl import SFTConfig, SFTTrainerimport jsonmodel, tokenizer = FastLanguageModel.from_pretrained( model_name="unsloth/Qwen3-1.7B", max_seq_length=4096, load_in_4bit=False)model = FastLanguageModel.get_peft_model( model, r=16, lora_alpha=16, lora_dropout=0, bias="none", target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"], use_gradient_checkpointing="unsloth", random_state=7)rows = [json.loads(l) for l in open("train.jsonl")]texts = [tokenizer.apply_chat_template(r["messages"], tokenize=False) for r in rows]trainer = SFTTrainer( model=model, tokenizer=tokenizer, train_dataset=Dataset.from_dict({"text": texts}), args=SFTConfig( dataset_text_field="text", max_seq_length=4096, per_device_train_batch_size=1, gradient_accumulation_steps=8, num_train_epochs=3, learning_rate=2e-4, warmup_steps=5, lr_scheduler_type="linear", optim="adamw_8bit", weight_decay=0.01, logging_steps=5, seed=7, output_dir="out", report_to="none"))trainer.train()model.save_pretrained("qwen3-1.7b-triage-lora")tokenizer.save_pretrained("qwen3-1.7b-triage-lora")What each setting doesWhat each training setting doesWith 302 examples and an effective batch of 8, that’s about 38 updates per epoch and about 114 in total. On the free Colab T4 the run took 541 seconds, about nine minutes.Training is still not fully deterministic on a GPU. I trained the same data with the same seed twice and got 79.8% and 82.3% on the test set. Report the spread, not only the best run.Code: the full training script, with scoring before and after and the q8_0 export, is models/train_colab.py.Model: the trained adapter is published at jcanizalez/qwen3–1.7b-k8s-alert-triage-lora, with a model card covering the prompt format, how to load it with PEFT, and how to serve it with llama.cpp at q8_0.Step 7: Evaluate against baselinesA score means little on its own. It needs baselines, and the same test for everyone. I scored four contenders on the same 124 test alerts, with the same system prompt and the same user messages: the untuned Qwen3–1.7B, the tuned one, and two API models, a frontier model and a cheap fast one.Generate, then parseThe model generates greedily (always the most likely next token), with a short output limit, and the answer is parsed back to one of the known ids. Evaluating in the task’s own terms is simple here, because the answer is a label. If the reply contains several ids, the last one mentioned wins, and a reply with none counts as wrong.def parse(text: str) -> str: low = (text or "").lower() hits = [f for f in FAULTS if re.search(rf"\b{re.escape(f)}\b", low)] return max(hits, key=lambda f: low.rfind(f)) if hits else "unparseable"prompt = tokenizer.apply_chat_template( row["messages"][:-1], tokenize=False, add_generation_prompt=True, enable_thinking=False)ids = tokenizer(prompt, return_tensors="pt").to("cuda")out = model.generate(**ids, max_new_tokens=48, do_sample=False)answer = parse(tokenizer.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))Scoring the API modelsThe two API models were scored through OpenRouter, which serves many providers behind one OpenAI-compatible endpoint, so a single script and a single key cover both. Each test alert gets exactly the same system and user messages the small model saw, with temperature 0, and the reply goes through the same parse function:OPENROUTER = "https://openrouter.ai/api/v1/chat/completions"body = json.dumps({ "model": model, # "anthropic/claude-opus-5" or "google/gemini-3.5-flash-lite" "messages": [ {"role": "system", "content": SYSTEM}, {"role": "user", "content": prompt_for(row)}, ], "temperature": 0, "max_tokens": 2000,}).encode()req = urllib.request.Request(OPENROUTER, data=body, headers={ "Content-Type": "application/json", "Authorization": f"Bearer {os.environ['OPENROUTER_API_KEY']}",})with urllib.request.urlopen(req, timeout=120) as res: text = json.loads(res.read())["choices"][0]["message"]["content"]answer = parse(text)Two details matter. The output limit is generous, 2,000 tokens, because a model that reasons before answering can spend a small limit before it writes anything, and an empty reply would score as wrong. And a failed request is retried, and aborts the run if it keeps failing, rather than counting as a wrong answer, so a network problem can’t pass for a bad model. The script records every answer and its latency per alert, which is where the p95 figures come from. To score another model, run eval/baseline.py --model .Two metricsAccuracy is the share of alerts labelled correctly. It’s easy to read, but a model can look good by getting the common classes right and ignoring the rare ones.Macro F1 fixes that. For each class, precision is how often the model is right when it names that class, and recall is how many of that class’s alerts it finds. F1 combines the two, and macro F1 averages F1 over the classes, so every class counts the same no matter how many alerts it has.The resultsResults on 124 held-out alertsThe tuned 1.7B model beats Opus by 12 points. A second training run with the same data and settings scored 82.3%, so the lead is well outside the run-to-run spread.Read the untuned row carefully. It answers none to almost everything: 8 of 8 on real noise and zero on ten of the other twelve classes. So its 10.5% is close to what you'd get by always saying nothing is wrong, and the useful comparison is against Opus, not against the untuned model.Look at every classCorrect answers per fault for the tuned model, Opus and Flash-Lite, on 124 held-out alertsThe per-class view shows what the totals hide. The top row is the case for fine-tuning: when the backend is scaled to zero, the frontend’s pods look healthy while its requests fail, and from outside that looks like several other faults. The tuned model gets 8 of 9, Opus 2 and Flash-Lite none. That’s knowledge about this cluster, and a general model can’t have it.The bottom rows show where the small model is weaker. dns_broken needs the model to notice that a Service is an ExternalName pointing at a host that doesn't resolve, and Opus reads that better, 5 of 8 against 3. On real noise the tuned model raises false alarms, 3 of 8 against Flash-Lite's 6. Those are the first two classes I'd send to a larger model, and they tell you what data to collect next.Code: the API models are scored by eval/baseline.py, the local model by the score function in models/train_colab.py. Every answer, per model and per alert, is in results/headtohead.Step 8: Merge, quantize and packageTraining leaves you with a base model and an adapter that run in Python on a GPU. The cluster wants one file that runs on a CPU. Getting there takes three moves: merge the adapter into the base, reduce the precision, and write the result as GGUF. Each one can cost accuracy, so score the model again after each.MergingMerging computes W + (α/r)BA once for every adapted matrix and saves the result as an ordinary model, so inference no longer needs the adapter. With a 16-bit base the arithmetic is exact. In my runs the merged model scored 80.6% against 82.3% for the adapter loaded separately, two alerts out of 124, which is within the spread between training runs.model.save_pretrained_merged("merged", tokenizer, save_method="merged_16bit")You can also skip merging. llama.cpp can load the base and the adapter side by side with --lora adapter.gguf, which suits a design where many clusters share one base and each gets its own small adapter.PrecisionEvery weight is a number, and precision is how many bits it gets:Number formatsQuantization, worked by handQuantization stores weights as small integers plus a scale. The simplest scheme, absmax, takes a block of weights, finds the largest absolute value, and maps it to the largest integer available. Take four weights: 0.2, −1.3, 4.1 and 0.05.At 8 bits the integers run from −127 to 127, so the scale is 127 / 4.1 ≈ 30.98. The weight 0.2 becomes round(0.2 × 30.98) = 6, which reads back as 6 / 30.98 ≈ 0.19. The weight 0.05 becomes 2, which reads back as 0.065. Both are close.At 4 bits the integers run from −7 to 7, so the scale is 7 / 4.1 ≈ 1.71. Now 0.2 becomes round(0.34) = 0, and so does 0.05. Both small weights are gone.The same four weights at 8 and 4 bitsThat’s the whole trade: fewer bits means a smaller file and faster CPU inference, and coarser steps, so small values get rounded away. Real formats reduce the damage by using small blocks, each with its own scale. q8_0, llama.cpp’s 8-bit format, uses blocks of 32 weights with one 16-bit scale each. q4_k_m uses 4-bit blocks grouped into super-blocks with their own scales, and keeps a few sensitive tensors at 6 bits.The research is encouraging for large models. LLM.int8() showed 8-bit inference matching 16-bit accuracy on models up to 175B parameters, and GPTQ brought models that size to 3 or 4 bits per weight with little loss. The LLM.int8() work also showed that a few outlier values can wreck simple 8-bit schemes, so whether quantization is cheap depends on what’s in the weights.GGUFGGUF is the file format of llama.cpp. It stores the weights together with typed key-value metadata in a single file: the architecture, the tokenizer, the chat template and every tensor. Here’s what’s inside the file I serve, read from its own header:Inside the GGUF the cluster servesThe chat template travels inside the file, so the server formats prompts exactly as training did. To produce it, either let Unsloth do everything:model.save_pretrained_gguf("export", tokenizer, quantization_method="q8_0")or convert the merged model with llama.cpp’s own tools:python convert_hf_to_gguf.py merged --outfile model-f16.gguf --outtype f16./llama-quantize model-f16.gguf model-q8_0.gguf Q8_0Unsloth writes into a sibling directory named export_gguf, not into export, so look there for the file.What it costThe same adapter, run four ways on the same 124 test alerts:One adapter run four ways, against Opus8-bit costs about five points and still beats Opus comfortably. 4-bit drops to 30.6%. q4_k_m is the default most tools suggest, and for many models it's a fine choice, but for this fine-tune it throws away most of what training taught. Always score the quantized file itself, not the model you trained.My working explanation, which I haven’t tested directly, is the one from the worked example: the adapter changes each weight by a small amount, and at 4 bits many of those changes round back to the original value, like the two small weights above.Code: the merge test is models/score_merged.py, the export and scoring of each quantization models/score_quantizations.py, and the GGUF header reader behind the figure is in diagrams/figures.py.Step 9: Serve it inside the clusterThe deployment is two small workloads in their own namespace: llama-server runs the model, and a triage service turns alerts into prompts and prompts into verdicts.One alert, from webhook to verdictThe model serverllama-server from llama.cpp serves an OpenAI-compatible API from a single GGUF, which sits on a volume so a retrain is a file copy rather than a new image:containers: - name: llama-server image: ghcr.io/ggml-org/llama.cpp:server args: ["-m", "/models/model.gguf", "--host", "0.0.0.0", "--port", "8080", "-c", "2048", "--reasoning", "off", "-np", "1", "-t", "2"] resources: requests: { cpu: "1", memory: 2Gi } limits: { cpu: "2", memory: 5Gi } readinessProbe: httpGet: { path: /health, port: 8080 }llama-server flagsThe triage serviceAlertmanager sends firing alerts to the service by webhook:receivers: - name: triage webhook_configs: - url: http://triage.triage.svc.cluster.local:8080/alert send_resolved: falseFor each alert, the service reads the namespace, builds the same prompt used in training, and asks the model:body = { "messages": [ {"role": "system", "content": SYSTEM}, {"role": "user", "content": prompt_for(labels, annotations, ctx)}, ], "temperature": 0, "max_tokens": 48,}answer = await http.post(LLAMA_URL, json=body)fault = parse(answer.json()["choices"][0]["message"]["content"])verdict = {"alert": labels.get("alertname"), "namespace": namespace, "object": workload, "fault": fault, "escalate": fault == "unparseable"}It reads the cluster through a service account bound to this role, and nothing more:kind: ClusterRolemetadata: name: triage-readerrules: - apiGroups: [""] resources: ["pods", "services", "events"] verbs: ["get", "list"]How it performsOn two CPU cores the 8-bit model answers in about 6 seconds on average, with a p95 under 10 seconds. That’s slower than Flash-Lite and faster than Opus, and each call costs nothing. In an end-to-end test I injected a crashloop into the demo app, and the first correct verdict came back 128 seconds later. Most of that is the alert rule waiting to fire, not the model.SecurityAlerts, pod state and events never leave the cluster. Only the verdict does.The service can get and list pods, services and events. It can't change anything it reads.Nothing the model outputs gets executed. The verdict is a label for a person or another system to read.No third party sees your topology, image names or error messages, which matters in regulated environments.An answer the service can’t parse is marked for escalation instead of being guessed.Code: the deployment, RBAC and model volume are serve/manifests.yaml, the service is serve/triage.py with its Dockerfile, and the Alertmanager receiver is in harness/prometheus-values.yaml.The checklistThe whole framework on one screen. Each line is something to decide or check before moving on.The checklistWhat this doesn’t show, and what’s nextThis is one cluster, one small app and twelve faults I wrote myself. Real clusters have hundreds of alert rules and failures nobody has catalogued, and a model trained on mine knows mine, which is the point, but it means you train your own. With 124 test alerts a 12-point gap is clear, while any single per-class number is only a handful of alerts. I also haven’t measured the escalation path, so I can’t say yet what share of alerts would go to a large model, or what the whole system costs per thousand alerts.The next step is that escalation path. AdaptiveLog does something similar for log analysis, sending a log to the large model when the small one is uncertain. For alerts, I’d let the small model answer when it’s confident, send the rest up, and measure where the line should sit. After that I’d try a public benchmark like ITBench, where I expect a 1.7B model to struggle with open-ended root cause, and a second cluster with different workloads.For the narrow, repetitive first pass of troubleshooting, a small model trained on your own cluster did better than the largest model I could rent, on two CPU cores, without sending anything outside. The hard, new incidents still belong to a bigger model or a person.Fine-Tuning a Small Model to Triage Kubernetes Alerts was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.