ggml_test_adamw_steps: Compare the AdamW Optimizer Step Across Backends

View source: R/backend_ops_test.R

ggml_test_adamw_stepsR Documentation

Compare the AdamW Optimizer Step Across Backends

Description

Runs ggml_opt_step_adamw() for several steps on backend and on the CPU from the same starting weights and the same gradients, and reports the weight checksum after each step.

Usage

ggml_test_adamw_steps(backend)

Arguments

backend

Backend pointer to compare against the CPU.

Details

This needs its own function rather than a case in ggml_test_backend_ops: the op updates the weights and both moment buffers in place, so step N depends on every step before it, and the bias-correction terms it receives change every step. Comparing a single execution proves nothing here – the first Adam step agrees bit-for-bit on both backends and the disagreement only starts at the second.

Value

A data frame with step, w_cpu, w_backend and abs_diff, or a one-column data frame with note when the op could not be run.

See Also

ggml_test_backend_ops

Examples


if (ggml_vulkan_available()) {
  be <- ggml_vulkan_init(0)
  print(ggml_test_adamw_steps(be))
  ggml_backend_free(be)
}


ggmlR documentation built on Oct. 23, 2026, 1:07 a.m.