Skip to content

Eval bug: lllama-spec failure at 16k boundary due to non-consecutive KV cache position tracking (Y != X + 1) #26478

Description

@Enlightnd

Name and Version

Latest llamacpp Master pull as of Second of August 2026.

Operating systems

Linux

GGML backends

Vulkan

Hardware

Ryzen 5950x, Ryzen 5600x
Tested with A770, RX6650XT and 9070XT.

Models

gpt-oss-20b

Problem description & steps to reproduce

Issue: llama-spec failure at 16k boundary due to non-consecutive KV cache position tracking (Y != X + 1)

Behavior: During speculative decoding, llama_decode fails validation in init when sequence positions jump across boundaries (e.g., KV cache holds up to index $X = 16382$, but the incoming batch requests start position $Y = 16384$ or $Y = 32766$).

This worked without issue yesterday.

E init: the tokens of sequence 0 in the input batch have inconsistent sequence positions:
 - the last position stored in the memory module of the context (i.e. the KV cache) for sequence 0 is X = 16382
 - the tokens for sequence 0 in the input batch have a starting position of Y = 16384
 it is required that the sequence positions remain consecutive: Y = X + 1
E decode: failed to initialize batch
E llama_decode: failed to decode, ret = -1
E spec         draft: llama_decode returned -1

First Bad Commit

All I can give you is the time I git pulled last before it happened.

But the likely cullprit is the dspark merges that happened last night, since that seems to be the only thing touching speculative decode features.

Relevant log output

Logs

E init: the tokens of sequence 0 in the input batch have inconsistent sequence positions:

  • the last position stored in the memory module of the context (i.e. the KV cache) for sequence 0 is X = 16382
  • the tokens for sequence 0 in the input batch have a starting position of Y = 16384
    it is required that the sequence positions remain consecutive: Y = X + 1
    E decode: failed to initialize batch
    E llama_decode: failed to decode, ret = -1
    E spec draft: llama_decode returned -1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions