rllm.nn.models.BRIDGE¶
- class rllm.nn.models.BRIDGE(table_encoder: TableEncoder, graph_encoder: GraphEncoder)[source]¶
Bases:
ModuleThe BRIDGE model introduced in the “rLLM: Relational Table Learning with LLMs” paper. BRIDGE is a simple RTL method based on rLLM framework, which combines table neural networks (TNNs) and graph neural networks (GNNs) to deal with multi-table data and their interrelationships, and uses “foreign keys” to build relationships and analyze them to improve the performance of multi-table joint learning tasks.
- Parameters:
table_encoder (TableEncoder) – Encoder for tabular data.
graph_encoder (GraphEncoder) – Encoder for graph data.
Example
>>> from rllm.nn.models.bridge import BRIDGE, TableEncoder, GraphEncoder >>> model = BRIDGE(TableEncoder(16, 32, metadata={}), GraphEncoder(32, 8))
- forward(table: TableData, non_table: Tensor, adj: Tensor | List[Tensor]) Tensor[source]¶
First, the Table Neural Network (TNN) learns the tabular data. Second, the learned representations are concatenated with the non-tabular data. Third, the Graph Neural Network (GNN) processes the combined data. along with the adjacency matrix to learn the overall representation.
- Parameters:
table (Tensor) – Input tabular data.
non_table (Tensor) – Input non-tabular data.
adj (Tensor) – Adjacency matrix.
- Returns:
Output table embedding features.
- Return type:
Tensor