## The BidiLayerSwap Model
A relational graph architecture combining bidirectional message passing with dynamic connection parametrization and expert selection.
### Components
**Term-Base Layer (Entity Layer)**
- Stores entity embeddings
- Selected/gated by MoE mechanism (different experts
activate for different entities)
- Receives and sends information via connection layer
- "Everything connected to everything"
**Connection Layer (Relation Layer)**
- Parametrized to allow sequential routing through different relation types
- A sequence of passes can start with one relation type, transition to another, then use results from other relations
- Each relation type has distinct learned parameters (like RGCN)
**Message Passing (Bidirectional contextual)**
- Forward pass: entities aggregate information from connections
- Backward pass: connections aggregate information from entities
- Multiple sequential passes allow iterative refinement
- Each pass can route through different relation types based on context
### Contextual Behavior example
The model handles conditional outputs based on a shopping list state and context:
**Example 1: List-dependent output**
- Input: list contains: [milk, cheese, return the can]
- Through connection sequence: identify milk & cheese → apply relation transformations
- Output: predict tuna (inverse relation, compositional)
**Example 2: Narrative with conditional action**
- "The boy drove the car to the supermarket holding a tuna can"
- Context from list determines action: bought or returned
- Context determines object bought: cheese, milk, or both
- Single entity/action structure, context-parametrized output
- Output: [boy, sequence: [droveto(supermarket),planned(buy, return), bought(milk, cheese), returned(tuna)].
- Result: B droveto S, B planned buy, B planned return, B bought milk, B bought cheese, B returned tuna.
**Example 3: Context-dependent entity type**
- "This is a chair or a small table"
- Same entity embedding
- Classification depends on: location (near table/bed), environment (other chairs/trays), usage (sitting human/objects)
- Connection layer routes through different relation contexts to determine type
### Why BidiLayerSwap Works
1. **Bidirectional flow** enables complex dependencies (entities influence connections, connections influence entities)
2. **MoE on term-base** scales efficiently only relevant experts activate
3. **Parametrized connection sequences** allow modular reasoning through different relation types
4. **Context routing** naturally handles conditional outputs without separate models
5. **Sequential learning** along with the static resolutions.
6. **Everything connects to Everything**
7. **Multi-pass architecture** iteratively refines representations based on accumulated highly contextualized testing.