{
  "format": "tensorviz.graph",
  "version": 3,
  "exportedAt": "2026-09-17T06:03:06.039514+00:00",
  "status": "static",
  "warningCount": 0,
  "document": {
    "schemaVersion": 2,
    "semantic": {
      "graph_id": "snapshot",
      "name": "LowRankAdapter",
      "revision": 0,
      "nodes": [
        {
          "node_id": "input",
          "kind": "input",
          "op": "Input",
          "params": {
            "shape": "1,4,8"
          },
          "in_ports": [],
          "out_ports": [
            "y"
          ],
          "metadata": {
            "layerType": {
              "id": "input",
              "name": "Input",
              "displayName": "Input",
              "description": "Model input node",
              "icon": "ArrowRight",
              "category": "io",
              "parameters": [
                {
                  "name": "shape",
                  "type": "string",
                  "defaultValue": "1,3,224,224",
                  "required": true,
                  "description": "Input tensor shape (comma-separated, e.g., 1,3,224,224)"
                },
                {
                  "name": "name",
                  "type": "string",
                  "defaultValue": "input",
                  "required": false,
                  "description": "Name for this input"
                }
              ]
            }
          }
        },
        {
          "node_id": "base",
          "kind": "layer",
          "op": "Linear",
          "params": {
            "in_features": 8,
            "out_features": 8,
            "bias": false
          },
          "in_ports": [
            "x"
          ],
          "out_ports": [
            "y"
          ],
          "metadata": {
            "layerType": {
              "id": "linear",
              "name": "Linear",
              "displayName": "Linear",
              "description": "Fully Connected Layer",
              "icon": "Minus",
              "category": "linear",
              "parameters": [
                {
                  "name": "in_features",
                  "type": "number",
                  "defaultValue": 512,
                  "required": true,
                  "description": "Size of input features",
                  "min": 1
                },
                {
                  "name": "out_features",
                  "type": "number",
                  "defaultValue": 256,
                  "required": true,
                  "description": "Size of output features",
                  "min": 1
                },
                {
                  "name": "bias",
                  "type": "boolean",
                  "defaultValue": true,
                  "required": false,
                  "description": "If set to False, the layer will not learn an additive bias"
                }
              ]
            }
          }
        },
        {
          "node_id": "down",
          "kind": "layer",
          "op": "Linear",
          "params": {
            "in_features": 8,
            "out_features": 2,
            "bias": false
          },
          "in_ports": [
            "x"
          ],
          "out_ports": [
            "y"
          ],
          "metadata": {
            "layerType": {
              "id": "linear",
              "name": "Linear",
              "displayName": "Linear",
              "description": "Fully Connected Layer",
              "icon": "Minus",
              "category": "linear",
              "parameters": [
                {
                  "name": "in_features",
                  "type": "number",
                  "defaultValue": 512,
                  "required": true,
                  "description": "Size of input features",
                  "min": 1
                },
                {
                  "name": "out_features",
                  "type": "number",
                  "defaultValue": 256,
                  "required": true,
                  "description": "Size of output features",
                  "min": 1
                },
                {
                  "name": "bias",
                  "type": "boolean",
                  "defaultValue": true,
                  "required": false,
                  "description": "If set to False, the layer will not learn an additive bias"
                }
              ]
            }
          }
        },
        {
          "node_id": "up",
          "kind": "layer",
          "op": "Linear",
          "params": {
            "in_features": 2,
            "out_features": 8,
            "bias": false
          },
          "in_ports": [
            "x"
          ],
          "out_ports": [
            "y"
          ],
          "metadata": {
            "layerType": {
              "id": "linear",
              "name": "Linear",
              "displayName": "Linear",
              "description": "Fully Connected Layer",
              "icon": "Minus",
              "category": "linear",
              "parameters": [
                {
                  "name": "in_features",
                  "type": "number",
                  "defaultValue": 512,
                  "required": true,
                  "description": "Size of input features",
                  "min": 1
                },
                {
                  "name": "out_features",
                  "type": "number",
                  "defaultValue": 256,
                  "required": true,
                  "description": "Size of output features",
                  "min": 1
                },
                {
                  "name": "bias",
                  "type": "boolean",
                  "defaultValue": true,
                  "required": false,
                  "description": "If set to False, the layer will not learn an additive bias"
                }
              ]
            }
          }
        },
        {
          "node_id": "add@LowRankAdapter#0",
          "kind": "layer",
          "op": "torch.add",
          "params": {},
          "in_ports": [
            "x"
          ],
          "out_ports": [
            "y"
          ],
          "metadata": {
            "layerType": {
              "id": "add",
              "name": "torch.add",
              "displayName": "torch.add",
              "description": "PyTorch add operation",
              "icon": "Activity",
              "category": "tensor",
              "parameters": [
                {
                  "name": "dim",
                  "type": "string",
                  "defaultValue": "",
                  "required": false,
                  "description": "Dimension(s) to apply the operation on"
                }
              ]
            }
          }
        },
        {
          "node_id": "output",
          "kind": "output",
          "op": "Output",
          "params": {},
          "in_ports": [
            "x"
          ],
          "out_ports": [],
          "metadata": {
            "layerType": {
              "id": "output",
              "name": "Output",
              "displayName": "Output",
              "description": "Model output node",
              "icon": "ArrowLeft",
              "category": "io",
              "parameters": [
                {
                  "name": "name",
                  "type": "string",
                  "defaultValue": "output",
                  "required": false,
                  "description": "Name for this output"
                }
              ]
            }
          }
        }
      ],
      "edges": [
        {
          "edge_id": "edge-1",
          "source_node_id": "input",
          "target_node_id": "base",
          "source_port": "y",
          "target_port": "x",
          "metadata": {}
        },
        {
          "edge_id": "edge-2",
          "source_node_id": "input",
          "target_node_id": "down",
          "source_port": "y",
          "target_port": "x",
          "metadata": {}
        },
        {
          "edge_id": "edge-3",
          "source_node_id": "down",
          "target_node_id": "up",
          "source_port": "y",
          "target_port": "x",
          "metadata": {}
        },
        {
          "edge_id": "edge-4",
          "source_node_id": "base",
          "target_node_id": "add@LowRankAdapter#0",
          "source_port": "y",
          "target_port": "x",
          "metadata": {}
        },
        {
          "edge_id": "edge-5",
          "source_node_id": "up",
          "target_node_id": "add@LowRankAdapter#0",
          "source_port": "y",
          "target_port": "x",
          "metadata": {}
        },
        {
          "edge_id": "edge-6",
          "source_node_id": "add@LowRankAdapter#0",
          "target_node_id": "output",
          "source_port": "y",
          "target_port": "x",
          "metadata": {}
        }
      ],
      "inputs": [],
      "modules": [],
      "operations": [],
      "metadata": {}
    },
    "view": {
      "graph_id": "snapshot",
      "node_positions": {
        "input": {
          "x": 0,
          "y": 160
        },
        "base": {
          "x": 340,
          "y": 160
        },
        "down": {
          "x": 680,
          "y": 160
        },
        "up": {
          "x": 1020,
          "y": 160
        },
        "add@LowRankAdapter#0": {
          "x": 1360,
          "y": 160
        },
        "output": {
          "x": 1700,
          "y": 160
        }
      },
      "collapsed_modules": [],
      "selection": [],
      "layout": {}
    }
  },
  "snapshotId": "snapshot-6173ffca1b2ad410",
  "collaboration": {
    "walkthrough": {
      "title": "Learn a small update to frozen weights",
      "steps": [
        {
          "id": "frozen",
          "title": "Keep the base weights frozen",
          "note": "The 8 × 8 base has 64 parameters with requires_grad=False. Its output is still part of the forward calculation, but the optimizer never updates its weights.",
          "view": {
            "camera": {
              "x": -7.5,
              "y": 56.5,
              "z": 1.25
            },
            "nodePositions": {
              "input": {
                "x": 0,
                "y": 160
              },
              "base": {
                "x": 340,
                "y": 160
              },
              "down": {
                "x": 680,
                "y": 160
              },
              "up": {
                "x": 1020,
                "y": 160
              },
              "add@LowRankAdapter#0": {
                "x": 1360,
                "y": 160
              },
              "output": {
                "x": 1700,
                "y": 160
              }
            },
            "expandedModuleIds": [],
            "selectedNodeIds": [
              "base"
            ],
            "viewport": {
              "width": 1100,
              "height": 700
            }
          },
          "anchors": [
            {
              "target": {
                "kind": "node",
                "nodeId": "base"
              },
              "snapshotId": "snapshot-6173ffca1b2ad410",
              "exportedAt": "2026-09-17T06:03:06.039514+00:00",
              "modelName": "LowRankAdapter",
              "context": "{\"connections\":[\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"base\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"add@LowRankAdapter#0\\\",\\\"targetPort\\\":\\\"x\\\"}\",\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"input\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"base\\\",\\\"targetPort\\\":\\\"x\\\"}\"],\"contents\":[],\"node\":{\"id\":\"base\",\"kind\":\"layer\",\"op\":\"Linear\",\"params\":{\"bias\":false,\"in_features\":8,\"out_features\":8}}}"
            }
          ]
        },
        {
          "id": "rank",
          "title": "Project into a rank-two subspace",
          "note": "The trainable A matrix maps eight features to two. This limits the effective update BA to rank at most two. Rank bounds the weight update, not the rank of the complete base matrix.",
          "view": {
            "camera": {
              "x": -347.5,
              "y": 56.5,
              "z": 1.25
            },
            "nodePositions": {
              "input": {
                "x": 0,
                "y": 160
              },
              "base": {
                "x": 340,
                "y": 160
              },
              "down": {
                "x": 680,
                "y": 160
              },
              "up": {
                "x": 1020,
                "y": 160
              },
              "add@LowRankAdapter#0": {
                "x": 1360,
                "y": 160
              },
              "output": {
                "x": 1700,
                "y": 160
              }
            },
            "expandedModuleIds": [],
            "selectedNodeIds": [
              "down"
            ],
            "viewport": {
              "width": 1100,
              "height": 700
            }
          },
          "anchors": [
            {
              "target": {
                "kind": "node",
                "nodeId": "down"
              },
              "snapshotId": "snapshot-6173ffca1b2ad410",
              "exportedAt": "2026-09-17T06:03:06.039514+00:00",
              "modelName": "LowRankAdapter",
              "context": "{\"connections\":[\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"down\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"up\\\",\\\"targetPort\\\":\\\"x\\\"}\",\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"input\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"down\\\",\\\"targetPort\\\":\\\"x\\\"}\"],\"contents\":[],\"node\":{\"id\":\"down\",\"kind\":\"layer\",\"op\":\"Linear\",\"params\":{\"bias\":false,\"in_features\":8,\"out_features\":2}}}"
            }
          ]
        },
        {
          "id": "up",
          "title": "Return to eight features",
          "note": "B maps two features back to eight and starts at zero. The adapter initially changes nothing. B receives the first update; A's first gradient is zero until B becomes nonzero.",
          "view": {
            "camera": {
              "x": -687.5,
              "y": 56.5,
              "z": 1.25
            },
            "nodePositions": {
              "input": {
                "x": 0,
                "y": 160
              },
              "base": {
                "x": 340,
                "y": 160
              },
              "down": {
                "x": 680,
                "y": 160
              },
              "up": {
                "x": 1020,
                "y": 160
              },
              "add@LowRankAdapter#0": {
                "x": 1360,
                "y": 160
              },
              "output": {
                "x": 1700,
                "y": 160
              }
            },
            "expandedModuleIds": [],
            "selectedNodeIds": [
              "up"
            ],
            "viewport": {
              "width": 1100,
              "height": 700
            }
          },
          "anchors": [
            {
              "target": {
                "kind": "node",
                "nodeId": "up"
              },
              "snapshotId": "snapshot-6173ffca1b2ad410",
              "exportedAt": "2026-09-17T06:03:06.039514+00:00",
              "modelName": "LowRankAdapter",
              "context": "{\"connections\":[\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"down\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"up\\\",\\\"targetPort\\\":\\\"x\\\"}\",\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"up\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"add@LowRankAdapter#0\\\",\\\"targetPort\\\":\\\"x\\\"}\"],\"contents\":[],\"node\":{\"id\":\"up\",\"kind\":\"layer\",\"op\":\"Linear\",\"params\":{\"bias\":false,\"in_features\":2,\"out_features\":8}}}"
            }
          ]
        },
        {
          "id": "merge",
          "title": "Add the update, or merge its weights",
          "note": "The two branches add as Wx + (alpha/r)BAx. At inference the weights can be merged as W + (alpha/r)BA. The recorded checkpoints check the resulting outputs match.",
          "view": {
            "camera": {
              "x": -1027.5,
              "y": 60,
              "z": 1.25
            },
            "nodePositions": {
              "input": {
                "x": 0,
                "y": 160
              },
              "base": {
                "x": 340,
                "y": 160
              },
              "down": {
                "x": 680,
                "y": 160
              },
              "up": {
                "x": 1020,
                "y": 160
              },
              "add@LowRankAdapter#0": {
                "x": 1360,
                "y": 160
              },
              "output": {
                "x": 1700,
                "y": 160
              }
            },
            "expandedModuleIds": [],
            "selectedNodeIds": [
              "add@LowRankAdapter#0"
            ],
            "viewport": {
              "width": 1100,
              "height": 700
            }
          },
          "anchors": [
            {
              "target": {
                "kind": "node",
                "nodeId": "add@LowRankAdapter#0"
              },
              "snapshotId": "snapshot-6173ffca1b2ad410",
              "exportedAt": "2026-09-17T06:03:06.039514+00:00",
              "modelName": "LowRankAdapter",
              "context": "{\"connections\":[\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"add@LowRankAdapter#0\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"output\\\",\\\"targetPort\\\":\\\"x\\\"}\",\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"base\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"add@LowRankAdapter#0\\\",\\\"targetPort\\\":\\\"x\\\"}\",\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"up\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"add@LowRankAdapter#0\\\",\\\"targetPort\\\":\\\"x\\\"}\"],\"contents\":[],\"node\":{\"id\":\"add@LowRankAdapter#0\",\"kind\":\"layer\",\"op\":\"torch.add\",\"params\":{}}}"
            }
          ]
        }
      ]
    },
    "threads": [],
    "savedViews": [
      {
        "id": "rank",
        "title": "Project into a rank-two subspace",
        "note": "The trainable A matrix maps eight features to two. This limits the effective update BA to rank at most two. Rank bounds the weight update, not the rank of the complete base matrix.",
        "view": {
          "camera": {
            "x": -347.5,
            "y": 56.5,
            "z": 1.25
          },
          "nodePositions": {
            "input": {
              "x": 0,
              "y": 160
            },
            "base": {
              "x": 340,
              "y": 160
            },
            "down": {
              "x": 680,
              "y": 160
            },
            "up": {
              "x": 1020,
              "y": 160
            },
            "add@LowRankAdapter#0": {
              "x": 1360,
              "y": 160
            },
            "output": {
              "x": 1700,
              "y": 160
            }
          },
          "expandedModuleIds": [],
          "selectedNodeIds": [
            "down"
          ],
          "viewport": {
            "width": 1100,
            "height": 700
          }
        },
        "anchors": [
          {
            "target": {
              "kind": "node",
              "nodeId": "down"
            },
            "snapshotId": "snapshot-6173ffca1b2ad410",
            "exportedAt": "2026-09-17T06:03:06.039514+00:00",
            "modelName": "LowRankAdapter",
            "context": "{\"connections\":[\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"down\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"up\\\",\\\"targetPort\\\":\\\"x\\\"}\",\"{\\\"kind\\\":\\\"edge\\\",\\\"source\\\":\\\"input\\\",\\\"sourcePort\\\":\\\"y\\\",\\\"target\\\":\\\"down\\\",\\\"targetPort\\\":\\\"x\\\"}\"],\"contents\":[],\"node\":{\"id\":\"down\",\"kind\":\"layer\",\"op\":\"Linear\",\"params\":{\"bias\":false,\"in_features\":8,\"out_features\":2}}}"
          }
        ]
      }
    ],
    "openingViewId": "rank"
  }
}
