TRANSMISSION // 2611.03684v1

A Wrong Chemistry Answer May Hide a More Structured Internal Representation

Source published

A preprint examining five open-weight language models finds chemical-family patterns inside their representations, even when their generated answers are unreliable. Chemistry fine-tuning appears to shift those representations toward functional groups and away from prompt wording.

When a language model misidentifies a molecule’s functional group, its answer does not reveal whether it missed the chemistry or failed to express information already encoded internally. A new preprint investigates that distinction by comparing generated answers with patterns inside five models.

A language model asked about 1-fluorobutane might identify an alkyne—a group the molecule does not contain. That answer is wrong, but it leaves an important question unresolved: did the model fail to represent the relevant chemistry, or did information present internally fail to reach its response?

In a preprint, Tran Nhat Khang Nguyen, Anh Nguyen, Obed Issakah and Janghoon Ock investigate this gap. Their results suggest that, for the small organic molecules studied, unreliable answers can coexist with chemically meaningful internal structure. That is a narrower claim than saying the models reliably understand chemistry, but it changes how a low benchmark score might be interpreted.

Comparing answers with internal patterns

The researchers studied five open-weight models with eight billion parameters each: Llama-3.1-8B, two Chem-R variants, ChemDFM-v1.5-8B and a DeepSeek reasoning-distilled Llama model. Four share the Llama-3.1 base; ChemDFM instead derives from Llama-3, making it an exception to comparisons that isolate fine-tuning.

Their dataset contained 92 small organic molecules spanning 20 functional-group classes, including an unsubstituted alkane reference. Each molecule appeared in ten differently worded sentence-completion prompts, producing 920 prompts per model. Every prompt supplied both a chemical name and a SMILES string, a textual representation of molecular structure.

The models generated continuations greedily, with a maximum of ten new tokens. All received raw completion prompts rather than model-specific chat formatting. Separately, the researchers recorded the internal vector at the final prompt token across all 32 model layers—the position immediately before answer generation.

Low accuracy did not mean mostly wrong classifications

The base Llama model correctly named the target group in 58.5% of prompts, compared with 90.2% for Chem-R, the strongest model on this strict generation measure. Chem-R-Faithful reached 84.3%, the reasoning-distilled model 78.9%, and ChemDFM 63.5%.

The base model’s failures, however, were mostly responses that did not commit to one functional-group class, rather than explicit wrong classifications. When it did name exactly one class, it was correct 91.8% of the time. Its overall accuracy also depended heavily on wording, ranging from 19.6% to 88.0% across the ten templates.

These distinctions matter. A malformed continuation, a broad category and a confidently incorrect group name all reduce strict accuracy, but they do not describe the same behavior.

Chemical relationships inside the vectors

To examine internal organization, the team averaged representations across prompt templates and subtracted the representation of an alkane with the same carbon count. This produced difference vectors intended to emphasize functional-group contributions. The authors note that, where a heteroatom interrupts the carbon skeleton, those differences also include the skeleton’s rearrangement.

Across all five models, functional groups formed chemically meaningful clusters. Amide, for example, showed relationships with both nitrogen-containing and carbonyl-containing groups. The researchers acknowledge that shared spelling could partly explain clustering among alkyl halides, making other chemical families more informative evidence.

They also tested vector analogies. The difference between thioether and thiol, added to ether, should point toward alcohol if the corresponding structural relationship is represented consistently. Across the inter-group analogy trials, the correct answer had a median rank of one in every model. These were retrieval tests among candidate vectors, not demonstrations of reaction prediction or synthesis planning.

A transition in the middle layers

A separate linear classifier tested whether internal vectors revealed broad chemical families when an entire functional group was withheld from its training data. Family information became sharply more decodable around the middle of the networks. By layer 19, reported balanced accuracy reached 95.0%–98.3%, compared with 47.5% for a classifier using character fragments from the prompts alone.

Chemistry fine-tuning also changed which similarities dominated local neighborhoods. In the chemistry-trained models, shared functional group eventually outweighed shared prompt wording. In the base and reasoning-distilled models, wording remained the stronger neighborhood label through the final layer.

The improvement was not uniform across every measurement. Chem-R and Chem-R-Faithful performed worse than the base model on chain-length analogies, often ranking the correct group at an adjacent carbon count first.

What the findings support

The authors interpret the results as evidence that chemistry fine-tuning reorganizes existing information rather than simply supplying missing knowledge. Their layer analyses are correlational, and the experiments concern a defined set of small molecules and completion prompts—not end-to-end chemical agents.

The practical proposal is therefore conditional: when useful chemical information is encoded but poorly expressed, answer-format tuning, few-shot prompting or constrained decoding might help. Those remedies are suggested, not demonstrated here. The central contribution is a diagnostic distinction: measuring what a model says need not fully reveal what information its representations contain.