How lamm-mit/graph-aware-transformers works
xgpt is a Python library for LLaMA-style language models augmented with graph-aware attention and GNN processing. The main workflow is to configure a model, pass tokenized text through the causal-LM entry point and stacked custom decoder layers, and produce language-model outputs; users can train a tokenizer separately. The README also describes sparse GIN fine-tuning and coarse-grained latent attention. Those capabilities are represented, though some implementation details are not visible in the sampled excerpts; edges without direct source evidence are omitted.
Main entry points: llama_decoder_layer_with_gnn.py GNN decoder layer · llama_model_with_gnn.py LLaMA model · gnn_config.py GNN configuration · llama_for_causal_lm_with_gnn.py Causal LM
Components 14
Model stack
- Causal LM
src/xgpt/llama_for_causal_lm_with_gnn.py - LLaMA model
src/xgpt/llama_model_with_gnn.py - GNN decoder layer
src/xgpt/llama_decoder_layer_with_gnn.py - Adjacency construction
src/xgpt/llama_decoder_layer_with_gnn.py
Graph reasoning
- GIN attention
src/xgpt/Attention_GNN.py - PNA attention
src/xgpt/Attention_GNN.py - Sparse GIN attention
src/xgpt/Attention_GNN.py - Coarse-grained attention
src/xgpt/CG_Attention.py - Causal graph network
src/xgpt/graph_neural_network.py - GNN MLP variants
src/xgpt/MLP_GNN.py
Inputs and configuration
- Tokenizer training
src/xgpt/custom_tokenizer.py - GNN configuration
src/xgpt/gnn_config.py
Fine-tuning tools
- Fine-tuning utilities
src/xgpt/utils.py
Other components
- Model user
Connections 15
- Model user → Tokenizer training: trains tokens
README.md - Model user → GNN configuration: configures model
README.md - Model user → Causal LM: runs model
README.md - Causal LM → LLaMA model: wraps model
src/xgpt/llama_for_causal_lm_with_gnn.py - LLaMA model → GNN decoder layer: creates layers
src/xgpt/llama_model_with_gnn.py - LLaMA model → GNN configuration: reads settings
src/xgpt/llama_model_with_gnn.py - GNN decoder layer → GNN configuration: reads settings
src/xgpt/llama_decoder_layer_with_gnn.py - GNN decoder layer → Adjacency construction: constructs
src/xgpt/llama_decoder_layer_with_gnn.py - GNN decoder layer → Causal graph network: applies GNN
src/xgpt/llama_decoder_layer_with_gnn.py - GNN decoder layer → GIN attention: selects attention
src/xgpt/llama_decoder_layer_with_gnn.py - GNN decoder layer → PNA attention: selects attention
src/xgpt/llama_decoder_layer_with_gnn.py - GNN decoder layer → Coarse-grained attention: supports variant
src/xgpt/llama_decoder_layer_with_gnn.py - GNN decoder layer → GNN MLP variants: supports variant
- Adjacency construction → Sparse GIN attention: sparsifies attention
src/xgpt/llama_decoder_layer_with_gnn.py - Model user → Fine-tuning utilities: fine-tunes model
README.md