Skip to content

[FEATURE] Add S3 doc-store option to WikiHow extraction benchmark - #421

Open
noel-improv wants to merge 2 commits into
awslabs:mainfrom
noel-improv:feat/benchmark-s3-doc-store
Open

[FEATURE] Add S3 doc-store option to WikiHow extraction benchmark#421
noel-improv wants to merge 2 commits into
awslabs:mainfrom
noel-improv:feat/benchmark-s3-doc-store

Conversation

@noel-improv

@noel-improv noel-improv commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Description

The extraction benchmark hardcoded FileBasedDocs (local disk), so it could not measure the cost of S3-backed document storage. This adds a BENCHMARK_DOC_STORE switch in the shared run_benchmark_extract path, so any dataset (ConcurrentQA, WikiHow, PGA) can use it. It defaults to local disk, so with the variable unset every dataset runs as before. The scale runs below use WikiHow.

Changes

  • benchmark_extract.py: read BENCHMARK_DOC_STORE (file default, or s3). When s3, use S3BasedDocs with BENCHMARK_S3_JSONL selecting the per-chunk or JSONL path, and collection_id=None (timestamp per run) so repeated runs land in separate collections. Log the resolved store, flag, and collection id.
  • benchmark_extract.py: when s3 is selected, validate AWS_REGION_NAME/S3_RESULTS_BUCKET/S3_RESULTS_PREFIX are set and raise a ValueError naming any that are missing, instead of a bare KeyError (these vars are not otherwise required in non-batch prototype runs).
  • build-tests.sh: propagate BENCHMARK_DOC_STORE and BENCHMARK_S3_JSONL into .env.testing so they reach the notebook.

Problem

benchmark_extract built FileBasedDocs unconditionally, so there was no way to benchmark extraction against S3. The switch lives in the shared helper, not one dataset's test, because the document store is a generic NodeHandler swap that any run should be able to opt into. The build-tests.sh change is needed too: without it the variables stay in the caller's shell, the notebook never sees them, and the run silently falls back to FileBasedDocs.

Related issue (if any): #

Testing

  • Unit tests added/updated
  • Integration tests added (as appropriate)
  • Existing tests pass (pytest)
  • Tested manually (describe below)

Ran the WikiHow 5,000-doc extraction on a SageMaker notebook across all three settings: file (33m 33s), s3 with BENCHMARK_S3_JSONL=false (42m 21s), and s3 with BENCHMARK_S3_JSONL=true. Each run logged the expected Doc store: line and produced the expected object layout (16,536 per-chunk objects vs one JSONL per source document). The default (file, unset) reproduces the prior behaviour unchanged.

Checklist

  • Code follows existing style and conventions
  • License headers present on new files
  • Documentation updated (if applicable)
  • No breaking changes (or clearly documented)

No new files (existing headers unchanged). Default behaviour is identical to before when the new variables are unset.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…n benchmark

benchmark_extract hardcoded FileBasedDocs (local disk), so the benchmark could
not measure S3-backed document storage. Add a BENCHMARK_DOC_STORE env switch:
"file" (default, unchanged behaviour) keeps FileBasedDocs; "s3" uses
S3BasedDocs, with BENCHMARK_S3_JSONL selecting the per-chunk or JSONL write
path. S3BasedDocs uses collection_id=None (timestamp per run) so repeated runs
do not accumulate into one collection. A log line records the resolved store,
flag, and collection_id.

build-tests.sh propagates the two new variables into .env.testing so they
reach the notebook; without this they stay local to the caller's shell and the
run silently falls back to FileBasedDocs.
@noel-improv
noel-improv marked this pull request as ready for review July 23, 2026 23:23
…hmark

BENCHMARK_DOC_STORE=s3 read AWS_REGION_NAME/S3_RESULTS_BUCKET/S3_RESULTS_PREFIX
via plain os.environ[...]. In non-batch (prototype) runs those vars are not
otherwise required, so a missing one raised a bare KeyError and aborted the run
before extraction. Check them up front and raise a clear ValueError naming the
missing variables.
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