cacheunit

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

internal/cacheunit/align.go Package cacheunit computes prefix padding so the Static Prefix ends on a DeepSeek cache-unit boundary. V4 reuses a stored prefix only up to its last COMPLETE compression block; the tail incomplete block is always recomputed (DeepSeek-V4 report §3.5.2). Padding the prefix to a unit multiple maximizes the reusable, fully-persisted portion. unit must be measured empirically with bench/cmd/cacheprobe before enabling padding; unit<=0 means "unknown -> none".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlignPadding

func AlignPadding(prefixTokens, unit int) int

AlignPadding returns the token count to append to a prefix of prefixTokens so its length is a multiple of unit. Returns 0 when unit<=0 or already aligned.

func PadText

func PadText(prefixTokens, unit int, count func(string) int) string

PadText returns deterministic filler to append to a prefix of prefixTokens so the total token count is a multiple of unit, as measured by count. Identical for a given (prefixTokens, unit) -> the frozen prefix stays byte-stable. count MUST be the same tokenizer used to fingerprint the prefix. "" when none.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL