Skip to content

Rd kit deterministic#1

Open
Macaulay001 wants to merge 5 commits into
mainfrom
RDKit_deterministic
Open

Rd kit deterministic#1
Macaulay001 wants to merge 5 commits into
mainfrom
RDKit_deterministic

Conversation

@Macaulay001

Copy link
Copy Markdown
Collaborator

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +185 to +189
# 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",

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# 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)(?:~|≈|≥|≤))",

Copilot uses AI. Check for mistakes.
Comment thread RDKit_Deterministic/scripts/rdkit_verifier.py Outdated
Comment thread RDKit_Deterministic/scripts/rdkit_verifier.py
Comment thread RDKit_Deterministic/scripts/rdkit_verifier.py Outdated
Comment thread RDKit_Deterministic/scripts/build_labeled_qa.py Outdated
…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>
Macaulay001 and others added 2 commits April 24, 2026 16:24
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luistafoi if results are fine then comment "good to merge"

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.

4 participants