aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
GitHub aien-dev/aien-sovereign-core-mv#160 (code only)
Apply it
git checkout -b patch-24d46cf4fbab3948 dd1fe323d5fc774ff0fe6faaadebfea6450563c0 curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/24d46cf4fbab3948.patch | git am
Provenance
github-import 1
aien-dev/aien-sovereign-core-mv
160
1500f4dd11090837c526d88e1b89de0550dcc168
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":160,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/160","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:09Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/crates/aien-runtime/Cargo.toml b/crates/aien-runtime/Cargo.toml index 2a8c4687..fda89ac1 100644 --- a/crates/aien-runtime/Cargo.toml +++ b/crates/aien-runtime/Cargo.toml @@ -28,3 +28,7 @@ thiserror = "1.0" [dev-dependencies] tempfile = "3.10" + +[[example]] +name = "prefill_bench" +path = "examples/prefill_bench/main.rs" diff --git a/crates/aien-runtime/examples/prefill_bench/main.rs b/crates/aien-runtime/examples/prefill_bench/main.rs new file mode 100644 index 00000000..9521a784 --- /dev/null +++ b/crates/aien-runtime/examples/prefill_bench/main.rs @@ -0,0 +1,701 @@ +//! PREFILL-BENCH (convergence item 6): AIEN shared prefill / N-branch fork +//! versus a MODELED vLLM-style automatic-prefix-cache baseline, same model, +//! same prompts, same CPU, same tensor backend. +//! +//! One command (release build; real checkpoint; takes tens of minutes): +//! +//! AIEN_BENCH_CHECKPOINT=$HOME/models/TinyLlama-1.1B-Chat-v1.0 \ +//! AIEN_BENCH_OUT=/tmp/prefill_bench.json \ +//! cargo run --release -p aien-runtime --example prefill_bench +//! +//! Knobs (all optional): AIEN_BENCH_N="1,2,4,8,16", AIEN_BENCH_LENS="40,200,700" +//! (prefix length in tokens: short, medium, long), AIEN_BENCH_STEPS=8, +//! AIEN_BENCH_REPS=1, AIEN_BENCH_PARITY_BRANCHES=2. +//! Unit tests of the baseline model: `cargo test -p aien-runtime --example prefill_bench`. +//! +//! Arms, per (N, prefix length) cell: +//! - AIEN: the real spine path (launch_swarm, scheduler, one pooled paged KV, +//! root prefill once, fence, N forks with copy-on-write). Branch tokens come +//! from AIEN's own per-branch seeded sampling. +//! - BASELINE (modeled vLLM APC): N independent requests with the same prompt. +//! Request 1 prefills everything. Requests 2..N get a cache hit on the full +//! blocks (<= len-1 tokens, see vllm_model.rs), by copying the donor's +//! first-F-token K/V (copy time is NOT charged, which favors the baseline) +//! and really prefilling only the remaining tokens with the same backend. +//! Decode is the same batched decode kernel. Decode inputs are teacher +//! forced with AIEN's sampled tokens so both arms do identical work. +//! Physical KV bytes of the baseline come from the bookkeeping model, not a +//! measurement of a real vLLM. +//! - CONTROL: fresh unpaged backend, one-shot prefill, teacher forced. Used for +//! correctness parity on the first AIEN_BENCH_PARITY_BRANCHES branches. Its +//! one-shot prefill time is also the per-copy cost of a NO-sharing engine, +//! used to model "naive" time and bytes (N x). + +mod vllm_model; + +use std::collections::HashMap; +use std::path::PathBuf; +use std::sync::Arc; +use std::time::{Duration, Instant}; + +use aien_inference_abi::{ + AienInferenceBackend, DecodeOutput, FinishReason, ModelConfig, NativeTransformerBackend, + ReferenceCpuBackend, SamplingParams, ScheduledBatch, SequenceState, StepMetrics, + TinyLlamaTokenizer, TransformerWeights, +}; +use aien_runtime::shared_kv::{build_shared_kv_runtime, SharedKvSizing}; +use aien_runtime::swarm::SwarmConfig; +use aien_scheduler::SchedulerConfig; +use async_trait::async_trait; +use serde_json::json; +use vllm_model::PrefixCacheModel; + +const PREFILL_CHUNK: usize = 128; +const SYSTEM_PROMPT: &str = "You are a careful engineering assistant. You answer in plain \ +English, you show the steps of your reasoning, and you never invent numbers you were not given."; +const USER_PROMPT: &str = "A small workshop builds wooden chairs. Each chair needs four legs, \ +one seat, two side rails, one back rest and twelve screws. The workshop has ninety legs, \ +twenty seats, forty side rails, eighteen back rests and two hundred screws in stock. Two of \ +the seats are cracked and cannot be used, and one box of twenty screws turned out to be the \ +wrong size. The carpenter wants to know how many complete chairs can be built today, which \ +part runs out first, and how many of every other part will be left over afterwards. After \ +that, suggest the smallest order of extra parts that would let the workshop build exactly \ +twenty five chairs tomorrow, and explain briefly why that order is the smallest one. "; + +fn env_list(name: &str, default: &str) -> Vec<usize> { + std::env::var(name) + .unwrap_or_else(|_| default.to_string()) + .split(',') + .map(|s| { + s.trim() + .parse() + .unwrap_or_else(|_| panic!("{name}: bad number {s:?}")) + }) + .collect() +} + +fn env_usize(name: &str, default: usize) -> usize { + std::env::var(name) + .ok() + .map(|v| v.parse().unwrap_or_else(|_| panic!("{name}: bad number"))) + .unwrap_or(default) +} + +// --------------------------------------------------------------------------- +// AIEN arm: recording backend around the real NativeTransformerBackend +// --------------------------------------------------------------------------- + +struct Tap { + inner: NativeTransformerBackend, + branches: Vec<u64>, + prompt_len: usize, + launch_at: Instant, + prefill_wall: Duration, + prefill_tokens: usize, + decode_wall: Duration, + decode_steps: usize, + decode_logits: HashMap<u64, Vec<Vec<f32>>>, + decode_tokens: HashMap<u64, Vec<u32>>, + first_token_at: HashMap<u64, Duration>, + root_token: Option<u32>, + first_decode_snapshot: Option<(usize, usize, usize)>, // physical, logical, shared pages + peak_physical_pages: usize, + block_bytes: usize, +} + +#[async_trait] +impl AienInferenceBackend for Tap { + async fn load_model(&mut self, _c: &ModelConfig) -> Result<(), String> { + Ok(()) + } + + async fn execute_step( + &mut self, + batch: &ScheduledBatch, + ) -> Result<(Vec<DecodeOutput>, StepMetrics), String> { + let mut outputs = Vec::new(); + let mut metrics = StepMetrics::default(); + if !batch.prefill_requests.is_empty() { + self.prefill_tokens += batch + .prefill_requests + .iter() + .map(|r| r.prompt_tokens.len()) + .sum::<usize>(); + let prefill_only = ScheduledBatch { + decode_requests: Vec::new(), + ..batch.clone() + }; + let t0 = Instant::now(); + let (o, m) = self.inner.execute_step(&prefill_only).await?; + self.prefill_wall += t0.elapsed(); + outputs.extend(o); + metrics = m; + } + if !batch.decode_requests.is_empty() { + if self.first_decode_snapshot.is_none() { + if let Some(kv) = self.inner.kv_manager.as_ref() { + let m = kv.read().metrics(); + self.first_decode_snapshot = + Some((m.physical_pages, m.logical_pages, m.shared_pages)); + } + self.root_token = batch.decode_requests.first().and_then(|id| { + self.inner + .pending_prefill_token + .get(id) + .copied() + .or_else(|| { + self.inner + .sequences + .get(id) + .and_then(|s| s.tokens.get(self.prompt_len).copied()) + }) + }); + } + let t0 = Instant::now(); + let (o, logits) = self + .inner + .forward_decode_batch_with_logits(&batch.decode_requests)?; + self.decode_wall += t0.elapsed(); + self.decode_steps += 1; + let preempted: Vec<u64> = o + .iter() + .filter_map(|out| match out { + DecodeOutput::Finished { + request_id, + reason: FinishReason::Preempted, + .. + } => Some(*request_id), + _ => None, + }) + .collect(); + let computed = batch + .decode_requests + .iter() + .filter(|id| !preempted.contains(*id)); + for (id, row) in computed.zip(logits) { + self.decode_logits.entry(*id).or_default().push(row); + if let Some(tok) = self.inner.sequences.get(id).and_then(|s| s.tokens.last()) { + self.decode_tokens.entry(*id).or_default().push(*tok); + } + self.first_token_at + .entry(*id) + .or_insert_with(|| self.launch_at.elapsed()); + } + if let Some(kv) = self.inner.kv_manager.as_ref() { + let pages = kv.read().metrics().physical_pages; + self.peak_physical_pages = self.peak_physical_pages.max(pages); + } + outputs.extend(o); + metrics.decode_tokens_emitted += batch.decode_requests.len(); + } + Ok((outputs, metrics)) + } + + fn manages_kv_cache(&self) -> bool { + self.inner.manages_kv_cache() + } + + fn fork_sequence(&mut self, parent: u64, child: u64) -> Result<(), String> { + self.inner.fork_sequence(parent, child) + } + + fn fork_sequence_with_sampling( + &mut self, + parent: u64, + child: u64, + sampling: &SamplingParams, + ) -> Result<(), String> { + self.inner + .fork_sequence_with_sampling(parent, child, sampling) + } + + fn release_sequence(&mut self, seq_id: u64) -> Result<(), String> { + AienInferenceBackend::release_sequence(&mut self.inner, seq_id) + } +} + +struct AienRun { + prefill_s: f64, + prefill_tokens: usize, + decode_s: f64, + total_s: f64, + ttft_ms: Vec<f64>, + physical_first_decode: usize, + logical_first_decode: usize, + peak_pages: usize, + block_bytes: usize, + allocated_after: usize, + root_token: u32, + tokens: Vec<Vec<u32>>, + logits: Vec<Vec<Vec<f32>>>, + error: Option<String>, + diag: String, +} + +async fn run_aien(weights: &TransformerWeights, prompt: &[u32], n: usize, steps: usize) -> AienRun { + let block_size = weights.config.block_size; + let total_blocks = prompt.len().div_ceil(block_size) + n * 4 + 32; + let scheduler = SchedulerConfig { + max_batch_size: 64, + max_batch_tokens: 4096, + max_prefill_tokens: 8192, + prefill_chunk_size: PREFILL_CHUNK, + chunk_prefill: true, + watermark_blocks: 2, + }; + let (mut spine, backend) = build_shared_kv_runtime( + weights.clone(), + Arc::new(ReferenceCpuBackend::new()), + scheduler, + SharedKvSizing { + arena_capacity: 128, + total_blocks, + }, + ) + .expect("build shared KV runtime"); + let kv = spine.kv_manager.clone(); + let block_bytes = kv.read().tensor_pool().map_or(0, |p| p.block_bytes()); + let launch_at = Instant::now(); + let swarm_id = spine + .launch_swarm( + SwarmConfig { + model_handle: 1, + branch_count: n, + max_active_sequences: n, + max_tokens_per_branch: steps, + root_world_id: 0, + priority: 1, + }, + prompt, + ) + .expect("launch swarm"); + let swarm = spine + .swarm_manager + .get_swarm(swarm_id) + .expect("swarm") + .clone(); + let branches: Vec<u64> = swarm.branch_sequences.iter().map(|s| s.as_u64()).collect(); + let mut tap = Tap { + inner: backend, + branches: branches.clone(), + prompt_len: prompt.len(), + launch_at, + prefill_wall: Duration::ZERO, + prefill_tokens: 0, + decode_wall: Duration::ZERO, + decode_steps: 0, + decode_logits: HashMap::new(), + decode_tokens: HashMap::new(), + first_token_at: HashMap::new(), + root_token: None, + first_decode_snapshot: None, + peak_physical_pages: 0, + block_bytes, + }; + let mut error = None; + let mut guard = 0usize; + while (spine.scheduler.running_count() > 0 + || spine.scheduler.waiting_count() > 0 + || spine.swarm_manager.is_root_prefill_pending(swarm_id)) + && guard < 1000 + { + guard += 1; + if let Err(e) = spine.step(&mut tap).await { + error = Some(e); + break; + } + } + let total_s = launch_at.elapsed().as_secs_f64(); + let diag = format!( + "spine_steps={guard} running={} waiting={} root_prefill_pending={} prefill_tokens={} decode_steps={}", + spine.scheduler.running_count(), + spine.scheduler.waiting_count(), + spine.swarm_manager.is_root_prefill_pending(swarm_id), + tap.prefill_tokens, + tap.decode_steps + ); + let (phys, logical, _shared) = tap.first_decode_snapshot.unwrap_or((0, 0, 0)); + let allocated_after = kv.read().allocated_block_count(); + AienRun { + prefill_s: tap.prefill_wall.as_secs_f64(), + prefill_tokens: tap.prefill_tokens, + decode_s: tap.decode_wall.as_secs_f64(), + total_s, + ttft_ms: tap + .branches + .iter() + .filter_map(|b| tap.first_token_at.get(b).map(|d| d.as_secs_f64() * 1e3)) + .collect(), + physical_first_decode: phys, + logical_first_decode: logical, + peak_pages: tap.peak_physical_pages, + block_bytes: tap.block_bytes, + allocated_after, + root_token: tap.root_token.unwrap_or(u32::MAX), + tokens: branches + .iter() + .map(|b| tap.decode_tokens.get(b).cloned().unwrap_or_default()) + .collect(), + logits: branches + .iter() + .map(|b| tap.decode_logits.get(b).cloned().unwrap_or_default()) + .collect(), + error, + diag, + } +} + +// --------------------------------------------------------------------------- +// Baseline arm: modeled vLLM APC policy on the same backend +// --------------------------------------------------------------------------- + +struct BaseRun { + prefill_s: f64, + prefill_tokens: usize, + decode_s: f64, + total_s: f64, + ttft_ms: f64, + model_physical_after_prefill: usize, + model_logical_after_prefill: usize, + model_physical_end: usize, + logits: Vec<Vec<Vec<f32>>>, +} + +fn truncated_donor(donor: &SequenceState, keep: usize, kv_dim: usize) -> SequenceState { + let mut s = donor.clone(); + s.tokens.truncate(keep); + for l in s.layers.iter_mut() { + l.cached_k.truncate(keep); + l.cached_v.truncate(keep); + l.flat_k.truncate(keep * kv_dim); + l.flat_v.truncate(keep * kv_dim); + } + s +} + +fn run_baseline( + weights: &TransformerWeights, + prompt: &[u32], + n: usize, + root_token: u32, + forced: &[Vec<u32>], + steps: usize, +) -> BaseRun { + let bs = weights.config.block_size; + let kv_dim = weights.config.num_kv_heads * weights.config.head_dim; + let mut backend = NativeTransformerBackend::new(weights.clone()); + let mut model = PrefixCacheModel::new(bs); + let mut reqs = Vec::new(); + let t_start = Instant::now(); + let mut prefill = Duration::ZERO; + let mut prefill_tokens = 0usize; + let ids: Vec<u64> = (0..n as u64).map(|i| 1000 + i).collect(); + for (i, id) in ids.iter().enumerate() { + let req = model.admit(prompt); + let hit = req.cached_tokens; + reqs.push(req); + if i > 0 && hit > 0 { + let donor = backend.sequences.get(&ids[0]).expect("donor"); + let st = truncated_donor(donor, hit, kv_dim); + backend.sequences.insert(*id, st); + } + let t0 = Instant::now(); + backend + .prefill_sequence(*id, &prompt[hit..]) + .expect("baseline prefill"); + prefill += t0.elapsed(); + prefill_tokens += prompt.len() - hit; + } + // vLLM samples the first token in the prefill step: push the root token. + for id in &ids { + backend + .sequences + .get_mut(id) + .unwrap() + .tokens + .push(root_token); + } + // Model bookkeeping: the generated token also lives in the request. + for r in reqs.iter_mut() { + model.append(r, root_token); + } + let after_prefill_phys = model.physical_blocks(); + let after_prefill_logical = model.logical_blocks(&reqs); + let mut decode = Duration::ZERO; + let mut ttft = 0.0; + let mut logits: Vec<Vec<Vec<f32>>> = vec![Vec::new(); n]; + for s in 0..steps.min(forced.iter().map(Vec::len).min().unwrap_or(0)) { + let t0 = Instant::now(); + let (_o, rows) = backend + .forward_decode_batch_with_logits(&ids) + .expect("baseline decode"); + decode += t0.elapsed(); + if s == 0 { + ttft = t_start.elapsed().as_secs_f64() * 1e3; + } + for (i, row) in rows.into_iter().enumerate() { + logits[i].push(row); + let tok = forced[i][s]; + let seq = backend.sequences.get_mut(&ids[i]).unwrap(); + seq.tokens.pop(); + seq.tokens.push(tok); + model.append(&mut reqs[i], tok); + } + } + BaseRun { + prefill_s: prefill.as_secs_f64(), + prefill_tokens, + decode_s: decode.as_secs_f64(), + total_s: t_start.elapsed().as_secs_f64(), + ttft_ms: ttft, + model_physical_after_prefill: after_prefill_phys, + model_logical_after_prefill: after_prefill_logical, + model_physical_end: model.physical_blocks(), + logits, + } +} + +// --------------------------------------------------------------------------- +// Control arm and parity +// --------------------------------------------------------------------------- + +struct Control { + prefill_s: f64, + logits: Vec<Vec<Vec<f32>>>, +} + +fn run_control( + weights: &TransformerWeights, + prompt: &[u32], + root_token: u32, + forced: &[Vec<u32>], + branches: usize, +) -> Control { + let mut b = NativeTransformerBackend::new(weights.clone()); + let t0 = Instant::now(); + b.prefill_sequence(1, prompt).expect("control prefill"); + let prefill_s = t0.elapsed().as_secs_f64(); + b.sequences.get_mut(&1).unwrap().tokens.push(root_token); + let proto = b.sequences.get(&1).unwrap().clone(); + let mut out = Vec::new(); + for br in 0..branches.min(forced.len()) { + let id = 10 + br as u64; + b.sequences.insert(id, proto.clone()); + let mut rows = Vec::new(); + for tok in &forced[br] { + let (_o, l) = b + .forward_decode_batch_with_logits(&[id]) + .expect("control decode"); + rows.push(l.into_iter().next().unwrap()); + let seq = b.sequences.get_mut(&id).unwrap(); + seq.tokens.pop(); + seq.tokens.push(*tok); + } + out.push(rows); + } + Control { + prefill_s, + logits: out, + } +} + +/// (max abs difference, number of compared values, number of bitwise-differing values) +fn compare(a: &[Vec<Vec<f32>>], b: &[Vec<Vec<f32>>]) -> (f64, usize, usize) { + let mut max_abs = 0f64; + let mut count = 0usize; + let mut diff = 0usize; + for (ba, bb) in a.iter().zip(b) { + for (ra, rb) in ba.iter().zip(bb) { + if ra.len() != rb.len() { + return (f64::INFINITY, count, usize::MAX); + } + for (x, y) in ra.iter().zip(rb) { + count += 1; + if x.to_bits() != y.to_bits() { + diff += 1; + } + let d = (f64::from(*x) - f64::from(*y)).abs(); + if d.is_nan() || d > max_abs { + max_abs = if d.is_nan() { f64::INFINITY } else { d }; + } + } + } + } + (max_abs, count, diff) +} + +fn mean(v: &[f64]) -> f64 { + if v.is_empty() { + f64::NAN + } else { + v.iter().sum::<f64>() / v.len() as f64 + } +} + +fn hardware() -> serde_json::Value { + let cpuinfo = std::fs::read_to_string("/proc/cpuinfo").unwrap_or_default(); + let processors = cpuinfo + .lines() + .filter(|l| l.starts_with("processor")) + .count(); + let mut parts: Vec<String> = Vec::new(); + for l in cpuinfo.lines() { + if let Some((k, v)) = l.split_once(':') { + if k.trim() == "CPU part" && !parts.contains(&v.trim().to_string()) { + parts.push(v.trim().to_string()); + } + } + } + let run = |cmd: &str, args: &[&str]| { + std::process::Command::new(cmd) + .args(args) + .output() + .ok() + .filter(|o| o.status.success()) + .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()) + }; + json!({ + "processors": processors, + "cpu_parts": parts, + "uname": run("uname", &["-a"]), + "lscpu_model": run("sh", &["-c", "lscpu | grep 'Model name' | sort -u"]), + "loadavg_at_start": std::fs::read_to_string("/proc/loadavg").ok(), + }) +} + +#[tokio::main] +async fn main() { + let ckpt = PathBuf::from( + std::env::var("AIEN_BENCH_CHECKPOINT") + .expect("AIEN_BENCH_CHECKPOINT (TinyLlama dir) is required; this bench never skips"), + ); + let out_path = PathBuf::from( + std::env::var("AIEN_BENCH_OUT").expect("AIEN_BENCH_OUT (JSON result path) is required"), + ); + let ns = env_list("AIEN_BENCH_N", "1,2,4,8,16"); + let lens = env_list("AIEN_BENCH_LENS", "40,200,700"); + let steps = env_usize("AIEN_BENCH_STEPS", 8); + let reps = env_usize("AIEN_BENCH_REPS", 1); + let parity_branches = env_usize("AIEN_BENCH_PARITY_BRANCHES", 2); + + let state_dir = tempfile::tempdir().expect("state dir"); + std::env::set_var("AIEN_RUNTIME_STATE_DIR", state_dir.path()); + + let (model_path, dir) = if ckpt.is_dir() { + (ckpt.join("model.safetensors"), ckpt.clone()) + } else { + (ckpt.clone(), ckpt.parent().unwrap().to_path_buf()) + }; + let config = ModelConfig::tinyllama_1_1b(); + let weights = TransformerWeights::load_from_safetensors(&model_path, &config) + .unwrap_or_else(|e| panic!("checkpoint load failed (no fallback): {e:?}")); + let tok = TinyLlamaTokenizer::from_file(&dir.join("tokenizer.json")).expect("tokenizer"); + let long_text = USER_PROMPT.repeat(8); + let all_ids = tok + .encode(&TinyLlamaTokenizer::format_prompt( + Some(SYSTEM_PROMPT), + &long_text, + )) + .expect("encode"); + let max_len = *lens.iter().max().unwrap(); + assert!( + all_ids.len() >= max_len, + "prompt source has only {} tokens", + all_ids.len() + ); + + let git = |args: &[&str]| { + std::process::Command::new("git") + .args(["-C", env!("CARGO_MANIFEST_DIR")]) + .args(args) + .output() + .ok() + .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()) + }; + let mut cells = Vec::new(); + for &len in &lens { + let prompt: Vec<u32> = all_ids[..len].to_vec(); + for &n in &ns { + for rep in 0..reps { + eprintln!("PREFILL_BENCH cell len={len} n={n} rep={rep}"); + let a = run_aien(&weights, &prompt, n, steps).await; + let nsteps = a.tokens.iter().map(Vec::len).min().unwrap_or(0); + let forced: Vec<Vec<u32>> = a.tokens.iter().map(|t| t[..nsteps].to_vec()).collect(); + let a_logits: Vec<Vec<Vec<f32>>> = + a.logits.iter().map(|l| l[..nsteps].to_vec()).collect(); + let base = run_baseline(&weights, &prompt, n, a.root_token, &forced, nsteps); + let ctl = run_control(&weights, &prompt, a.root_token, &forced, parity_branches); + let pb = ctl.logits.len(); + let (a_ctl, a_ctl_n, a_ctl_d) = compare(&a_logits[..pb], &ctl.logits); + let (b_ctl, _, b_ctl_d) = compare(&base.logits[..pb], &ctl.logits); + let (a_b, a_b_n, a_b_d) = compare(&a_logits, &base.logits); + let bb = a.block_bytes; + let tokens_out = n * nsteps; + let aien_ttft = mean(&a.ttft_ms); + // MODELED naive (no sharing): N full prefills at the control's + // measured one-shot rate; N x full-prompt blocks. + let naive_prefill_s = ctl.prefill_s * n as f64; + let blocks_per_prompt = len.div_ceil(config.block_size); + cells.push(json!({ + "n": n, "prefix_tokens": len, "rep": rep, "decode_steps": nsteps, + "aien_error": a.error, "aien_exit_state": a.diag, + "aien": { + "prefill_s": a.prefill_s, "prefill_tokens_computed": a.prefill_tokens, + "decode_s": a.decode_s, "total_s": a.total_s, + "ttft_ms_mean": aien_ttft, + "ttft_ms_max": a.ttft_ms.iter().cloned().fold(f64::NAN, f64::max), + "physical_kv_bytes_first_decode": a.physical_first_decode * bb, + "logical_kv_bytes_first_decode": a.logical_first_decode * bb, + "physical_kv_bytes_peak": a.peak_pages * bb, + "blocks_still_allocated_after_run": a.allocated_after, + "tokens_per_s_total": tokens_out as f64 / a.total_s, + "tokens_per_s_decode": tokens_out as f64 / a.decode_s, + }, + "baseline_modeled_vllm_apc": { + "prefill_s": base.prefill_s, "prefill_tokens_computed": base.prefill_tokens, + "decode_s": base.decode_s, "total_s": base.total_s, + "ttft_ms": base.ttft_ms, + "physical_kv_bytes_after_prefill": base.model_physical_after_prefill * bb, + "logical_kv_bytes_after_prefill": base.model_logical_after_prefill * bb, + "physical_kv_bytes_end": base.model_physical_end * bb, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "tokens_per_s_total": tokens_out as f64 / base.total_s, + "tokens_per_s_decode": tokens_out as f64 / base.decode_s, + }, + "naive_no_sharing_modeled": { + "prefill_s": naive_prefill_s, + "physical_kv_bytes_after_prefill": n * blocks_per_prompt * bb, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks", + }, + "control_prefill_s": ctl.prefill_s, + "parity": { + "compared_branches_vs_control": pb, + "aien_vs_control": {"max_abs": a_ctl, "values": a_ctl_n, "bit_differences": a_ctl_d}, + "baseline_vs_control": {"max_abs": b_ctl, "bit_differences": b_ctl_d}, + "aien_vs_baseline_all_branches": {"max_abs": a_b, "values": a_b_n, "bit_differences": a_b_d}, + }, + })); + // Flush partial results after every cell (long run, cut-off safe). + let doc = json!({ + "bench": "prefill_bench", "complete": false, "cells": cells, + }); + std::fs::write(&out_path, serde_json::to_vec_pretty(&doc).unwrap()).ok(); + } + } + } + let doc = json!({ + "bench": "prefill_bench", + "complete": true, + "commit": git(&["rev-parse", "HEAD"]), + "dirty": git(&["status", "--porcelain"]).map(|s| !s.is_empty()), + "model": {"path": model_path.display().to_string(), "id": config.model_id, + "kv_block_size": config.block_size}, + "hardware": hardware(), + "knobs": {"n": ns, "prefix_tokens": lens, "decode_steps": steps, "reps": reps, + "parity_branches": parity_branches, "prefill_chunk": PREFILL_CHUNK}, + "baseline_label": "MODELED vLLM automatic prefix caching, not a vLLM run", + "cells": cells, + }); + std::fs::write(&out_path, serde_json::to_vec_pretty(&doc).unwrap()).expect("write result"); + println!("PREFILL_BENCH_DONE {}", out_path.display()); +} diff --git a/crates/aien-runtime/examples/prefill_bench/vllm_model.rs b/crates/aien-runtime/examples/prefill_bench/vllm_model.rs new file mode 100644 index 00000000..a705599f --- /dev/null +++ b/crates/aien-runtime/examples/prefill_bench/vllm_model.rs @@ -0,0 +1,212 @@ +//! MODELED BASELINE: vLLM automatic prefix caching (APC), as a bookkeeping +//! model. It does no tensor math; it decides which tokens a vLLM-style engine +//! would prefill and how many physical KV blocks it would hold. +//! +//! Every modeled behavior and its source (vLLM main, read 2026-10-01): +//! - Block hash = hash(parent block hash, tuple of the block's tokens, extra +//! keys). Only FULL blocks are cached. Default hash algo sha256. +//! docs/design/prefix_caching.md ("Block hash", "We only cache full blocks"); +//! vllm/config/cache.py (`prefix_caching_hash_algo = "sha256"`, +//! `enable_prefix_caching = True`). +//! - A cache hit is at most `prompt_len - 1` tokens, because the last token is +//! always recomputed to get logits. +//! vllm/v1/core/kv_cache_manager.py get_computed_blocks: +//! `max_cache_hit_length = request.num_tokens - 1`. +//! - Blocks are cached right after allocation in `allocate_slots` +//! (`self.coordinator.cache_blocks(request, num_tokens_to_cache)`), so a +//! request scheduled later in the SAME step can hit blocks of an earlier one. +//! (The hit-after-allocate ordering is from that code; that same-step +//! scheduling really produces cross-request hits for N sibling requests is +//! inferred from it and not re-verified by a run: UNVERIFIED.) +//! - Hits are shared by reference count (no copy). A request's partially +//! filled last block is never shared, so each request gets its own tail +//! block. This is how a vLLM request "diverges": it never writes into a +//! shared block. There is no copy-on-write copy of KV bytes in the prefix +//! caching path (same doc: partial blocks stay uncached). +//! - No eviction is modeled: the bench window never fills the pool +//! (vLLM uses LRU free queue, same doc). +//! - Block size is a parameter. vLLM's `block_size` default is platform +//! chosen (`Field(default=None)` in vllm/config/cache.py); the bench uses +//! AIEN's block size (16) so both sides page identically. +//! +//! Not modeled: sliding window or multimodal extra hash keys, speculative +//! decoding, preemption, chunked prefill token budgets. + +use std::collections::HashMap; + +use sha2::{Digest, Sha256}; + +pub type Hash = [u8; 32]; + +fn block_hash(parent: &Hash, tokens: &[u32]) -> Hash { + let mut h = Sha256::new(); + h.update(parent); + for t in tokens { + h.update(t.to_le_bytes()); + } + h.finalize().into() +} + +pub struct ModelRequest { + pub blocks: Vec<usize>, + pub tokens: Vec<u32>, + /// Number of leading blocks already hashed (cached or deliberately skipped). + hashed_blocks: usize, + last_hash: Hash, + /// Tokens served from cache at admission (not recomputed). + pub cached_tokens: usize, +} + +pub struct PrefixCacheModel { + block_size: usize, + next_block: usize, + cache: HashMap<Hash, usize>, + refs: HashMap<usize, usize>, +} + +impl PrefixCacheModel { + pub fn new(block_size: usize) -> Self { + assert!(block_size > 0); + Self { + block_size, + next_block: 0, + cache: HashMap::new(), + refs: HashMap::new(), + } + } + + fn alloc(&mut self) -> usize { + let id = self.next_block; + self.next_block += 1; + self.refs.insert(id, 1); + id + } + + fn cache_full_blocks(&mut self, req: &mut ModelRequest) { + let bs = self.block_size; + while (req.hashed_blocks + 1) * bs <= req.tokens.len() { + let i = req.hashed_blocks; + let h = block_hash(&req.last_hash, &req.tokens[i * bs..(i + 1) * bs]); + self.cache.entry(h).or_insert(req.blocks[i]); + req.last_hash = h; + req.hashed_blocks += 1; + } + } + + /// Admits a prompt: finds the longest cached full-block prefix (capped at + /// len-1 tokens), shares those blocks, allocates the rest, caches the new + /// full blocks. + pub fn admit(&mut self, prompt: &[u32]) -> ModelRequest { + let bs = self.block_size; + let max_hit = prompt.len().saturating_sub(1); + let mut req = ModelRequest { + blocks: Vec::new(), + tokens: prompt.to_vec(), + hashed_blocks: 0, + last_hash: [0u8; 32], + cached_tokens: 0, + }; + while (req.hashed_blocks + 1) * bs <= max_hit { + let i = req.hashed_blocks; + let h = block_hash(&req.last_hash, &prompt[i * bs..(i + 1) * bs]); + match self.cache.get(&h) { + Some(&b) => { + *self.refs.get_mut(&b).expect("cached block is live") += 1; + req.blocks.push(b); + req.last_hash = h; + req.hashed_blocks += 1; + } + None => break, + } + } + req.cached_tokens = req.hashed_blocks * bs; + while req.blocks.len() * bs < prompt.len() { + let b = self.alloc(); + req.blocks.push(b); + } + self.cache_full_blocks(&mut req); + req + } + + /// Appends one generated token (one new block when the last is full). + pub fn append(&mut self, req: &mut ModelRequest, token: u32) { + req.tokens.push(token); + if req.tokens.len() > req.blocks.len() * self.block_size { + let b = self.alloc(); + req.blocks.push(b); + } + self.cache_full_blocks(req); + } + + pub fn physical_blocks(&self) -> usize { + self.refs.len() + } + + pub fn logical_blocks(&self, reqs: &[ModelRequest]) -> usize { + reqs.iter().map(|r| r.blocks.len()).sum() + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn prompt(n: usize) -> Vec<u32> { + (0..n as u32).collect() + } + + #[test] + fn second_request_hits_all_full_blocks_below_len_minus_one() { + let mut m = PrefixCacheModel::new(16); + let p = prompt(217); + let a = m.admit(&p); + assert_eq!(a.cached_tokens, 0); + assert_eq!(a.blocks.len(), 14); + let b = m.admit(&p); + assert_eq!(b.cached_tokens, 208); // 13 full blocks + assert_eq!(m.physical_blocks(), 15); // 13 shared + 2 tails + } + + #[test] + fn exact_multiple_still_recomputes_the_last_block() { + let mut m = PrefixCacheModel::new(16); + let p = prompt(64); + m.admit(&p); + let b = m.admit(&p); + assert_eq!(b.cached_tokens, 48); // cap is len-1 = 63 -> 3 blocks + } + + #[test] + fn short_prompt_below_one_block_never_shares() { + let mut m = PrefixCacheModel::new(16); + let p = prompt(10); + m.admit(&p); + let b = m.admit(&p); + assert_eq!(b.cached_tokens, 0); + assert_eq!(m.physical_blocks(), 2); + } + + #[test] + fn different_prefix_does_not_hit_after_a_mismatch() { + let mut m = PrefixCacheModel::new(4); + m.admit(&[1, 2, 3, 4, 5, 6, 7, 8, 9]); + let b = m.admit(&[1, 2, 3, 4, 5, 6, 0, 8, 9]); + assert_eq!(b.cached_tokens, 4); + } + + #[test] + fn decode_blocks_grow_per_request_and_identical_full_blocks_dedupe_only_via_hit() { + let mut m = PrefixCacheModel::new(4); + let p = prompt(6); + let mut a = m.admit(&p); + let mut b = m.admit(&p); + // a and b share block 0; tails separate. + assert_eq!(m.physical_blocks(), 3); + for t in [100, 101, 102] { + m.append(&mut a, t); + m.append(&mut b, t); + } + // 6+3=9 tokens each: 3 blocks each, block 0 shared => 5 physical. + assert_eq!(m.physical_blocks(), 5); + } +} diff --git a/docs/campaigns/c6-prefill-bench/RESULTS.md b/docs/campaigns/c6-prefill-bench/RESULTS.md new file mode 100644 index 00000000..f3665d78 --- /dev/null +++ b/docs/campaigns/c6-prefill-bench/RESULTS.md @@ -0,0 +1,69 @@ +# C6 comparative benchmark: AIEN shared prefill vs a MODELED vLLM-style prefix cache + +Status: measured on CPU only. GB10 GPU: NOT_RUN. Real vLLM: NOT_RUN. + +## What was measured +`cargo run --release -p aien-runtime --example prefill_bench` (code in +`crates/aien-runtime/examples/prefill_bench/`). One shared prompt prefix, N branches forked from it, 8 decode steps. + +- AIEN leg: the real runtime path (spine, shared KV pool, fork hooks, TinyLlama CPU backend). Measured. +- Baseline leg: a MODELED vLLM automatic-prefix-caching run (`vllm_model.rs`). It uses vLLM's rule that only + full KV blocks (16 tokens) are shared, so each extra branch recomputes the partial last block. The compute + time is measured on our own CPU backend; the KV byte counts are a bookkeeping model, NOT measured. + The JSON says so: `"baseline_label": "MODELED vLLM automatic prefix caching, not a vLLM run"`. +- Control: one unshared one-shot prefill, used to check numerical parity (logits bit-for-bit). + +Model: TinyLlama-1.1B-Chat-v1.0, safetensors, CPU (Spark, 20 cores, Cortex-X925/A725). +Grid: prefix length 40, 200, 700 tokens; N = 1, 2, 4, 8, 16; 2 repetitions per cell (reps = 2, so N=2 samples per cell). + +## Numbers (mean of 2 reps, seconds; source `evidence/ltc6-full.json`, run at f2a5a27) + +| prefix | N | AIEN prefill | modeled APC prefill | AIEN total | modeled APC total | AIEN peak KV MiB | modeled APC KV MiB | +|---|---|---|---|---|---|---|---| +| 40 | 1 | 2.00 | 2.01 | 5.0 | 5.0 | 2.8 | 2.8 | +| 40 | 4 | 1.95 | 5.02 | 7.9 | 10.5 | 4.8 | 6.9 | +| 40 | 16 | 2.00 | 17.29 | 11.6 | 26.4 | 13.1 | 23.4 | +| 200 | 1 | 9.03 | 7.82 | 12.1 | 10.8 | 9.6 | 9.6 | +| 200 | 4 | 8.90 | 11.15 | 14.8 | 17.2 | 11.7 | 13.8 | +| 200 | 16 | 8.52 | 25.14 | 19.7 | 35.3 | 19.9 | 19.3 | +| 700 | 4 | 33.55 | 33.91 | 40.1 | 41.6 | 35.8 | 35.1 | +| 700 | 8 | 33.41 | 39.65 | 45.6 | 52.9 | 41.3 | 40.6 | +| 700 | 16 | 33.80 | 51.98 | 48.1 | 65.3 | 52.3 | 51.6 | + +All 30 cells (all N) are in the JSON. Tokens prefilled by AIEN equal the prefix length for every N; the modeled +baseline prefills extra tokens per branch (for example 880 vs 700 at N=16). + +## Reading +- AIEN prefill time stays flat as N grows (one shared prefill). The modeled baseline grows with N because it + recomputes the partial last block per branch. At short prefixes (40 tokens, mostly partial block) the gap is large + (N=16: about 8.6x on prefill, 2.3x on total). At 700 tokens it is smaller (N=16: 1.5x prefill, 1.4x total). +- At N=1 there is nothing to share. AIEN was about 15 percent slower on prefill than the modeled baseline at 200 and 700 + tokens (9.03 vs 7.82 s, 34.8 vs 30.2 s). Not investigated; with 2 reps it may be noise or runtime overhead. +- Peak KV memory: AIEN is lower at short prefixes, roughly equal at 200 to 700 tokens (the baseline model already shares + full blocks), and slightly higher at some long cells (N=4 to 16 at 700: 35.8 vs 35.1 MiB, etc.). No memory win is claimed. +- Parity: every valid cell has 0 bit differences, AIEN vs the unshared control and AIEN vs the baseline. + +## Invalid cells: 700 tokens, N=1 and N=2 +In these four cells the AIEN run did not decode at all: decode time 0, no tokens, peak KV 0, parity compared 0 values, +and `aien_error` was null (silent). The diag run at head 1afc699 (`evidence/ltc6-diag.json`, N=2, len 700, 4 steps) +shows why it looks stuck: `spine_steps=1000 running=0 waiting=2 root_prefill_pending=false prefill_tokens=700 +decode_steps=0`. The bench hit its 1000-step loop guard with both branches still waiting after the root prefill +finished. Cause not found. These cells must not be read as results. Whether this is a bench bug or a real +scheduler/admission bug in the runtime is OPEN. + +## Runs and logs +| job | sha | what | log | +|---|---|---|---| +| LTC6-smoke2 | f2a5a27 | N=4, len 200, 4 steps | ~/workspace/test-queue-logs/LTC6-smoke2-light-233731.log | +| LTC6-full | f2a5a27 | full grid, reps 2 | ~/workspace/test-queue-logs/LTC6-full-light-234215.log | +| LTC6-diag | 1afc699 | N=2, len 700, 4 steps (diagnostic) | ~/workspace/test-queue-logs/LTC6-diag-light-004504.log | + +The only code change between f2a5a27 and 1afc699 is an added diagnostic string (`aien_exit_state`) in the output; the +full grid was not rerun at 1afc699. + +## NOT claimed +- No real vLLM was run. The baseline is a model. Real vLLM on a GPU may differ in both time and memory. +- No GPU (GB10) result. CPU, one model (TinyLlama 1.1B), one machine, 2 reps per cell, no confidence intervals. +- No energy measurement. No memory measurement of the baseline (bookkeeping only). +- Machine load was not controlled (loadavg 8.8 at start of the full run). +- Nothing about the 700-token N=1/N=2 cells beyond "invalid, cause open". diff --git a/docs/campaigns/c6-prefill-bench/evidence/ltc6-diag.json b/docs/campaigns/c6-prefill-bench/evidence/ltc6-diag.json new file mode 100644 index 00000000..6a2535ed --- /dev/null +++ b/docs/campaigns/c6-prefill-bench/evidence/ltc6-diag.json @@ -0,0 +1,94 @@ +{ + "baseline_label": "MODELED vLLM automatic prefix caching, not a vLLM run", + "bench": "prefill_bench", + "cells": [ + { + "aien": { + "blocks_still_allocated_after_run": 44, + "decode_s": 0.0, + "logical_kv_bytes_first_decode": 0, + "physical_kv_bytes_first_decode": 0, + "physical_kv_bytes_peak": 0, + "prefill_s": 34.234228324, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": null, + "tokens_per_s_total": 0.0, + "total_s": 34.234723618, + "ttft_ms_max": null, + "ttft_ms_mean": null + }, + "aien_error": null, + "aien_exit_state": "spine_steps=1000 running=0 waiting=2 root_prefill_pending=false prefill_tokens=700 decode_steps=0", + "baseline_modeled_vllm_apc": { + "decode_s": 0.0, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 63438848, + "physical_kv_bytes_after_prefill": 32440320, + "physical_kv_bytes_end": 32440320, + "prefill_s": 30.966225526, + "prefill_tokens_computed": 712, + "tokens_per_s_decode": null, + "tokens_per_s_total": 0.0, + "total_s": 30.972233383, + "ttft_ms": 0.0 + }, + "control_prefill_s": 29.875642446, + "decode_steps": 0, + "n": 2, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 63438848, + "prefill_s": 59.751284892, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 0 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 0 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 700, + "rep": 0 + } + ], + "commit": "1afc6990451cf2324f7ee21e0fa10279741f84ec", + "complete": true, + "dirty": false, + "hardware": { + "cpu_parts": [ + "0xd87", + "0xd85" + ], + "loadavg_at_start": "14.99 11.15 7.87 3/1646 544987\n", + "lscpu_model": "Model name: Cortex-A725\nModel name: Cortex-X925", + "processors": 20, + "uname": "Linux spark-b87b 7.0.0-1019-nvidia #19~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Sun Sep 6 18:35:11 UTC 2 aarch64 aarch64 aarch64 GNU/Linux" + }, + "knobs": { + "decode_steps": 4, + "n": [ + 2 + ], + "parity_branches": 2, + "prefill_chunk": 128, + "prefix_tokens": [ + 700 + ], + "reps": 1 + }, + "model": { + "id": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "kv_block_size": 16, + "path": "/home/drakestapleton/models/TinyLlama-1.1B-Chat-v1.0/model.safetensors" + } +} \ No newline at end of file diff --git a/docs/campaigns/c6-prefill-bench/evidence/ltc6-full.json b/docs/campaigns/c6-prefill-bench/evidence/ltc6-full.json new file mode 100644 index 00000000..1a262aec --- /dev/null +++ b/docs/campaigns/c6-prefill-bench/evidence/ltc6-full.json @@ -0,0 +1,1752 @@ +{ + "baseline_label": "MODELED vLLM automatic prefix caching, not a vLLM run", + "bench": "prefill_bench", + "cells": [ + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 2.97553461, + "logical_kv_bytes_first_decode": 4325376, + "physical_kv_bytes_first_decode": 2162688, + "physical_kv_bytes_peak": 2883584, + "prefill_s": 2.025217174, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 2.6885924879227, + "tokens_per_s_total": 1.5997304703715378, + "total_s": 5.000842422, + "ttft_ms_max": 2397.144989, + "ttft_ms_mean": 2397.144989 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 2.959711463, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 2162688, + "physical_kv_bytes_after_prefill": 2162688, + "physical_kv_bytes_end": 2883584, + "prefill_s": 2.017204909, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 2.7029661843763315, + "tokens_per_s_total": 1.6074149550362355, + "total_s": 4.976935156, + "ttft_ms": 2386.721649 + }, + "control_prefill_s": 1.9774022439999999, + "decode_steps": 8, + "n": 1, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 2162688, + "prefill_s": 1.9774022439999999, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 256000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 256000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 1 + }, + "prefix_tokens": 40, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 2.970881368, + "logical_kv_bytes_first_decode": 4325376, + "physical_kv_bytes_first_decode": 2162688, + "physical_kv_bytes_peak": 2883584, + "prefill_s": 1.969198529, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 2.6928035855519896, + "tokens_per_s_total": 1.6193785587778227, + "total_s": 4.940166681, + "ttft_ms_max": 2341.6430689999997, + "ttft_ms_mean": 2341.6430689999997 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 2.942665134, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 2162688, + "physical_kv_bytes_after_prefill": 2162688, + "physical_kv_bytes_end": 2883584, + "prefill_s": 2.007925719, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 2.718623980542939, + "tokens_per_s_total": 1.6159625178269652, + "total_s": 4.950609876, + "ttft_ms": 2376.041405 + }, + "control_prefill_s": 2.005382926, + "decode_steps": 8, + "n": 1, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 2162688, + "prefill_s": 2.005382926, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 256000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 256000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 1 + }, + "prefix_tokens": 40, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 3.634429078, + "logical_kv_bytes_first_decode": 6488064, + "physical_kv_bytes_first_decode": 2162688, + "physical_kv_bytes_peak": 3604480, + "prefill_s": 1.9871161910000001, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 4.402342061605088, + "tokens_per_s_total": 2.846115549411393, + "total_s": 5.621697265, + "ttft_ms_max": 2420.32262, + "ttft_ms_mean": 2420.322348 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 3.821694748, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 4325376, + "physical_kv_bytes_after_prefill": 2883584, + "physical_kv_bytes_end": 4325376, + "prefill_s": 2.966497286, + "prefill_tokens_computed": 48, + "tokens_per_s_decode": 4.186624274053611, + "tokens_per_s_total": 2.3568489571625157, + "total_s": 6.788725239, + "ttft_ms": 3476.037166 + }, + "control_prefill_s": 4.7145455290000005, + "decode_steps": 8, + "n": 2, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 4325376, + "prefill_s": 9.429091058000001, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 40, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 4.017390613, + "logical_kv_bytes_first_decode": 6488064, + "physical_kv_bytes_first_decode": 2162688, + "physical_kv_bytes_peak": 3604480, + "prefill_s": 2.084622961, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 3.9826846680591874, + "tokens_per_s_total": 2.622022860421279, + "total_s": 6.102158849, + "ttft_ms_max": 2621.323653, + "ttft_ms_mean": 2621.323445 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 3.7398010839999998, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 4325376, + "physical_kv_bytes_after_prefill": 2883584, + "physical_kv_bytes_end": 4325376, + "prefill_s": 3.042265976, + "prefill_tokens_computed": 48, + "tokens_per_s_decode": 4.278302412514088, + "tokens_per_s_total": 2.3589662788495045, + "total_s": 6.782631928, + "ttft_ms": 3513.923796 + }, + "control_prefill_s": 2.005220792, + "decode_steps": 8, + "n": 2, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 4325376, + "prefill_s": 4.010441584, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 40, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 6.047401004, + "logical_kv_bytes_first_decode": 10813440, + "physical_kv_bytes_first_decode": 2162688, + "physical_kv_bytes_peak": 5046272, + "prefill_s": 1.8826653, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 5.291529365893527, + "tokens_per_s_total": 4.035186357968666, + "total_s": 7.930240926, + "ttft_ms_max": 2684.2638340000003, + "ttft_ms_mean": 2684.2628700000005 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 5.503569815, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 8650752, + "physical_kv_bytes_after_prefill": 4325376, + "physical_kv_bytes_end": 7208960, + "prefill_s": 5.009828904, + "prefill_tokens_computed": 64, + "tokens_per_s_decode": 5.814407934425376, + "tokens_per_s_total": 3.0429891737885306, + "total_s": 10.515975632, + "ttft_ms": 5713.5518999999995 + }, + "control_prefill_s": 1.966580606, + "decode_steps": 8, + "n": 4, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 8650752, + "prefill_s": 7.866322424, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 1024000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 40, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 5.745322082, + "logical_kv_bytes_first_decode": 10813440, + "physical_kv_bytes_first_decode": 2162688, + "physical_kv_bytes_peak": 5046272, + "prefill_s": 2.025829264, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 5.56974866565888, + "tokens_per_s_total": 4.117698863638348, + "total_s": 7.771330799, + "ttft_ms_max": 2632.974107, + "ttft_ms_mean": 2632.972711 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 5.39424046, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 8650752, + "physical_kv_bytes_after_prefill": 4325376, + "physical_kv_bytes_end": 7208960, + "prefill_s": 5.030110684, + "prefill_tokens_computed": 64, + "tokens_per_s_decode": 5.932253157286948, + "tokens_per_s_total": 3.069126539950858, + "total_s": 10.426419238, + "ttft_ms": 5671.451937999999 + }, + "control_prefill_s": 1.984913368, + "decode_steps": 8, + "n": 4, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 8650752, + "prefill_s": 7.939653472, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 1024000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 40, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 8.472267443, + "logical_kv_bytes_first_decode": 19464192, + "physical_kv_bytes_first_decode": 2162688, + "physical_kv_bytes_peak": 7929856, + "prefill_s": 2.032706543, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 7.554058040610888, + "tokens_per_s_total": 6.092211754236539, + "total_s": 10.505215935, + "ttft_ms_max": 3085.290182, + "ttft_ms_mean": 3085.286782 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 8.237421538, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 17301504, + "physical_kv_bytes_after_prefill": 7208960, + "physical_kv_bytes_end": 12976128, + "prefill_s": 9.105318549, + "prefill_tokens_computed": 96, + "tokens_per_s_decode": 7.769421499769313, + "tokens_per_s_total": 3.6888415353530615, + "total_s": 17.349620304, + "ttft_ms": 10146.026428000001 + }, + "control_prefill_s": 1.965310238, + "decode_steps": 8, + "n": 8, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 17301504, + "prefill_s": 15.722481904, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 2048000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 40, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 8.454734826, + "logical_kv_bytes_first_decode": 19464192, + "physical_kv_bytes_first_decode": 2162688, + "physical_kv_bytes_peak": 7929856, + "prefill_s": 2.005122644, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 7.569722920603874, + "tokens_per_s_total": 6.118500491926102, + "total_s": 10.460079244, + "ttft_ms_max": 3043.144918, + "ttft_ms_mean": 3043.141786 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 8.214537371, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 17301504, + "physical_kv_bytes_after_prefill": 7208960, + "physical_kv_bytes_end": 12976128, + "prefill_s": 9.02107037, + "prefill_tokens_computed": 96, + "tokens_per_s_decode": 7.791065657080202, + "tokens_per_s_total": 3.7123485104669594, + "total_s": 17.239760712, + "ttft_ms": 10045.011199999999 + }, + "control_prefill_s": 2.012280403, + "decode_steps": 8, + "n": 8, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 17301504, + "prefill_s": 16.098243224, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 2048000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 40, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 9.600701449, + "logical_kv_bytes_first_decode": 36765696, + "physical_kv_bytes_first_decode": 2162688, + "physical_kv_bytes_peak": 13697024, + "prefill_s": 1.985648475, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 13.332359169790907, + "tokens_per_s_total": 11.047166229207082, + "total_s": 11.58668181, + "ttft_ms_max": 3180.476397, + "ttft_ms_mean": 3180.4695739999997 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 9.151810978, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 34603008, + "physical_kv_bytes_after_prefill": 12976128, + "physical_kv_bytes_end": 24510464, + "prefill_s": 17.234761571, + "prefill_tokens_computed": 160, + "tokens_per_s_decode": 13.986302853904943, + "tokens_per_s_total": 4.848569876054917, + "total_s": 26.399537033, + "ttft_ms": 18389.703833 + }, + "control_prefill_s": 1.971069529, + "decode_steps": 8, + "n": 16, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 34603008, + "prefill_s": 31.537112464, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 4096000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 40, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 9.537612731, + "logical_kv_bytes_first_decode": 36765696, + "physical_kv_bytes_first_decode": 2162688, + "physical_kv_bytes_peak": 13697024, + "prefill_s": 2.0230555, + "prefill_tokens_computed": 40, + "tokens_per_s_decode": 13.420549104909972, + "tokens_per_s_total": 11.071710167123983, + "total_s": 11.560996275, + "ttft_ms_max": 3222.042282, + "ttft_ms_mean": 3222.0357760000006 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 9.105412821, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 34603008, + "physical_kv_bytes_after_prefill": 12976128, + "physical_kv_bytes_end": 24510464, + "prefill_s": 17.352500099, + "prefill_tokens_computed": 160, + "tokens_per_s_decode": 14.057572404053003, + "tokens_per_s_total": 4.836130813466275, + "total_s": 26.467439558, + "ttft_ms": 18488.82711 + }, + "control_prefill_s": 2.015277514, + "decode_steps": 8, + "n": 16, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 34603008, + "prefill_s": 32.244440224, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 4096000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 40, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 3.011815419, + "logical_kv_bytes_first_decode": 18743296, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 10092544, + "prefill_s": 9.430583971, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 2.656205273912903, + "tokens_per_s_total": 0.6429528817272933, + "total_s": 12.442591405, + "ttft_ms_max": 9805.987084, + "ttft_ms_mean": 9805.987084 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 2.991468757, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 9371648, + "physical_kv_bytes_after_prefill": 9371648, + "physical_kv_bytes_end": 10092544, + "prefill_s": 7.9731257620000004, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 2.674271620347062, + "tokens_per_s_total": 0.7296194354939552, + "total_s": 10.964620199, + "ttft_ms": 8346.273072 + }, + "control_prefill_s": 7.513682213, + "decode_steps": 8, + "n": 1, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 9371648, + "prefill_s": 7.513682213, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 256000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 256000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 1 + }, + "prefix_tokens": 200, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 3.049884469, + "logical_kv_bytes_first_decode": 18743296, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 10092544, + "prefill_s": 8.63193707, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 2.623050178232833, + "tokens_per_s_total": 0.6848121298477069, + "total_s": 11.682036067, + "ttft_ms_max": 9013.318070000001, + "ttft_ms_mean": 9013.318070000001 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 2.995585018, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 9371648, + "physical_kv_bytes_after_prefill": 9371648, + "physical_kv_bytes_end": 10092544, + "prefill_s": 7.6683356, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 2.6705968790500876, + "tokens_per_s_total": 0.7501912493028366, + "total_s": 10.66394737, + "ttft_ms": 8042.867145000001 + }, + "control_prefill_s": 7.467938974, + "decode_steps": 8, + "n": 1, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 9371648, + "prefill_s": 7.467938974, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 256000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 256000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 1 + }, + "prefix_tokens": 200, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 3.923794042, + "logical_kv_bytes_first_decode": 28114944, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 10813440, + "prefill_s": 8.680108034, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 4.077685991858183, + "tokens_per_s_total": 1.2694232295289418, + "total_s": 12.604149371, + "ttft_ms_max": 9160.129483, + "ttft_ms_mean": 9160.129275 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 4.095799429, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 18743296, + "physical_kv_bytes_after_prefill": 10092544, + "physical_kv_bytes_end": 11534336, + "prefill_s": 8.815362411, + "prefill_tokens_computed": 208, + "tokens_per_s_decode": 3.9064412887782543, + "tokens_per_s_total": 1.239060840627458, + "total_s": 12.913005944, + "ttft_ms": 9409.502462 + }, + "control_prefill_s": 8.018966207, + "decode_steps": 8, + "n": 2, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 18743296, + "prefill_s": 16.037932414, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 200, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 3.770001092, + "logical_kv_bytes_first_decode": 28114944, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 10813440, + "prefill_s": 8.927841509, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 4.2440306009333115, + "tokens_per_s_total": 1.2600297365899558, + "total_s": 12.698113017, + "ttft_ms_max": 9395.881325, + "ttft_ms_mean": 9395.881013 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 3.797659994, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 18743296, + "physical_kv_bytes_after_prefill": 10092544, + "physical_kv_bytes_end": 11534336, + "prefill_s": 8.940957394, + "prefill_tokens_computed": 208, + "tokens_per_s_decode": 4.2131207178311705, + "tokens_per_s_total": 1.2557682910994021, + "total_s": 12.741204021, + "ttft_ms": 9389.927459999999 + }, + "control_prefill_s": 7.640007188, + "decode_steps": 8, + "n": 2, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 18743296, + "prefill_s": 15.280014376, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 200, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 6.298311092, + "logical_kv_bytes_first_decode": 46858240, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 12255232, + "prefill_s": 8.682593123, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 5.080727123918318, + "tokens_per_s_total": 2.136010267125307, + "total_s": 14.981201398, + "ttft_ms_max": 9644.753537, + "ttft_ms_mean": 9644.751805 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 6.3050461890000005, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 37486592, + "physical_kv_bytes_after_prefill": 11534336, + "physical_kv_bytes_end": 14417920, + "prefill_s": 11.057585391, + "prefill_tokens_computed": 224, + "tokens_per_s_decode": 5.0752998536042915, + "tokens_per_s_total": 1.8424804160955837, + "total_s": 17.367891523, + "ttft_ms": 12101.700152 + }, + "control_prefill_s": 7.651668418, + "decode_steps": 8, + "n": 4, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 37486592, + "prefill_s": 30.606673672, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 1024000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 200, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 5.454077517, + "logical_kv_bytes_first_decode": 46858240, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 12255232, + "prefill_s": 9.123443179, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 5.8671700026738, + "tokens_per_s_total": 2.1951171269142313, + "total_s": 14.577809816, + "ttft_ms_max": 9768.380333, + "ttft_ms_mean": 9768.378596999999 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 5.8785937619999995, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 37486592, + "physical_kv_bytes_after_prefill": 11534336, + "physical_kv_bytes_end": 14417920, + "prefill_s": 11.23503586, + "prefill_tokens_computed": 224, + "tokens_per_s_decode": 5.443478712009697, + "tokens_per_s_total": 1.869281015491884, + "total_s": 17.118881396, + "ttft_ms": 11871.131342 + }, + "control_prefill_s": 7.852343034, + "decode_steps": 8, + "n": 4, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 37486592, + "prefill_s": 31.409372136, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 1024000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 200, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 9.324853812, + "logical_kv_bytes_first_decode": 84344832, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 15138816, + "prefill_s": 8.710469965, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 6.863378374644271, + "tokens_per_s_total": 3.5485157417199136, + "total_s": 18.035709761, + "ttft_ms_max": 9840.537106, + "ttft_ms_mean": 9840.531202000002 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 9.719819599000001, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 74973184, + "physical_kv_bytes_after_prefill": 14417920, + "physical_kv_bytes_end": 20185088, + "prefill_s": 16.282524366, + "prefill_tokens_computed": 256, + "tokens_per_s_decode": 6.58448434645685, + "tokens_per_s_total": 2.4594441378692458, + "total_s": 26.022140131, + "ttft_ms": 17477.650827 + }, + "control_prefill_s": 7.456674083, + "decode_steps": 8, + "n": 8, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 74973184, + "prefill_s": 59.653392664, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 2048000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 200, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 9.244214746, + "logical_kv_bytes_first_decode": 84344832, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 15138816, + "prefill_s": 8.454273094, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 6.923248946341602, + "tokens_per_s_total": 3.6160594097696364, + "total_s": 17.698824258, + "ttft_ms_max": 9592.647297, + "ttft_ms_mean": 9592.642895 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 9.630338212, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 74973184, + "physical_kv_bytes_after_prefill": 14417920, + "physical_kv_bytes_end": 20185088, + "prefill_s": 15.773376587, + "prefill_tokens_computed": 256, + "tokens_per_s_decode": 6.645664834517652, + "tokens_per_s_total": 2.5169289737045566, + "total_s": 25.427813287, + "ttft_ms": 17041.886091 + }, + "control_prefill_s": 7.597422491, + "decode_steps": 8, + "n": 8, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 74973184, + "prefill_s": 60.779379928, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 2048000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 200, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 11.182896205, + "logical_kv_bytes_first_decode": 159318016, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 20905984, + "prefill_s": 8.370501029, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 10.015294602298422, + "tokens_per_s_total": 5.7277695752895585, + "total_s": 19.553859234, + "ttft_ms_max": 9767.29556, + "ttft_ms_mean": 9767.289 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 10.135550919, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 149946368, + "physical_kv_bytes_after_prefill": 20185088, + "physical_kv_bytes_end": 20185088, + "prefill_s": 25.015421616, + "prefill_tokens_computed": 320, + "tokens_per_s_decode": 11.050213342626098, + "tokens_per_s_total": 3.1808930379646423, + "total_s": 35.210237711, + "ttft_ms": 26456.213976 + }, + "control_prefill_s": 7.500479851, + "decode_steps": 7, + "n": 16, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 149946368, + "prefill_s": 120.007677616, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 3584000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 448000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 200, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 11.121596275, + "logical_kv_bytes_first_decode": 159318016, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 20905984, + "prefill_s": 8.671380311, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 10.07049682712925, + "tokens_per_s_total": 5.658437692662998, + "total_s": 19.793449373, + "ttft_ms_max": 10020.964763, + "ttft_ms_mean": 10020.957988999999 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 10.188062504, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 149946368, + "physical_kv_bytes_after_prefill": 20185088, + "physical_kv_bytes_end": 20185088, + "prefill_s": 25.270497931, + "prefill_tokens_computed": 320, + "tokens_per_s_decode": 10.99325803665093, + "tokens_per_s_total": 3.156296316273293, + "total_s": 35.484627797, + "ttft_ms": 26796.099801 + }, + "control_prefill_s": 7.613648588, + "decode_steps": 7, + "n": 16, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 149946368, + "prefill_s": 121.818377408, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 3584000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 448000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 200, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 44, + "decode_s": 0.0, + "logical_kv_bytes_first_decode": 0, + "physical_kv_bytes_first_decode": 0, + "physical_kv_bytes_peak": 0, + "prefill_s": 34.219436487, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": null, + "tokens_per_s_total": 0.0, + "total_s": 34.219968761, + "ttft_ms_max": null, + "ttft_ms_mean": null + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 0.0, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 31719424, + "physical_kv_bytes_after_prefill": 31719424, + "physical_kv_bytes_end": 31719424, + "prefill_s": 30.047978917, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": null, + "tokens_per_s_total": 0.0, + "total_s": 30.048007766, + "ttft_ms": 0.0 + }, + "control_prefill_s": 30.638343102, + "decode_steps": 0, + "n": 1, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 31719424, + "prefill_s": 30.638343102, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 0 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 0 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 1 + }, + "prefix_tokens": 700, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 44, + "decode_s": 0.0, + "logical_kv_bytes_first_decode": 0, + "physical_kv_bytes_first_decode": 0, + "physical_kv_bytes_peak": 0, + "prefill_s": 35.306169934, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": null, + "tokens_per_s_total": 0.0, + "total_s": 35.306766065, + "ttft_ms_max": null, + "ttft_ms_mean": null + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 0.0, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 31719424, + "physical_kv_bytes_after_prefill": 31719424, + "physical_kv_bytes_end": 31719424, + "prefill_s": 30.414754022, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": null, + "tokens_per_s_total": 0.0, + "total_s": 30.414783366, + "ttft_ms": 0.0 + }, + "control_prefill_s": 30.808185269, + "decode_steps": 0, + "n": 1, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 31719424, + "prefill_s": 30.808185269, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 0 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 0 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 1 + }, + "prefix_tokens": 700, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 44, + "decode_s": 0.0, + "logical_kv_bytes_first_decode": 0, + "physical_kv_bytes_first_decode": 0, + "physical_kv_bytes_peak": 0, + "prefill_s": 34.598060322, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": null, + "tokens_per_s_total": 0.0, + "total_s": 34.598635702, + "ttft_ms_max": null, + "ttft_ms_mean": null + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 0.0, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 63438848, + "physical_kv_bytes_after_prefill": 32440320, + "physical_kv_bytes_end": 32440320, + "prefill_s": 31.589217745, + "prefill_tokens_computed": 712, + "tokens_per_s_decode": null, + "tokens_per_s_total": 0.0, + "total_s": 31.595246629000002, + "ttft_ms": 0.0 + }, + "control_prefill_s": 29.889947856, + "decode_steps": 0, + "n": 2, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 63438848, + "prefill_s": 59.779895712, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 0 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 0 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 700, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 44, + "decode_s": 0.0, + "logical_kv_bytes_first_decode": 0, + "physical_kv_bytes_first_decode": 0, + "physical_kv_bytes_peak": 0, + "prefill_s": 34.053125939, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": null, + "tokens_per_s_total": 0.0, + "total_s": 34.053619815, + "ttft_ms_max": null, + "ttft_ms_mean": null + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 0.0, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 63438848, + "physical_kv_bytes_after_prefill": 32440320, + "physical_kv_bytes_end": 32440320, + "prefill_s": 31.393784444, + "prefill_tokens_computed": 712, + "tokens_per_s_decode": null, + "tokens_per_s_total": 0.0, + "total_s": 31.399900293, + "ttft_ms": 0.0 + }, + "control_prefill_s": 29.967115498, + "decode_steps": 0, + "n": 2, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 63438848, + "prefill_s": 59.934230996, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 0 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 0 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 700, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 6.373980749, + "logical_kv_bytes_first_decode": 158597120, + "physical_kv_bytes_first_decode": 31719424, + "physical_kv_bytes_peak": 37486592, + "prefill_s": 33.367540977, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": 5.020410518971274, + "tokens_per_s_total": 0.8051891745722637, + "total_s": 39.742213396, + "ttft_ms_max": 34174.00898599999, + "ttft_ms_mean": 34174.00663 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 8.429918175, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 126877696, + "physical_kv_bytes_after_prefill": 33882112, + "physical_kv_bytes_end": 36765696, + "prefill_s": 33.925670191, + "prefill_tokens_computed": 736, + "tokens_per_s_decode": 3.7960036308418856, + "tokens_per_s_total": 0.7549660195828416, + "total_s": 42.386013635, + "ttft_ms": 34634.965370000005 + }, + "control_prefill_s": 29.422927296, + "decode_steps": 8, + "n": 4, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 126877696, + "prefill_s": 117.691709184, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 1024000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 700, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 6.7577353460000005, + "logical_kv_bytes_first_decode": 158597120, + "physical_kv_bytes_first_decode": 31719424, + "physical_kv_bytes_peak": 37486592, + "prefill_s": 33.726602853, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": 4.7353141787272355, + "tokens_per_s_total": 0.7904179329045241, + "total_s": 40.484911422, + "ttft_ms_max": 34621.190466, + "ttft_ms_mean": 34621.188442 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 6.80621177, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 126877696, + "physical_kv_bytes_after_prefill": 33882112, + "physical_kv_bytes_end": 36765696, + "prefill_s": 33.891790692, + "prefill_tokens_computed": 736, + "tokens_per_s_decode": 4.701587473526407, + "tokens_per_s_total": 0.7859271926785358, + "total_s": 40.716239746, + "ttft_ms": 34750.823261 + }, + "control_prefill_s": 29.504619014, + "decode_steps": 8, + "n": 4, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 126877696, + "prefill_s": 118.018476056, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 1024000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 700, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 12.281458384, + "logical_kv_bytes_first_decode": 285474816, + "physical_kv_bytes_first_decode": 31719424, + "physical_kv_bytes_peak": 43253760, + "prefill_s": 33.30886619, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": 5.211107508484312, + "tokens_per_s_total": 1.403785230745678, + "total_s": 45.591019622, + "ttft_ms_max": 34626.986011, + "ttft_ms_mean": 34626.983451 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 13.35095523, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 253755392, + "physical_kv_bytes_after_prefill": 36765696, + "physical_kv_bytes_end": 42532864, + "prefill_s": 39.575183943, + "prefill_tokens_computed": 784, + "tokens_per_s_decode": 4.7936644904770604, + "tokens_per_s_total": 1.2073664820410854, + "total_s": 53.007931686, + "ttft_ms": 41298.604989 + }, + "control_prefill_s": 29.381371969, + "decode_steps": 8, + "n": 8, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 253755392, + "prefill_s": 235.050975752, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 2048000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 700, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 12.015521709, + "logical_kv_bytes_first_decode": 285474816, + "physical_kv_bytes_first_decode": 31719424, + "physical_kv_bytes_peak": 43253760, + "prefill_s": 33.514981884, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": 5.326443707563859, + "tokens_per_s_total": 1.4056298708265007, + "total_s": 45.531189489, + "ttft_ms_max": 35076.060097, + "ttft_ms_mean": 35076.056104999996 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 13.067893288, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 253755392, + "physical_kv_bytes_after_prefill": 36765696, + "physical_kv_bytes_end": 42532864, + "prefill_s": 39.71851038, + "prefill_tokens_computed": 784, + "tokens_per_s_decode": 4.897499435411674, + "tokens_per_s_total": 1.2105023375350066, + "total_s": 52.870612485, + "ttft_ms": 41080.978849 + }, + "control_prefill_s": 29.692341517, + "decode_steps": 8, + "n": 8, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 253755392, + "prefill_s": 237.538732136, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 2048000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 700, + "rep": 1 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 14.594965757, + "logical_kv_bytes_first_decode": 539230208, + "physical_kv_bytes_first_decode": 31719424, + "physical_kv_bytes_peak": 54788096, + "prefill_s": 33.759715821, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": 8.770147332384727, + "tokens_per_s_total": 2.6470634082286373, + "total_s": 48.355471804, + "ttft_ms_max": 35517.728616, + "ttft_ms_mean": 35517.724076 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 13.185587951, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 507510784, + "physical_kv_bytes_after_prefill": 42532864, + "physical_kv_bytes_end": 54067200, + "prefill_s": 52.605580539, + "prefill_tokens_computed": 880, + "tokens_per_s_decode": 9.70756863294006, + "tokens_per_s_total": 1.9395601763342492, + "total_s": 65.994343234, + "ttft_ms": 54461.98484899999 + }, + "control_prefill_s": 29.607783852, + "decode_steps": 8, + "n": 16, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 507510784, + "prefill_s": 473.724541632, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 4096000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 700, + "rep": 0 + }, + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 13.993530059, + "logical_kv_bytes_first_decode": 539230208, + "physical_kv_bytes_first_decode": 31719424, + "physical_kv_bytes_peak": 54788096, + "prefill_s": 33.845659914, + "prefill_tokens_computed": 700, + "tokens_per_s_decode": 9.147084364011228, + "tokens_per_s_total": 2.675583740674932, + "total_s": 47.8400276, + "ttft_ms_max": 35599.744710000006, + "ttft_ms_mean": 35599.737 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 12.992392891, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 507510784, + "physical_kv_bytes_after_prefill": 42532864, + "physical_kv_bytes_end": 54067200, + "prefill_s": 51.356783501, + "prefill_tokens_computed": 880, + "tokens_per_s_decode": 9.851918816946128, + "tokens_per_s_total": 1.9829526346197537, + "total_s": 64.550205469, + "ttft_ms": 53233.209705 + }, + "control_prefill_s": 29.680487459, + "decode_steps": 8, + "n": 16, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 507510784, + "prefill_s": 474.887799344, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 4096000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 700, + "rep": 1 + } + ], + "commit": "f2a5a275023e35897c5e8d84af1d46862dc7833a", + "complete": true, + "dirty": false, + "hardware": { + "cpu_parts": [ + "0xd87", + "0xd85" + ], + "loadavg_at_start": "8.81 10.51 11.46 2/1636 470703\n", + "lscpu_model": "Model name: Cortex-A725\nModel name: Cortex-X925", + "processors": 20, + "uname": "Linux spark-b87b 7.0.0-1019-nvidia #19~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Sun Sep 6 18:35:11 UTC 2 aarch64 aarch64 aarch64 GNU/Linux" + }, + "knobs": { + "decode_steps": 8, + "n": [ + 1, + 2, + 4, + 8, + 16 + ], + "parity_branches": 2, + "prefill_chunk": 128, + "prefix_tokens": [ + 40, + 200, + 700 + ], + "reps": 2 + }, + "model": { + "id": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "kv_block_size": 16, + "path": "/home/drakestapleton/models/TinyLlama-1.1B-Chat-v1.0/model.safetensors" + } +} \ No newline at end of file diff --git a/docs/campaigns/c6-prefill-bench/evidence/ltc6-smoke2.json b/docs/campaigns/c6-prefill-bench/evidence/ltc6-smoke2.json new file mode 100644 index 00000000..d5a19a11 --- /dev/null +++ b/docs/campaigns/c6-prefill-bench/evidence/ltc6-smoke2.json @@ -0,0 +1,93 @@ +{ + "baseline_label": "MODELED vLLM automatic prefix caching, not a vLLM run", + "bench": "prefill_bench", + "cells": [ + { + "aien": { + "blocks_still_allocated_after_run": 0, + "decode_s": 3.131402933, + "logical_kv_bytes_first_decode": 46858240, + "physical_kv_bytes_first_decode": 9371648, + "physical_kv_bytes_peak": 12255232, + "prefill_s": 8.54119836, + "prefill_tokens_computed": 200, + "tokens_per_s_decode": 5.109530885145913, + "tokens_per_s_total": 1.370702743752953, + "total_s": 11.672844512, + "ttft_ms_max": 9330.638165, + "ttft_ms_mean": 9330.637032999999 + }, + "aien_error": null, + "baseline_modeled_vllm_apc": { + "decode_s": 3.041935419, + "kv_bytes_source": "bookkeeping model (examples/prefill_bench/vllm_model.rs), not measured", + "logical_kv_bytes_after_prefill": 37486592, + "physical_kv_bytes_after_prefill": 11534336, + "physical_kv_bytes_end": 11534336, + "prefill_s": 11.271426691, + "prefill_tokens_computed": 224, + "tokens_per_s_decode": 5.259809231998688, + "tokens_per_s_total": 1.1171343820918391, + "total_s": 14.322359294, + "ttft_ms": 11977.153574 + }, + "control_prefill_s": 7.414129802, + "decode_steps": 4, + "n": 4, + "naive_no_sharing_modeled": { + "physical_kv_bytes_after_prefill": 37486592, + "prefill_s": 29.656519208, + "source": "N x control one-shot prefill time; N x ceil(len/block) blocks" + }, + "parity": { + "aien_vs_baseline_all_branches": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 512000 + }, + "aien_vs_control": { + "bit_differences": 0, + "max_abs": 0.0, + "values": 256000 + }, + "baseline_vs_control": { + "bit_differences": 0, + "max_abs": 0.0 + }, + "compared_branches_vs_control": 2 + }, + "prefix_tokens": 200, + "rep": 0 + } + ], + "commit": "f2a5a275023e35897c5e8d84af1d46862dc7833a", + "complete": true, + "dirty": false, + "hardware": { + "cpu_parts": [ + "0xd87", + "0xd85" + ], + "loadavg_at_start": "8.69 12.86 12.23 3/1617 385643\n", + "lscpu_model": "Model name: Cortex-A725\nModel name: Cortex-X925", + "processors": 20, + "uname": "Linux spark-b87b 7.0.0-1019-nvidia #19~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Sun Sep 6 18:35:11 UTC 2 aarch64 aarch64 aarch64 GNU/Linux" + }, + "knobs": { + "decode_steps": 4, + "n": [ + 4 + ], + "parity_branches": 2, + "prefill_chunk": 128, + "prefix_tokens": [ + 200 + ], + "reps": 1 + }, + "model": { + "id": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "kv_block_size": 16, + "path": "/home/drakestapleton/models/TinyLlama-1.1B-Chat-v1.0/model.safetensors" + } +} \ No newline at end of file