arXiv(opens in a new tab)cs.SEAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.24267

Cross-Stack Validation of Language-Model Training: A Clinical Fine-Tuning Case Study

Thang Tran, Lan Dang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Neural network training suffers from an oracle problem. A run can converge normally, report a falling loss and yield a usable model even when the software beneath it computes something other than what was specified. Since almost all such work runs on one software stack, there is rarely anything independent to check it against. We ask whether independently implemented training stacks can act as differential oracles for a complete fine-tuning pipeline, rather than for the individual operators and inference paths targeted by earlier differential testing of deep-learning libraries.

The protocol we define works at the level of the learning trajectory. It comprises a shared specification, cross-check points spanning arithmetic, model loading, data rendering and the trajectory itself, and an explicit separation of three kinds of implementation independence: of the stack, of the training orchestration, and of the language runtime. We apply it to a realistic workload, a LoRA adaptation of Qwen3-0.6B over 168,574 clinical question-answer pairs, running the identical specification under PyTorch and under numbat, an independent framework written in Zig, driven natively and through its C interface from six programming languages.

The two stacks agree closely. Over 42 paired evaluations spanning a full epoch their held-out cross-entropy differs by 0.134% on average, and four implementations end the epoch within 0.15% of one another. The comparison also exposed 17 faults that single-implementation development had missed. Two of these matter for software engineering. The first is that the fault with the largest effect on the trained model lay outside the numerical kernels altogether: a mismatch in how clinical text was rendered moved held-out loss by 0.15, roughly 500 times more than the arithmetic faults found alongside it. The second is that four faults were reachable only from a language whose memory model differs from the first two implementations, namely a scheduler that migrates work across threads, a collector that cannot observe device memory, and an ownership discipline requiring a primitive the interface did not provide. Implementation diversity, on this evidence, has several axes, and the runtime is one of them.

1 Introduction

A trained model is the product of a long chain of arithmetic and data handling. When one link in that chain is wrong the result is rarely a crash. It is a slightly worse model, produced quietly, with a loss curve that still falls and outputs that still read fluently. The chain is hard to test for the same reason numerical software is generally hard to test: for most of the computation there is no

∗^{*}Corresponding author: thang.tran@cloudkites.com independently known correct answer. Training compounds this in two ways. The computation is stateful, so an error at update t propagates through every update that follows, and it is stochastic, so even two correct runs will not agree exactly.

Software engineering’s established answer to a missing oracle is to obtain a second implementation and compare. The idea has been applied productively to deep-learning libraries, and §2 surveys that work. Almost all of it operates on individual API calls, on generated models, or on inference, so the unit under comparison is an operator or a forward pass. The closest work we are aware of that targets training itself compares distributed against non-distributed execution of the same library [17].

We ask instead what happens when the unit under comparison is a whole fine-tuning pipeline: template rendering, tokenisation, forward, loss, backward, optimizer, checkpoint and evaluation, executed by stacks that share no code. The learning trajectory then becomes the signal. Two stacks implementing the same specification should do more than produce similar final models. They should pass through the same sequence of held-out losses along the way, and should depart from that sequence together whenever the specification is misread.

References (21)