Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 7,168 Bytes
b78ff28 49442cb b78ff28 49442cb b78ff28 49442cb b78ff28 49442cb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | # Architecture, and what changed from the template
This challenge is modelled on
[OpenADMET's blind-challenge-template](https://github.com/OpenADMET/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`](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.
|