PLUG-challenge / docs /architecture.md
alanclayrichard's picture
lohi splits and supervised and unsupervised tracks
49442cb
|
Raw History Blame Contribute Delete
7.17 kB

Architecture, and what changed from the template

This challenge is modelled on OpenADMET's blind-challenge-template. The participant-facing shape is deliberately the same β€” a Gradio Space with About / Submit / Leaderboard / FAQ tabs, a config.py holding every challenge-specific string, a separate scoring library with its own tests, anonymity and disclosure flags on the leaderboard, and a submission cooldown. The backend is not.

The template's architecture

Space (Gradio) ──upload──► S3 submissions/
                              β”‚
                          EventBridge (scheduled)
                              β–Ό
                          Lambda (scoring image from ECR)
                              β”œβ”€β”€β–Ί S3 scores/
                              └──► Discord webhook
                          Lambda (leaderboard) ──► S3 leaderboard/*.csv
                              β–²
Space ────────────readβ”€β”€β”€β”€β”€β”€β”€β”˜

Submissions are asynchronous because the challenge is blind: a participant must not learn their score immediately, or the held-out labels leak one submission at a time. That requirement is what buys the queue, the container image, the OpenTofu stack, the OIDC deploy role and the Discord receipts.

This challenge's architecture

Space (Gradio)
  β”œβ”€β”€ validate bundle            plug_challenge.validation
  β”œβ”€β”€ score vs held-back labels  plug_challenge.scoring     ◄── private repo: ground_truth/
  β”œβ”€β”€ store bundle + metadata                               ──► private repo: submissions/
  β”œβ”€β”€ store scores                                          ──► private repo: scores/
  └── append leaderboard row                                ──► private repo: leaderboard/entries.csv
                                                                     β”‚
Space leaderboard tabs ──────────────readβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

public repo: manifest (ids + Lo-Hi splits) / proteins.csv   ──► participants
             (labels come from each benchmark's original source)

PLUG is not blinded, so scoring can happen inside the request. Removing the asynchrony removes everything the asynchrony was for:

Template Here Why
S3 bucket private Hub dataset repo One storage system, and it is the one the Space already authenticates to
Scoring Lambdas + ECR image + EventBridge a function call in the Submit handler Nothing to queue when the answer is allowed to be immediate
Leaderboard Lambda aggregate.build_leaderboard, called on read The board is small; ranking it per page load is cheaper than storing a ranked copy
OpenTofu stack, OIDC deploy role, AWS_DEPLOY_ROLE_ARN β€” No cloud account
GitHub repo deploying an hf_space/ subtree this repo is the Space No second repo, no deploy workflow, no HF_TOKEN in GitHub
Discord webhook receipts the response in the Submit tab The participant already sees their per-benchmark scores and PLUG Score
interim / final / live leaderboards one board per track (supervised, unsupervised), frozen at phase 2 The interim/final split exists to stage the reveal of blinded results; the tracks instead separate methods fitted to these labels from methods that never see them
ACTIVITY_DATASET_SIZE constants the ids in the ground truth Row counts are read from the data rather than restated in config, so they cannot drift

What that costs: there is no queue to absorb a burst, and a long scoring run would block a request. Every metric is one or two NumPy passes over the scored rows, so a supervised bundle (the Lo-Hi test rows, about 210,000 datapoints) scores in a second or two. An unsupervised bundle is every row β€” about 6.5 million datapoints, dominated by DMS's 2.5 million variants and the three per-residue benchmarks β€” and is a ~37 MB zip that validates in ~3 s and scores in ~25 s on a laptop. That is slow for a request but still fits in one. Bootstrap resampling is off by default for the same reason, noted in scoring.md: 1000 resamples of eleven benchmarks is not a request-time workload.

Ordering guarantees in the Submit handler

The order in submission.submit_bundle is the part worth not breaking:

  1. Identity and form checks β€” cheapest, and they need no data.
  2. Cooldown check β€” before any work, so a rate-limited user pays nothing.
  3. Validation β€” before anything is stored. A malformed bundle costs the participant nothing and does not start their cooldown, which is what makes "validate locally, then upload" a reasonable instruction rather than a trap.
  4. Scoring β€” after validation, so the scorer can assume a clean join.
  5. Store the bundle and metadata β€” the durable record.
  6. Store the scores, then append the leaderboard row β€” in that order, so a failure between them leaves a scored submission that plug-challenge rebuild can recover, rather than a leaderboard row with nothing behind it.

Consistency: one source of truth

plug_challenge/benchmarks.py declares each benchmark's submission schema, ground-truth schema and metrics. Generated from it: the validator's column and range checks, the scorer's metric dispatch, the leaderboard's columns and sort order, the Submit tab's per-file schema tables, and the FAQ's format rules. The template keeps its endpoint lists in two files (backend/config.py and hf_space/config.py) and asks you to keep them in sync by hand; collapsing that into one import is the one place this repo departs from the template's structure on purpose.

Threat model

It is worth being precise about what the held-back labels do and do not buy.

Prevented. Self-reported numbers. Every leaderboard value was computed here from an uploaded bundle that is still on file.

Bounded. Fitting the test set by repeated submission. The cooldown (HOURS_BETWEEN_SUBMISSIONS, 12) and latest-submission-only ranking make this slow and visible, but eleven scalars per attempt is still information. A determined participant with months can extract some of it.

Not prevented. Sybil accounts. Hugging Face username validation is a typo check, not an identity proof, and nothing here ties an account to a person. BANNED_USERNAMES in utils.py is the manual remedy.

Not prevented. Fitting the unsupervised track to its labels. That track is scored on every row, train and val included, and those labels are available from the original sources. The required method link is how a method's track is checked, by reading it, not enforced.

Out of scope. Training on the test proteins. The splits are public by design β€” you cannot predict for them otherwise β€” and PLUG's whole subject is what it costs when training data resembles test data. The method report link (required on every submission) and the proprietary-data flag are how that gets disclosed, not prevented.