SHEET 04 / 06ENGINEERING · TECHNICAL EXHIBITS

The GenAI stack, end to end — pretraining to the ECU.

Seven engineering exhibits across training, serving and in-vehicle edge. One model lineage flows through all of them: what's trained in the cloud is quantized, escalated, and safety-gated before it influences vehicle behavior. Metrics are representative of the configurations described — each carries an I flag and names its method. Every architecture here is open to scrutiny; that's the point of a technical review.

TRAINazure cloud
CORPUScurate · dedup
PRETRAIN3D-parallel
FINE-TUNEQLoRA · DPO
SERVEdatacentre
REGISTRYversioned · eval'd
vLLM + RAYbatched · autoscaled
AGENTS + RAGorchestrated
EDGEin-vehicle
QUANTIZEINT4 · TensorRT-LLM
ECUgemma + phi · real-time
DECISIONISO 26262 gated
ONE MODEL LINEAGE, LEFT TO RIGHT — CLOUD-TRAINED, QUANTIZED, ESCALATED, SAFETY-GATED
FIG. 01 — ONE PIPELINE, THREE PLANES: TRAIN IN THE CLOUD · SERVE AT SCALE · DECIDE IN THE VEHICLE
exhibit 01 --agentic-systems

Agents as a typed graph of roles. I

EXHIBIT 01 / 07

A planner decomposes the goal across specialised agents; each acts through a governed MCP tool layer and shared persistent memory. A meta-cognitive monitor watches trajectories and re-plans on failure.

GOALspec
PLANNERdecompose
CODE · REVIEW · TEST3 agents, parallel
MCP + MEMORYgoverned · rust-backed
META-COGtrajectory monitor
⟲ META-COG → PLANNER · DETECT & RE-PLAN
FIG. 02 — TYPED STATE GRAPH · TOOL USE · SHARED MEMORY · META-COGNITIVE RECOVERY
87%MULTI-STEP TASK COMPLETION
96%TOOL-CALL VALIDITY
71%FAILED TRAJECTORIES AUTO-RECOVERED
4.2AVG AGENT HOPS PER TASK
LangGraphMCPA2AReActfunction-callingRust agent-memory
exhibit 02 --pretraining

Pretraining a 1.5B domain model from scratch. I

EXHIBIT 02 / 07

A decoder-only transformer trained from random init on a curated automotive-software corpus — embedded C, AUTOSAR ARXML, MISRA rules, diagnostics — with a domain-extended tokenizer and a final annealing phase on the highest-quality data.

CORPUSdedup · filter
TOKENIZERbyte-BPE 48K
PRETRAINdecoder-only 1.5B
EVALdomain suite
ANNEALhighest-quality data
CHECKPOINT→ registry
FIG. 03 — 1.5B · ROPE · GQA · 8K CONTEXT · ~320B TOKENS · COSINE LR · BF16
1.5BPARAMETERS, DECODER-ONLY
320BTRAINING TOKENS
+24%DOMAIN-EVAL FROM ANNEALING
~14KH100 GPU-HOURS
PyTorchMegatron-LMFlashAttention-3RoPEGQAbyte-BPEBF16
exhibit 03 --distributed-training

3D-parallel across 256× H100 on Azure. I

EXHIBIT 03 / 07

Pretraining sharded with data, tensor and pipeline parallelism across an Azure ND H100 v5 cluster on NDR InfiniBand — ZeRO-3 sharding, activation checkpointing, async checkpoints to blob storage every 12 minutes.

ND H100 v5256× H100 SXM
INFINIBANDNDR 400 Gb/s
3D PARALLELTP 8 · PP 4 · DP 8
ZERO-3+ activation ckpt
ASYNC CKPT→ blob storage
FIG. 04 — MEGATRON-LM + DEEPSPEED · NCCL · COMPUTE–COMMS OVERLAP IS THE GAME
256×H100 GPUS IN CLUSTER
52%MODEL FLOPS UTILISATION
92%SCALING EFFICIENCY AT 256 GPUS
12 minASYNC CHECKPOINT CADENCE
Azure ND H100 v5DeepSpeedMegatron-LMNCCLZeRO-3Blob storage
exhibit 04 --serving

vLLM replicas behind a Ray Serve mesh. I

EXHIBIT 04 / 07

vLLM gives each replica PagedAttention, continuous batching and prefix caching; Ray Serve routes, multiplexes and autoscales. FP8 weights and speculative decoding lift throughput without hurting tail latency. Deep-dive on serving economics: Sheet 05 →

REQUESTstream in
RAY SERVEroute · autoscale
vLLM × 3FP8 · PagedAttn
RESPONSEcontinuous batching
FIG. 05 — PAGEDATTENTION · PREFIX CACHE · SPECULATIVE DECODING · AWQ FOR SLM REPLICAS
3.4×THROUGHPUT VS HF BASELINE
<250msTIME-TO-FIRST-TOKEN, P50
71%SUSTAINED GPU UTILISATION
−58%COST PER 1M TOKENS
vLLMRay ServePagedAttentionFP8AWQspeculative decoding
exhibit 05 --code-intelligence

RAG that understands code structure — 8.4M LOC. I

EXHIBIT 05 / 07

The repository is indexed three ways — AST-aware semantic chunks, a symbol and call graph, and a lexical index. A hybrid retriever fuses the signals, re-ranks with a cross-encoder, and assembles context the model can actually reason over. An agentic loop re-retrieves when the first pass falls short.

REPO8.4M LOC
AST CHUNKSfunction-level
3 INDICESdense · graph · BM25
HYBRID FUSION+ cross-encoder rerank
CONTEXT → LLM
⟲ AGENTIC RE-RETRIEVE LOOP WHEN CONFIDENCE IS LOW
FIG. 06 — EMBEDDINGS + CALL GRAPH + BM25, FUSED — STRUCTURE-BLIND RAG FAILS ON CODE
8.4MLINES OF CODE INDEXED
0.91RETRIEVAL PRECISION @ 10
88%REPOSITORY-QA ACCURACY
<900msRETRIEVAL LATENCY, P95
tree-sitter ASTcode embeddingsgraph indexBM25cross-encoderhybrid fusion
exhibit 06 --slm-fine-tuning

Fine-tuning an SLM for embedded-C and MISRA. I

EXHIBIT 06 / 07

A 3–4B base model specialised with QLoRA on a small, rigorously-cleaned SFT set, preference-aligned with DPO, then 4-bit quantized — recovering ~93% of a full fine-tune's quality at a fraction of the compute. Clean beats large. Methods deep-dive: Reference 02 below →

BASE SLMphi-4-mini · gemma-2
SFT~5K curated pairs
QLORANF4 4-bit · rank 64
DPOpreference pairs
EVALMISRA · AUTOSAR
INT4 EXPORTdeploy
FIG. 07 — ~0.4% OF PARAMETERS TRAINED · PEFT · BITSANDBYTES
0.4%PARAMETERS TRAINED
~8 GBVRAM FOR THE FINE-TUNE
~93%QUALITY VS FULL FINE-TUNE
40→94%MISRA FIRST-PASS COMPLIANCE
Phi-4-miniGemma-2QLoRANF4DPOPEFTbitsandbytes
exhibit 07 --in-vehicle-edge --accent=amber

AI inside the car — two tiers, one safety gate. I

EXHIBIT 07 / 07

Quantized Gemma and Phi run on the ECU for hard-real-time local reasoning; heavier queries escalate to an in-vehicle NVIDIA DGX Spark. Both paths feed a safety-gated decision layer before any action reaches an actuator.

DRIVER / SENSORinput event
ECUgemma + phi · INT4 · ~82%
DGX SPARKGB10 · rich path · ~18%
GATEISO 26262
FEATUREactuation
FAST PATH ON-ECU · DASHED = ESCALATION · NOTHING ACTS UNGATED
FIG. 08 — TWO-TIER IN-VEHICLE DEPLOYMENT · TENSORRT-LLM · LLAMA.CPP · ONNX RUNTIME
~160 MBECU FOOTPRINT · 270M @ INT4
<60 msON-ECU FIRST-TOKEN LATENCY
~1 PFLOPDGX SPARK · FP4 COMPUTE
~18%QUERIES ESCALATED TO SPARK
Gemma-3 270MPhi-4-miniINT4 / NF4TensorRT-LLMllama.cppDGX Spark GB10
report --consolidated

The numbers, in one view.

SEC 08 / SHEET 04
LayerMetricResultMethod / reference
PretrainingDomain-eval uplift+24%annealing phase · 1.5B model
Distributed trainingModel FLOPs utilisation52%256× H100 · 3D-parallel
Inference servingThroughput vs HF baseline3.4×vLLM + Ray · FP8
Inference servingCost per 1M tokens−58%continuous batching · autoscale
Code RAGRepository-QA accuracy88%8.4M LOC · hybrid retrieval
SLM fine-tuningMISRA first-pass compliance40 → 94%QLoRA + DPO
SLM fine-tuningQuality vs full fine-tune~93%0.4% of parameters trained
ECU edgeOn-ECU first-token latency<60 msGemma / Phi · INT4
ECU edgeHeavy-path escalation rate~18%escalated to DGX Spark
TABLE 01 — ILLUSTRATIVE TARGETS FOR THE CONFIGURATIONS IN EXHIBITS 01–07, NOT A SINGLE AUDITED RUN. EACH RESULT NAMES ITS METHOD.
cat tradeoffs.md --honest

The hard parts — where this earns its keep.

SEC 09 / SHEET 04
EDGE

Quantization is a budget, not a free lunch.

INT4 at the edge costs accuracy. Measure the drop per task, keep safety-critical paths gated, and escalate rather than trust a degraded local answer.

TRAINING

MFU is the metric, not GPU count.

Distributed training is won in compute–communication overlap. 52% model-FLOPs utilisation on 256 GPUs beats a larger cluster idling on a comms bottleneck.

RETRIEVAL

Structure-blind RAG fails on code.

Flat chunking loses call graphs and symbol scope. AST-aware chunks plus graph retrieval are the line between a demo and something that survives an 8M-LOC repo.

SERVING

Throughput is reported net of review.

More generated code creates more to verify. Serving and agent gains are quoted after verification overhead — tail latency and change-fail rate held as guardrails.

man train --pages=2

From exhibit to playbook.

SEC 10 / SHEET 04

Exhibits 02 and 06 showed one pretraining run and one fine-tune. These two references generalise them — when to build an SLM at all, which path, what it costs, and how to tune a base model without burning a cluster.

reference 01 --building-slms

Building a new SLM: two paths, nine stages.

PATH A · RARE — PRETRAIN FROM SCRATCH

Own tokenizer, architecture, weights — full control and IP, massive compute. Only justified for a moat or a hard data-sovereignty mandate. Design architecture + tokenizer (~0.5–7B) → assemble a heavily-filtered corpus → distributed pretraining on a TPU/Trainium/GPU pod → shared tuning stages.

NeMoMaxText / LevanterMegatron-LMtorchtitan
PATH B · DEFAULT — DERIVE FROM AN OPEN BASE

Start from Llama / Gemma / Phi / Qwen / Mistral and specialize: optional continued pretraining on domain text → distillation from a frontier teacher → SFT via LoRA/QLoRA on curated instructions → DPO/RLAIF alignment. Faster, cheaper, and usually beats a from-scratch small model on a narrow task.

HF TRLAxolotlUnslothPEFT
01 SCOPEtask · budget · evals
02 DATAclean · dedup · synth
03–04 TRAINbase · SFT · align
05 COMPRESSquantize · compile
06–07 EVAL + REGred-team · registry
08 DEPLOYpick a rung
09 OBSERVEdrift · traces
⟲ FLYWHEEL: PRODUCTION TRACES FROM 09 BECOME CURATED TRAINING DATA IN 02 — COMPOUNDING ADVANTAGE
FIG. 09 — THE NINE-STAGE SLM PIPELINE, IDENTICAL ACROSS ALL THREE CLOUDS
Target sizeTokens (20:1)H100-hrs @ 40% MFUCost
0.5B10B~120$300–1K
1B20B~480$1K–3K
3B60B~4,300$10K–25K
7B140B~23,000$50K–150K
7B over-trained15T~2.5M$5M–10M
TABLE 02 — FROM-SCRATCH ECONOMICS: WHY MOST TEAMS TAKE PATH B
WHAT ACTUALLY MOVES QUALITY Data curation is the dominant lever for small models, not parameter count. Phi-4: ~400B tokens across ~50 synthetic dataset types — surpassed its own GPT-4-class teacher on STEM QA. Llama 3 used Llama 2 to grade data quality (the model-grades-data loop is now standard). Annealing — the final ~40M tokens at linear LR→0 on the highest-quality mix — was worth +24% GSM8K and +6.4% MATH on an 8B.
reference 02 --fine-tuning

Fine-tuning: one of five options — pick deliberately.

ApproachUse when
Prompt engineeringBehavior reachable with base model + few-shot; under ~100 examples
RAGKnowledge is dynamic, large, proprietary; you need citations and freshness
Fine-tune (PEFT)Stable task, 500–50K curated examples; consistent style/format/vocab, or compressing inference cost
Continued pretrainingNew language/domain with a large unlabeled corpus (10B+ tokens) — e.g. automotive ARXML / MISRA-C
From scratchAlmost never — extreme constraints or a novel architecture
TABLE 03 — THE DECISION, BEFORE THE METHOD
MethodTrainableQuality recoveryVRAM (7B)
Full fine-tune100%100% baseline~100–120 GB
LoRA0.1–1%90–95%~28 GB
QLoRA0.1–1%~80–95%~5–8 GB
DoRA0.1–1%> LoRA at equal rank~LoRA
Adapters / IA³ / prefix~0.01%< LoRA, cheapestsmallest
TABLE 04 — METHODS · QLORA PUTS A 70B FINE-TUNE ON ONE A100-80GB (~46 GB), A 7B ON A $1,500 RTX 4090
HYPERPARAMETERS · 2026 DEFAULTS rank 8–64 (start 16) · alpha = r or 2r · target all linear modules · LR 1e-4–3e-4 · 1–3 epochs · enable DoRA by default. Data: 500 clean examples beat 5,000 noisy; 90/5/5 split + domain holdout; mix 5–20% original instruction data and watch the MMLU-delta for catastrophic forgetting.
ALIGNMENT & AFTER DPO is the default (chosen/rejected pairs); ORPO folds SFT+align with no reference model; KTO when you only have thumbs-up/down; GRPO/PPO for math/code RL. Then merge_and_unload() collapses LoRA into base weights at zero inference latency, GPTQ/AWQ-quantize to INT4, and serve on commodity hardware — vLLM hot-swaps LoRA adapters directly.
HF TRL + PEFT — reference APIAxolotl — YAML, productionUnsloth — ~2× faster, −30–50% VRAMLLaMA-Factory — UI + model zootorchtune · NeMo — enterprise