Learn R Programming

ggmlR (version 0.6.1)

ggml_flash_attn_back: 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)

Value

Gradient tensor

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