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

  1. Place multiple formula blocks using the Formula tool (F)
  2. Connect them by dragging from output ports (right) to input ports (left)
  3. Connect a data block to the first formula block's input
  4. 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

PortPositionDescription
Data outputRight side of data blocksProvides dataset to the pipeline
Formula inputLeft side of formula blocksReceives data or previous layer output
Formula outputRight side of formula blocksSends processed output to next block

Compilation

When you compile a graph, MathExec:

  1. Validates the graph structure (no cycles, all inputs connected)
  2. Topologically sorts the formula blocks
  3. Compiles each formula to a PyTorch layer
  4. 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.