---
title: "ClikaRT::graph::KVCacheLayerInfo"
sidebar_label: "KVCacheLayerInfo"
description: "Per-attention-layer KV-cache descriptor: which graph inputs carry the layer's past keys/values in, which graph outputs carry the present keys/values out (any may be empty, a layer with no cache IO), p…"
---

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

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

**Header:** `ClikaRT/graph/model_graph.h`

Per-attention-layer KV-cache descriptor: which graph inputs carry the layer's past keys/values in, which graph outputs carry the present keys/values out (any may be empty, a layer with no cache IO), plus the layer's attention properties. A serving loop drives its cache handling off these; [`generate_kv_input_specs`](./index.md#generate_kv_input_specs) derives compile-time shape specs from them.

## Data members

### op\_name {#op_name}

<div class="api-signature">

`std::string` **`op_name`**

</div>

graph node name of the attention op

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 66

</div>

### past\_key\_input {#past_key_input}

<div class="api-signature">

`std::string` **`past_key_input`**

</div>

graph input name (empty if none)

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 67

</div>

### past\_value\_input {#past_value_input}

<div class="api-signature">

`std::string` **`past_value_input`**

</div>

graph input name (empty if none)

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 68

</div>

### present\_key\_output {#present_key_output}

<div class="api-signature">

`std::string` **`present_key_output`**

</div>

graph output name (empty if none)

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 69

</div>

### present\_value\_output {#present_value_output}

<div class="api-signature">

`std::string` **`present_value_output`**

</div>

graph output name (empty if none)

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 70

</div>

### layer\_idx {#layer_idx}

<div class="api-signature">

`std::int64_t` **`layer_idx`** `= -1`

</div>

sequential layer index

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 71

</div>

### is\_self\_attention {#is_self_attention}

<div class="api-signature">

`bool` **`is_self_attention`** `= true`

</div>

attends its own sequence

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 72

</div>

### is\_cross\_attention {#is_cross_attention}

<div class="api-signature">

`bool` **`is_cross_attention`** `= false`

</div>

attends the encoder stream

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 73

</div>

### sliding\_window\_size {#sliding_window_size}

<div class="api-signature">

`std::int64_t` **`sliding_window_size`** `= 0`

</div>

0 = no sliding window

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 74

</div>

### num\_heads {#num_heads}

<div class="api-signature">

`std::int64_t` **`num_heads`** `= 0`

</div>

query heads

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 75

</div>

### num\_kv\_heads {#num_kv_heads}

<div class="api-signature">

`std::int64_t` **`num_kv_heads`** `= 0`

</div>

K/V heads (grouped-query when fewer than num\_heads).

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 76

</div>

### mask\_kind {#mask_kind}

<div class="api-signature">

[`AttentionMaskKind`](./index.md#AttentionMaskKind) **`mask_kind`** `=` [`AttentionMaskKind::Causal`](./index.md#AttentionMaskKind)

</div>

mask family

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 77

</div>

### bound\_to\_cache {#bound_to_cache}

<div class="api-signature">

`bool` **`bound_to_cache`** `= false`

</div>

True once [`ModelGraph::attach_kv_cache`](./ModelGraph.md#attach_kv_cache) bound this layer's past/present slots to the attached [`nn::KVCache`](../nn/KVCache.md): the layer's K/V live in the cache, the past inputs named above have left the graph's input list (those two fields then read empty), and the present outputs stay, each returned by `run(inputs, step)` as the layer's cache plane at its present position.

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 83

</div>
