Rd kit deterministic#1
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an RDKit-based deterministic auditing pipeline to validate numeric and structural claims in Chem2TextQA answers against SMILES-derived ground truth, producing per-compound and per-Q&A outputs without an LLM judge.
Changes:
- Introduces a topic bucketer to classify Q&A topics as structural vs functional.
- Implements an RDKit verifier that extracts checkable claims from answers and compares them to RDKit-derived facts, writing JSONL + Markdown summaries.
- Adds a script to emit per-Q&A JSONL records with aggregated RDKit labels.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| RDKit_Deterministic/scripts/topic_bucket.py | Adds shared helper to bucket freeform topic tags into structural/functional/other. |
| RDKit_Deterministic/scripts/rdkit_verifier.py | Adds RDKit ground-truth extraction + regex-based claim verification + reporting outputs. |
| RDKit_Deterministic/scripts/build_labeled_qa.py | Adds utility to join verifier output back onto each Q&A and compute an aggregate RDKit label. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # treated as a bound/approximation rather than a specific count. | ||
| HEDGE_REGEX = re.compile( | ||
| r"\b(?:fewer\s+than|less\s+than|more\s+than|greater\s+than|at\s+least|" | ||
| r"at\s+most|up\s+to|under|over|about|approximately|roughly|around|" | ||
| r"between|~|≈|≥|≤)\b", |
There was a problem hiding this comment.
HEDGE_REGEX wraps symbol tokens like ~, ≈, ≥, ≤ in \b...\b, but word-boundaries don’t match around non-word characters. As a result, symbol-based hedges (e.g. ~3, ≤4) won’t be detected and will be treated as exact numeric claims. Consider handling these symbols without \b (e.g., separate alternation or lookarounds) so hedged claims are consistently skipped.
| # treated as a bound/approximation rather than a specific count. | |
| HEDGE_REGEX = re.compile( | |
| r"\b(?:fewer\s+than|less\s+than|more\s+than|greater\s+than|at\s+least|" | |
| r"at\s+most|up\s+to|under|over|about|approximately|roughly|around|" | |
| r"between|~|≈|≥|≤)\b", | |
| # treated as a bound/approximation rather than a specific count. Word/phrase | |
| # hedges use \b boundaries, but symbol hedges must be matched separately | |
| # because \b does not match around non-word characters like "~" or "≤". | |
| HEDGE_REGEX = re.compile( | |
| r"(?:\b(?:fewer\s+than|less\s+than|more\s+than|greater\s+than|" | |
| r"at\s+least|at\s+most|up\s+to|under|over|about|approximately|" | |
| r"roughly|around|between)\b|(?<!\w)(?:~|≈|≥|≤))", |
…ive defaults in build_labeled_qa.py Agent-Logs-Url: https://github.com/vinash85/Chem2TextQA/sessions/92ac8604-eb41-4ccd-b4ce-eb0fb2f958c5 Co-authored-by: Macaulay001 <93085297+Macaulay001@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
@luistafoi if results are fine then comment "good to merge"
Goal. Automatically verify the numeric / structural claims in each Q&A against RDKit ground truth derived from the SMILES. For claims like "degree of unsaturation = 3", "has 2 chiral centers", "contains a carboxylic acid group", RDKit can compute the right answer. We use this to audit label quality without an LLM judge.