Skip to content

inspector: cKDTree-based KNN for fast neighbor lookup on click#486

Draft
ElmoPA wants to merge 4 commits into
aidan/pi-6dfrom
elmo/inspector-knn-tree
Draft

inspector: cKDTree-based KNN for fast neighbor lookup on click#486
ElmoPA wants to merge 4 commits into
aidan/pi-6dfrom
elmo/inspector-knn-tree

Conversation

@ElmoPA

@ElmoPA ElmoPA commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

ElmoPA commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@aidang3019
aidang3019 changed the base branch from elmo/latent-dataset-stride-filters to graphite-base/486 June 11, 2026 20:50
@aidang3019
aidang3019 force-pushed the elmo/inspector-knn-tree branch from 2c8a0d7 to 5c56d8f Compare June 11, 2026 20:50
@aidang3019
aidang3019 changed the base branch from graphite-base/486 to aidan/pi-6d June 11, 2026 20:50
@aidang3019
aidang3019 force-pushed the elmo/inspector-knn-tree branch 2 times, most recently from ef48d0d to f0bd0eb Compare June 13, 2026 20:35
@aidang3019
aidang3019 changed the base branch from aidan/pi-6d to graphite-base/486 June 16, 2026 02:18
@aidang3019
aidang3019 force-pushed the elmo/inspector-knn-tree branch from f0bd0eb to 807d103 Compare July 7, 2026 02:57
@aidang3019
aidang3019 force-pushed the graphite-base/486 branch from 2c53ef8 to 43c897b Compare July 7, 2026 02:57
@aidang3019
aidang3019 changed the base branch from graphite-base/486 to aidan/pi-6d July 7, 2026 02:57
@aidang3019
aidang3019 force-pushed the elmo/inspector-knn-tree branch from 807d103 to 2a01b14 Compare July 7, 2026 03:36
@aidang3019
aidang3019 changed the base branch from aidan/pi-6d to graphite-base/486 July 8, 2026 00:45
This was referenced Jul 8, 2026
ElmoPA and others added 4 commits July 20, 2026 22:45
…ector

Audit follow-up on the latent-KNN stack: frames not covered by any
annotation span were never filtered from the KNN — they only collapsed
into a whole-recording fallback action in the dedupe, so unannotated
frames still surfaced as neighbors (and competed in pair ranking).

Extraction side (the clean path — banks become annotation-clean at the
source):
- AnnotatedFramesDataset: MultiDataset wrapper keeping only frames inside
  >=1 annotation span, unioned across every `annotations*` array (legacy
  flat + role-keyed annotations_task/annotations_subtask). Composable
  under EvenStrideDataset (re-exports _global_indices_by_dataset).
- latent_dataset: annotated_frames_only wiring in build_dataset + ported
  build_even_stride factory; cotrain_pi_latent.yaml defaults it to true.
- eval_latent: port the layer_subset / front_tokens_only / capture_lang
  capture options the fulldata run used (from the uncommitted 6dstack
  checkout) on top of the source-frame_idx machinery.
- sortpp_latent_stride15 + cotrain_sort_pp_lang_6d data configs and the
  precompute_knn.py sidecar producer committed (previously uncommitted in
  the 6dstack checkout); stride15 extraction now annotated_frames_only.
- _has_annotation: role-keyed fallback when the flat `annotations` array
  is absent.

Inspector side (defense in depth for banks that still carry unannotated
rows):
- annotation_intervals unions all `annotations*` arrays (role-keyed ready).
- _row_action_ids: rows outside every span get id -1;
  _dedupe_neighbors_by_action drops them, so they never appear in the
  scatter KNN, the browser precomputed fast path, or the computed scan;
  same-embodiment mode masks them explicitly; pair_rank excludes them
  from queries and candidates.
- Legacy banks whose frame_idx is the per-run sample counter (e.g. the
  fulldata_2026-07-07 artifacts) are detected
  (_frames_look_like_source_indices) and keep the old fallback behavior
  with a loud warning — counter rows cannot be mapped to spans, so those
  banks need re-extraction to be filterable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ions

Every episode in that folder carries an empty `annotations` array, so the
July-7 fulldata bank's aria half has zero annotation coverage. With
annotated_frames_only this config now fails loudly there; point
human_bimanual at sortpp_aria_new or sortpp_aria_rolekeys instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ZarrDataset surfaces the true source frame index and PILatentEvalVideo
consumes it, but process_batch_for_training rebuilt the batch keeping
only norm-stat keys + episode_hash — frame_idx never reached the latent
writer, which silently fell back to the per-run sample counter (caught
by the annfilter smoke: every CSV frame_idx was <= n_samples). Forward
frame_idx alongside episode_hash so bank rows can be mapped to
annotation spans.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@aidang3019
aidang3019 force-pushed the elmo/inspector-knn-tree branch from 2a01b14 to 8b878cc Compare July 21, 2026 03:09
@aidang3019
aidang3019 changed the base branch from graphite-base/486 to aidan/pi-6d July 21, 2026 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant