Research

Technical report · DPO-Mini · 2026

Measuring the cost of a fixed reference

A correctness and performance study of Direct Preference Optimization. Caching reduced complete benchmark time by 11.70% against a shared-base reference, with matching observed training trajectories.

How much does caching save once the full cost is counted?

DPO compares a policy’s preference scores with a fixed reference. Recomputing that reference costs time; keeping a second model resident costs memory. Precomputing scores can reduce repeated work, but the cache itself has a construction cost. The study measures those costs separately and checks that the strategies preserve the tested computation.

An independent implementation of the original sigmoid DPO objective, explicit completion-token masking, validated reference caches, deterministic checkpoint resume, and a controlled comparison of three reference strategies. DPO and caching are established methods; the contribution here is the implementation, audit and measurement.

11.70%Less whole-process timeCold cache construction included
32.43%Less measured training time20 updates after warm-up
3.2 MiBLower training RSSDifference between medians
9 / 9Matching benchmark endpointsCanonical model-state hashes

A stronger baseline separates sharing from caching.

Comparing a cache only with a separately resident reference mixes two changes: reference computation and model residency. Adding the shared-base strategy makes B versus C the relevant comparison for caching. A versus B measures the reference implementation strategy.

Separate reference

Keep a second frozen model in memory and recompute reference scores during training.

Shared frozen base

Use the policy’s frozen base with its LoRA adapter temporarily disabled. Recompute reference scores without retaining a second model.

Cold shared-base cache

Use the shared base to compute training-reference scores once, inside each trial process, then read them from a validated cache.

Model
SmolLM2-135M-Instruct · rank-16 LoRA · 921,600 trainable parameters
Hardware
AMD Ryzen 5 PRO 7540U · 30.67 GiB RAM · Windows 11
Execution
CPU FP32 · four computation threads · seed 42
Data
Filtered UltraFeedback Binarized · 256 / 64 / 64 train / validation / test pairs
Timing workload
5 warm-up + 20 measured updates · 16 pairs per update · 3 trials per strategy
Matched conditions
Initial state, data order, optimiser, schedule and backend · balanced orders ABC / BCA / CAB

The training gain remains useful after paying for the cache.

The cache took a median 228.976 seconds to construct. Including that cost, the process took 1,013.617 seconds versus 1,147.964 seconds for the shared-base reference. The larger training-only reduction describes the part of execution where reference scores are already available.

Median whole benchmark process Seconds · lower is faster
Separate reference1,151.5 s
Shared frozen base1,148.0 s
Cold shared-base cache1,013.6 s

Zero-based scale. Each cold-cache process includes its own reference precomputation.

Median (minimum–maximum) across three fresh-process trials per strategy
Reference strategyTraining block, sWhole process, sTraining RSS, MiB
A: Separate reference901.831897.240–902.1951,151.4781,145.515–1,159.7112,632.42,623.5–2,637.2
B: Shared frozen base902.774896.044–907.7901,147.9641,142.434–1,159.7112,098.92,098.3–2,102.8
C: Cold shared-base cache609.977609.702–611.6671,013.6171,013.588–1,014.8312,095.72,095.6–2,101.3

The training block covers 320 processed pairs after 80 warm-up pairs. Whole-process time includes loading, warm-up, cache construction and adapter endpoint output. Held-out evaluation, generation and full learning checkpoints are outside this benchmark. RSS is sampled during training; it is not whole-process peak memory. Percentage reductions use the ratio of medians.

Most of the memory saving came from sharing the base.

Replacing the separate reference with a shared base lowered median training RSS by 533.5 MiB. Caching then changed it by only 3.2 MiB, with overlapping trial ranges. The large A-to-C memory difference cannot be attributed to caching alone.

Numerical checks exposed a real qualification.

Both the working and fresh-environment core suites passed all 19 tests. Shared-base reference invariants and matched short trajectories also passed. However, the actual pretrained comparison with TRL 0.24.0 exceeded the original FP32 tolerances. That failure remains part of the result.

What matched

  • Reference scores before and after policy-adapter updates.
  • Frozen base parameters and buffers, optimiser membership, and state restoration after exceptions.
  • Short three-strategy loss traces and adapter tensors, with zero reference forwards in cached training.
  • Complete update traces and canonical model-state hashes across all nine timing runs.

Where FP32 diverged

  • Pretrained score differences reached 6.4087e−4 and loss differences reached 1.6809e−5.
  • The trained-adapter gradient difference was 2.0103e−6, narrowly above the original 2e−6 bound.
  • Input IDs, masks and logits matched; different score-reduction arithmetic caused the discrepancy.
  • Separate FP64-reduction diagnostics recovered identical adapter gradients. This does not establish full TRL Trainer equivalence.

Timing boundaries change the conclusion.

The earlier sixteen-update learning workflow included evaluation, generation and a checkpoint. It took 1,518.458 seconds without caching and 1,409.365 seconds with caching: a 7.18% reduction. Its recorded aggregate stages reconcile that saving, while finer historical phase attribution remains unresolved. A new instrumented replay measures its own detailed costs; those measurements are not retroactively assigned to the earlier run.

The single paired learning seed ended at test DPO loss 0.690726, with 39 of 64 strict-positive preference margins and no ties. This small objective-level change does not establish better human preference, helpfulness or truthfulness. The timing trials describe one nonexclusive CPU host, and the short exploratory generations have no completed human ratings.

Inspect the implementation and recalculate the results.

The repository includes source, tests, a dependency lockfile, configurations, per-trial numeric evidence and the report’s tables. Its offline verification and report-only commands run without retraining. The clean-environment check covered the core suite, pinned upstream comparisons, short pretrained trajectories and report regeneration; it did not repeat the complete timing campaign. Weights, full datasets and large checkpoints must be obtained separately for pretrained reruns.

Technical report released 16 October 2026. Primary references, licenses and numerical qualifications are documented in the report and repository.

All research