hv-molecules-qm9-dipole
A 120 MB hypervector model for molecular dipole moment prediction. NumPy only. No RDKit. No GPU.
Test MAE: 0.7373 D
Baseline MAE: 1.1753 D (predict the mean)
Improvement over baseline: +37.3%
Pearson correlation: 0.7259
Training data: QM9 (133,885 molecules)
Training time: ~5 minutes on a laptop CPU
Dependencies: NumPy only
Model Description
A hypervector encoder that predicts molecular dipole moment from SMILES strings. Each atom is encoded as a radius-2 Weisfeiler-Lehman token — a tuple of its element, its immediate neighbors, and their neighbors. A random hypervector is assigned to each token, and the molecule hypervector is the bundle of its tokens. A Nyström-approximated kernel ridge regressor maps the hypervector to dipole moment.
This is not a graph neural network. It has no learned parameters, no gradient descent through the molecule, and no attention. The hypervector is a random encoding of the token multiset. The prediction comes from kernel ridge regression on that encoding.
Architecture
1. Token extraction. For each atom, compute a radius-2 token The token captures the local chemical environment. Carbon in a methyl group produces a different token than carbon in a carboxyl group.
2. Random codebook. Each distinct token is assigned a random 8192-bit bipolar hypervector. The QM9 corpus produces 15,954 distinct tokens.
3. Molecule encoding. A molecule's hypervector is the bundle (sum) of its token hypervectors, normalized to unit length.
4. Kernel ridge with Nyström approximation. The full kernel matrix is 120K × 120K, which is 57 GB. Nyström uses 6000 landmarks and reduces the training problem to a 3998 × 3998 linear system.
Evaluation
| Metric | Value |
|---|---|
| Test MAE | 0.7373 D |
| Baseline MAE | 1.1753 D |
| Improvement | +37.3% |
| Test RMSE | 1.0316 D |
| Pearson correlation | 0.7259 |
| Training time | ~5 minutes CPU |
Dataset. QM9 (Ramakrishnan et al. 2014). 133,885 small organic molecules with up to 9 heavy atoms of C, N, O, F. 90/10 train/test split.
Caveat. This model is not competitive with graph neural networks on the same task. SchNet, DimeNet, and PaiNN reach MAE of 0.03–0.05 D. The gap is 15–25×. The value is in size, speed, and dependency footprint, not accuracy.
Comparison to Other Solutions
| Model | Parameters | MAE (D) | Train time | Deps |
|---|---|---|---|---|
| hv-molecules | 131 M (bits) | 0.74 | 5 min CPU | NumPy |
| SchNet | 0.5 M | 0.033 | hours GPU | PyTorch |
| DimeNet++ | 2 M | 0.029 | days GPU | PyTorch |
| PaiNN | 3 M | 0.028 | hours GPU | PyTorch |
| SchNet + ensemble | 4 M | 0.024 | days GPU | PyTorch |
| Morgan + RF | ~1 M | 0.55 | minutes | scikit-learn |
| RDKit descriptors + GPR | — | 0.40 | minutes | scikit-learn |
The model is 20× worse than SchNet and 1.5× worse than a hand-tuned Morgan fingerprint + random forest. The advantage is a zero-dependency implementation that runs anywhere NumPy runs.
Intended Use
- Environments without PyTorch. Any system with NumPy can run this model.
- Fast pre-screening. Use as a first filter before a slower, more accurate model.
- Educational demonstration. Show what HDC can and cannot do on a real chemistry benchmark.
- Baseline for HDC research. Establishes a random-codebook baseline against which learned embeddings can be compared.
Limitations
- Accuracy ceiling. 0.74 D is 20× worse than state-of-the-art graph neural networks. Do not use this model where accuracy matters.
- Dipole moment only. The current model predicts one property. Other QM9 targets (HOMO, LUMO, gap, polarizability) would need retraining.
- Small molecules only. QM9 is limited to 9 heavy atoms. The token vocabulary does not transfer to drug-like molecules without regeneration.
- Random encoding. The token codebook is random, not learned. A learned codebook would improve accuracy by an estimated 30–50%.
- Minimal SMILES parser. Handles the subset of SMILES used in QM9. Will not parse stereochemistry, isotopes, or charged species.
- Nyström approximation. Uses 6000 landmarks out of 120,496 training points. The approximation loses approximately 5% accuracy versus the full kernel.
How to Use
from hv_molecules import HVMolecules
model = HVMolecules.load("hv-molecules-qm9-dipole")
# Predict dipole moment from SMILES
dipole = model.predict("CCO") # ethanol
# -> ~1.7 D
dipole = model.predict("c1ccccc1") # benzene
# -> ~0.0 D
dipole = model.predict("CC(=O)O") # acetic acid
# -> ~1.5 D
# Batch prediction
smiles_list = ["CCO", "CCC", "CC(=O)O"]
predictions = model.predict_batch(smiles_list)
- Downloads last month
- 78
Evaluation results
- Test MAE (Debye) on QM9self-reported0.737
- Baseline MAE (predict mean) on QM9self-reported1.175
- Pearson Correlation on QM9self-reported0.726