                               Hierarchical Graph Tokenization for Molecule-Language Alignment



i.e., molecules and molecular captions (Liu et al., 2023c).             language models with more sophisticated graph information

Usually, an l-layer GNN is employed to encode a graph as:               fusion modules. For example, Liu et al. (2023c); Zhao et al.

                                                                        (2023) develop advanced cross-modal adapters and gener-

h(l)

  u = COM(hu

                 (l−1)

                       , AGG({(hu(l−1) , h(l−1)

                                          v     )|v ∈ N (u)})),         alized position embeddings to promote better alignment

                                                           (1)          based on encoder-decoder-based molecular language mod-

          (l)

where hu ∈ Rh refers to the node embedding of node u                    els. Liang et al. (2023); Cao et al. (2023); Li et al. (2024)

after l layers of GNN, AGG(·) is the aggregation function               develop cross-modal adapters for decoder only language

(e.g., mean) among the information from neighbors of node               models such as Llama (Touvron et al., 2023a). Orthogo-

u, and COM is the operator for combining information                    nal to the aforementioned works, we focus more on what

of node u with its neighbors N (u) (e.g., concatenation).               information one shall extract from the molecules for the

Then, after l message passing iterations, the graph-level               alignment. We choose to build our methods upon decoder-

embedding can be obtained as:                                           only language models, with the hope of building a versatile

                                                                      agent that can perceive molecules beyond the language, im-

              hG = READOUT {h(l)    u |u  ∈  V}    ,       (2)          age, and audio modalities (Xi et al., 2023).



where READOUT(·) is a pooling operator (e.g., mean                      In the meantime, existing works also try to enrich the

pooling) among all the node embeddings. With the rep-                   molecule-language alignment with additional modalities,

resentations of the nodes and graphs, LGLMs can fuse                    such as 2D (Liu et al., 2023c) and 3D (Li et al., 2024) infor-

the graph and language information in various ways, such                mation. In contrast, we focus on the intrinsic hierarchical

as transforming into natural languages describing the                   information of the molecules, such as motifs.

graphs (Fatemi et al., 2024), or neural prompts within the              Hierarchical Graph Representation Learning. The hi-

LLMs (Tian et al., 2024). In addition, the embeddings can               erarchical nature has been widely incorporated in learning

also be leveraged to post-process the LLM outputs (Liu                  high-quality graph representations (Ying et al., 2018). Espe-

et al., 2024b). Orthogonal to different fusion mechanisms,              cially in molecular graphs, the high-order structural informa-

in this work, we focus on transforming graph embeddings                 tion naturally captures the existence of motifs and functional

into input tokens of LLMs, which can be formulated as (Tang             groups. Therefore, the hierarchy of atom-motif-molecule

et al., 2023; Chen et al., 2024a; Liu et al., 2023c; Zhao et al.,       has been widely applied in self-supervised molecular rep-

2023; Cao et al., 2023; Li et al., 2024):                               resentation learning (Zhang et al., 2021; Zang et al., 2023;

                        Yla                                             Inae et al., 2023; Luong & Singh, 2023). Nevertheless,

        pθ (a|q, h) =            pθ (ai |q, fn (h), a<i ),   (3)        how to properly incorporate the hierarchical information in

                           i=1

                                                                        molecular instruction tuning of LGLMs remains unclear.

where the LGLM is required to approximate pθ to out-

put the desired answer a given the question q, and the                  In addition, concurrent works by Park et al. (2024) and Hu

graph tokens h adapted with adapter fn : Rh → Rhe                       & Li (2024) explored incorporating hierarchical graph in-

that projects the graph tokens to the embedding space of                formation into LLMs. Nevertheless, they mostly focus on

LLMs. One could also incorporate the 1D information such                the architecture-level incorporation, while we show that it

as SMILES (Weininger, 1988) into q and a for alignment.                 is crucial to integrate the hierarchical information in the

                                                                        instruction tuning data. More importantly, we highlight

Molecular Foundation Models. There is a separate line of                the consequences of inadequate alignment due to the lack

works aiming to develop language models for molecules and               of hierarchical information, i.e., hallucination, and demon-

proteins – the language of lives, from 1D sequences such as             strate the usefulness of the hierarchical information in a

SMILES (Irwin et al., 2022), 2D molecular graphs (Rong                  wide range of downstream tasks.

et al., 2020; Wang et al., 2022; Zhang et al., 2024a), 3D ge-

ometric conformations (Liu et al., 2022; Zhou et al., 2023),

to scientific text (Beltagy et al., 2019) and multimodal

                                                                        3. Graph Tokenization in LGLMs

molecule-text data (Liu et al., 2023b; Luo et al., 2023a;               In this section, we analyze the limitations of node-centric

Christofidellis et al., 2023; Liu et al., 2024c; Su et al., 2022;       tokenization, which is widely adopted in existing LGLMs.

Zeng et al., 2022; Srinivas & Runkana, 2024). The adopted

backbones range from encoder-decoder architectures such                 3.1. Node-Centric Tokenization

as MolT5 (Edwards et al., 2022) and Galactica (Taylor et al.,

2022), to auto-regressive language modeling (Luo et al.,                Specifically, most existing LGLMs directly take the node

2023b; Liu et al., 2023e). Inspired by the success of large             tokens from GNNs as inputs to LLMs (Cao et al., 2023):

vision-language models (Li et al., 2023a; Zhu et al., 2023;                              Yla

Liu et al., 2023a), the community further seeks to develop               pθ (a|q, h) =           pθ (ai |q, fn (h1 ), ..., fn (hn ), a<i ),

                                                                                           i=1

molecular foundation models built upon existing molecular                                                                                (4)



                                                                    3

