Learn R Programming

ggmlR (version 0.6.1)

ggml_rope_ext_back: RoPE Extended Backward (Graph)

Description

Backward pass for extended RoPE (Rotary Position Embedding). Used during training to compute gradients through RoPE.

Usage

ggml_rope_ext_back(
  ctx,
  a,
  b,
  c = NULL,
  n_dims,
  mode = 0L,
  n_ctx_orig = 0L,
  freq_base = 10000,
  freq_scale = 1,
  ext_factor = 0,
  attn_factor = 1,
  beta_fast = 32,
  beta_slow = 1
)

Value

Gradient tensor for the input

Arguments

ctx

GGML context

a

Gradient tensor from upstream (gradients of ggml_rope_ext result)

b

Position tensor (same as forward pass)

c

Optional frequency factors tensor (NULL for default)

n_dims

Number of dimensions for rotation

mode

RoPE mode

n_ctx_orig

Original context length

freq_base

Base frequency

freq_scale

Frequency scale factor

ext_factor

Extension factor (YaRN)

attn_factor

Attention factor

beta_fast

YaRN fast beta

beta_slow

YaRN slow beta