Skip to content

Commit 13159f8

Browse files
committed
Update
1 parent e85e85e commit 13159f8

File tree

4 files changed

+103
-78
lines changed

4 files changed

+103
-78
lines changed

README.md

Lines changed: 103 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,42 @@
1-
# GraphNet ![](https://img.shields.io/badge/version-v0.1-brightgreen) ![](https://img.shields.io/github/issues/PaddlePaddle/GraphNet?label=open%20issues) [![](https://img.shields.io/badge/Contribute%20to%20GraphNet-blue)](https://github.com/PaddlePaddle/GraphNet/issues/98)
21

3-
**GraphNet** is a large-scale dataset of deep learning **computation graphs**, built as a standard benchmark for **tensor compiler** optimization. It provides 2.7K computation graphs extracted from state-of-the-art deep learning models spanning diverse tasks and ML frameworks. With standardized formats and rich metadata, GraphNet enables fair comparison and reproducible evaluation of the general optimization capabilities of tensor compilers, thereby supporting advanced research such as AI for System on compilers (AI for Compiler).
2+
<h1 align="center">GraphNet: A Large-Scale Computational Graph Dataset for Tensor Compiler Research</h1>
43

5-
<br>
64
<div align="center">
7-
<img src="/pics/Eval_result.png" alt="Violin plots of speedup distributions" width="65%">
8-
</div>
9-
10-
Compiler developers can use GraphNet samples to evaluate tensor compilers (e.g., CINN, TorchInductor, TVM) on target tasks. The figure above shows the speedup of two compilers (CINN and TorchInductor) across two tasks (CV and NLP).
11-
12-
## 🧱 Dataset Construction
13-
14-
To guarantee the dataset’s overall quality, reproducibility, and cross-compiler compatibility, we define the following construction **constraints**:
155

16-
1. Computation graphs must be executable in imperative (eager) mode.
17-
2. Computation graphs and their corresponding Python code must support serialization and deserialization.
18-
3. The full graph can be decomposed into two disjoint subgraphs.
19-
4. Operator names within each computation graph must be statically parseable.
20-
5. If custom operators are used, their implementation code must be fully accessible.
21-
22-
### Graph Extraction & Validation
23-
24-
We provide automated extraction and validation tools for constructing this dataset.
25-
26-
<div align="center">
27-
<img src="/pics/graphnet_overview.jpg" alt="GraphNet Architecture Overview" width="65%">
6+
![](https://img.shields.io/badge/version-v0.1-brightgreen)
7+
![](https://img.shields.io/github/issues/PaddlePaddle/GraphNet?label=open%20issues)
8+
[![Documentation](https://img.shields.io/badge/documentation-blue)](./GraphNet_technical_report.pdf)
9+
<a href="https://img.shields.io/badge/微信-green?logo=wechat&amp"><img src="https://img.shields.io/badge/微信-green?logo=wechat&amp"></a>
2810
</div>
2911

30-
**Demo: Extract & Validate ResNet‑18**
31-
```bash
32-
git clone https://github.com/PaddlePaddle/GraphNet.git
33-
cd GraphNet
34-
35-
# Set your workspace directory
36-
export GRAPH_NET_EXTRACT_WORKSPACE=/home/yourname/graphnet_workspace/
37-
38-
# Extract the ResNet‑18 computation graph
39-
python graph_net/test/vision_model_test.py
40-
41-
# Validate the extracted graph (e.g. /home/yourname/graphnet_workspace/resnet18/)
42-
python -m graph_net.torch.validate \
43-
--model-path $GRAPH_NET_EXTRACT_WORKSPACE/resnet18/
44-
```
45-
46-
**Illustration: How does GraphNet extract and construct a computation graph sample on PyTorch?**
12+
**GraphNet** is a large-scale dataset of deep learning **computation graphs**, built as a standard benchmark for **tensor compiler** optimization. It provides over 2.7K computation graphs extracted from state-of-the-art deep learning models spanning diverse tasks and ML frameworks. With standardized formats and rich metadata, GraphNet enables fair comparison and reproducible evaluation of the general optimization capabilities of tensor compilers, thereby supporting advanced research such as AI for System on compilers.
4713

14+
## News
15+
- [2025-10-14] ✨ Our technical report is out: a detailed study of dataset construction and compiler benchmarking, introducing the novel performance metrics Speedup Score S(t) and Error-aware Speedup Score ES(t). [📘 GraphNet: A Large-Scale Computational Graph Dataset for Tensor Compiler Research](./GraphNet_technical_report.pdf)
16+
- [2025-8-20] 🚀 The second round of [open contribution tasks](https://github.com/PaddlePaddle/Paddle/issues/74773) was released. (completed ✅)
17+
- [2025-7-30] 🚀 The first round of [open contribution tasks](https://github.com/PaddlePaddle/GraphNet/issues/44) was released. (completed ✅)
18+
## Benchmark Results
19+
We evaluate two representative tensor compiler backends, CINN (PaddlePaddle) and TorchInductor (PyTorch), on GraphNet's NLP and CV subsets. The evaluation adopts two quantitative metrics proposed in the [GraphNet Technical Report](./GraphNet_technical_report.pdf):
20+
- **Speedup Score** S(t) — evaluates compiler performance under varying numerical tolerance levels.
4821
<div align="center">
49-
<img src="/pics/graphnet_sample.png" alt="GraphNet Extract Sample" width="65%">
22+
<img src="/pics/St-result.jpg" alt="Speedup Score S_t Results" width="80%">
5023
</div>
5124

52-
* Source code of custom_op is required **only when** corresponding operator is used in the module, and **no specific format** is required.
53-
54-
**Step 1: graph_net.torch.extract**
55-
56-
Import and wrap the model with `graph_net.torch.extract(name=model_name, dynamic=dynamic_mode)()` is all you need:
57-
58-
```bash
59-
import graph_net
60-
61-
# Instantiate the model (e.g. a torchvision model)
62-
model = ...
63-
64-
# Extract your own model
65-
model = graph_net.torch.extract(name="model_name", dynamic="True")(model)
66-
```
67-
68-
After running, the extracted graph will be saved to: `$GRAPH_NET_EXTRACT_WORKSPACE/model_name/`.
69-
70-
For more details, see docstring of `graph_net.torch.extract` defined in `graph_net/torch/extractor.py`.
71-
72-
**Step 2: graph_net.torch.validate**
73-
74-
To verify that the extracted model meets requirements, we use `graph_net.torch.validate` in CI tool and also ask contributors to self-check in advance:
25+
- **Error-aware Speedup Score** ES(t) — further accounts for runtime and compilation errors.
26+
<div align="center">
27+
<img src="/pics/ESt-result.jpg" alt="Error-aware Speedup Score ES_t Results" width="80%">
7528

76-
```bash
77-
python -m graph_net.torch.validate \
78-
--model-path $GRAPH_NET_EXTRACT_WORKSPACE/model_name
79-
```
29+
</div>
8030

81-
All the **construction constraints** will be examined automatically. After passing validation, a unique `graph_hash.txt` will be generated and later checked in CI procedure to avoid redundant.
31+
## Quick Start
32+
This section shows how to evaluate tensor compilers and reproduce benchmark results (for compiler users and developers),
33+
as well as how to contribute new computation graphs (for GraphNet contributors).
8234

83-
## ⚖️ Compiler Evaluation
35+
### ⚖️ Compiler Evaluation
8436

8537
**Step 1: Benchmark**
8638

87-
We use `graph_net.torch.test_compiler` to benchmark GraphNet samples with specific batch and log configurations:
39+
Use graph_net.torch.test_compiler to benchmark GraphNet samples with specific batch and logging configurations:
8840

8941
```bash
9042
# Set your benchmark directory
@@ -110,8 +62,7 @@ After executing, `graph_net.torch.test_compiler` will:
11062

11163
**Step 2: Generate JSON Record**
11264

113-
This step is to extract information (including failure) from logs in benchmark.
114-
All the information will be saved to multiple `model_compiler.json` files via:
65+
Extract runtime, correctness, and failure information from benchmark logs:
11566

11667
```bash
11768
python -m graph_net.log2json \
@@ -121,7 +72,7 @@ python -m graph_net.log2json \
12172

12273
**Step 3: Analysis**
12374

124-
After processing, we provide `graph_net.violin_analysis` to generate [violin plot](https://en.m.wikipedia.org/wiki/Violin_plot) and `graph_net.S_analysis` to generate S and ES plot based on the JSON results.
75+
Use `graph_net.violin_analysis` to generate [violin plot](https://en.m.wikipedia.org/wiki/Violin_plot) and `graph_net.S_analysis` to generate S and ES plot based on the JSON results.
12576

12677
```bash
12778
python -m graph_net.violin_analysis \
@@ -140,7 +91,69 @@ python -m graph_net.S_analysis \
14091

14192
The scripts are designed to process a file structure as `/benchmark_path/category_name/`, and items on x-axis are identified by name of the sub-directories. After executing, several summary plots of result in categories (model tasks, libraries...) will be exported to `$GRAPH_NET_BENCHMARK_PATH`.
14293

143-
## 📌 Roadmap
94+
### 🧱 Contribute More Samples
95+
96+
GraphNet provides automated tools for graph extraction and validation.
97+
98+
<div align="center">
99+
<img src="/pics/graphnet_overview.jpg" alt="GraphNet Architecture Overview" width="65%">
100+
</div>
101+
102+
**Demo: Extract & Validate ResNet‑18**
103+
```bash
104+
git clone https://github.com/PaddlePaddle/GraphNet.git
105+
cd GraphNet
106+
107+
# Set your workspace directory
108+
export GRAPH_NET_EXTRACT_WORKSPACE=/home/yourname/graphnet_workspace/
109+
110+
# Extract the ResNet‑18 computation graph
111+
python graph_net/test/vision_model_test.py
112+
113+
# Validate the extracted graph (e.g. /home/yourname/graphnet_workspace/resnet18/)
114+
python -m graph_net.torch.validate \
115+
--model-path $GRAPH_NET_EXTRACT_WORKSPACE/resnet18/
116+
```
117+
118+
**Illustration – Extraction Workflow**
119+
120+
<div align="center">
121+
<img src="/pics/dataset_composition.png" alt="GraphNet Extract Sample" width="65%">
122+
</div>
123+
124+
* Source code of custom_op is required **only when** corresponding operator is used in the module, and **no specific format** is required.
125+
126+
**Step 1: graph_net.torch.extract**
127+
128+
Wrap the model with the extractor — that’s all you need:
129+
130+
```bash
131+
import graph_net
132+
133+
# Instantiate the model (e.g. a torchvision model)
134+
model = ...
135+
136+
# Extract your own model
137+
model = graph_net.torch.extract(name="model_name", dynamic="True")(model)
138+
```
139+
140+
After running, the extracted graph will be saved to: `$GRAPH_NET_EXTRACT_WORKSPACE/model_name/`.
141+
142+
For more details, see docstring of `graph_net.torch.extract` defined in `graph_net/torch/extractor.py`.
143+
144+
**Step 2: graph_net.torch.validate**
145+
146+
To verify that the extracted model meets requirements, we use `graph_net.torch.validate` in CI tool and also ask contributors to self-check in advance:
147+
148+
```bash
149+
python -m graph_net.torch.validate \
150+
--model-path $GRAPH_NET_EXTRACT_WORKSPACE/model_name
151+
```
152+
153+
All the **construction constraints** will be examined automatically. After passing validation, a unique `graph_hash.txt` will be generated and later checked in CI procedure to avoid redundant.
154+
155+
156+
## Future Roadmap
144157

145158
1. Scale GraphNet to 10K+ graphs.
146159
2. Further annotate GraphNet samples into more granular sub-categories
@@ -149,7 +162,7 @@ The scripts are designed to process a file structure as `/benchmark_path/categor
149162

150163
**Vision**: GraphNet aims to lay the foundation for AI for Compiler by enabling **large-scale, systematic evaluation** of tensor compiler optimizations, and providing a **dataset for models to learn** and transfer optimization strategies.
151164

152-
## 💬 GraphNet Community
165+
## GraphNet Community
153166

154167
You can join our community via following group chats. Welcome to ask any questions about using and building GraphNet.
155168

@@ -167,5 +180,17 @@ You can join our community via following group chats. Welcome to ask any questio
167180
</table>
168181
</div>
169182

170-
## 🪪 License
171-
This project is released under the [MIT License](LICENSE).
183+
## License and Acknowledgement
184+
185+
GraphNet is released under the [MIT License](./LICENSE).
186+
187+
If you find this project helpful, please cite:
188+
189+
```bibtex
190+
@article{li2025graphnet,
191+
title = {GraphNet: A Large-Scale Computational Graph Dataset for Tensor Compiler Research},
192+
author = {Xinqi Li and Yiqun Liu and Shan Jiang and Enrong Zheng and Huaijin Zheng and Wenhao Dai and Haodong Deng and Dianhai Yu and Yanjun Ma},
193+
year = {2025},
194+
url = {https://github.com/PaddlePaddle/GraphNet/blob/develop/GraphNet_technical_report.pdf}
195+
}
196+
```

pics/ESt-result.jpg

306 KB
Loading

pics/St-result.jpg

298 KB
Loading

pics/dataset_composition.png

806 KB
Loading

0 commit comments

Comments
 (0)