MolJSON: Structured Molecular Graphs for LLMs
- MolJSON is a structured JSON format that encodes molecular graphs with explicit atom and bond lists, enhancing LLM interpretation of chemical data.
- Benchmark studies show MolJSON achieves high performance on graph-centric tasks, with up to 98.5% accuracy in shortest-path reasoning and efficient token usage.
- Its schema-constrained design minimizes hidden reconstruction errors and offers flexibility over traditional formats like SMILES and IUPAC for LLM applications.
Searching arXiv for the cited MolJSON-related papers to ground the article. MolJSON is a structured JSON representation of molecular graphs designed for LLMs. In its benchmarked form, it encodes a molecule through explicit atom and bond lists rather than through a traversal string, nomenclature-derived text, or a layered identifier. The representation was introduced to reduce the mismatch between graph-structured molecular data and sequence-based LLMs, and later comparative studies placed it among the strongest text representations for structure-centric molecular reasoning, while also showing that its advantages are task-dependent rather than universal (Runcie et al., 3 May 2026, Raja et al., 2 Jun 2026).
1. Definition and historical placement
MolJSON was introduced as a “novel molecular representation for LLMs” in a study comparing six common chemical formats—SMILES, IUPAC, MOL V2000, SELFIES, InChI, and MolJSON—on translation, shortest-path reasoning, and constrained generation tasks. Its defining idea is to serialize the molecular graph explicitly in JSON, with atoms and bonds directly addressable as structured objects rather than implicitly recoverable from a string grammar (Runcie et al., 3 May 2026).
A later benchmark, spanning nine molecular representations, eight chemical tasks, and sixteen LLMs, treated MolJSON as one of the two principal “structured text representations” alongside CML. In that study, MolJSON ranked second overall with 75 statistically supported wins across 128 model-task configurations, behind CML’s 81 and ahead of InChI’s 72 and canonical SMILES’ 66. The same study emphasized that no single representation dominates all tasks: MolJSON is especially strong on graph-centric tasks, whereas IUPAC and SMILES variants remain preferable in several semantic or charge-salient settings (Raja et al., 2 Jun 2026).
This placement is important for understanding what MolJSON is and is not. It is not presented as a canonical chemistry identifier in the style of InChI, nor as a comprehensive computational-chemistry result format. It is an LLM-oriented graph serialization whose design goal is to make molecular structure explicit, machine-checkable, and compatible with schema-constrained output generation (Runcie et al., 3 May 2026).
2. Core schema and representational semantics
In the benchmarked schema, MolJSON is a top-level JSON object with four required keys: "atoms", "bonds", "charges", and "aromatic_n_h". Atoms are objects with required "id" and "element" fields. Bonds are objects with required "source", "target", and "order" fields. The "charges" field is a sparse list of non-zero formal charges or null. The "aromatic_n_h" field is a sparse list recording explicit hydrogens on aromatic nitrogen atoms or null (Runcie et al., 3 May 2026).
| Field | Meaning | Notes |
|---|---|---|
atoms |
Explicit atom list | Each atom has unique id and element |
bonds |
Explicit connectivity list | Each bond has source, target, order |
charges |
Sparse non-zero formal charges | null means none |
aromatic_n_h |
Sparse aromatic nitrogen hydrogen counts | null means none |
Several semantic choices distinguish MolJSON from linear notations. Molecular identity is defined directly by the sets of atoms and bonds, independent of array ordering. Atom identifiers may be arbitrary unique strings. Hydrogens are mostly implicit and inferred from the graph using standard valence rules. Aromatic bonds are represented by order 1.5, and the schema permits bond orders 0, 1, 1.5, 2, 3; the schema description states that “Aromatic bonds are 1.5. ZERO bonds are 0.” The element enumeration also includes the dummy atom "*" (Runcie et al., 3 May 2026).
The use of "source" and "target" is syntactic rather than chemically directional. The paper notes that chemical bonds are undirected and suggests that a future two-item list might be semantically preferable. Likewise, the representation deliberately avoids canonical serialization: equivalence is defined at the graph level after parsing rather than by exact string identity (Runcie et al., 3 May 2026).
A canonical illustrative example is the acetic-acid encoding:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
{
"atoms": [
{"id": "C1", "element": "C"},
{"id": "C2", "element": "C"},
{"id": "O1", "element": "O"},
{"id": "O2", "element": "O"}
],
"bonds": [
{"source": "C1", "target": "C2", "order": 1},
{"source": "C2", "target": "O1", "order": 2},
{"source": "C2", "target": "O2", "order": 1}
],
"charges": null,
"aromatic_n_h": null
} |
The appendices also include more complex examples with aromatic bonds, non-zero charges, and explicit aromatic nitrogen hydrogens, demonstrating that the format was designed to preserve graph information needed for correct valence assignment without requiring fully explicit hydrogen expansion (Runcie et al., 3 May 2026).
3. Motivation relative to legacy molecular text formats
The central motivation for MolJSON is representational alignment with LLMs. The authors argue that common chemistry formats were designed for chemists, databases, or classical software pipelines rather than for sequence models that must parse and generate structured objects (Runcie et al., 3 May 2026).
For SMILES, the difficulty is traversal dependence. A molecule must be linearized through atom order, branching parentheses, ring-closure digits, and local syntax constraints. This creates two burdens: on input, the model must reconstruct the graph from the string; on output, it must serialize the intended graph into valid traversal syntax. The paper attributes systematic errors to atom count and ring complexity, and reports that SMILES outputs produced the greatest proportion of invalid molecules among GPT-5 translation responses (Runcie et al., 3 May 2026).
For IUPAC names, the burden is linguistic rather than topological. IUPAC encodes molecules via parent structures, locants, prefixes, suffixes, and naming rules. The paper argues that this makes both interpretation and generation especially difficult for fused ring systems. SELFIES, although validity-preserving under its decoder, performed poorly in the reported LLM experiments. InChI, while canonical and informative, was described as difficult for LLMs because of its intrinsic complexity. MOL V2000 exposes connectivity explicitly, but its rigid line-based formatting proved brittle, particularly in the reverse generation direction (Runcie et al., 3 May 2026).
MolJSON is presented as a response to these burdens. By making atoms and edges explicit and allowing schema-constrained output, it reduces hidden graph-reconstruction and graph-serialization steps. The appendix adds a more speculative observation: because atom IDs may be arbitrary unique strings, models sometimes generate richer identifiers such as C_acyl or O_me, which the authors hypothesize may function as useful symbolic handles during reasoning (Runcie et al., 3 May 2026).
4. Empirical performance in LLM benchmarks
The first major empirical study evaluated GPT-5-nano, GPT-5-mini, GPT-5, and Claude Haiku 4.5 on 78,045 questions spanning translation, shortest-path reasoning, and constrained generation. Molecules were drawn from PubChem entries deposited between 1 October 2025 and 22 December 2025, with exclusions for stereochemistry, salts, multiple molecules, isotopic information, radicals, and inorganic elements. Across these tasks, MolJSON was the strongest representation tested overall (Runcie et al., 3 May 2026).
| Setting | Result for MolJSON |
|---|---|
| Translation, GPT-5 | IUPAC → MolJSON: 71.0%; SMILES → MolJSON: 92.3% |
| Shortest path, GPT-5 | 98.5% accuracy |
| Shortest path, GPT-5-mini | 86.6% accuracy |
| Shortest path, GPT-5-nano | 67.7% accuracy |
| Constrained generation, GPT-5 | 95.3% accuracy |
The translation results showed that output representation mattered most. For GPT-5, converting IUPAC to MolJSON reached 71.0% accuracy, whereas converting the same inputs to SMILES reached 43.7%. Converting SMILES to MolJSON reached 92.3%, whereas converting SMILES to IUPAC reached 43.5%. The authors interpreted this asymmetry as evidence that strong models can often recover the graph from SMILES or IUPAC, but struggle to re-express that graph in restrictive target formats (Runcie et al., 3 May 2026).
In shortest-path reasoning, MolJSON was the best input format for all three OpenAI models. Aggregate accuracies were 98.5% for GPT-5, 86.6% for GPT-5-mini, and 67.7% for GPT-5-nano, versus 92.2%, 53.3%, and 42.9% for SMILES, and 82.7%, 63.4%, and 42.7% for IUPAC. For GPT-5, MolJSON also reduced average output tokens to 1,021, compared with 1,854 for SMILES and 1,587 for IUPAC; the paper summarizes this as MolJSON being about as efficient as SMILES on that task (Runcie et al., 3 May 2026).
In constrained generation, MolJSON was again dominant. GPT-5 reached 95.3% accuracy generating MolJSON, compared with 76.3% for IUPAC and 64.0% for SMILES. The gains were largest on topologically difficult subsets: for fused two-ring systems, GPT-5 achieved 91.5% with MolJSON versus 41.5% with SMILES and 56.4% with IUPAC; for spiro systems, 90.0% versus 57.0% for both SMILES and IUPAC. The same qualitative pattern held for GPT-5-mini and GPT-5-nano, indicating that MolJSON improved the usability of smaller models as well (Runcie et al., 3 May 2026).
A second large benchmark, MolRepBench, broadened the picture. Across eight tasks over nine representations and sixteen LLMs, MolJSON was second overall with 75 wins. Its task-specific profile was highly uneven: atom counting 9 wins, functional groups 4, LogP 3, TPSA 7, HBD 0, HBA 13, retrieval 3, isomer discrimination 13, caption-to-molecule 4, tautomer recognition 12, and protonation recognition 7. The study concluded that MolJSON is especially strong on structure-centric tasks such as isomer discrimination, tautomer recognition, atom counting, and HBA-related graph counting, but not universally optimal. IUPAC won molecule retrieval for all sixteen LLMs, and SMILES variants were preferable for protonation-state recognition because charge is surfaced directly in the string (Raja et al., 2 Jun 2026).
The mechanistic analysis in that study is also notable. MolJSON was among the longest representations by token count, together with InChI and CML. Yet it yielded shorter reasoning-token length in atom counting than several more compact alternatives. In Qwen3-4B, MolJSON and CML had the largest last-token-to-molecule attention, nearly 5 to 10 times that of canonical SMILES, while SMILES variants showed about 20 times larger within-molecule attention than MolJSON and CML. In linear-probe experiments on hidden states, MolJSON produced the best probe performance for molecular weight, LogP, and TPSA, even though the evaluated model predated MolJSON’s introduction (Raja et al., 2 Jun 2026).
5. Relationship to earlier chemistry JSON formats
MolJSON belongs to a broader lineage of web-native chemistry representations, but it is distinct from earlier JSON efforts in both scope and target use case. The 2017 paper “Open Chemistry: RESTful Web APIs, JSON, NWChem and the Modern Web Application” does not mention MolJSON explicitly, but it presents two closely related JSON models: Chemical JSON and ExtendedChem JSON (Hanwell et al., 2017).
Chemical JSON is a compact, array-oriented format associated with Avogadro 2. It encodes molecules through flat arrays such as atoms.coords.3d, atoms.elements.number, bonds.connections.index, and bonds.order. The paper states that each 3D vector is offset by 3N where N is the atom index. This model emphasizes compactness, efficient BSON/MongoDB storage, and transport to JavaScript clients such as 3DMol.js (Hanwell et al., 2017).
ExtendedChem JSON, by contrast, is object-oriented and semantically explicit. It was developed to capture computational chemistry inputs and outputs, especially from NWChem. Atoms are full objects with id, element metadata, and cartesianCoordinates stored as { "value": [...], "units": "bohr" }. The format also represents calculation setup and results, including wavefunction type, basis set references, charge, spin multiplicity, dipole moments, quadrupole moments, and atom-specific properties. It supports multiple calculation steps through a calculations array and uses application-level ID/reference conventions such as "Molecule.2" and "Atom.1.Mol.2" (Hanwell et al., 2017).
MolJSON differs from both. Compared with Chemical JSON, it is less focused on dense numerical transport and more focused on explicit graph addressability. Compared with ExtendedChem JSON, it is not a structured replacement for computational chemistry log files. Its niche is narrower and more operational: explicit graph serialization for LLM input, reasoning, and constrained output (Runcie et al., 3 May 2026, Hanwell et al., 2017).
6. Limitations, misconceptions, and likely extensions
A common misconception is to treat MolJSON as a general-purpose, fully mature chemistry interchange standard. The benchmarked papers do not make that claim. MolJSON is presented as a starting point for LLM-oriented molecular representation, and its current schema excludes several important classes of chemistry information. The dataset used to evaluate it excluded stereochemistry, isotopes, radicals, salts, multiple molecules, and inorganic elements, and the paper explicitly notes that the format could be extended for features not considered, such as stereochemistry and atomic coordinates (Runcie et al., 3 May 2026).
Another misconception is to assume that MolJSON is superior in every LLM chemistry task. The larger comparative benchmark rejects that conclusion. MolJSON is one of the strongest formats for explicit structural reasoning, but IUPAC is superior for semantically aligned tasks such as retrieval and often generation, while canonical and isomeric SMILES are preferable for protonation-state recognition because they expose charge directly (Raja et al., 2 Jun 2026).
Its non-canonical semantics are both a strength and a limitation. Because molecular identity is independent of array ordering and atom IDs may be arbitrary, MolJSON is easier for models to generate flexibly. At the same time, this means it is not a canonical identifier suitable for hashing or direct deduplication without downstream normalization after parsing (Runcie et al., 3 May 2026).
A plausible extension, suggested by molecular geometric deep learning rather than by the benchmarked MolJSON schema itself, is a MolJSON-like format that stores not only atoms and bonds but also 3D coordinates and multiple distance-defined interaction layers. The Mol-GDL framework represents a molecule as a family of graphs over the same atom set, with one covalent interval and several non-covalent intervals such as , , , , and . This suggests that a future geometric MolJSON variant would need explicit support for 3D coordinates, interval-indexed graph layers, optional stored distances, feature-construction metadata, and possibly precomputed node features. That implication goes beyond the current benchmark schema, but it follows directly from the representational requirements of Mol-GDL (Shen et al., 2023).
Taken together, these studies position MolJSON as a graph-explicit, schema-constrained molecular representation whose principal significance lies in LLM interaction rather than legacy interoperability. It is strongest where models must manipulate molecular structure directly, weaker where tasks reward linguistic or charge-explicit surface forms, and open to substantial extension for broader cheminformatics and geometric-learning workloads (Runcie et al., 3 May 2026, Raja et al., 2 Jun 2026).