SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2509.23099 · EMNLP · 2025

How to Make Large Language Models Generate 100% Valid Molecules?

Alvin Chan, Bryan Hooi, Nanyun Peng, Jing Tang, Yiwei Wang, Ucla, Baolong Bi, Yuansheng Liu, Wen Tao

arXiv · PDF · Open in the Atlas

Code that ran

16 of 34 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 7 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 5 failures of our instrument; 18 no recorded run), measured 2026-11-24; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2509.23099.json · badge: /api/ran/2509.23099.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
wentao228/SmiSelf community
Papers with Code archive
16 ran · 18 no recorded run
FunctionStatusWhere it lives
Atom Ran
ran on a synthesized input
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("81b048dbf36c3a27")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

_build_branch_cache Ran
ran on a synthesized input
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("dc08b2c505155615")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

_build_ring_cache Ran
ran on a synthesized input
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("add60b6dc9899eb1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

_build_update_table Ran
ran on a synthesized input
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("10b4141ed789febc")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

_read_index_from_selfies Ran
ran, honoured the contract we drafted
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("9708695a44e8dd43")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

_strlen Ran
ran, honoured the contract we drafted
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("b6a16c1dfa930c32")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

atom_to_smiles Ran
ran; our contract draft was wrong, not the code
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("4732c4c562dda1a7")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

bond_to_smiles Ran
ran; our contract draft was wrong, not the code
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("64f1a0674514e76a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_bonding_capacity Ran
ran, honoured the contract we drafted
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("32fb62b6dcc59a99")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

next_atom_state Ran
ran, honoured the contract we drafted
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("99349bade0657ad1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

next_branch_state Ran
ran, honoured the contract we drafted
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("9cc50e5d5b436b5a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

next_ring_state Ran
ran, honoured the contract we drafted
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("0365f5c8a7ed29d2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

process_branch_symbol Ran
ran, honoured the contract we drafted
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("73356d9638a506bb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

process_ring_symbol Ran
ran; our contract draft was wrong, not the code
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("f29a60a9be07632e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

smiles_to_bond Ran
ran; our contract draft was wrong, not the code
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("5c6ee0f3e533ee08")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

split_selfies Ran
ran; our contract draft was wrong, not the code
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("dc75e852fcc0ba0f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Attribution Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("f2550f1417a99a0a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

AttributionMap Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("882fe047aa89c912")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

DecoderError Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("1192ef9fe327df5b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

DirectedBond Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("7aca720417a84830")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

MolecularGraph Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("10f38da4a2db9228")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

_build_atom_cache Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("be668ede7fc5787a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

_derive_mol_from_symbols Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("d11e5ac8cbe6b3a8")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

_derive_smiles_from_fragment Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("c4aafd5b6356f5fb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

_form_rings_bilocally Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("d62276a8a9743437")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

_process_atom_selfies_no_cache Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("dfb074f8eafbdc02")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

_raise_decoder_error Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("c4b81be1f7a91ba1")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

_tokenize_selfies Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("1b1ec6c6cee4f0ed")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

decoder Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("45f1bef14e59d6da")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_index_from_selfies Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("f847c03c18ef8150")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

modernize_symbol Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("fccd219f72b04e86")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

mol_to_smiles Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("50e2e5ca727694f5")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

process_atom_symbol Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("d3c26747c47c25c4")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

smiles_to_atom Not yet run
unverified (harvested, no recorded run)
wentao228/SmiSelf/smiself/decoder.py
pointer only (licence: NONE) · get_code("22339558285650e2")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, wentao228/SmiSelf when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 34 samples lifted from this paper's linked repositories, 34 carry a function identity and 0 do not. Of the 34 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 0 later) and 30 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
get_bonding_capacity
brick of this paper's assembly: helper
2 other papers
2 dated earlier
2211.13322 (2022-11)
Group SELFIES: A Robust Fragment-Based Molecular String Representation
2302.03620 (2023-02)
Recent advances in the Self-Referencing Embedding Strings (SELFIES) library
process_branch_symbol
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2211.13322 (2022-11)
Group SELFIES: A Robust Fragment-Based Molecular String Representation
process_ring_symbol
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2211.13322 (2022-11)
Group SELFIES: A Robust Fragment-Based Molecular String Representation
smiles_to_bond
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2302.03620 (2023-02)
Recent advances in the Self-Referencing Embedding Strings (SELFIES) library

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Molecule generation is key to drug discovery and materials science, enabling the design of novel compounds with specific properties. Large language models (LLMs) can learn to perform a wide range of tasks from just a few examples. However, generating valid molecules using representations like SMILES is challenging for LLMs in few-shot settings. In this work, we explore how LLMs can generate 100% valid molecules. We evaluate whether LLMs can use SELFIES, a representation where every string corresponds to a valid molecule, for valid molecule generation but find that LLMs perform worse with SELFIES than with SMILES. We then examine LLMs' ability to correct invalid SMILES and find their capacity limited. Finally, we introduce SmiSelf, a cross-chemical language framework for invalid SMILES correction. SmiSelf converts invalid SMILES to SELFIES using grammatical rules, leveraging SELFIES' mechanisms to correct the invalid SMILES. Experiments show that SmiSelf ensures 100% validity while preserving molecular characteristics and maintaining or even enhancing performance on other metrics. SmiSelf helps expand LLMs' practical applications in biomedicine and is compatible with all SMILES-based generative models. Code is available at https: //github.com/wentao228/SmiSelf.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2509.23099")
get_code_for_paper("2509.23099")
have("2509.23099")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2509.23099.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2509.23099.svg)](https://syntology.ai/paper/2509.23099)

Connect an agent — have() is free.