---
title: "ClikaRT::nn::KVLayerSpec::RecurrentState"
sidebar_label: "KVLayerSpec::RecurrentState"
description: "The delta-rule recurrent state geometry (per slot: [heads, k_dim, v_dim])."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--struct">struct</span>

**Header:** `ClikaRT/nn/kv_cache.h`

The delta-rule recurrent state geometry (per slot: `[`[`heads`](./KVLayerSpec.RecurrentState.md#heads)`, `[`k_dim`](./KVLayerSpec.RecurrentState.md#k_dim)`, `[`v_dim`](./KVLayerSpec.RecurrentState.md#v_dim)`]`). [`dtype`](../dtype/index.md) picks the slab's STORAGE dtype: Float32 (the default reference), or BFloat16 / Float16, half the state bandwidth and checkpoint bytes; the recurrence ops still compute fp32 and round only at the slab round-trip (bf16 keeps f32's exponent range, f16 keeps more mantissa).

[`quant`](../quant/index.md) stores the slab QUANTIZED instead: the element-coded per-tensor SYMMETRIC subset of [`KVQuantSpec`](./KVQuantSpec.md) (a symmetric byte code: Int8 / Float8\_E4M3 / Float8\_E5M2 under one static `scale`; `zero_point` / `block` / `per_token` must stay at their defaults, and [`dtype`](../dtype/index.md) above is then ignored). Quarter the state bandwidth; compute stays fp32, the encode/decode round-trip is the only rounding the state sees.

## Data members

### heads {#heads}

<div class="api-signature">

`int64_t` **`heads`** `= 0`

</div>

Recurrent heads (the slab's leading extent).

<div class="api-declared">

Declared in `ClikaRT/nn/kv_cache.h`, line 229

</div>

### k\_dim {#k_dim}

<div class="api-signature">

`int64_t` **`k_dim`** `= 0`

</div>

Per-head key width of the `[`[`heads`](./KVLayerSpec.RecurrentState.md#heads)`, `[`k_dim`](./KVLayerSpec.RecurrentState.md#k_dim)`, `[`v_dim`](./KVLayerSpec.RecurrentState.md#v_dim)`]` slab.

<div class="api-declared">

Declared in `ClikaRT/nn/kv_cache.h`, line 231

</div>

### v\_dim {#v_dim}

<div class="api-signature">

`int64_t` **`v_dim`** `= 0`

</div>

Per-head value width of the slab.

<div class="api-declared">

Declared in `ClikaRT/nn/kv_cache.h`, line 233

</div>

### dtype {#dtype}

<div class="api-signature">

[`DataType`](../../index.md#DataType) **`dtype`** `=` [`DataType::Float32`](../../index.md#DataType)

</div>

The slab's STORAGE dtype (compute stays fp32); Float32 default, BFloat16 / Float16 halve the state bandwidth.

<div class="api-declared">

Declared in `ClikaRT/nn/kv_cache.h`, line 236

</div>

### quant {#quant}

<div class="api-signature">

`std::optional<`[`KVQuantSpec`](./KVQuantSpec.md)`>` **`quant`**

</div>

Optional quantized storage instead of [`dtype`](../dtype/index.md), the symmetric element-coded subset only (see the struct doc).

<div class="api-declared">

Declared in `ClikaRT/nn/kv_cache.h`, line 239

</div>
