// SCI Figure Hub — Typst CeTZ Transformer Encoder Layer (CC0-1.0) #import "@preview/cetz:0.3.2" #set page(width: auto, height: auto, margin: 8pt) #cetz.canvas({ import cetz.draw: * rect((-0.6, 1.1), (4.6, 5.9), radius: 0.18, fill: rgb("#F8FAFC"), stroke: (paint: rgb("#94A3B8"), dash: "dashed")) let blk(y, label, col) = { rect((0, y), (4.0, y + 0.72), radius: 0.1, fill: col.lighten(86%), stroke: 1.2pt + col) content((2.0, y + 0.36), text(8.5pt, weight: "bold", fill: col.darken(15%))[#label]) } blk(0.0, "Input Tokens + RoPE", rgb("#1D4E89")) blk(1.35, "Multi-Head Self-Attention", rgb("#00A087")) blk(2.55, "RMSNorm + Residual Add", rgb("#475569")) blk(3.75, "SwiGLU Feed-Forward", rgb("#E64B35")) blk(4.95, "RMSNorm + Residual Add", rgb("#475569")) blk(6.35, "Contextual Output", rgb("#1D4E89")) for (y1, y2) in ((0.72, 1.35), (2.07, 2.55), (3.27, 3.75), (4.47, 4.95), (5.67, 6.35)) { line((2.0, y1), (2.0, y2), mark: (end: ">"), stroke: 1.1pt) } // Skip arrows line((2.0, 0.95), (-0.35, 0.95), (-0.35, 2.91), (0.0, 2.91), mark: (end: ">"), stroke: 1.1pt + rgb("#00A087")) line((2.0, 3.48), (-0.35, 3.48), (-0.35, 5.31), (0.0, 5.31), mark: (end: ">"), stroke: 1.1pt + rgb("#E64B35")) })