DE vs D2C: Compiler & SOM Deep Dive

SOM F1 匹配逻辑详解 + DVI/PDF 编译器对比 + 5 个 Case 完整分析
Model: Gemini 3.1 Pro PreviewDataset: SciDiagram-Bench v1.2Run: 20260225_015615_v12

SOM F1 匹配逻辑详解

SOM (Structured Object Model) 是从 LaTeX 编译产物中提取的语义结构。F1 指标通过 4 个独立维度评估 GT 与 Gen SOM 的匹配度。 每个维度独立计算,不存在跨维度的元素配对。

整体流程

Pipeline B (DVI Compilation)
LaTeX Code → latex 引擎 → .dvi → semantic_spy.sty 注入语义标签 → dvisvgm → .svg
→ SOM 提取器 → Elements[] (每个元素包含: id, type, text, bbox, color, z_index)
→ F1 Evaluator → 4 维 F1 分数 → Overall F1 = macro average

4 个 F1 维度的匹配算法

Type F1

细粒度类型计数匹配。不需要元素配对。

GT: {node:circle: 3, path:open: 2}
Gen: {node:circle: 2, path:open: 4}
TP = min(3,2) + min(2,4) = 4

排除容器元素 (picture, scope, axis)。细粒度类型: node:{shape}, path:{open/closed}, component:{type}

算法: Multiset Intersection

Text F1

贪心精确匹配文本内容。不考虑元素位置。

GT texts: ["1A", "u1", "0.5"]
Gen texts: ["2.5A", "u1"]
match "1A"→miss, "u1"→hit, "0.5"→miss
TP = 1

文本来源: TextElement.content, NodeElement.text_content, DataPoint 坐标值

算法: Greedy Exact Match

BBox F1

IoU 贪心匹配边界框。位置和大小都必须接近。

for gt_bbox in GT:
  find gen_bbox where IoU ≥ 0.3
  if found: TP++, remove gen_bbox
FP = len(Gen) - TP
FN = len(GT) - TP

IoU = Intersection Area / Union Area。阈值 0.3 比 CV 常用的 0.5 更宽松。

阈值: IoU ≥ 0.3

Color F1

按类型分组后,组内最优匹配(排列或贪心)。

GT path colors: [#ff0000, #0000ff]
Gen path colors: [#ff0001, #0000ff]
sim = Delta-E CIE76 in Lab space
total_sim = 0.98 + 1.0 = 1.98

相似度 = max(0, 1 - ΔE/100)。 命名色精确匹配。≤6 个颜色用全排列,>6 用贪心。

算法: Permutation / Greedy

Overall F1 计算

Overall F1 = (Type F1 + Text F1 + BBox F1 + Color F1) / 4 (macro average)

如果某维度 GT 和 Gen 都为空,则该维度 F1 = 1.0(不惩罚)。如果只有 Gen 为空,F1 = 0(全部 miss)。

关键设计:4 个维度完全独立——Type 匹配上了不代表 BBox 也匹配上了。每个维度单独衡量一个方面的正确性。

LaTeX 编译器原理对比 (DVI vs PDF)
Pipeline B — DVI 编译 (SOM / F1)
latex -interaction=nonstopmode → .dvi → dvisvgm → .svg → SOM

latex 引擎(Knuth 原版)输出 DVI 格式,保留 \special{} 语义标签。

  • semantic_spy.sty 注入 \special{dvisvgm:raw <g class="tikz-node"...>}
  • dvisvgm 转 SVG 时保留这些标签 → SOM 提取器可识别每个元素

局限:不支持 PDF 原生图形操作、高复杂度 PostScript、现代字体包

Pipeline A — PDF 编译 (图片渲染)
latexmk -pdflatex → .pdf (回退 lualatex → xelatex) → pdftoppm → .png

三个 PDF 引擎按序回退:pdflatex → lualatex → xelatex

  • 几乎所有语法正确的代码都能编译出图片
  • 但 PDF 不保留 \special{} 语义标签 → 无法提取 SOM

优势:高兼容性。劣势:无语义信息。

DVI 失败但 PDF 成功的常见原因

  • 高复杂度渲染(samples=40 + shader=interp = 1600 个插值点)— GT 用 samples=2 时 DVI 可以处理
  • 复杂 PostScript 图形 — DVI 对 PS 的支持有限
  • tikzcd 等高级宏 — SVG 结构与 semantic_spy.sty 不兼容
  • 代码不完整(缺少 \documentclass)— 预处理器补全后可能产生嵌套 document 环境

98.1% 的 GT 代码是 DVI 兼容的 — 如果模型准确重建了 GT 结构,DVI 应该能成功。

D2C vs DE 任务对比

D2C 和 DE 都提供了相同的 Prefix Code

经验证,D2C 和 DE 任务给模型的 prefix code 完全相同。两者的唯一区别是 DE 额外提供了编辑指令。

D2C: "Convert the diagram... starting exactly with the provided snippet below." + prefix

DE: 同上 + "applying the following modification: [编辑指令]"

信息D2CDE
参考图片
Prefix Code有(与 DE 相同)有(与 D2C 相同)
编辑指令有(额外语义信息)
GT 源代码
评估 GT原始 GT 源代码修改后的 answer_code

DE 可能优于 D2C 的原因

  • 语义提示:"将电流源从 1A 改为 2.5A" → 告诉模型这是电流源
  • 结构引导:"转为笛卡尔图,角度映射到 X 轴" → 引导模型用离散点
  • 简化方向:"将渐变色改为纯红色" → 引导模型用更简单的 fill
  • 不总是有帮助:"移动节点坐标" → 无法修正语法错误

核心结论:DVI 失败 / F1=0 是否等于代码质量问题?

结论:绝大多数情况下是——模型生成了"视觉近似但结构错误"的代码

  • 98.1% 的 GT 代码 DVI 兼容——准确重建 GT 结构则 DVI 应成功
  • D2C 模型选择了与 GT 不同的实现方式(连续函数 vs 离散点、过多采样点、错误语法)
  • PDF 的多重回退把结构问题"纸包火"了——图片看似相似,代码结构完全不同
  • F1 正确暴露了这些差异——DVI 失败 → Gen SOM = 0 → F1 = 0
CaseD2C F1DVI根本原因判定
#1 1769 circuit0.00FAIL无视 prefix + 组件错误代码质量
#2 0085 charts0.05OKDVI 成功但元素爆炸 (1656 vs 52)结构错误
#3 0057 3d0.00FAILsamples=40 vs GT 的 samples=2规模过度
#4 2682 geometry0.00FAILthrough=(a) 缺花括号语法 Bug
#5 5508 graph0.00FAIL用 tikzcd 宏 vs GT 的手动 \draw(模型不会手动实现)模型能力
#1 scidiagram_1769 circuit_diagrams Component Parameter Modification Code Quality Issue
D2C F1: 0.00 DE F1: 0.71
DE Edit Instruction
Change the parameter of the current source from 1A to 2.5A.
Shared Prefix Code (D2C & DE both receive this)
\documentclass[border=5pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
GT Original
GT
D2C Generated
D2C
DE Generated
DE
DE Reference
DE Ref
Metrics Comparison
MetricD2CDEDiff
SOM F1
F1 Overall 0.0000 0.7083 +0.7083
F1 Type 0.0000 0.7500 +0.7500
F1 Text 0.0000 1.0000 +1.0000
F1 BBox 0.0000 0.3333 +0.3333
F1 Color 0.0000 0.7500 +0.7500
Image Metrics
SSIM 0.4809 0.8153 +0.3344
LPIPS (lower=better) 0.6810 0.1152 -0.5657
CLIP 0.6909 0.9901 +0.2992
Code Metrics
CrystalBLEU 0.4573 0.2698 -0.1875
Compiler Analysis

DVI 编译: D2C FAIL | DE OK

D2C 问题:

D2C 模型无视 prefix 指令,输出不完整代码 + 用错组件。 D2C 和 DE 收到相同的 prefix\documentclass + \usepackage[siunitx, RPvoltages]{circuitikz}), 但 D2C 模型没有遵循"从 prefix 开始"的指令,直接输出了 \begin{document},丢失了整个前导声明。 而且代码体中用了 eV(欧洲电压源)而非 GT 中的 I(电流源)。
  • DVI 编译:缺少 \documentclass → 预处理器自动补全后产生嵌套 \begin{document} → DVI 失败 → Gen SOM = 0 → F1 = 0
  • PDF 编译latexmk 容错能力更强,回退成功 → 生成图片(但组件类型是错的)
结论:明确的代码质量问题——模型既没遵循 prefix 指令,组件类型也选错了。

DE 优势:

DE 模型正确遵循了相同的 prefix。虽然没有使用 GT 中的 to[I,...] circuitikz 高级宏(改为手动画圆+线), 但代码完整、DVI 编译成功,SOM 提取到 10 个元素,F1 = 0.71。
关键差异:DE 的编辑指令"将电流源参数从 1A 改为 2.5A"提供了额外语义信息,帮助模型理解这是电流源。
LaTeX Code (D2C / DE / GT Source / DE Answer)
\begin{document}
\begin{circuitikz}[european voltages, thick]
    \draw (0,0) to[eV, l=1\ampere, v_>=$u_1$] (2.5,0);
\end{circuitikz}
\end{document}
\documentclass[border=5pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}
  % Wires
  \draw (-1.5,0) -- (-0.6,0);
  \draw (0.6,0) -- (1.5,0);
  
  % Source component
  \draw[thick] (0,0) circle (0.6) (0,0.6) -- (0,-0.6);
  
  % Current parameter label
  \node at (0,0.95) {\Large 2.5A};
  
  % Voltage arrow and label
  \draw[-{Latex[length=3mm, width=2.5mm]}, thick] (-0.9,-0.15) arc (200:340:0.957cm);
  \node at (0,-1.2) {\Large $u_1$};
\end{tikzpicture}
\end{document}
\documentclass[border=5pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}

  \begin{circuitikz}

    \draw (0,0) to[I,l=1A, v_=$u_1$] (2,0);
  \end{circuitikz}
\end{document}
\documentclass[border=5pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}

  \begin{circuitikz}

    \draw (0,0) to[I,l=2.5A, v_=$u_1$] (2,0);
  \end{circuitikz}
\end{document}
SOM & F1 Details
D2C SOM Analysis
GT: 10 elements Gen: 0 elements DVI: FAIL
F1 = 0 (Gen SOM = 0, DVI compilation failed — no elements to match)
Full SOM Elements (GT: 10 / Gen: 0)
GT Elements (10)
IDTypeTextColorBBoxMatch
scope-1scope---67,-53 57x30Unmatched
picture-2picture---67,-53 57x30Unmatched
path-001path-S:#000-67,-41 57x18Unmatched
path-002path-S:#000-50,-53 24x24Unmatched
node-3node--nullUnmatched
node-8node1A--66,-48 11x7Unmatched
path-003path---24,-38 4x5Unmatched
path-004path-S:#000-24,-38 4x5Unmatched
node-24node--nullUnmatched
node-26nodeu1--66,-45 9x6Unmatched
Gen Elements (0)
No SOM elements (DVI compilation failed)
DE SOM Analysis
GT: 10 elements Gen: 10 elements DVI: OK
Type
0.7500
P:0.750 R:0.750
TP:6 FP:2 FN:2
Text
1.0000
P:1.000 R:1.000
TP:2 FP:0 FN:0
BBox
0.3333
P:0.300 R:0.375
TP:3 FP:7 FN:5
Color
0.7500
P:0.600 R:1.000
TP:3 FP:2 FN:0
Overall
0.7083

BBox Matched Pairs (3 matches, IoU ≥ 0.3)

GT ElementGT TypeGen ElementGen TypeIoU
scope-1scopescope-1scope0.417
picture-2picturepicture-2picture0.417
path-001pathpath-003path0.346
Type Breakdown (5 types)
TypeGTGenMatched (min)
node:currarrow100
node:isourceshape100
node:rectangle222
path:closed222
path:open242
Total886
Text Matching (2 matched, 0 GT unmatched, 0 Gen extra)
Matched (2)
2.5A u1
Full SOM Elements (GT: 10 / Gen: 10)
GT Elements (10)
IDTypeTextColorBBoxMatch
scope-1scope---67,-53 57x30↔ scope-1 (IoU:0.42)
picture-2picture---67,-53 57x30↔ picture-2 (IoU:0.42)
path-001path-S:#000-67,-41 57x18↔ path-003 (IoU:0.35)
path-002path-S:#000-50,-53 24x24Unmatched
node-3node--nullUnmatched
node-8node2.5A--66,-48 19x7Unmatched
path-003path---24,-38 4x5Unmatched
path-004path-S:#000-24,-38 4x5Unmatched
node-24node--nullUnmatched
node-26nodeu1--66,-45 9x6Unmatched
Gen Elements (10)
IDTypeTextColorBBoxMatch
scope-1scope---67,-49 85x39Matched
picture-2picture---67,-49 85x39Matched
path-001path-S:#000-67,-32 26x0Extra
path-002path-S:#000-7,-32 26x0Extra
path-003path-S:#000-41,-49 34x34Matched
node-1node2.5A--24,-42 27x10Extra
path-004path-S:#000-50,-28 47x18Extra
path-005path---5,-26 6x7Extra
path-006path-S:#000-5,-26 6x7Extra
node-2nodeu1--24,-38 12x8Extra
#2 scidiagram_0085 charts Structure Type Conversion Structural Mismatch
D2C F1: 0.05 DE F1: 0.60
DE Edit Instruction
Convert this polar plot into a Cartesian line chart where the angles (0, 90, 180, 270) are mapped to the X-axis and the radial values (1) are mapped to the Y-axis.
Shared Prefix Code (D2C & DE both receive this)
\documentclass[tikz,border=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{polar}
GT Original
GT
D2C Generated
D2C
DE Generated
DE
DE Reference
DE Ref
Metrics Comparison
MetricD2CDEDiff
SOM F1
F1 Overall 0.0502 0.6028 +0.5526
F1 Type 0.0549 0.9180 +0.8631
F1 Text 0.0734 0.4138 +0.3404
F1 BBox 0.0341 0.2222 +0.1881
F1 Color 0.0384 0.8571 +0.8187
Image Metrics
SSIM 0.6939 0.6773 -0.0166
LPIPS (lower=better) 0.1793 0.6093 +0.4299
CLIP 0.9777 0.9425 -0.0352
Code Metrics
CrystalBLEU 0.2609 0.5374 +0.2765
Compiler Analysis

DVI 编译: D2C OK (element explosion) | DE OK

D2C 问题:

D2C DVI 编译成功,但 SOM 元素爆炸(注意:这不是 DVI 失败案例)。 D2C 和 DE 收到相同的 prefix。D2C 模型选择用连续数学函数 {1/(abs(cos(x)) + abs(sin(x)))} 配合 samples=400 来画极坐标图形, 而 GT 只用 4 个 \addplot coordinates {(0,1)(90,1)(180,1)(270,1)} 离散点。
  • DVI 编译:成功!但 SOM 提取到 1656 个元素(GT 只有 52 个)→ 元素爆炸
  • 精确率崩溃:Precision 仅 0.028(1204 个 FP),虽然 Recall 0.97(35/36 TP)→ Type F1 仅 0.055
结论:这个 case 证明 DVI 编译成功不等于代码结构正确——模型选择了视觉上近似但结构完全不同的实现方式。

DE 优势:

DE 编辑指令"将极坐标图转为笛卡尔折线图,角度映射到 X 轴,半径值映射到 Y 轴"直接引导模型使用离散坐标点。 模型生成了 \addplot coordinates {(0,1)(90,1)...}(仅 50 个 SOM 元素 vs GT 42),结构匹配度高,Type F1 = 0.92。
关键差异:编辑指令中"angles (0,90,180,270) mapped to X-axis"直接告诉模型用离散点。
LaTeX Code (D2C / DE / GT Source / DE Answer)
\documentclass[tikz,border=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{polar}

\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[
    font=\Large,
    xmin=45, xmax=360,
    ymin=0, ymax=1.15,
    xtick={60,90,120,150,180,210,240,270,300,330,360},
    ytick={0.5, 1},
    yticklabels={},
    ytick style={draw=none},
    grid=major,
    major grid style={solid, lightgray},
    axis line style={solid, thick, black},
    tick style={solid, thick, black},
    xtick align=outside,
]
    % Plot the straight Cartesian segments in polar coordinates
    \addplot [
        blue,
        thick,
        domain=45:360,
        samples=400,
    ] {1/(abs(cos(x)) + abs(sin(x)))};
    
    % Add the markers at the vertices
    \addplot [
        blue,
        only marks,
        mark=*,
        mark size=2.5pt
    ] coordinates {
        (90,1) (180,1) (270,1) (360,1)
    };
    
    % Add custom labels for the radial axis
    \node[anchor=south east, inner sep=2pt] at (axis cs:180,0) {0};
    \node[anchor=north west, inner sep=3pt] at (axis cs:45,0.5) {0.5};
    \node[anchor=north west, inner sep=3pt] at (axis cs:45,1) {1};

\end{polaraxis}
\end{tikzpicture}
\end{document}
\documentclass[tikz,border=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{polar}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    width=10cm,
    height=6cm,
    xmin=0, xmax=360,
    ymin=0, ymax=1.2,
    xtick={0,90,180,270,360},
    ytick={0,0.5,1},
    xlabel={Angle},
    ylabel={Radius},
    grid=both
]
\addplot[blue, mark=*] coordinates {
    (0,1)
    (90,1)
    (180,1)
    (270,1)
    (360,1)
};
\end{axis}
\end{tikzpicture}
\end{document}
\documentclass[tikz,border=5pt]{standalone}

% Base package
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

% Required pgfplots library for polaraxis
\usepgfplotslibrary{polar}

\begin{document}
  \begin{tikzpicture}
    \begin{polaraxis}[
      xmin=45,
      xmax=360,
      ]
      \addplot coordinates {
      (0,1) (90,1) (180,1) (270,1)
    };
  \end{polaraxis}
\end{tikzpicture}
\end{document}
\documentclass[tikz,border=5pt]{standalone}

% Base package
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

% Required pgfplots library for polaraxis
\usepgfplotslibrary{polar}

\begin{document}
  \begin{tikzpicture}
    \begin{axis}
      \addplot coordinates {
      (0,1) (90,1) (180,1) (270,1)
    };
  \end{axis}
\end{tikzpicture}
\end{document}
SOM & F1 Details
D2C SOM Analysis
GT: 52 elements Gen: 1656 elements DVI: OK (element explosion)
Type
0.0549
P:0.028 R:0.972
TP:35 FP:1204 FN:1
Text
0.0734
P:0.038 R:0.889
TP:16 FP:402 FN:2
BBox
0.0341
P:0.018 R:0.569
TP:29 FP:1622 FN:22
Color
0.0384
P:0.020 R:0.998
TP:16 FP:799 FN:0
Overall
0.0502

BBox Matched Pairs (20 matches, IoU ≥ 0.3)

GT ElementGT TypeGen ElementGen TypeIoU
scope-1scopescope-1scope0.918
picture-2picturepicture-2picture0.918
scope-3scopescope-3scope0.918
picture-4picturepicture-4picture0.918
scope-5scopescope-5scope0.918
scope-6scopescope-6scope0.967
path-001pathpath-001path0.967
scope-7scopescope-7scope0.915
path-002pathpath-002path0.915
scope-8scopescope-8scope0.918
path-003pathpath-003path0.918
path-005pathpath-004path0.967
path-006pathpath-005path0.909
node-1nodenode-14node0.425
node-2nodenode-16node0.391
node-3nodenode-1node0.466
node-4nodenode-2node0.466
node-5nodenode-6node0.316
node-6nodenode-7node0.308
node-7nodenode-8node0.312
Type Breakdown (5 types)
TypeGTGenMatched (min)
data_point44044
data_series:unknown242
node:rectangle141614
path:closed88088
path:open877
Total36123935
Text Matching (16 matched, 2 GT unmatched, 402 Gen extra)
Matched (16)
60 90 120 150 180 210 240 270 300 330 360 0 1 (90, 1) (180, 1) (270, 1)
GT Unmatched (2)
0:5 (0, 1)
Gen Extra (402)
0.5 (45, 0.7071) (45.7895, 0.70721) (46.5789, 0.7074) (47.3684, 0.70773) (48.1579, 0.7082) (48.9474, 0.7088) (49.7368, 0.70956) (50.5263, 0.71045) (51.3158, 0.71147) (52.1052, 0.7126) (52.8947, 0.71388) (53.6842, 0.71535) (54.4736, 0.71693) (55.2631, 0.71863) (56.0526, 0.72047) (56.8421, 0.7225) (57.6315, 0.72469) (58.421, 0.72697) (59.2105, 0.72946) (59.9999, 0.73206) (60.7894, 0.73486) (61.5789, 0.73782) (62.3683, 0.74094) (63.1578, 0.74419) (63.9473, 0.74763) (64.7368, 0.75128) (65.5262, 0.75508) (66.3157, 0.75906) (67.1052, 0.76323)
Full SOM Elements (GT: 52 / Gen: 1656)
GT Elements (52)
52 elements (element explosion). Type distribution:
TypeCount
path16
node14
scope13
data_point4
picture2
data_series2
axis1
Gen Elements (1656)
1656 elements (element explosion). Type distribution:
TypeCount
path815
scope414
data_point404
node16
data_series4
picture2
axis1
DE SOM Analysis
GT: 42 elements Gen: 50 elements DVI: OK
Type
0.9180
P:0.849 R:1.000
TP:28 FP:5 FN:0
Text
0.4138
P:0.400 R:0.429
TP:6 FP:9 FN:8
BBox
0.2222
P:0.204 R:0.244
TP:10 FP:39 FN:31
Color
0.8571
P:0.750 R:1.000
TP:12 FP:4 FN:0
Overall
0.6028

BBox Matched Pairs (10 matches, IoU ≥ 0.3)

GT ElementGT TypeGen ElementGen TypeIoU
scope-1scopescope-1scope0.542
picture-2picturepicture-2picture0.542
scope-3scopescope-3scope0.542
picture-4picturepicture-4picture0.542
scope-5scopescope-5scope0.540
scope-6scopescope-6scope0.492
path-001pathpath-001path0.492
scope-7scopescope-7scope0.637
path-002pathpath-002path0.637
path-003pathscope-8scope0.540
Type Breakdown (5 types)
TypeGTGenMatched (min)
data_point454
data_series:unknown222
node:rectangle101010
path:closed9119
path:open353
Total283328
Text Matching (6 matched, 8 GT unmatched, 9 Gen extra)
Matched (6)
0 1 (0, 1) (90, 1) (180, 1) (270, 1)
GT Unmatched (8)
50 100 150 200 250 0:9 1:1 1:2
Gen Extra (9)
90 180 270 360 0 0:5 (360, 1) Angle Radius
Full SOM Elements (GT: 42 / Gen: 50)
GT Elements (42)
IDTypeTextColorBBoxMatch
scope-1scope---47,-60 194x161↔ scope-1 (IoU:0.54)
picture-2picture---47,-60 194x161↔ picture-2 (IoU:0.54)
axis-1axis--nullUnmatched
scope-3scope---47,-60 194x161↔ scope-3 (IoU:0.54)
picture-4picture---47,-60 194x161↔ picture-4 (IoU:0.54)
scope-5scope---47,-60 194x161↔ scope-5 (IoU:0.54)
scope-6scope---31,-60 150x161↔ scope-6 (IoU:0.49)
path-001path-S:#808080-31,-60 150x161↔ path-001 (IoU:0.49)
scope-7scope---47,-60 194x121↔ scope-7 (IoU:0.64)
path-002path-S:#808080-47,-60 194x121↔ path-002 (IoU:0.64)
path-003path-S:#000-47,-60 194x161↔ scope-8 (IoU:0.54)
node-1node0--11,0 4x7Unmatched
node-2node50--11,0 9x7Unmatched
node-3node100--11,0 14x7Unmatched
node-4node150--11,0 14x7Unmatched
node-5node200--11,0 14x7Unmatched
node-6node250--11,0 14x7Unmatched
node-7node0:9--11,0 12x7Unmatched
node-8node1--11,0 3x7Unmatched
node-9node1:1--11,0 11x7Unmatched
node-10node1:2--11,0 11x7Unmatched
series-1data_series---31,20 162x0Unmatched
scope-8scope---31,20 162x0Unmatched
path-004path-S:#00f-31,20 162x0Unmatched
series-2data_series---33,18 166x4Unmatched
scope-9scope---33,18 166x4Unmatched
scope-10scope---33,18 4x4Unmatched
pt-2-1data_point---33,18 4x4Unmatched
path-005path-F:#00f-33,18 4x4Unmatched
path-006path-S:#00c-33,18 4x4Unmatched
scope-11scope--21,18 4x4Unmatched
pt-2-2data_point--21,18 4x4Unmatched
path-007path-F:#00f21,18 4x4Unmatched
path-008path-S:#00c21,18 4x4Unmatched
scope-12scope--75,18 4x4Unmatched
pt-2-3data_point--75,18 4x4Unmatched
path-009path-F:#00f75,18 4x4Unmatched
path-010path-S:#00c75,18 4x4Unmatched
scope-13scope--129,18 4x4Unmatched
pt-2-4data_point--129,18 4x4Unmatched
path-011path-F:#00f129,18 4x4Unmatched
path-012path-S:#00c129,18 4x4Unmatched
Gen Elements (50)
IDTypeTextColorBBoxMatch
scope-1scope---36,-67 243x125Matched
picture-2picture---36,-67 243x125Matched
axis-1axis--nullExtra
scope-3scope---36,-67 243x125Matched
picture-4picture---36,-67 243x125Matched
scope-5scope---34,-67 239x125Matched
scope-6scope---34,-67 239x125Matched
path-001path-S:#bfbfbf-34,-67 239x125Matched
scope-7scope---34,-46 239x104Matched
path-002path-S:#bfbfbf-34,-46 239x104Matched
scope-8scope---34,-67 239x125Matched
path-003path-S:#808080-34,-67 239x125Extra
scope-9scope---34,-46 239x104Extra
path-004path-S:#808080-34,-46 239x104Extra
path-005path-S:#000-34,-67 239x125Extra
node-1node0-0,23 4x7Extra
node-2node90-0,23 9x7Extra
node-3node180-0,23 14x7Extra
node-4node270-0,23 14x7Extra
node-5node360-0,23 14x7Extra
node-6node0-0,23 4x7Extra
node-7node0:5-0,23 12x7Extra
node-8node1-0,23 3x7Extra
series-1data_series---34,-46 239x0Extra
scope-10scope---34,-46 239x0Extra
path-006path-S:#00f-34,-46 239x0Extra
series-2data_series---36,-48 243x4Extra
scope-11scope---36,-48 243x4Extra
scope-12scope---36,-48 4x4Extra
pt-2-1data_point---36,-48 4x4Extra
path-007path-F:#00f-36,-48 4x4Extra
path-008path-S:#00c-36,-48 4x4Extra
scope-13scope--24,-48 4x4Extra
pt-2-2data_point--24,-48 4x4Extra
path-009path-F:#00f24,-48 4x4Extra
path-010path-S:#00c24,-48 4x4Extra
scope-14scope--84,-48 4x4Extra
pt-2-3data_point--84,-48 4x4Extra
path-011path-F:#00f84,-48 4x4Extra
path-012path-S:#00c84,-48 4x4Extra
scope-15scope--143,-48 4x4Extra
pt-2-4data_point--143,-48 4x4Extra
path-013path-F:#00f143,-48 4x4Extra
path-014path-S:#00c143,-48 4x4Extra
scope-16scope--203,-48 4x4Extra
pt-2-5data_point--203,-48 4x4Extra
path-015path-F:#00f203,-48 4x4Extra
path-016path-S:#00c203,-48 4x4Extra
node-9nodeAngle--0,22 25x9Extra
node-10nodeRadius--0,23 29x7Extra
#3 scidiagram_0057 3d Element Color Change Scale Mismatch
D2C F1: 0.00 DE F1: 0.81
DE Edit Instruction
Change the fill color of the 3D surface plot from the existing multi-color gradient to a solid red.
Shared Prefix Code (D2C & DE both receive this)
\documentclass[tikz,border=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{patchplots}
GT Original
GT
D2C Generated
D2C
DE Generated
DE
DE Reference
DE Ref
Metrics Comparison
MetricD2CDEDiff
SOM F1
F1 Overall 0.0000 0.8073 +0.8073
F1 Type 0.0000 1.0000 +1.0000
F1 Text 0.0000 1.0000 +1.0000
F1 BBox 0.0000 0.5735 +0.5735
F1 Color 0.0000 0.6558 +0.6558
Image Metrics
SSIM 0.6137 0.4988 -0.1149
LPIPS (lower=better) 0.3609 0.5694 +0.2085
CLIP 0.9532 0.9491 -0.0041
Code Metrics
CrystalBLEU 0.2507 0.3732 +0.1225
Compiler Analysis

DVI 编译: D2C FAIL | DE OK

D2C 问题:

D2C 用 samples=40 产生 1600 个采样点,DVI 无法处理。 D2C 和 DE 收到相同的 prefix(含 patchplots 库)。注意:GT 也使用了 shader=interp,但 GT 用 samples=2(仅 2×2=4 个点做 bilinear patch),DVI 能正常处理。 D2C 模型却用 samples=40(40×40=1600 个采样点)+ 自定义 colormap,复杂度远超 DVI 引擎承受范围。
  • DVI 编译:1600 个插值着色点的 PostScript 超出 DVI 引擎处理能力 → 失败 → Gen SOM = 0
  • PDF 编译pdflatex 原生支持 PDF 图形操作 → 成功渲染
  • 对比:GT 用 samples=2, shader=interp(4 个点)→ DVI 成功,GT SOM = 36 个元素
结论shader=interp 本身不是问题(GT 也用了),问题在于 samples=40 导致的规模爆炸。模型没有理解 GT 用 4 个角点做 bilinear patch 的简洁方式。

DE 优势:

DE 编辑指令"将 3D 表面的渐变色改为纯红色"引导模型使用 fill=red(不需要 shader), 并用 patch type=bilinear + 4 个显式坐标点,与 GT 的 bilinear patch 结构高度一致。 DVI 编译成功,SOM 69 个元素完全匹配 GT → Type F1 = 1.0,Overall F1 = 0.81。
关键差异:编辑指令引导模型放弃渐变着色 → 代码更简洁、DVI 兼容。
LaTeX Code (D2C / DE / GT Source / DE Answer)
\documentclass[tikz,border=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{patchplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    title={Bilinear from $2 \times 2$ matrix input},
    title style={font=\Large, pad=15pt},
    view={35}{30},
    xmin=-5, xmax=5,
    ymin=-5, ymax=5,
    zmin=-25, zmax=25,
    xtick={-4,-2,0,2,4},
    ytick={-5,0,5},
    ztick={-20,0,20},
    ticklabel style={font=\large},
    colormap={custom}{
        color(0cm)=(blue!80!black);
        color(1cm)=(yellow);
        color(2cm)=(orange);
        color(3cm)=(red)
    },
    mesh/ordering=y varies
]

\addplot3[
    surf,
    samples=40,
    shader=interp,
    domain=-5:5,
    y domain=-5:5
] {0.75*x*y - 1.25*x + 1.25*y + 6.25};

\node[above=2pt, font=\Large] at (axis cs:-5, 5, 0) {(0)};
\node[above=2pt, font=\Large] at (axis cs:5, 5, 25) {(1)};
\node[above=2pt, font=\Large] at (axis cs:-5, -5, 25) {(2)};
\node[below=2pt, font=\Large] at (axis cs:5, -5, -25) {(3)};

\end{axis}
\end{tikzpicture}
\end{document}
\documentclass[tikz,border=5pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usepgfplotslibrary{patchplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    title={Bilinear from $2 \times 2$ matrix input},
    view={35}{30},
    xlabel={},
    ylabel={},
    zlabel={},
    xmin=-5, xmax=5,
    ymin=-5, ymax=5,
    zmin=-20, zmax=20,
    xtick={-4,-2,0,2,4},
    ytick={-5,0,5},
    ztick={-20,0,20},
    tick style={color=black},
    ticklabel style={font=\large},
    title style={font=\Large},
]
\addplot3 [
    patch,
    patch type=bilinear,
    fill=red,
    nodes near coords={(\coordindex)},
    every node near coord/.append style={font=\Large, text=black}
] coordinates {
    (-5,-5,0)
    (5,5,20)
    (-5,5,20)
    (5,-5,-20)
};
\end{axis}
\end{tikzpicture}
\end{document}
\documentclass[tikz,border=5pt]{standalone}

% Base packages
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

% pgfplots libraries
% patchplots is required for 'patch type=bilinear'
\usepgfplotslibrary{patchplots}

\begin{document}
  \begin{tikzpicture}
    \begin{axis}[
      nodes near coords={(\coordindex)},
      title=Bilinear from $2\times 2$ matrix input,
      ]
      % note that surf implies 'patch type=rectangle'
      \addplot3 [
      surf,
      shader=interp,
      samples=2,
      patch type=bilinear,
      ] {x*y};
    \end{axis}
  \end{tikzpicture}
\end{document}
\documentclass[tikz,border=5pt]{standalone}

% Base packages
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

% pgfplots libraries
% patchplots is required for 'patch type=bilinear'
\usepgfplotslibrary{patchplots}

\begin{document}
  \begin{tikzpicture}
    \begin{axis}[
      nodes near coords={(\coordindex)},
      title=Bilinear from $2\times 2$ matrix input,
      ]
      % note that surf implies 'patch type=rectangle'
      \addplot3 [
      patch,
      fill=red,
      draw=red,
      samples=2,
      patch type=bilinear,
      ] {x*y};
    \end{axis}
  \end{tikzpicture}
\end{document}
SOM & F1 Details
D2C SOM Analysis
GT: 36 elements Gen: 0 elements DVI: FAIL
F1 = 0 (Gen SOM = 0, DVI compilation failed — no elements to match)
Full SOM Elements (GT: 36 / Gen: 0)
GT Elements (36)
IDTypeTextColorBBoxMatch
path-001path-S:#80808043,23 168x66Unmatched
path-002path-S:#80808030,21 194x70Unmatched
path-003path-S:#00030,21 132x22Unmatched
path-004path-S:#00091,69 132x22Unmatched
path-005path-S:#00030,43 62x48Unmatched
path-006path-S:#000162,21 62x48Unmatched
path-007path--33,32 6x0Unmatched
path-008path--40,30 4x7Unmatched
path-009path--60,28 6x0Unmatched
path-010path--67,26 4x7Unmatched
path-011path--90,21 4x7Unmatched
path-012path--117,17 4x7Unmatched
path-013path--143,13 4x7Unmatched
path-014path--164,11 6x0Unmatched
path-015path--172,9 4x7Unmatched
path-016path--197,34 4x7Unmatched
path-017path--228,58 4x7Unmatched
path-018path-S:#808080101,160 109x20Unmatched
path-019path-S:#80808030,134 66x48Unmatched
path-020path-S:#00091,160 132x22Unmatched
path-021path-S:#00030,134 62x48Unmatched
path-022path-S:#80808030,43 62x139Unmatched
path-023path-S:#80808030,58 62x109Unmatched
path-024path-S:#00030,43 0x91Unmatched
path-025path-S:#00091,91 0x91Unmatched
path-026path--9,55 6x0Unmatched
path-027path--16,52 9x7Unmatched
path-028path--21,84 4x7Unmatched
path-029path--16,114 9x7Unmatched
path-030path-S:#808080162,21 62x52Unmatched
path-031path-S:#808080220,81 3x64Unmatched
path-032path-S:#000224,69 0x91Unmatched
path-033path-S:#80808043,23 106x22Unmatched
path-034path-S:#80808030,58 4x62Unmatched
path-035path-S:#808080104,71 106x109Unmatched
path-036path-S:#80808091,84 132x83Unmatched
Gen Elements (0)
No SOM elements (DVI compilation failed)
DE SOM Analysis
GT: 69 elements Gen: 69 elements DVI: OK
Type
1.0000
P:1.000 R:1.000
TP:49 FP:0 FN:0
Text
1.0000
P:1.000 R:1.000
TP:16 FP:0 FN:0
BBox
0.5735
P:0.574 R:0.574
TP:39 FP:29 FN:29
Color
0.6558
P:0.656 R:0.656
TP:20 FP:11 FN:11
Overall
0.8073

BBox Matched Pairs (20 matches, IoU ≥ 0.3)

GT ElementGT TypeGen ElementGen TypeIoU
scope-1scopescope-1scope0.799
picture-2picturepicture-2picture0.799
scope-3scopescope-3scope0.799
picture-4picturepicture-4picture0.799
scope-5scopescope-5scope0.922
scope-6scopescope-6scope0.880
path-001pathpath-001path0.880
scope-7scopescope-7scope0.890
path-002pathpath-002path0.890
path-003pathpath-003path0.671
path-004pathpath-004path0.549
path-005pathpath-005path0.640
path-006pathpath-006path0.599
scope-8scopescope-8scope0.437
path-007pathpath-007path0.437
scope-9scopescope-9scope0.658
path-008pathpath-008path0.658
path-009pathpath-009path0.475
path-010pathpath-010path0.640
scope-10scopescope-10scope0.674
Type Breakdown (4 types)
TypeGTGenMatched (min)
data_series:unknown222
node:rectangle161616
path:closed101010
path:open212121
Total494949
Text Matching (16 matched, 0 GT unmatched, 0 Gen extra)
Matched (16)
4 2 0 2 4 5 0 5 20 0 20 (0) (1) (2) (3) Bilinearfrom22matrixinput
Full SOM Elements (GT: 69 / Gen: 69)
GT Elements (69)
69 elements (element explosion). Type distribution:
TypeCount
path31
scope17
node16
picture2
data_series2
axis1
Gen Elements (69)
69 elements (element explosion). Type distribution:
TypeCount
path31
scope17
node16
picture2
data_series2
axis1
#4 scidiagram_2682 planar_geometry Element Position Move Code Quality Issue
D2C F1: 0.00 DE F1: 0.00
DE Edit Instruction
Move the node 'a' from the coordinates (2, 1.5) to the new position (2.5, 1.5).
Shared Prefix Code (D2C & DE both receive this)
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{through}
GT Original
GT
D2C Generated
D2C
DE Generated
DE
DE Reference
DE Ref
Metrics Comparison
MetricD2CDEDiff
SOM F1
F1 Overall 0.0000 0.0000 0.0000
F1 Type 0.0000 0.0000 0.0000
F1 Text 0.0000 0.0000 0.0000
F1 BBox 0.0000 0.0000 0.0000
F1 Color 0.0000 0.0000 0.0000
Image Metrics
SSIM 0.6639 0.6419 -0.0219
LPIPS (lower=better) 0.4385 0.5540 +0.1155
CLIP 0.8793 0.8955 +0.0163
Code Metrics
CrystalBLEU 0.5113 0.5667 +0.0554
Compiler Analysis

DVI 编译: D2C FAIL | DE FAIL

D2C 问题:

D2C 和 DE 犯了相同的语法错误。 两者收到相同的 prefix(含 \usetikzlibrary{through})。 GT 用 \node[draw]at(1,1)[circle through={(a)}]{$c$}(注意花括号 {(a)}), 但 D2C 和 DE 都写了 through=(a)(缺少花括号),导致 TikZ through 库无法正确解析坐标引用,圆形未被绘制。
  • D2C 写法:\node[draw, thick, circle, through=(a)] at (c) {}
  • DE 写法:\node[draw, thick, circle, through=(a)] at (c) {}
  • GT 写法:\node[draw]at(1,1)[circle through={(a)}]{$c$}
结论:这是明确的代码 bug——两者都缺少花括号,导致关键图形元素缺失。

DE 优势:

D2C 和 DE 的 F1 都是 0,因为两者犯了相同的语法错误。 DE 的编辑指令是"将节点 'a' 从 (2,1.5) 移动到 (2.5,1.5)"——这只涉及坐标修改,无法帮助模型修正 through 的花括号语法。
结论:编辑指令无法弥补模型对 TikZ 语法细节的误解。
LaTeX Code (D2C / DE / GT Source / DE Answer)
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{through}

\begin{document}
\begin{tikzpicture}
  \draw[gray] (0,0) grid (3,2);
  \coordinate (c) at (1,1);
  \coordinate (a) at (2,1.5);
  \node[draw, thick, circle, through=(a)] at (c) {};
  \node at (c) {\Large $c$};
  \node at (a) {\Large $a$};
\end{tikzpicture}
\end{document}
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{through}

\begin{document}
\begin{tikzpicture}
  \draw[step=1cm,gray,very thin] (0,0) grid (3,2);
  \node (c) at (1,1) {\Large $c$};
  \node (a) at (2.5,1.5) {\Large $a$};
  \node[draw, thick, circle, through=(a)] at (c) {};
\end{tikzpicture}
\end{document}
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{through}
\begin{document}

  \begin{tikzpicture}

    \draw[help lines](0,0)grid(3,2);
    \node(a)at(2,1.5){$a$};
    \node[draw]at(1,1)[circle through={(a)}]{$c$};
  \end{tikzpicture}
\end{document}
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{through}
\begin{document}

  \begin{tikzpicture}

    \draw[help lines](0,0)grid(3,2);
    \node(a)at(2.5,1.5){$a$};
    \node[draw]at(1,1)[circle through={(a)}]{$c$};
  \end{tikzpicture}
\end{document}
SOM & F1 Details
D2C SOM Analysis
GT: 6 elements Gen: 0 elements DVI: FAIL
F1 = 0 (Gen SOM = 0, DVI compilation failed — no elements to match)
Full SOM Elements (GT: 6 / Gen: 0)
GT Elements (6)
IDTypeTextColorBBoxMatch
scope-1scope---67,-67 88x63Unmatched
picture-2picture---67,-67 88x63Unmatched
path-001path-S:#808080-64,-64 85x57Unmatched
node-1nodea--63,-11 5x4Unmatched
path-002path-S:#000-67,-67 63x63Unmatched
node-2nodec--63,-11 4x4Unmatched
Gen Elements (0)
No SOM elements (DVI compilation failed)
DE SOM Analysis
GT: 6 elements Gen: 0 elements DVI: FAIL
F1 = 0 (Gen SOM = 0, DVI compilation failed — no elements to match)
Full SOM Elements (GT: 6 / Gen: 0)
GT Elements (6)
IDTypeTextColorBBoxMatch
scope-1scope---67,-67 102x90Unmatched
picture-2picture---67,-67 102x90Unmatched
path-001path-S:#808080-50,-50 85x57Unmatched
node-1nodea--50,2 5x4Unmatched
path-002path-S:#000-67,-67 90x90Unmatched
node-2nodec--50,2 4x4Unmatched
Gen Elements (0)
No SOM elements (DVI compilation failed)
#5 scidiagram_5508 graph_structures Conditional Filtering Code Quality Issue
D2C F1: 0.00 DE F1: 0.00
DE Edit Instruction
Filter the diagram to only show the nodes and arrows on the left side with x-coordinates less than or equal to -1, removing all other elements.
Shared Prefix Code (D2C & DE both receive this)
\documentclass[tikz,border=5pt]{standalone}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{xcolor}
\usetikzlibrary{matrix,arrows,backgrounds,shapes.misc,shapes.geometric,patterns,calc,positioning,shapes,decorations.pathmorphing}
GT Original
GT
D2C Generated
D2C
DE Generated
DE
DE Reference
DE Ref
Metrics Comparison
MetricD2CDEDiff
SOM F1
F1 Overall 0.0000 0.0000 0.0000
F1 Type 0.0000 0.0000 0.0000
F1 Text 0.0000 0.0000 0.0000
F1 BBox 0.0000 0.0000 0.0000
F1 Color 0.0000 0.0000 0.0000
Image Metrics
SSIM 0.6290 0.6499 +0.0209
LPIPS (lower=better) 0.3469 0.6707 +0.3238
CLIP 0.9515 0.9712 +0.0197
Code Metrics
CrystalBLEU 0.0392 0.3842 +0.3451
Compiler Analysis

DVI 编译: D2C FAIL | DE FAIL

D2C 问题:

D2C 和 DE 都用了 tikzcd 宏,但 GT 用的是手动 \draw。 两者收到相同的 prefix(包含 \usepackage{tikz-cd} 和多个 TikZ 库)。 虽然 prefix 中有 tikz-cd,但 GT 代码实际用的是 \begin{tikzpicture} + 手动 \draw 命令逐条绘制节点和箭头—— 这说明正确的实现方式就是手动 TikZ,而不是高级宏。模型选择 \begin{tikzcd} 是"偷懒"的做法,无法精确控制节点位置和箭头样式。
  • D2C:用 \begin{tikzcd} 高级宏(859 字符,3×5 节点矩阵)
  • DE:用 \begin{tikzcd} 简化版(440 字符,仅左侧 2 个节点)
  • GT source:手动 \draw(~80 行,每条箭头单独定位和绘制)
  • DE answer:手动 \draw(仅保留左侧节点和箭头)
结论:模型不会用手动 TikZ 精确重建图结构,转而使用高级宏生成视觉近似但结构完全不同的代码。这是明确的模型能力不足

DE 优势:

两者 F1 都是 0。但 DE 的 CrystalBLEU (0.38) 远高于 D2C (0.04), 因为 DE 代码更短、与 GT answer_code 的 preamble 重合度更高。
注意:prefix 中虽然包含 tikz-cd,但 GT 并不使用它——手动 \draw 才是正确的实现方式,模型没有这个能力。
LaTeX Code (D2C / DE / GT Source / DE Answer)
\documentclass[tikz,border=5pt]{standalone}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{xcolor}
\usetikzlibrary{matrix,arrows,backgrounds,shapes.misc,shapes.geometric,patterns,calc,positioning,shapes,decorations.pathmorphing}

\begin{document}
\begin{tikzcd}[row sep=4em, column sep=5em]
& & K \arrow[dd, "0"'] \arrow[rr, "0"] & & K \arrow[dl, "{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}"] \\
K & K^2 \arrow[l, "{\begin{bmatrix} 1 & 0 \end{bmatrix}}"'] \arrow[ur, "{\begin{bmatrix} 0 & 1 \end{bmatrix}}"] & & K^2 \arrow[ul, "{\begin{bmatrix} 0 & 1 \end{bmatrix}}"'] \arrow[dr, "{\begin{bmatrix} 0 & 1 \end{bmatrix}}"] & \\
& & K \arrow[ul, "{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}"] \arrow[ur, "{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}"] & & K \arrow[ll, "0"]
\end{tikzcd}
\end{document}
\documentclass[tikz,border=5pt]{standalone}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{xcolor}
\usetikzlibrary{matrix,arrows,backgrounds,shapes.misc,shapes.geometric,patterns,calc,positioning,shapes,decorations.pathmorphing}

\begin{document}
\begin{tikzcd}[column sep=4em]
K & K^2 \arrow[l, "{\begin{bmatrix} 1 & 0 \end{bmatrix}}"]
\end{tikzcd}
\end{document}
\documentclass[tikz,border=5pt]{standalone}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{xcolor}
\usetikzlibrary{matrix,arrows,backgrounds,shapes.misc,shapes.geometric,patterns,calc,positioning,shapes,decorations.pathmorphing}
\begin{document}

  \begin{tikzpicture}[scale=1]
    % configuracion

    \draw  (-4,0)node{$K$};
    \draw  (-2.5,0)node{$K^{2}$};
    \draw  (-1,1.15)node{$K$};
    \draw  (-1,-1.15)node{$K$};
    \draw  (0.5,0)node{$K^{2}$};
    \draw  (2,1.15)node{$K$};
    \draw  (2,-1.15)node{$K$};

    %triangulacion
    \draw[->][line width=0.5pt] (-2.72,0) -- (-3.85,0)
    node[pos=0.5,above] {{\tiny $ \begin{bmatrix}
    1&0\\
  \end{bmatrix} $}};

  \draw[->][line width=0.5pt] (-2.27,0.18) -- (-1.15,1)
  node[pos=0.5,left] {{\tiny $ \begin{bmatrix}
  0&1\\
\end{bmatrix} $}};

\draw[->][line width=0.5pt] (-1.15,-1.1) -- (-2.35,-0.1)
node[pos=0.5,below] {{\tiny $ \begin{bmatrix}
1\\
0
\end{bmatrix} $}};

\draw[->][line width=0.5pt] (-1,0.95) -- (-1,-0.95)
node[pos=0.5,left] {$0$};

\draw[->][line width=0.5pt] (0.3,0.15) -- (-0.85,1)
node[pos=0.5,right] {{\tiny $ \begin{bmatrix}
0&1\\
\end{bmatrix} $}};

\draw[->][line width=0.5pt] (-0.855,-1.05) -- (0.27,-0.15)
node[pos=0.5,above] {{\tiny $ \begin{bmatrix}
1\\
0
\end{bmatrix} $}};

\draw[->][line width=0.5pt] (-0.85,1.15) -- (1.85,1.15)
node[pos=0.5,above] {$0$};

\draw[<-][line width=0.5pt] (-0.85,-1.15) -- (1.85,-1.15)
node[pos=0.5,below] {$0$};

\draw[->][line width=0.5pt] (1.85,1) -- (0.72,0.17)
node[pos=0.35,below]  {{\tiny $ \begin{bmatrix}
1\\
0
\end{bmatrix} $}};

\draw[->][line width=0.5pt]  (0.65,-0.1) -- (1.85,-1)
node[pos=0.65,right]{{\tiny $ \begin{bmatrix}
0&1\\
\end{bmatrix} $}};

\end{tikzpicture}

\end{document}
\documentclass[tikz,border=5pt]{standalone}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{xcolor}
\usetikzlibrary{matrix,arrows,backgrounds,shapes.misc,shapes.geometric,patterns,calc,positioning,shapes,decorations.pathmorphing}
\begin{document}

  \begin{tikzpicture}[scale=1]
    % nodes on the left side (x < -1)
    \draw  (-4,0)node{$K$};
    \draw  (-2.5,0)node{$K^{2}$};

    % Arrow from K^2 to K (left)
    \draw[->][line width=0.5pt] (-2.72,0) -- (-3.85,0)
    node[pos=0.5,above] {{\tiny $ \begin{bmatrix}
    1&0\\
  \end{bmatrix} $}};

\end{tikzpicture}

\end{document}
SOM & F1 Details
D2C SOM Analysis
GT: 39 elements Gen: 0 elements DVI: FAIL
F1 = 0 (Gen SOM = 0, DVI compilation failed — no elements to match)
Full SOM Elements (GT: 39 / Gen: 0)
GT Elements (39)
IDTypeTextColorBBoxMatch
scope-1scope---55,-56 161x70Unmatched
picture-2picture---55,-56 161x70Unmatched
node-1nodeK-55,-28 8x7Unmatched
node-2nodeK2-55,-29 12x8Unmatched
node-3nodeK-55,-28 8x7Unmatched
node-4nodeK-55,-28 8x7Unmatched
node-5nodeK2-55,-29 12x8Unmatched
node-6nodeK-55,-28 8x7Unmatched
node-7nodeK-55,-28 8x7Unmatched
path-001path-S:#000-54,-21 32x0Unmatched
path-002path-S:#000-55,-24 2x5Unmatched
node-8node10-56,-25 19x6Unmatched
path-003path-S:#000-10,-49 31x23Unmatched
path-004path-S:#00018,-50 3x4Unmatched
node-9node01-56,-25 19x6Unmatched
path-005path-S:#000-12,-18 34x28Unmatched
path-006path-S:#000-12,-19 3x4Unmatched
node-10node10-56,-28 7x12Unmatched
path-007path-S:#00026,-48 0x53Unmatched
path-008path-S:#00023,3 5x2Unmatched
node-11node0-55,-28 4x7Unmatched
path-009path-S:#00031,-49 32x24Unmatched
path-010path-S:#00030,-50 3x4Unmatched
node-12node01-56,-25 19x6Unmatched
path-011path-S:#00030,-16 32x25Unmatched
path-012path-S:#00058,-17 3x4Unmatched
node-13node10-56,-28 7x12Unmatched
path-013path-S:#00030,-54 76x0Unmatched
path-014path-S:#000104,-56 2x5Unmatched
node-14node0-55,-28 4x7Unmatched
path-015path-S:#00031,12 76x0Unmatched
path-016path-S:#00030,9 2x5Unmatched
node-15node0-55,-28 4x7Unmatched
path-017path-S:#00075,-50 32x23Unmatched
path-018path-S:#00075,-29 3x4Unmatched
node-16node10-56,-28 7x12Unmatched
path-019path-S:#00073,-18 34x25Unmatched
path-020path-S:#000103,4 3x4Unmatched
node-17node01-56,-25 19x6Unmatched
Gen Elements (0)
No SOM elements (DVI compilation failed)
DE SOM Analysis
GT: 7 elements Gen: 0 elements DVI: FAIL
F1 = 0 (Gen SOM = 0, DVI compilation failed — no elements to match)
Full SOM Elements (GT: 7 / Gen: 0)
GT Elements (7)
IDTypeTextColorBBoxMatch
scope-1scope---55,-62 129x11Unmatched
picture-2picture---55,-62 129x11Unmatched
node-1nodeK-55,-61 8x7Unmatched
node-2nodeK2-55,-62 12x8Unmatched
path-001path-S:#000-54,-54 32x0Unmatched
path-002path-S:#000-55,-57 2x5Unmatched
node-3node10-56,-58 19x6Unmatched
Gen Elements (0)
No SOM elements (DVI compilation failed)