ggml_flash_attn_back: Flash Attention Backward (Graph)

View source: R/operations.R

ggml_flash_attn_backR Documentation

Flash Attention Backward (Graph)

Description

Backward pass for Flash Attention. Used during training to compute gradients through attention.

Usage

ggml_flash_attn_back(ctx, q, k, v, d, masked = TRUE)

Arguments

ctx

GGML context

q

Query tensor (same as forward pass)

k

Key tensor (same as forward pass)

v

Value tensor (same as forward pass)

d

Gradient tensor from upstream (same shape as forward output)

masked

Logical: whether causal masking was used in forward pass

Value

Gradient tensor


ggmlR documentation built on July 14, 2026, 1:08 a.m.