Skip to content

Require full-data-scale efficiency; prefer standard MEDS tooling - #57

Merged
florian6973 merged 1 commit into
mainfrom
efficiency-guidance
Nov 30, 2026
Merged

florian6973 merged 1 commit into
mainfrom
efficiency-guidance

Conversation

@florian6973

@florian6973 florian6973 commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Curiosity passed every gate on the synthetic fixture and the MIMIC-IV demo. Then on NWICU:

  • it ran out of GPU memory twice, once in pretraining and once in generation;
  • its generation needed 29 minutes per prediction time, which projects to about 2,700 GPU-hours for the held-out set.

The causes were generic implementation patterns that small fixtures never expose:

  • recomputing a shared prompt for each of 100 samples;
  • logits for every prompt position;
  • five sequential groups;
  • a Python loop with a GPU-to-CPU synchronisation per sample per token;
  • float32 inference that fell back to materialised attention.

Nothing in the template asked implementers to write for full-data scale, or to project cost before a full run.

What

  • Guide, section 4: a new "Efficiency at realistic scale" subsection, applied where relevant:
    • reuse shared work (prefix or prompt caches, last-position outputs, cached per-subject features);
    • batch to memory, with no per-item Python loops or host-device syncs in inner loops; check termination every few dozen iterations; preallocated buffers;
    • inference in the training compute dtype with fused kernels;
    • memory bounded by the longest realistic input, tested with a long synthetic input; lazy or sharded reads;
    • results independent of batch size (per-item seeding), otherwise record the setting;
    • reuse the source's efficient paths.
    • Then time a realistic slice and project each step's full-data cost (time per unit × units, peak memory) in IMPLEMENTATION_REPORT.md, and optimize or ask if the projection exceeds the approved resources.
  • Staged gates: the MIMIC-IV demo gate also measures per-unit cost, and the demo report must include each step's projected full-data cost before the human gate.
  • Guide, "Reuse the source implementation": when reimplementing, or the source has no pipeline for a step, prefer MEDS-Transforms stages (code filtering, normalization, quantile binning, time-delta tokens) and meds-torch-data (tensorized loading) over bespoke code, where they reproduce the source's representation. Algorithm-specific tokens stay in the package, and which steps use which tool is recorded.
  • AGENTS.md: one bullet for each rule.

Checks

  • ruff check and ruff format --check pass.
  • pytest -q: 87 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NJQdbHt5icm1CgFVHsHTNx

Curiosity passed every gate on the fixture and demo, then needed 29 min
per NWICU prediction time (about 2,700 GPU-h for the held-out set): five
sequential groups, a per-sample host sync each token, float32 inference
that fell back to materialized attention.

- Guide, section 4: "Efficiency at realistic scale": reuse shared work
  (prefix caches, last-position outputs, per-subject features), batch to
  memory with no per-item Python loops or host-device syncs in inner
  loops, preallocated buffers, inference in the training dtype with
  fused kernels, memory bounded by the longest real input,
  batch-independent results, the source's efficient paths; then time a
  realistic slice and project each step's full-data cost in the report.
- Gates 4-5: the demo measures per-unit cost; the demo report projects
  each step's full-data cost before the human gate.
- AGENTS.md summarises the rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJQdbHt5icm1CgFVHsHTNx
@florian6973
florian6973 merged commit 560c1a8 into main Nov 30, 2026
1 check passed
@florian6973 florian6973 changed the title Require implementations to be efficient at full-data scale Require full-data-scale efficiency; prefer standard MEDS tooling Dec 1, 2026
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