You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

HBF profiling — where KV belongs when HBM holds a few percent of it

Overview

  • What: per-position attention statistics from four sparse-attention models over the same 19 agentic coding traces, each with a full-attention oracle alongside. Not text — every file is a reduction over an attention matrix that was never stored.
  • Why: decide which KV tokens live in HBM when HBM fronts a much larger High Bandwidth Flash tier. A query reads ~2,048 keys, not the whole context, but which 2,048 changes every step, so it is measured rather than derived.
  • Scope: 19 sessions × 4 models = 76 measurements, 608 shards, 53 GB, exactly 154 files per model directory.
directory checkpoint layers heads selector
deepseek-v3.2-exp/ deepseek-ai/DeepSeek-V3.2-Exp 61 128 2,048 tokens
deepseek-v4-flash/ deepseek-ai/DeepSeek-V4-Flash 43 64 512 C4 slots × 4
minimax-m3/ MiniMaxAI/MiniMax-M3 57 of 60 64 16 blocks × 128
glm-5.2-fp8/ zai-org/GLM-5.2-FP8 78, 21 with an indexer 64 2,048 tokens

Constant across the whole repo, so stated once here and in every manifest rather than repeated in paths: 8 × H200 141 GB, TP 8, vendor fp8 checkpoints with no post-hoc quantization, attention=native, DeepGEMM fp8 indexer, hist_row_stride 64.

Two things vary per model. Both are recorded in the manifest, and neither changes what was measured:

  • gpu_fraction is 0.9 for the first three and 0.78 for GLM-5.2, whose 91.9 GiB of weights per GPU leave a two-sided window: at 0.90 the KV pool claims memory the oracle's own buffers need and the run dies in vLLM's MoE reduction; at 0.72 vLLM cannot cover weights plus activation and refuses to allocate a KV cache at all.
  • One session is truncated, alone in the repo. FlashMLA's sparse kernel indexes its top-k buffer with int32 and overflows above a single-prefill width of (2311)/(index_topk18)(2^{31}-1) / (\texttt{index\_topk} \cdot 18) = 58,254 tokens; django-12713 renders to 69,720 under GLM's tokenizer. It is collected at 58,000, truncated from the front, and carries truncated: true. The other 18 are whole. V3.2 sits under the same ceiling and clears it by 1,536 tokens.

The same transcripts tokenise differently per checkpoint: 10,499–56,718 under V3.2, 10,689–71,322 under M3, 10,739–73,507 under V4, and 10,544–58,000 under GLM-5.2 — where the upper end is that truncation, not the session's own length.

Naming syntax

<model>/oracle_<session_id>.rank<r>.npz        r in 0..7, one per tensor-parallel rank
<model>/oracle_manifest.json                   how each session was collected
<model>/oracle_placement.json                  the analysis tables — the results
sessions.json                                  which sessions exist under which model
  • <model> is the checkpoint's HF repo name, lowercased. Nothing else is in the path because nothing else varies.
  • <session_id> is lmcache's own key, verbatim — no prefix stripped, no field reordered. Its structure is swebench__{org}__{repo}-{issue}__{writer}.
    • swebench__django__django-11451__deepseek is not a duplication: the GitHub org and repo share a name, which sphinx-doc__sphinx-9658 shows is not always so.
    • {writer} is who produced the transcript, not the profiled model. Comparing writers compares traces; comparing directories compares models.
  • There is no session index. A position in a sorted selection named two different sessions under two trace sources, so the identifier is the id.
  • Every model directory holds the same 19 filenames, so a cross-model comparison is the same name in two directories.

Connecting to lmcache

Source corpus: sammshen/lmcache-agentic-traces. The join is the filename, both ways, with no lookup table:

sid = os.path.basename(path)[len("oracle_"):].split(".rank")[0]   # file  -> lmcache
row = dataset.filter(lambda r: r["session_id"] == sid)
paths = glob.glob(f"{model}/oracle_{row['session_id']}.rank*.npz")  # lmcache -> files
  • Each manifest records, per session, the trace_source it was drawn from and the trace_model that wrote it — both lmcache columns.
  • Two selections are present: 8 sessions filtered to trace_model="deepseek-v3.1" out of shard 4 of 5, and 11 from an unfiltered read of the first hub shard. The latter carry trace_model: null; that they are all minimax-m2.5 is an observation from their ids, not a filter that was applied.
  • Only the most-accumulated turn of each session is profiled: earlier turns are prefixes of later ones, so one prefill covers every position.
  • Token counts differ per model for the same session — django-11451 is 13,568 tokens under V3.2 and 13,567 under V4. Join on session_id; compare positions only within a directory.

What was profiled

The object of study is the post-softmax attention weight over four axes — layer \ell, head hh, query tt, key jj — causal, so jtj \le t:

Ah,t,j(),jtAh,t,j()  +  σh,t()  =  1A^{(\ell)}_{h,t,j}, \qquad \sum_{j\le t} A^{(\ell)}_{h,t,j} \;+\; \sigma^{(\ell)}_{h,t} \;=\; 1

with σ\sigma a learned sink belonging to no key position (zero except on V4). The joint is never stored — for one 43K-token V3.2 session it is

LHT2  =  61128(43,000)2    1.4×1013 entries    29 TBL\,H\,T^2 \;=\; 61 \cdot 128 \cdot (43{,}000)^2 \;\approx\; 1.4\times 10^{13}\ \text{entries}\;\approx\; 29\ \text{TB}

so every array is a marginal, and which axes collapse is the whole design. Three bucketings do the collapsing: c(t){0..7}c(t)\in\{0..7\} places a query by its context length against edges (2048,,131072)(2048,\dots,131072); d(t,j){0..17}d(t,j)\in\{0..17\} places a key by distance tjt-j; ρ(t)\rho(t) is the message role.

array \ell hh tt jj definition
mass kept kept summed out kept Mh,j()=tjAh,t,j()M^{(\ell)}_{h,j}=\sum_{t\ge j} A^{(\ell)}_{h,t,j}
hist kept kept bucketed cc bucketed dd Hh,c,d()=c(t)=cd(t,j)=dAh,t,j()H^{(\ell)}_{h,c,d}=\sum_{c(t)=c}\sum_{d(t,j)=d} A^{(\ell)}_{h,t,j}
dsa_mass kept kept bucketed cc summed over SS Dh,c()=c(t)=cjS()(t)Ah,t,j()D^{(\ell)}_{h,c}=\sum_{c(t)=c}\sum_{j\in S^{(\ell)}(t)} A^{(\ell)}_{h,t,j}
sel_count kept dropped bucketed cc kept Nc,j()={t:c(t)=c, jS()(t)}N^{(\ell)}_{c,j}=\lvert\{t: c(t)=c,\ j\in S^{(\ell)}(t)\}\rvert
hist_by_qrole kept kept bucketed c,ρc,\rho bucketed dd as hist, split by ρ(t)\rho(t)
sink_mass kept kept summed out sh()=tσh,t()s^{(\ell)}_h=\sum_t \sigma^{(\ell)}_{h,t}
  • S()(t)S^{(\ell)}(t) is the model's own selection, the thing the oracle is measured against: S()(t)=min(t+1,B)\lvert S^{(\ell)}(t)\rvert = \min(t+1,\,B) per independent selection, with B=kSblk=2048B = k\cdot S_{\text{blk}} = 2048 for all four models — reached as 2048×1, 512×4, 16×128 and 2048×1 respectively.
  • mass and sel_count use every query; hist and hist_by_qrole subsample queries at stride 64. dsa_rows Rc()={t:c(t)=c}R^{(\ell)}_c=\lvert\{t:c(t)=c\}\rvert is the denominator that turns dsa_mass into a fraction.
  • sel_count carries no head axis — one score per query-key pair, shared across the heads that consume it.

Why sel_count and not just mass

The simulator bills counts, not mass: 5% of the mass outside HBM could be two tokens or five hundred — indistinguishable in a mass marginal, 250× apart in traffic. For a resident set RR chosen offline, nhbf(t)=S(t)S(t)Rn_{\text{hbf}}(t)=\lvert S(t)\rvert-\lvert S(t)\cap R\rvert, and the bucket total is exact:

t:c(t)=cnhbf(t)  =  jRNc,j()\sum_{t:\,c(t)=c} n_{\text{hbf}}(t) \;=\; \sum_{j\notin R} N^{(\ell)}_{c,j}

placement.hbf_read_counts(sel_count, resident_mask, rows=dsa_rows)

Exact: totals and per-bucket means. Not measurable here: the per-step spread of nhbfn_{\text{hbf}} (\(R\) is chosen after the pass), dynamic placement, migration traffic.

Reading it

from huggingface_hub import snapshot_download
from sparse_attention.placement import load_merged
import glob, json

root = snapshot_download("FuriosaAI/hbf-profile", repo_type="dataset",
                         local_dir="/workspace/hbf-profile")   # real files, not symlinks
d = f"{root}/deepseek-v3.2-exp"
for report in json.load(open(f"{d}/oracle_manifest.json"))["sessions"]:
    layers, meta = load_merged(sorted(f"{d}/{s}" for s in report["shards"]))
    layers[0]["mass"]          # [head, position]
  • Use load_merged. The eight shards combine three different ways and getting it wrong is silent and off by an integer factor: head-indexed arrays concatenate, dsa_rows is replicated, and sel_count needs distinct selections deduplicated then summed — one independent selection for V3.2, V4 and GLM-5.2, four for M3.
  • Exact equality is not how replicas are detected: a tie at the kk-th score breaks differently per rank, so eight copies of one measurement differ in a handful of cells by one.
  • GLM-5.2 repeats sel_count down the layer axis. IndexShare gives 21 of 78 layers an indexer; the other 57 arrays are bit-identical copies of the nearest preceding indexer layer. Summing all 78 gives exactly 78/21=3.714times78/21 = 3.714\\times what the 21 distinct selections give, and both are right for different questions — HBF read traffic wants all 78, since each layer holds and reads its own KV at those positions, while index bytes and "how often the model chooses" want 21. Nothing in the file marks a layer as shared.
  • oracle_placement.json's index column is not V4's or M3's. Their index is a per-block summary — V4 one 128-dim entry per 4 positions, M3 4×128 per 128-token block — so charging it per token would overstate it 4× and 32×; analyze_placement refuses, warns, and falls back to V3.2's shape. The byte model is exact for V3.2 and GLM-5.2 only, so an equal-bytes token-vs-block comparison should be quoted from those two. The block-summary cost itself (Quest-style min/max, 2 vectors × 2 bytes) is a modelling assumption applied identically to all four, not a measurement.
  • Every session here passed analyze_placement --verify: position count against prompt length, head and layer counts against the manifest, jMh,j()+sh()=T\sum_j M^{(\ell)}_{h,j} + s^{(\ell)}_h = T, and c,jNc,j()\sum_{c,j} N^{(\ell)}_{c,j} against gtmin(t+1,B)g \cdot \sum_t \min(t+1,B) for sel_groups gg, on every layer that carries a selection.
  • DATASTRUCTURE.md has the per-array dtypes and shapes, the rank-merge rules, and the five ways to read this wrongly.

What is not here

  • The A100 collectionQuantTrio/DeepSeek-V3.2-Exp-AWQ, forced dense attention, bf16 reference indexer, 14 sessions over 112 shards — was a different machine and a different checkpoint, not comparable to anything above. Its arrays no longer exist: the bucket that held them, mjbooo/ai-research-hbf, was deleted on 2026-08-06 and now returns 404. Reproducing them needs 8 × A100 again.
Downloads last month
6