Teaching an Open-Weights Model to Read Maintenance Work Orders
Large manufacturers such as the Volvo Penta, Scania and ABB plants in SMART and AI-COMPETE hold years of
maintenance work orders. Technicians wrote them in Swedish shop-floor shorthand, full of plant abbreviations and
equipment codes. This project fine-tunes an open-weights language model with QLoRA to turn each record into a
structured failure record: component, failure mode, cause, action and downtime. It then serves the model with
vLLM inside the company’s own cloud tenant, with MLOps covering data curation, deployment and monitoring.
ContextUniversity of Skövde · SMART (KK-stiftelsen) & AI-COMPETE (Vinnova) · 2025 · system design
ResultSystem design — data pipeline, training recipe, evaluation protocol and serving architecture. No benchmark results are claimed yet.
What this page is. A system design for a use case from the industrial partners of SMART and
AI-COMPETE. It is not a report of a deployment at any partner. The comparison tables below describe the planned
evaluation and its release gates. They are not measured results.
Stakeholder engagement · problem formulation
Years of failure history, written in a language no model was trained on
The data SMART’s resilience models need already exists, as free text.
Predicting failures and planning recovery needs labelled failure history: which component failed, how, why, what
fixed it and how long the line stood still. A large plant’s maintenance system holds hundreds of thousands of
such records, but the important part is a free-text note like “SP2 larm 50204, bytt gripdon, kabel
nött vid axel 6, 40 min”. It is Swedish and English mixed, with abbreviations that differ from plant
to plant.
Why fine-tune, rather than prompt a large hosted model or use retrieval:
Volume. Backfilling the whole history and then classifying every new record is a
high-volume batch job. Per-token API pricing and rate limits dominate the cost at that scale.
Consistency. The output has to follow one failure taxonomy the same way every time. Few-shot
prompting drifts. A fine-tuned model learns the taxonomy.
Jargon. Plant abbreviations and equipment codes are not in any pre-training corpus.
Retrieval can supply facts, but it cannot teach a model to read a new dialect.
Data residency. Maintenance records name people, suppliers and weaknesses in the line. The
model runs inside the company’s tenant, on weights the company controls.
Pipeline · end-to-end MLOps
Curate, train, evaluate, quantise, serve, and learn from corrections
Every stage is versioned. A model reaches production only through the evaluation gate.
The review loop turns engineers’ corrections into training data, so the model improves where it was weakest.
Stage 1 · dataset curation & synthetic data
Most of the work is the data
A small, trusted gold set, a larger teacher-labelled set, and targeted synthetic examples for rare failures.
Clean. Records are exported from the maintenance system. Names and personal identifiers are
removed, near-duplicate notes are collapsed, and each record is tagged with language and plant.
Gold labels. Maintenance engineers label about 2,000 records against the plant’s failure
taxonomy, modelled on ISO 14224. Double-labelling a sample measures how much the engineers agree with each
other, which sets the ceiling a model can honestly reach.
Teacher labels. A large model inside the tenant labels tens of thousands more with detailed
instructions. Only labels that are consistent across repeated runs and pass schema checks are kept, and a
sample is audited against gold.
Synthetic data for rare classes. Rare but costly failure modes get synthetic work orders,
generated from real templates and checked by an engineer, so the model does not learn to ignore them.
Synthetic data never enters the test sets.
Leakage-proof splits. The last months of data and one entire plant are held out. A model that
only memorised one plant’s habits fails visibly.
Stage 2 · parameter-efficient fine-tuning
A 7–8B model, one GPU, and a recipe built around memory
QLoRA makes the training fit one GPU. The rest of the recipe decides whether it fits fast.
Training recipe
Base model chosen from a shortlist of 7–8B open-weights models (Llama, Mistral, Qwen families),
screened on Swedish text and on a licence that allows commercial use.
QLoRA: base weights frozen in 4-bit NF4, with LoRA adapters on attention and MLP projections, trained with
TRL’s supervised fine-tuning on instruction–JSON pairs.
Loss only on the answer tokens, so the model learns to produce records, not to repeat work orders.
Rank, learning rate and data mix swept with Ray Tune. Every run is logged in MLflow with its dataset
hash.
Memory and throughput
Gradient checkpointing trades recomputation for activation memory, which allows longer
sequences on the same card.
FlashAttention-2 and sequence packing: short work orders are packed into
full sequences, so the GPU is not padding most of the time.
Paged 8-bit AdamW keeps optimiser states from causing out-of-memory spikes.
Unsloth kernels for fast single-GPU iteration. DeepSpeed ZeRO-3 across
several GPUs is used only for a full fine-tune ablation, to check whether LoRA is leaving accuracy
behind.
Stage 3 · automated evaluation
A fine-tune has to beat the cheap options, or it should not exist
Four systems on the same held-out records: time-split and unseen-plant.
System
What it tests
Base model, zero-shot
What the open-weights model can do before any training
Base model, few-shot with retrieved examples
Whether good prompting alone closes the gap
Large hosted model, few-shot
The quality bar, and the cost the fine-tune has to undercut
Fine-tuned model (QLoRA)
The candidate for production
Metric
How it is measured
Release gate (target)
Failure-mode macro-F1
Against gold labels; macro so rare modes count as much as common ones
≥ large hosted model
Field-level accuracy
Component, cause, action and downtime, exact or normalised match
≥ 0.90 of engineer agreement
Unseen-plant drop
Macro-F1 on the held-out plant compared with the seen plants
≤ 5 points
Invented codes
Equipment or part codes in the output that are not in the input or the asset register
0
Schema validity
Outputs that parse against the JSON schema
1.00 (guided decoding)
Cost per 1,000 records
GPU-hours at measured throughput vs the hosted model’s token pricing
well below hosted
An LLM judge is used only for the free-text cause summary, and it is calibrated against engineer
ratings first. ROUGE and BLEU are reported for completeness, but they do not decide a release, because two
correct summaries of a fault can share few words.
Stage 4 · quantisation, serving & CI/CD
From adapter to endpoint without a manual step
A pull request that changes data, code or configuration retrains, re-evaluates and redeploys through the same path.
QuantiseThe adapter is merged and the model quantised to AWQ 4-bit or FP8. The quantised
model is re-evaluated, because quantisation can move rare-class F1.
ServevLLM with continuous batching and guided JSON decoding. Multi-LoRA serving hosts one
adapter per plant on one base model.
DeployGitHub Actions pulls the registered model and deploys to Azure ML managed GPU
endpoints. It runs in shadow mode first, then as a canary, and rolls back automatically if it misses a gate.
MonitorConfidence and schema errors are tracked, along with drift in vocabulary as new
equipment and abbreviations appear. Low-confidence records go to engineers, and their corrections feed the
next round.
The same pipeline runs overnight as an offline vLLM batch job to backfill the historical archive. The endpoint
handles new work orders as they are closed.
Where the output goes: SMART’s operational-resilience models get labelled failure history to learn from. The
robot-cell copilot gets structured past incidents to match against, and the
data analyst agent can finally answer “which failure mode cost us the
most downtime last quarter?”