aisimulate-fpm-dataset / docs /measurement-protocols.md
nv-simonec's picture
feat: migrate measurement manifests to v5 and Parquet (#16)
e62c2f6
|
Raw History Blame Contribute Delete
9.28 kB

Measurement Protocols

Measurement protocols describe usable latency truth. They are independent of model, workload generator, campaign, release, and collection topology.

FPM Parquets are predictor inputs governed by the aic_fpm_forward_perf schema. They do not declare a measurement protocol. Summary-only evidence uses an evidence_format_id, not a measurement protocol.

Supported protocols

Protocol Record meaning Schema
forward-pass-measurement-v1 Full scheduler observation with rank-local timing and request state. forward-pass-measurement-v1.schema.json
forward-pass-record-v1 Minimal self-contained workload coordinates and measured latency. forward-pass-record-v1.schema.json

The protocol ID is stored in measurement_protocol_id in the measurement manifest and as measurements.protocol_id in the configuration manifest. An unknown protocol is an incompatible contract and must fail validation.

forward-pass-measurement-v1

This protocol retains captured scheduler state and rank-local latency. Its canonical record is synchronizedIteration: one evaluation target containing every contributing rankObservation in rank_measurements. A rank observation stores the worker and rank identity, rank-local counter and wall time, scheduled requests, and queued requests.

The canonical record separates who emitted a measurement from how its ranks were synchronized:

Field Meaning
source_kind self_benchmark or rank_event_stream.
producer Component that created the rank-local FPM measurements.
collector Optional separate capture component. Required for a listener receive-time-window join.
grouping Iteration membership method, authority, and source evidence.

The grouping.method records how the ranks became one iteration:

Method Purpose Required source evidence
single_rank Normalize a rank-event iteration with one attention-DP rank. One rank observation; producer authority.
benchmark_id Normalize ranks grouped by a self-benchmark producer. benchmark_id, benchmark point, and producer authority.
listener_receive_time_window Reconstruct an iteration from separately received rank events. Engine role, raw _recv_ts, clock-group offsets, corrected window start and size, collector provenance, and derived authority.
pre_grouped Consume explicit rank membership already supplied by the uploader. File-level producer, expected ranks, grouping authority, and hashed processing/alignment provenance. No receive-time window is imposed.

All methods produce the same canonical measurement. For a complete iteration, rank_measurements contains exactly the declared expected_dp_ranks, sorted by dp_rank, and max_rank_wall_time caches the maximum rank-local wall_time as the default scoring latency. Consumers may derive another latency policy from the retained, authoritative rank measurements. A consumer records the policy it uses in its own result provenance. Incomplete groups retain their available ranks with max_rank_wall_time: null.

Measurement v5 stores canonical bulk data in typed Parquet. Storage schemas are declared separately from these semantic protocols; see the storage and collection contract. Grouped iterations keep typed rank lists, while ungrouped observations remain ungrouped. Logical file/record references preserve identity and evaluation order independently of physical rows and row-group boundaries.

The following producer formats remain supported for import and older pinned snapshots. Original compressed captures can remain as supporting evidence:

  • Rank observation streams store one rankObservation per JSONL line. A standalone row is directly evaluable only when the configuration has one attention-DP rank. Multi-rank streams require raw listener receive timestamps, explicit clock correction, and a declared time window. File order, exact timestamp equality, and rank-local counter_id are not join keys.
  • Self-benchmark files store iteration_groups. Their rank_results[].fpms[0] records normalize to canonical rank_measurements[] with source_kind: self_benchmark and grouping.method: benchmark_id; the source wall_time normalizes to max_rank_wall_time after validation against the nested ranks.
  • Canonical iteration streams store one synchronizedIteration per JSONL line.
  • Pre-grouped list files (.json or .json.gz) store [[iteration0_rank0, iteration0_rank1, ...], [iteration1_rank0, ...], ...]. Measurement-manifest file entries declare representation: pre_grouped_rank_lists, iteration_count, rank_record_count, and grouping metadata. Every truth group contains exactly the sorted expected ranks. DP1 uses singleton lists. Incomplete groups may be retained under provenance as supporting evidence; they are not complete-iteration truth. scripts/pre_grouped.py normalizes each inner list into a canonical iteration, deriving a stable ID from the measurement file ID and outer index, and maximum latency from the rank values. It never repeats the uploader's matching procedure. authority: derived explicitly distinguishes audited offline inference from producer-certified IDs.

Listener _recv_ts values are assigned independently when each rank event is received, so equal timestamps must not be expected. A dataset importer may use listener_receive_time_window only when the source preserves _recv_ts and the grouping provenance declares reproducible clock offsets and window rules. The GLM DEP16 campaign corrects its four node clocks, then groups distinct ranks within an 8 ms half-open window. Importers and consumers apply the serialized receive timestamps and clock offsets as exact decimal values when selecting the window anchor and enforcing the half-open boundary.

Zero-time observations and empty scheduler heartbeats may remain in source evidence, but consumers exclude them from measured points.

The pre-grouped representation can preserve producer-certified grouping or an explicitly audited uploader algorithm, including sequence-based reconstruction. Duration similarity may be a feature of such an algorithm; after-matching similarity is then not independent evidence of timing accuracy. See each file's grouping provenance rather than assuming equal counters or close receive times.

Request metrics use the following fields. Missing metrics normalize to zero.

Field Meaning
num_prefill_requests Scheduled or queued prefill request count.
sum_prefill_tokens New prefill tokens computed in the iteration.
sum_prefill_kv_tokens Previously computed prefix or prior-chunk tokens read from KV cache by prefill requests.
num_decode_requests Scheduled or queued decode request count.
sum_decode_kv_tokens Total KV context length across decode requests.
var_prefill_length Population variance of full prompt lengths across prefill requests.
var_decode_kv_tokens Population variance of KV context lengths across decode requests.

Workload kind is derived from scheduled request metrics. It is not encoded in the protocol ID.

forward-pass-record-v1

This protocol is the minimum self-contained record needed for FPM evaluation. It is used when the original measurement stream is external but a hashed, derived truth table is retained.

Field Requirement
measurement_id Stable non-empty record identity.
phase prefill or decode.
batch_size Positive request count.
total_prefill_tokens Positive for prefill; zero or empty for decode.
total_kv_read_tokens Non-negative; an empty value normalizes to zero.
truth_latency_ms Finite, positive observed latency in milliseconds.
source_file Optional source provenance.
source_row Optional one-based source row.

The current physical representation is CSV or gzip-compressed CSV. The schema applies after CSV text values are decoded to their logical types. Empty token cells normalize to zero.

For prefill records, batch_size, total_prefill_tokens, and total_kv_read_tokens map to scheduled prefill request count, new tokens, and prefill KV reads. For decode records, batch_size and total_kv_read_tokens map to scheduled decode request count and decode KV reads.

Supporting evidence

wave-summary-v1 and bucket-summary-v1 describe summaries that cannot reconstruct the scheduler inputs and observed latency required for evaluation. They are evidence formats, not measurement protocols. Their bundles set measurement_protocol_id to null and use only supporting-evidence file roles.

A protocol bundle may also carry explicitly reviewed non-truth files with the supporting_evidence role, stored under measurements/provenance/; they never count as measured points.

Availability labels such as ready, no_measurements, and supporting_evidence_only are derived by consumers. They are not stored in this repository.