MolecularIQ Benchmark Dataset

January 20, 2026 ยท View on GitHub

MolecularIQ Benchmark Dataset

A comprehensive benchmark for evaluating large language models on molecular reasoning tasks

License: MIT Python 3.9+ RDKit

Count, index, and constraint generation questions across diverse chemical features

MolecularIQ benchmark statistics


๐ŸŽฏ Overview

MolecularIQ is a benchmark specifically designed to measure the structural reasoning abilities of large language models on molecules. Unlike many chemistry evaluation sets that rely on literature labels or surrogate predictors, MolecularIQ focuses only on tasks whose correctness can be verified algorithmically from the molecular graph itself. This makes it possible to distinguish genuine structural understanding from memorization or correlation-based answers.

๐Ÿ“ Repository Structure

moleculariq-benchmark/
โ”œโ”€โ”€ ๐Ÿ“‚ src/                                # Source code
โ”‚   โ”œโ”€โ”€ ๐Ÿ“‚ a_dataset_pools/               # Stage A: Dataset pool creation
โ”‚   โ”‚   โ”œโ”€โ”€ 1_collect_pubchem_data.py
โ”‚   โ”‚   โ”œโ”€โ”€ 2_collect_external_test_set_molecules.py
โ”‚   โ”‚   โ”œโ”€โ”€ 3_standardize_pubchem_mols_and_remove_external_test_mols.py
โ”‚   โ”‚   โ”œโ”€โ”€ 4_create_train_test_pools.py
โ”‚   โ”‚   โ”œโ”€โ”€ 5_create_hard_test_pool_dataframe.py
โ”‚   โ”‚   โ””โ”€โ”€ utils/                        # External test set utilities
โ”‚   โ””โ”€โ”€ ๐Ÿ“‚ b_benchmark/                   # Stage B: Benchmark generation
โ”‚       โ”œโ”€โ”€ 1_compute_properties.py       # Compute ground truth properties
โ”‚       โ”œโ”€โ”€ 2_create_benchmark.py         # Generate final benchmark dataset
โ”‚       โ”œโ”€โ”€ task_names.py                 # Task name definitions
โ”‚       โ””โ”€โ”€ benchmark_generator/          # Generation logic (uses moleculariq-core)
โ”‚           โ”œโ”€โ”€ main.py                   # CLI entry point
โ”‚           โ”œโ”€โ”€ config.py                 # Configuration
โ”‚           โ”œโ”€โ”€ tasks/                    # Task generators (count, index, constraint)
โ”‚           โ”œโ”€โ”€ core/                     # Sampling, scoring, validation
โ”‚           โ””โ”€โ”€ output/                   # JSON & HuggingFace export
โ”œโ”€โ”€ ๐Ÿ“‚ data/                              # Data artifacts (not tracked)
โ”‚   โ”œโ”€โ”€ dataset_pools/                    # Molecule pools
โ”‚   โ”‚   โ”œโ”€โ”€ external/                     # External benchmark molecules
โ”‚   โ”‚   โ”œโ”€โ”€ intermediate/                 # Pipeline intermediates
โ”‚   โ”‚   โ”œโ”€โ”€ processed/                    # Processed datasets
โ”‚   โ”‚   โ”œโ”€โ”€ pseudo_sdf/                   # Sample SDF for testing
โ”‚   โ”‚   โ””โ”€โ”€ pubchem_raw_sdf/              # Raw PubChem SDF files
โ”‚   โ””โ”€โ”€ benchmark/                        # Generated benchmark data
โ”‚       โ”œโ”€โ”€ properties.pkl                # Precomputed molecular properties
โ”‚       โ””โ”€โ”€ benchmark_dataset.json        # Final benchmark dataset
โ”œโ”€โ”€ ๐Ÿ““ notebooks/                         # Analysis notebooks
โ”‚   โ””โ”€โ”€ overview_created_data.ipynb       # Data creation walkthrough
โ””โ”€โ”€ ๐Ÿ“Š assets/                            # Documentation assets
    โ””โ”€โ”€ moleculariq_statistics.png

๐Ÿ”„ Data Creation Pipeline

Stage A: Dataset Pool Creation

1. Collect PubChem Data โ†’ 1_collect_pubchem_data.py

  • Extract SMILES and IUPAC names from PubChem SDF files
  • Filter molecules (carbon-containing, single-fragment)

2. Collect External Test Sets โ†’ 2_collect_external_test_set_molecules.py

  • Aggregate molecules from LLaSMol, ChemDFM, Ether0, ChemIQ benchmarks

3. Standardize and Filter โ†’ 3_standardize_pubchem_mols_and_remove_external_test_mols.py

  • Canonicalize SMILES
  • Remove molecules present in external benchmarks

4. Create Train/Test Pools โ†’ 4_create_train_test_pools.py

  • Cluster molecules using MinHash LSH on Morgan fingerprints
  • Split into: Training pool, Easy test set, Hard test set

5. Create Hard Test Pool DataFrame โ†’ 5_create_hard_test_pool_dataframe.py

  • Build structured dataframe with molecular complexity metrics

Stage B: Benchmark Generation

1. Compute Properties โ†’ 1_compute_properties.py

  • Calculate ground truth values for all molecular properties
  • Uses SymbolicSolver from moleculariq-core for accurate computation

2. Create Benchmark โ†’ 2_create_benchmark.py

  • Sample diverse datapoints across complexity dimensions
  • Generate questions using natural language templates
  • Create single/multi count, index, and constraint generation tasks
  • Export to JSON and HuggingFace dataset formats

๐Ÿš€ Getting Started

Prerequisites

# Install moleculariq-core
pip install git+https://github.com/ml-jku/moleculariq-core.git

# Then install this package
pip install .  
# or pip install -e . for development

Quick Start

1. Download PubChem SDF files (optional - pseudo SDF included for testing)

# Download from https://pubchem.ncbi.nlm.nih.gov/docs/downloads
# Place in data/dataset_pools/pubchem_raw_sdf/

2. Run the data creation pipeline

# Stage A: Create molecule pools (run from repo root)
python src/a_dataset_pools/1_collect_pubchem_data.py
python src/a_dataset_pools/2_collect_external_test_set_molecules.py
python src/a_dataset_pools/3_standardize_pubchem_mols_and_remove_external_test_mols.py
python src/a_dataset_pools/4_create_train_test_pools.py
python src/a_dataset_pools/5_create_hard_test_pool_dataframe.py

# Stage B: Generate benchmark (run from repo root)
python src/b_benchmark/1_compute_properties.py
python src/b_benchmark/2_create_benchmark.py

3. Explore the created data

jupyter notebook notebooks/overview_created_data.ipynb

๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ MolecularIQ Family

This package is part of the MolecularIQ ecosystem:

RepositoryPurpose
moleculariqCentral hub for the MolecularIQ benchmark ecosystem
moleculariq-leaderboardLeaderboard: HuggingFace space, displays results, handles submissions
moleculariq-coreMolecularIQD and shared library providing core functionality, e.g. symbolic verifiers and question formatting
๐Ÿ“ moleculariq-benchmarkDataset creation: task definitions, symbolic verifiers implementations, question generator
moleculariq-evalEvaluation code: integration with lm-eval-harness, model configs, reward functions, extraction functions, and system prompts

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.