Pipelines
Multi-formula graph mode architectures
Pipelines (also called "graph mode") let you build multi-formula architectures by connecting multiple formula blocks together on the canvas. This is how you build complex models like attention networks, residual connections, and multi-stage processing.
When to Use Pipelines
Use pipeline mode when your model can't be expressed as a single formula. Common scenarios:
- Multi-layer networks with different activation functions per layer
- Attention mechanisms (separate Q, K, V projections)
- Residual connections (
y = x + F(x)) - Encoder-decoder architectures
- Feature extraction followed by classification head
How Graph Mode Activates
Graph mode activates automatically when you have multiple formula blocks on the canvas. The Pipeline panel appears instead of the single-formula LaTeX panel.
âšī¸Note
Data-only blocks don't trigger graph mode. You need at least one formula block for graph mode to activate, and multiple formula blocks for it to matter.
Building a Pipeline
- Place multiple formula blocks using the Formula tool (F)
- Connect them by dragging from output ports (right) to input ports (left)
- Connect a data block to the first formula block's input
- The Pipeline panel shows the graph structure and compilation status
Pipeline Panel
The Pipeline panel (right side) shows:
- Recognition status â whether each formula block has been recognized
- Compile button â compiles the entire graph to a single PyTorch model
- Train button â trains the compiled pipeline on the connected dataset
- Graph visualization â block-and-arrow view of the pipeline structure
Port Types
| Port | Position | Description |
|---|---|---|
| Data output | Right side of data blocks | Provides dataset to the pipeline |
| Formula input | Left side of formula blocks | Receives data or previous layer output |
| Formula output | Right side of formula blocks | Sends processed output to next block |
Compilation
When you compile a graph, MathExec:
- Validates the graph structure (no cycles, all inputs connected)
- Topologically sorts the formula blocks
- Compiles each formula to a PyTorch layer
- Wires them into a single
nn.Module
đĄTip
Data blocks are filtered out before compilation â they provide training data but aren't part of the model architecture.