Source-linked AI summary

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

Thang Tran, Lan Dang

arXiv:2608.24267v1cs.SE

TL;DR

Training은 run이 converge하더라도 잘못된 model을 조용히 만들어낼 수 있으며, 기존 differential testing은 독립적으로 전체 training pipeline을 점검하는 경우가 드물다. 이 논문은 trajectory-level cross-stack protocol을 정의하고, 42 paired evaluations에서 held-out cross-entropy의 평균 차이 0.134%를 확인하는 동시에 data rendering 및 runtime-specific fault를 포함한 미발견 fault 17개를 드러냈다.

  • 문제

    전체 fine-tuning pipeline에는 data handling, arithmetic, optimization, evaluation 전반의 조용한 오류를 탐지할 수 있는 독립적 검증이 부족하다.

  • 방법

    이 연구는 pipeline 단계와 learning trajectory를 아우르는 cross-check를 사용해, 공통 specification 아래 독립적으로 구현된 stack을 비교한다.

  • 결과

    42 paired evaluations에서 held-out cross-entropy의 평균 차이 0.134%와 함께 data rendering 및 runtime-specific fault를 포함한 fault 17개가 드러났다.

  • 시사점 및 한계

    서로 다른 유형의 조용한 fault를 드러내려면 독립 구현은 stack, orchestration, runtime 차원에서 서로 달라야 한다.

  • 시사점 및 한계

    이 연구에는 stochastic baseline이 없으므로 0.134%와 같은 residual을 작다고 해석하는 일은 measurement가 아니라 여전히 judgement에 해당한다.

Abstract

from arXiv · show

Neural network training has an oracle problem: a run can converge normally and yield a usable model while the software beneath it computes something other than specified. Almost all such work runs on one stack, so there is rarely anything independent to check against. We study whether independently implemented training stacks can serve as differential oracles for a whole fine-tuning pipeline, rather than the operators and inference paths that prior differential testing targets. We define a trajectory-level protocol -- a shared specification, cross-check points spanning arithmetic, model loading, data rendering and the learning trajectory, and a separation of independence of the stack, the orchestration and the language runtime -- and apply it to a LoRA adaptation of Qwen3-0.6B over 168,574 clinical question-answer pairs under PyTorch and under numbat, an independent framework written in Zig, driven natively and through its C interface from six languages. Across 42 paired evaluations spanning a full epoch the two stacks' held-out cross-entropy differs by 0.134% on average, and four implementations end the epoch within 0.15% of one another. The comparison exposed 17 faults that single-implementation development had missed, two of them notable for software engineering. The fault with the largest effect on the trained model lay outside the numerical kernels: a mismatch in how clinical text was rendered moved held-out loss 0.15, some 500 times more than the arithmetic faults found beside it. And four faults were reachable only from a language whose memory model differs from the first two implementations: a scheduler migrating work across threads, a collector blind to device memory, an ownership discipline needing a primitive the interface lacked. Implementation diversity has several axes, and the runtime is one.

1 서론

독립적으로 알려진 정답이 없는 상태 기반·확률적 pipeline에서는 학습이 조용히 성능이 저하된 model을 만들 수 있다. 이 논문은 code-independent stack 간 전체 fine-tuning pipeline을 differential validation하여 oracle problem을 다루고, data rendering과 runtime diversity가 수치 검증으로 놓칠 수 있는 fault를 드러냄을 보인다.

  • 동기: 오류는 대개 crash를 일으키지 않고, 상태 기반 업데이트가 오류를 전파하며, 확률적 정상 실행은 정확히 일치할 필요가 없기 때문에 문제가 특히 어렵다.따라서 감소하는 loss curve와 유창한 output만으로는 correctness가 확립되지 않는다.
  • 기여: 전체 pipeline 비교에서는 operator나 forward pass가 아니라 learning trajectory를 code를 공유하지 않는 stack 간 differential-validation signal로 삼는다.비교하는 pipeline은 template rendering, tokenisation, forward, loss, backward, optimization, checkpointing, evaluation을 포괄한다.
  • 기여: 제안하는 protocol은 공유 specification을 고정하고, trajectory level을 통해 arithmetic을 점검하며, stack·orchestration·language-runtime independence를 구분한다.이는 end-to-end training을 위한 trajectory-level differential validation protocol로 제시된다.
  • 결과: 17개의 fault가 드러났으며, model에 가장 큰 영향을 준 것은 numerical computation이 아니라 data rendering에서 발생했고, 네 개의 fault에는 runtime diversity가 필요했다.이 결과는 language-runtime independence가 독립적이고 생산적인 validation axis임을 뒷받침하는 한편, 독립적으로 작성한 version들도 함께 실패할 수 있음을 경고한다.
  • 범위: 이 case study는 두 번째 implementation을 실행하는 비용을 가정하지 않고 측정하기 때문에, stack 간 full clinical adaptation을 재현하는 일이 감당 가능함을 보인다.clinical corpus는 현실적인 workload를 제공하지만, 이 논문은 더 낮은 held-out loss가 clinical answer accuracy를 확립한다고 주장하지 않는다.

2 관련 연구

기존 연구는 구현, 실행 모드, API, 생성 모델 또는 추론을 비교하는 반면, 본 연구는 학습 trajectory를 통해 end-to-end training을 differential validation한다. 또한 수렴하는 loss curve에 가려진 framework failure, design diversity, reproducibility를 runtime semantics와 pipeline behavior를 둘러싼 공백과 연결한다.

  • Deep-learning library의 differential testing: 기존 differential testing은 backend, 생성 또는 변형된 model, distributed 및 non-distributed execution을 비교하는 반면, 본 연구는 두 stack에서 실제 adaptation을 비교한다.D3 가 가장 가까운 선례지만, 그 oracle은 하나의 library에서 실행하는 두 번째 execution mode이고 workload는 실제 adaptation이 아니라 생성된 것이다.
  • 이러한 framework에서 발생하는 문제: Framework 연구는 silent bug가 error나 crash를 일으키지 않을 수 있음을 보여주며, 수렴하는 loss curve에 가려진 failure에 주목하게 한다.이 연구의 fault inventory는 framework-level analysis [1] [15]를 넘어 tokenisation 전 text rendering과 같은 pipeline fault도 다룬다.
  • Design diversity: N-version programming 은 reliability를 위해 독립적으로 구현된 version을 제안했지만, correlated mistake 는 implementation independence가 단일한 property가 아님을 보여준다.따라서 independent implementation을 하나의 미분화된 attribute로 취급하기보다 stack, orchestration, runtime diversity를 분리해야 한다.
  • Reproducibility: 동일한 code를 다시 실행해 얻는 reproducibility만으로는 동일한 specification을 별도로 구현한 것이 같은 learning behavior를 산출한다는 사실을 확립할 수 없다.이 연구는 implementation 간 agreement를 conventional reproducibility의 대체물이 아니라 보완적 증거로 규정한다.
  • 공백: 이 연구는 end-to-end training을 stateful stochastic computation으로 다루고 learning trajectory를 differential signal로 사용함으로써 공백을 메운다.기존 machine-learning differential testing은 하나의 library 내부에서 API, 생성된 network, inference 또는 대체 execution mode를 대상으로 하며, 이 연구는 runtime-semantic diversity가 추가적인 fault class를 드러내는지 묻는다.

3 연구 설계

이 연구는 하나의 공통 training specification을 고정하고, 독립적인 stack, orchestration layer, language runtime 간 일치도를 평가한다. arithmetic와 model loading부터 data rendering과 training trajectory까지 동등성을 점검하되, 일치도는 테스트한 configuration과 관측 가능한 값에 한정된 증거로 다룬다.

  • Configuration: 동일한 configuration과 corpus가 구현 간 adaptation method, optimizer, schedule, batching, sequence length, precision, evaluation protocol을 고정한다.Framework default는 specification에 우선하지 않으며, Table 1에 동일한 adaptation configuration이 기록되어 있다.
  • Independence axes: 세 가지 independence axis가 arithmetic, orchestration, runtime test를 분리한다: PyTorch와 Zig 기반 numbat의 비교, numbat의 C interface 위에서 새로 구현한 trainer, 그리고 여섯 가지 language binding이다.runtime axis는 arithmetic를 바꾸지 않은 채 scheduling, memory, ownership, foreign-function semantics를 변경해 다른 축에서는 드러나지 않는 네 가지 fault를 노출한다.
  • Validation protocol: 일치도는 네 수준에서 점검한다: operator arithmetic와 pre-training loss, checkpoint loading, exact token rendering, 그리고 42개 지점의 held-out-loss 및 gradient-norm trajectory다.이 순서의 수준들은 failure를 국소화하며, trajectory check는 앞선 세 수준에서 보이지 않는 fault를 드러낸다.
  • Interpretation and limits: 다양한 trajectory에서 독립적으로 계산한 observable이 일치하면 실질적으로 동등한 training behavior를 뒷받침하지만, 동일한 held-out loss가 동일한 function을 입증하지는 않는다.이 inference는 테스트한 configuration으로 명시적으로 제한되며, observable의 수와 다양성이 이를 강화한다.
  • Execution environment: Windows WDDM에서는 device-memory pressure가 error를 발생시키는 대신 execution을 저하시킬 수 있어, Fault 17이 loss를 바꾸지 않고도 대략 일곱 배 느려진다.실용성을 위해 trajectory run은 별도의 accelerator를 동시에 사용했으므로, 각 step의 loss 비교는 뒷받침하지만 timing 비교는 뒷받침하지 않는다.

4 작업 부하

이 작업 부하는 현실적인 임상 instruction-tuning 과제를 사용한다. 중복 제거한 시험 corpus를 단일 형식으로 렌더링하고 Qwen3-0.6B에 LoRA를 적용한다. 작은 모델은 폭넓은 구현을 가능하게 하며, 엄격한 template는 렌더링 정확성을 중요하게 만든다.

  • 이 작업 부하는 합성 데이터가 아닌 현실적인 workload다. 긴 sequence, 사소하지 않은 template, 실제 corpus, 최신 adaptation method를 함께 사용한다.Clinical instruction tuning은 이 네 가지 특성을 모두 제공한다. 다만 자료는 임상 진료가 아니라 시험 콘텐츠이며 patient data를 포함하지 않는다.
  • 공개 라이선스가 부여된 세 source의 194,000개 row를 변환하고 중복 제거한 뒤 168,574 training 및 3,440 held-out example이 남는다.모든 input row는 변환, 중복, 또는 거부된 항목으로 빠짐없이 분류된다(100.0%). target에는 answer-choice letter가 아니라 서술형 설명이 들어 있다.
  • Qwen3-0.6B [14]에 low-rank adaptation [4]을 적용한다. 공개된 weight는 고정하고 40 MB file에 trainable matrix를 추가한다.base model은 변경되지 않는다. configuration은 Table 1에 제시한다.
  • 이 model은 consumer card 한 장에서 full epoch를 수행할 만큼 작아 다양한 implementation을 가능하게 한다. 그러나 Qwen3의 비어 있는 최종 assistant reasoning block 때문에 template를 잘못 렌더링하기 쉽다.이 절은 이후 분석에서 이 렌더링 세부 사항이 arithmetic보다 더 중요하다고 지적한다.

5 결과: trajectory 일치

한 epoch 전체에서 독립적으로 구현된 PyTorch와 numbat training stack은 held-out loss에서 긴밀히 일치했으며, 모든 evaluation에서 실제 learning이 나타났다. 추가적인 네 가지 interface-driven implementation도 0.15% 이내로 수렴했지만, kernel을 공유했기 때문에 근거는 더 약하다.

  • Learning trajectory: held-out perplexity가 31% 낮아지고 10,536 updates 동안 cross-entropy가 2.5314에서 2.1635로 감소한 것은 해당 workload가 실제 learning task임을 보여줬다.모든 42 evaluations가 직전 evaluation보다 개선됐지만, 이것이 clinical correctness를 입증하는 것은 아니다.
  • Initialization check: 두 stack에서 학습하지 않은 model의 held-out cross-entropy가 소수점 여섯째 자리까지 일치하는 3.672389를 보여, training 전에 forward path와 data pipeline을 점검했다.이 일치는 어느 implementation도 한 step을 수행하기 전에 확인됐다.
  • Cross-stack agreement: epoch 전체에서 PyTorch와 numbat 사이의 held-out cross-entropy 차이는 평균 0.134%였고, 최대 차이는 0.316%, standard deviation은 0.138%였다.signed residual은 12번 부호가 바뀌어, 체계적인 numerical difference라기보다 unbiased difference와 일치했다.
  • Gradient agreement: gradient-norm의 0.1% median agreement는 독립적인 trajectory check를 제공했으며, 더 큰 maximum 차이는 composition이 다른 개별 batch에 따른 것으로 설명됐다.Gradient norm은 내부 quantity이므로, 이를 맞추는 것은 보고된 loss를 넘어 implementation들이 comparable step을 수행하는지 검증한다.
  • Interface-driven replication: Zig의 0.151%와 Python의 0.060% mean absolute deviation으로 네 implementation이 0.15% 이내에서 epoch를 마쳤고 gradient magnitude에서는 0.11% 이내로 일치했다.Implementation들이 kernel을 공유했기 때문에 이 비교는 더 약한 근거지만, interface와 독립적으로 작성된 세 training loop를 검증했다.

6 결과: 어떤 관찰이 어떤 fault를 드러냈는가

단일 구현으로 개발할 때는 놓쳤던 17개 fault가 구현 간 비교를 통해 식별되었으며, 여기에는 수치, data rendering, evaluation, runtime-specific failure가 포함된다. 관찰은 상호보완적이었다. data rendering은 가장 큰 loss 변화를 드러냈고, runtime diversity는 다른 검사로는 도달할 수 없는 fault를 밝혀냈다.

  • Fault discovery: 단일 구현 개발에서는 17개 fault가 누락되었으며, 여기에는 5개의 hard failure가 포함되었고 모든 fault는 구현 비교를 통해 발견되었다.hard failure에는 out-of-memory, kernel-launch, autograd error가 포함되었다.
  • Fault discovery: model-taught chat rendering이 아닌 generic chat rendering을 수정하자 held-out loss가 0.15 감소했으며, 이는 두 numerical fault로 인한 0.0003 개선보다 대략 500배 컸다.numerical fault는 shared projection의 adapter와 transpose-matmul backward에서의 non-contiguous operand에 관련되었다.
  • Runtime diversity: runtime diversity는 첫 두 구현으로는 도달할 수 없었던 4개의 fault를 드러냈다. 추가된 language가 서로 다른 memory model을 사용했기 때문이다.여기에는 Go scheduling에서 thread-local state가 깨지는 문제, garbage collection이 device-memory pressure를 감지하지 못하는 문제, Rust ownership에 두 번째 owning handle이 필요한 문제가 포함되었다.
  • Evaluation: 평가가 adapter 없이 실행되었기 때문에 held-out-loss curve가 평평해졌으며, training이 실패했기 때문은 아니었다.evaluation fault를 수정하자 §3.4에서 설명한 memory behavior가 드러났다.
  • Cross-check levels: 검사는 상호보완적이었다. unit test는 local operator fault를, forward comparison은 configuration fault를, data check는 rendering fault를, trajectory는 accumulated-state fault를, runtime diversity는 language-specific fault를 찾아냈다.어떤 단일 관찰 수준도 전체 fault 집합을 포괄하지 못했다.

7 실행 가능성

이 연구는 이 workload에서 cross-stack validation이 실행 가능하다는 것을 확인했다. 독립적으로 구현된 numbat은 reference보다 더 빠르게 학습하고 device memory를 적게 사용하며, 두 번째 구현은 실행 비용이 대략 비슷하다. 다만 구현마다 한 번씩만 실행했고 clock 동작이 변동했기 때문에, 저자들은 이 측정치를 performance claim으로 간주하지 않는다.

  • 실행 가능성: 여덟 개 구현이 동일한 accelerator에서 Table 1 configuration으로 500회 update를 수행했으며, 처음 100회는 warmup으로 버리고 400회를 측정했다.각 실행은 다른 작업이 없는 machine에서 한 번에 하나씩 수행했으며, 각 실행 전후에 device가 idle 상태인지 확인했다.
  • 실행 가능성: 측정 결과는 performance claim이 아니라 실행 가능성을 뒷받침한다. 두 번째 독립 구현을 실행하는 비용은 첫 번째 구현을 실행하는 비용과 대략 비슷하다.저자들은 구현마다 한 번씩만 실행했고 session 간 clock 변동이 보고된 차이보다 컸으므로 performance conclusion을 뒷받침할 수 없다고 주의를 준다.

8 논의

논의에서는 독립성을 stack, orchestration, runtime 차원으로 나누며, 각 차원이 서로 다른 fault class를 드러낸다고 본다. 또한 학습 전에 semantic data-rendering 검증과 비용이 낮은 cross-implementation validation을 수행해야 한다고 강조한다.

  • 독립성은 stack, orchestration, runtime 차원에 걸쳐 각각 arithmetic, training-loop interface, scheduling·lifetime·ownership을 다룬다.runtime independence는 비수치적 동작을 다루고, stack independence는 arithmetic을, orchestration independence는 training loop와 kernel interface를 다룬다.
  • data-rendering fault와 arithmetic fault 사이의 500배 효과 격차는 differential framework testing이 다루지 못하는 framework 상위의 semantic boundary를 부각한다.이 대목은 이것이 단일 관찰임을 경고하면서도, project-specific template이 검증되지 않은 testing boundary임을 지적한다.
  • 실무자를 위한 제안: 학습 전에 untrained model의 held-out loss를 비교한 뒤, 여러 record의 rendered token sequence를 비교하면 비용이 큰 fault를 저렴하게 포착할 수 있다.첫 번째 검사는 몇 분이면 되고 두 번째 training run이 필요 없다. 두 번째 검사는 이 연구에서 가장 비용이 큰 fault가 발생한 지점을 겨냥한다.

9 타당성 위협

이 연구의 타당성은 희소한 trajectory evidence, 재구성된 fault-detection 기록, stochastic baseline의 부재로 제한된다. timing, scale, configuration, clinical conclusion 역시 적용 범위가 좁다.

  • Fault detection: Fault matrix는 개발 과정에서 fault가 발견된 순서를 기록할 뿐, 통제된 detection rate를 기록하지 않는다. 따라서 각 fault를 재주입하고 모든 observation을 테스트하는 것이 핵심 확장이다.두 번째로 발생한 signal도 발견 순서가 달랐다면 첫 번째로 발생했을 수 있다.
  • Trajectory evidence: Held-out cross-entropy와 gradient norm은 비교 벡터로는 빈약하며, 하나의 seed만 사용했기 때문에 cross-stack residuals와 비교할 same-stack run-to-run variation을 측정할 수 없다.더 풍부한 observable인 prediction distribution, parameter-update summary, activation statistic을 사용하면 equivalent-training 주장을 강화할 수 있다. Stochastic envelope가 없으면 0.134%를 작다고 해석하는 것은 measurement가 아니라 judgment다.
  • Trajectory continuity: numbat trajectory는 10,536 중 8,912번째 update에서 중단되었고 optimizer moment 없이 재개되었다. 이로 인해 discontinuity가 발생했으며, 중단 없는 rerun이라면 이를 제거할 수 있다.한 noisy batch에서 supervisory rule이 작동했고, run은 마지막 checkpoint에서 재개되었다.
  • Timing: Timing study는 comparative performance가 아니라 feasibility를 입증한다. 각 implementation이 불안정한 clock governor 아래 서로 다른 날에 한 번씩만 실행되었기 때문이다.앞서 수행한 bit-identical 단계는 다섯 배에서 여덟 배 느렸다. 성능을 주장하려면 신뢰구간을 포함한 반복 교차 실행이 필요하지만, 이 연구는 그런 주장을 하지 않는다.
  • Scale and configuration: 이 연구는 596M-parameter model 하나, adaptation method 하나, f32 precision, laptop-class card 하나만 다루므로 더 큰 규모, reduced precision, multi-device, distributed regime은 검증하지 않았다.Absolute memory figure 역시 platform에 따라 달라진다.
  • Clinical validity: Downstream accuracy나 safety evaluation은 수행하지 않았다. Held-out loss가 낮다는 것은 clinical answer-text prediction이 더 우수하다는 뜻이지 correctness나 safety를 의미하지 않으며, 이 artifact는 medical device가 아니다.이 artifact는 research use를 목적으로 한다.

10 결론

독립적으로 구현된 training stack은 learning trajectory를 통해 전체 fine-tuning pipeline을 differential validation할 수 있다. 임상 Qwen3-0.6B 사례에서 cross-stack 일치는 fault를 드러냈고, implementation diversity가 stack, orchestration, runtime에 걸쳐야 함을 보였다.

  • 결론: 독립적으로 구현된 training stack은 learning trajectory를 비용 효율적인 비교 신호로 사용해 전체 fine-tuning pipeline의 differential oracle로 기능했다.이는 training software가 수렴하면서도 잘못된 계산을 수행할 수 있다는 문제를 다룬다.
  • 결론: 전체 epoch에 걸친 42회의 paired evaluation에서 held-out cross-entropy 차이는 0.134%였고, 네 구현은 서로 간 0.15% 이내로 epoch를 마쳤다.두 stack은 training code를 전혀 공유하지 않았으며, 비교를 통해 단일 구현 개발에서는 놓친 17개의 fault가 드러났다.
  • 결론: 가장 큰 피해를 준 fault는 임상 텍스트 rendering이었으며, held-out loss를 인접한 numerical fault보다 대략 500배 더 크게 변화시켰다.이 fault는 arithmetic 바깥에서 발생했으며, model이 임상 텍스트를 보기 전에 일어났다.
  • 결론: 추가로 네 fault는 서로 다른 scheduler, collector 또는 ownership model을 가진 language에서만 도달 가능했으며, implementation diversity가 stack, orchestration, runtime에 걸쳐 있음을 보였다.두 번째 구현은 첫 번째 구현과 다른 차원에서 가장 큰 가치를 지닌다.

데이터 및 코드 이용 가능성

저자들은 측정 데이터와 figure·table 생성 스크립트를 제공하며, adapted model이 의료기기가 아니라 연구 산출물임을 명확히 한다.

  • 데이터 및 코드 이용 가능성: 모든 figure와 table의 측정 데이터 및 이를 생성하는 스크립트는 저자들에게서 제공받을 수 있으며, adapted model은 의료기기가 아니다.이 model은 연구 산출물로 지정된다.
Loading 2608.24267v1…