Spaces:
Running
SupraDashboard β Product Spec (v0)
CB[7] (cucurbit[7]uril) hostβguest binding-affinity (logKa) reasoning dashboard. Gradio app β Hugging Face Docker Space. Inference via a CLIPROXYAPI OpenAI-compatible endpoint (codex closedbook GPT-5.5). Public GitHub repo, unpublished research β no private prompts/data committed.
1. Problem & goal
We have an LLM reasoning system that predicts CB[7] hostβguest binding affinity
(logKa) from precomputed molecular features, producing a chain-of-thought with
numbered binding-driver rules, a one-line summary, and a numeric prediction. The
research is unpublished and the reasoning quality must be judged by domain experts,
not by automated metrics alone. The goal of v0 is a lightweight internal review
tool: pick a guest, render its structure, run three reasoning trajectories
(physics-guided / chemistry-guided / combined) over precomputed features, show each
trajectory's predicted logKa + <tldr> + the combined <think> reasoning (rule
headers color-coded), and capture a structured expert reasoning-quality rating plus
a free-text comment β so we accumulate expert judgments on whether the model's
reasoning is chemically sound.
2. Target users & job-to-be-done
- Primary users: ~3 domain-expert supramolecular chemists (internal collaborators).
- NOT a public consumer app; no anonymous traffic, no scale concerns.
- Job-to-be-done: "For this guest, is the model's reasoning chemically sound, and where does it go wrong?" β read the structure + features + reasoning, then record a calibrated quality rating and pinpoint flawed feature interpretations in a comment, fast enough to review many guests in a sitting.
3. v0 scope
MUST have
- Guest selection from a dropdown populated by the private HF feature dataset.
- RDKit 2D structure render from the guest SMILES.
- Three reasoning trajectories per guest β physics-guided, chemistry-guided, combined β each calling the CLIPROXYAPI endpoint over that guest's precomputed features (physics/chemistry trajectories receive feature subsets; combined gets all).
- Parse and display from each trajectory: predicted
logKa(<answer>), one-line<tldr>; show the combined trajectory's<think>reasoning with numbered binding-driver rule headers bolded and color-coded. - A predicted-logKa comparison table (combined / physics / chemistry).
- Expert rating widget with the 5-point scale (Absolutely right / Mostly right / Partially right (mixed) / Mostly wrong / Absolutely wrong) + free-text comment, persisted to a feedback store.
- Config entirely by env vars / Space Secrets β no secrets in code or repo.
- Password login wall via
APP_AUTH(Gradioauth); recommended on by default. - Production prompts loaded at runtime from
PROMPT_DIR(never committed); repo ships only a generic public-safe prompt scaffold. - Features pulled at runtime from a private HF dataset via
HF_TOKEN. - Loading / busy state during the (slow) inference call so reviewers aren't left staring at a frozen UI.
- Persistent feedback on Spaces (point
FEEDBACK_DBat the/datamount). - An admin/export path to retrieve collected ratings (CSV/rows).
Out of scope / deferred (design-for-later, do NOT build in v0)
- Live feature computation (docking / xtb / RDKit conformer generation). v0 uses
precomputed features only. The Docker Space base is chosen so xtb/docking can be
added later β keep
data_loaderthe single seam where "precomputed vs live" is decided. - Multi-user accounts / per-reviewer identity & auth roles (shared password only in v0; see Open Questions on reviewer attribution).
- Editing/curating features or prompts from the UI.
- Inter-rater agreement analytics, dashboards over collected ratings, model retraining hooks.
- Public/anonymous deployment, rate limiting, abuse protection.
- Batch / bulk scoring of many guests in one action.
- Result caching across sessions (see Open Questions β may be promoted into v0).
4. User flow (happy path)
- Reviewer opens the Space, passes the
APP_AUTHpassword wall. - App shows a health line (proxy configured? dataset loaded?) and a guest dropdown.
- Reviewer picks a guest and clicks Run prediction.
- UI enters a loading state; the three trajectories run and the proxy returns text.
- App renders: guest 2D structure; predicted-logKa table (combined/physics/chemistry);
physics
<tldr>; chemistry<tldr>; combined<think>reasoning with color-coded numbered rule headers. - Reviewer reads the reasoning, picks a 5-point rating, and writes a comment.
- Reviewer clicks Submit feedback; a confirmation with the saved row id appears.
- Reviewer picks the next guest and repeats.
5. Functional requirements
- FR1 β The app SHALL load the guest list from the private HF dataset (
HF_DATASET, defaultSupraBench/physics_feature) usingHF_TOKEN, with aLOCAL_FEATURESCSV fallback for offline dev. Dropdown labels useguest_name, falling back toinchikey. - FR2 β On guest selection, the app SHALL render a 2D RDKit structure from the guest's SMILES, and SHALL degrade gracefully (no crash, empty image) on missing/ invalid SMILES or absent RDKit.
- FR3 β The app SHALL build three prompts per guest: physics (physics feature
subset), chemistry (complementary subset), combined (all features), using the
scaffold prompts unless
PROMPT_DIR/{physics,chemistry,combined}.txtoverrides exist. - FR4 β The app SHALL call the CLIPROXYAPI OpenAI-compatible endpoint
(
CLIPROXY_BASE_URL,CLIPROXY_API_KEY,CLIPROXY_MODEL) once per trajectory and return the raw completion text. - FR5 β The app SHALL parse
<answer>β numeric logKa,<tldr>β summary, and<think>β reasoning from each completion, tolerating missing tags (showβ). - FR6 β The app SHALL display a logKa comparison table for the three trajectories
and render the combined
<think>with numbered rule headers (N. Title β β¦orN. Title: β¦) bolded and color-coded by rule index. - FR7 β The app SHALL present the 5-point reasoning-quality rating and a free-text comment box, and SHALL refuse submission with a visible warning if no rating is chosen.
- FR8 β On submit, the app SHALL persist
{ts (UTC ISO), inchikey, guest_name, rating, comment, reviewer}to the feedback store and confirm with the row id. - FR9 β Feedback SHALL persist across Space restarts when
FEEDBACK_DBpoints at the persistent-storage mount; otherwise it MAY be ephemeral (documented). - FR10 β The app SHALL enforce a password login wall when
APP_AUTHis set (comma-separateduser:passpairs) and run open when it is blank. - FR11 β The app SHALL show a health/status line indicating whether the proxy is configured and whether the dataset loaded, surfacing config errors as readable text rather than crashing on startup.
- FR12 β There SHALL be a path to export all collected feedback rows (e.g. an admin export tab / CSV download), gated behind the same access control.
6. Non-functional requirements
- NFR1 (latency / async). codex closedbook inference is slow (multi-second to tens-of-seconds per call) and v0 runs three calls per guest. The UI MUST show an explicit loading/busy state on Run prediction and MUST NOT appear frozen. Long request timeouts MUST be configured on the proxy client; a per-call failure SHOULD surface as readable error text without losing already-rendered panels. (Sequential vs concurrent execution and caching are Open Questions that directly affect perceived latency.)
- NFR2 (secrets). No secret (
CLIPROXY_API_KEY,HF_TOKEN) ever appears in code, logs, or the repo. All config is env vars locally (.env, gitignored) / Space Secrets in prod. Only.env.example(placeholders) is committed. - NFR3 (no data/prompt leakage). The public repo MUST contain no unpublished data
and no production prompts β features come from the private HF dataset at runtime;
production prompts mount via
PROMPT_DIR. CI/repo hygiene MUST keep feature CSVs and prompt files out of git. - NFR4 (access control). Because the research is unpublished, the deployed Space
SHOULD keep
APP_AUTHset and/or be a private Space. Access is a shared password for the ~3 reviewers in v0. - NFR5 (graceful degradation). Missing dataset, unconfigured proxy, missing RDKit, or malformed model output MUST degrade to readable status/placeholder, never an uncaught crash at startup or per-guest.
- NFR6 (portability). Runs identically locally (
python app.py, port 7860) and on a HF Docker Space; RDKit native libs provided in the Dockerfile.
7. Acceptance criteria (verifier checklist)
- With valid
.env,python app.pyserves the dashboard on :7860. - The guest dropdown is populated from the (private HF or
LOCAL_FEATURES) dataset. - Selecting a guest + Run prediction renders the 2D structure for a valid SMILES.
- Three trajectories execute and a logKa table shows combined/physics/chemistry values
(or
βwhen a tag is missing). - Physics and chemistry
<tldr>lines render; combined<think>renders with numbered rule headers color-coded. - A loading/busy indicator is visible while inference runs.
- Submitting without a rating shows a warning and does not persist a row.
- Submitting with a rating persists a row and confirms a row id; the row survives a
restart when
FEEDBACK_DBis on persistent storage. - With
APP_AUTHset, the app requires login; blank disables it. - With the proxy or dataset misconfigured, the app starts and shows a readable status error instead of crashing.
-
git grepfinds no real API keys,HF_TOKEN, production prompts, or feature CSVs in the repo; only.env.exampleplaceholders are present. - Collected feedback can be exported (rows/CSV) by an admin path.
8. Open questions / decisions needed from the user
- CLIPROXYAPI endpoint + model string. Exact production
CLIPROXY_BASE_URLand theCLIPROXY_MODELstring that maps to codex closedbook GPT-5.5 (scaffold default isgpt-5.5-codex). Also: expected per-call latency and a sane client timeout. - HF dataset contract. Confirm
HF_DATASETrepo id, the filename (data_loaderhardcodesphysics_feature.csv), and that the columns includeinchikey,guest_name,smilesplus the 22 feature columns. Is the schema stable, or should loading be column-tolerant? - Sequential vs concurrent trajectories. v0 currently runs the three calls in a loop (sequential β ~3Γ latency). Run them concurrently to cut wait time? (Affects NFR1 and proxy rate limits.)
- Caching. Cache inference results per (guest, prompt-version) so re-opening a guest
is instant and we don't re-bill the proxy? If yes, in-memory vs persistent, and how is
it invalidated when
PROMPT_DIRprompts change? - Reviewer attribution. The feedback schema has a
reviewercolumn but the UI never sets it. Do we want per-reviewer attribution (e.g. from theAPP_AUTHlogin) for inter-rater analysis, or is anonymous v0 fine? - Deployment privacy. Private Space vs public Space +
APP_AUTHonly? And where does persistent storage /FEEDBACK_DBlive, and who exports the ratings? - Prompt delivery. How do production prompts reach
PROMPT_DIRon the Space (build- time mount, secret, or pulled from a private repo)? Confirm the expectedphysics.txt / chemistry.txt / combined.txtcontract.