Skip to main content

Training Corpus

All ChemLactica and Chemma models are trained on a comprehensive corpus derived from PubChem, the world’s largest collection of freely accessible chemical information.

Corpus Size

40 billion tokensCovering 100M+ molecules

Dataset on HuggingFace

yerevann/PubChemForLMPublicly available dataset

Data Format

JSONL Structure

The training data is stored in JSONL (JSON Lines) format, with each line representing one molecular entry:
chemlactica/get_dataset.py

Example Entry

Each molecule in the corpus contains multiple fields:

Data Processing

Text Formatting

Raw JSON data is converted to formatted text strings for training:
chemlactica/utils/text_format_utils.py
The order of properties is randomized during training to prevent the model from learning order-dependent patterns.

Property Formatting

Different types of data are formatted with special tags:
chemlactica/utils/text_format_utils.py

Example Formatted Output

Data Types

The corpus supports different data types:
chemlactica/utils/dataset_utils.py
Standard PubChem molecular data with computed properties and similar molecules.
Experimental assay data with biological activity measurements:
User-provided molecular data in the same JSONL format.

Dataset Loading

For Pre-training

chemlactica/get_dataset.py

For Fine-tuning

Tokenization

Custom Tokenizer

ChemLactica uses specialized tokenizers optimized for chemical notation:
chemlactica/utils/utils.py

Vocabulary Size

Chemlactica

50,000 tokensOptimized for chemistry

Chemma

256,000 tokensLarger vocabulary from Gemma

Special Tokens

The tokenizer includes chemistry-specific special tokens:
chemlactica/utils/utils.py

Data Statistics

Corpus Coverage

  • 100M+ unique molecules from PubChem
  • 40B tokens total
  • Multiple properties per molecule (avg 10-15 properties)
  • Similar molecules included for ~70% of compounds
  • Chemical synonyms and IUPAC names when available

Property Distribution

All molecules include:
  • SMILES notation (100%)
  • Core properties: SAS, WEIGHT, TPSA, CLOGP, QED (>95%)
  • Structural counts (>95%)
  • Similar molecules with Tanimoto scores (~70%)
  • Chemical names and synonyms (~60%)
  • Experimental properties (varies)

Training Configuration

Block Size

The 2048 token context window is sufficient for most molecules and their associated properties. Very large molecules or those with many similar molecules may be truncated.

Data Processing Parameters

Accessing the Dataset

From Hugging Face

Local JSONL Files

Data Quality

  • All SMILES validated with RDKit
  • Properties computed from validated molecular structures
  • Similar molecules verified with Tanimoto similarity
  • Duplicate molecules removed via canonical SMILES
  • Empty fields removed
  • Float values rounded to 2 decimal places
  • Related molecules limited to 10 per entry
  • Property order randomized for training diversity

Next Steps

Model Architectures

Learn about the models

Pre-training

Train your own model

Fine-tuning

Adapt to your dataset

SMILES Format

Understand molecular representation