GNN 101

姚伟峰

http://www.cnblogs.com/Matrix_Yao/

Why

Graph无处不在

Graph Intelligence helps

It’s the right time now!

Gartner预测,graph技术在数据和分析创新中的使用率从2021年的10%,到2025年会增长到80%。我们目前正在经历从early adoption到early mainstream的穿越大峡谷期间,既不太早也不太晚,时间刚刚好。

What

如何建模图

A graph is an ordered pair = (, ) comprising:

  • , a set of vertices (or nodes)

  • ⊆{(,)|,∈}, a set of edges (or links), which are pairs of nodes

Example:

Different Types of Graph

  • Are edges directed?

    Directed Graph vs. Undirected Graph

  • Are there multiple types of nodes or multiple types of edges?

    Homogeneous Graph vs Heterogeneous Graph

如何表示图

不同的表示方式会指向不同的计算模式。

如何计算图

如下图所示,图的计算步骤如下:

  • 遍历图中的所有结点,或者采样图中的一些结点。每次选择其中一个结点,称为目标结点(target node);

  • 一个-层的GNN至少需要聚合目标结点的L-跳领域的信息。因此,我们需要以围绕目标结点构造一个L-跳的ego network。图中是一个2-跳ego network的例子,其中绿色结点是第1跳,蓝色结点是第2跳;

  • 计算并更新ego-network里的每个结点的embedding。embeddings会使用到图的结构信息和结点与边的特征。

那么,这些embedding是如何计算和更新的呢?主要是使用Message Passing的计算方法。Message Passing有一些计算范式如GAS(Gather-ApplyEdge-Scatter), SAGA(Scatter-ApplyEdge-Gather-ApplyVertex)等。我们这里介绍归纳得比较全面的SAGA计算范式。假设需要计算和更新下图中的:

  • Scatter

    Propagate message from source vertex to edge.

  • ApplyEdge

    Transform message along each edge.

  • Gather

    Gather transformed message to the destination vertex.

  • ApplyVertex

    Transform the gathered output to get updated vertex.

公式如下:



分析一下,会发现,SAGA模式中ApplyEdge和ApplyVertex是传统deep learning中的NN(Neural Network)操作,我们可以复用;而Scatter和Gather是GNN新引入的操作。即,Graph Computing = Graph Ops + NN Ops

不同的图数据集规模

  • One big graph

    可能高达数十亿的结点,数百亿的边。

  • Many small graphs

不同的图任务

  • Node-level prediction

    预测图中结点的类别或性质

  • Edge-level prediction

    预测图中两个结点是否存在边,以及边的类别或性质

  • Graph-level prediction

    预测整图或子图的类别或性质

How

Workflow

以fraud detection为例:

  • Tabformer数据集

  • workflow

软件栈

  • 计算平面

  • 数据平面

SW Challenges

Graph Sampler

For many small graphs datasets, full batch training works most time. Full batch training means we can do training on whole graph;

When it comes to one large graph datasets, in many real scenarios, we meet Neighbor Explosion problem;

Neighbor Explosion:

Graph sampler comes to rescue. Only sample a fraction of target nodes, and furthermore, for each target node, we sample a sub-graph of its ego-network for training. This is called mini-batch training.

Graph sampling is triggered for each data loading. And the hops of the sampled graph equals the GNN layer number . Which means graph sampler in data loader is important in GNN training.



Challenge: How to optimize sampler both as standalone and in training pipe?

When graph comes to huge(billions of nodes, tens of billions of edges), we meet new at-scale challenges:

  • How to store the huge graph across node? -> graph partition

  • How to build a training system w/ not only distributed model computing but also distributed graph store and sampling?

    • How to cut the graph while minimize cross partition connections?

A possible GNN distributed training architecture:

Scatter-Gather

  • Fuse adjacent graphs ops

    One common fuse pattern for GCN & GraphSAGE:

    Challenge:

    How to fuse more GNN patterns on different ApplyEdge and ApplyVertex,automatically?

  • How to implement fused Aggregate



    Challenge:

    • Different graph data structures lead to different implementations in same logic operations;

    • Different graph characteristics favors different data structures;(like low-degree graphs favor COO, high-degree graphs favor CSR)

    • How to find the applicable zone for each and hide such complexity to data scientists?

More

  • Inference challenge

    • GNN inference needs full batch inference, how to make it efficient?

    • Distributed inference for big graph?

    • Vector quantization for node and edge features?

    • GNN distilled to MLP?

  • SW-HW co-design challenge

    • How to relief irregular memory access in scatter-gather?

    • Do we need some data flow engine for acceleration?

Finishing words

“There is plenty of room at the top” 对技术人员很重要。但为避免入宝山而空返,我们更需要建立起技术架构,这就像是地图一样,只有按图索骥才能更好地探索和利用好top里的plenty of room。

References

  1. Graph + AI: What’s Next? Progress in Democratizing Graph for All

  2. Recent Advances in Efficient and Scalable Graph Neural Networks

  3. Crossing the Chasm – Technology adoption lifecycle

  4. Understanding and Bridging the Gaps in Current GNN Performance Optimizations

  5. Automatic Generation of High-Performance Inference Kernels for Graph Neural Networks on Multi-Core Systems

  6. Understanding GNN Computational Graph: A Coordinated Computation, IO, And Memory Perspective

  7. Graphiler: A Compiler For Graph Neural Networks

  8. Scatter-Add in Data Parallel Architectures

  9. fuseGNN: Accelerating Graph Convolutional Neural Network Training on GPGPU

  10. VQ-GNN: A Universal Framework to Scale up Graph Neural Networks using Vector Quantization

  11. NeuGraph: Parallel Deep Neural Network Computation on Large Graphs

  12. Completing a member knowledge graph with Graph Neural Networks

  13. PinnerFormer: Sequence Modeling for User Representation at Pinterest

  14. Gartner and Graph Analytics

GNN 101的更多相关文章

  1. 了解 ARDUINO 101* 平台

    原文链接 简介 作为一名物联网 (IoT) 开发人员,您需要根据项目的不同需求,选择最适合的平台来构建应用. 了解不同平台的功能至关重要. 本文第一部分比较了 Arduino 101 平台和 Ardu ...

  2. Entity Framework 6 Recipes 2nd Edition(10-1)译->非Code Frist方式返回一个实体集合

    存储过程 存储过程一直存在于任何一种关系型数据库中,如微软的SQL Server.存储过程是包含在数据库中的一些代码,通常为数据执行一些操作,它能为数据密集型计算提高性能,也能执行一些为业务逻辑. 当 ...

  3. 虚拟 ​router 原理分析- 每天5分钟玩转 OpenStack(101)

    上一节我们创建了虚拟路由器"router_100_101",并通过 ping 验证了 vlan100 和 vlan101 已经连通. 本节将重点分析其中的原理. 首先我们查看控制节 ...

  4. VS:101 Visual Studio 2010 Tips

    101 Visual Studio 2010 Tips Tip #1        How to not accidentally copy a blank line TO – Text Editor ...

  5. 【Mocha.js 101】钩子函数

    前情提要 在上一篇文章<[Mocha.js 101]同步.异步与 Promise>中,我们学会了如何对同步方法.异步回调方法以及 Promise 进行测试. 在本篇文章中,我们将了解到 M ...

  6. 【Mocha.js 101】同步、异步与 Promise

    前情提要 在上一篇文章<[Mocha.js 101]Mocha 入门指南>中,我们提到了如何用 Mocha.js 进行前端自动化测试,并做了几个简单的例子来体验 Mocha.js 给我们带 ...

  7. [nginx] connect() failed (111: Connection refused) while connecting to upstream, client: 101.18.123.107, server: localhost,

    nginx一直报错, 2016/12/02 10:23:19 [error] 1472#0: *31 connect() failed (111: Connection refused)while c ...

  8. 学习 Linux,101: Linux 命令行

    概述 本教程将简要介绍 bash shell 的一些主要特性,涵盖以下主题: 使用命令行与 shell 和命令交互 使用有效的命令和命令序列 定义.修改.引用和导出环境变量 访问命令历史和编辑工具 调 ...

  9. UVa 101 The Blocks Problem Vector基本操作

    UVa 101 The Blocks Problem 一道纯模拟题 The Problem The problem is to parse a series of commands that inst ...

随机推荐

  1. ARC120D Bracket Score 2 (模拟)

    题面 给一个长度为 2 N 2N 2N 的序列 A A A,定义一个长度为 2 N 2N 2N 的合法括号序列的 得分(score) 为: 对于每对配对的括号 i , j i,j i,j, ∣ A i ...

  2. 轻量级消息队列 Django-Q 轻度体验

    前言 最近做的这个项目(基于Django),需要做个功能,实现定时采集车辆定位. 这让我想起来几年前那个OneCat项目,当时我用的是Celery这个很重的组件 Celery实在是太重了,后来我做公众 ...

  3. 排序算法整理C++(初赛)

    排序算法整理 常见考点 将一个乱掉的字符串排回有序(以交换为基本操作)的最少操作,就是冒泡排序. 排序算法的稳定性 排序算法的时间复杂度 排序算法的稳定性 稳定性是指排序前两个元素a1 = a2,a1 ...

  4. Linux_tail总结

    tail 命令用法 功能从尾部显示文件若干行 语法: tail [ +/- num ][参数] 文件名 使用tail命令的-f选项可以方便的查阅正在改变的日志文件,tail -f filename会把 ...

  5. Oracle PLM,协同研发的产品生命周期管理平台

    官网:Oracle PLM - 方正璞华 适用企业:电子高科技.机械制造.医疗器械.化工行业等大型企业和中小型企业 咨询热线:4006-160-730 申请试用.预约演示.产品询价 邮箱:jiangc ...

  6. SpringSecurity基本使用

    SpringSecurity web 安全管理框架 需要依赖多 shiro 轻量 SSM+Shiro SpringBoot/SpringCloud+SpringSecurity 配置用户名密码 配置文 ...

  7. 关于使用kubeoperator搭建k8s集群使用containerd作为容器运行时,从自己搭建的habor仓库拉取镜像的有关说明

    1.kubepi界面添加habor仓库信息,并授权给k8s集群 这一步的操作是当在工作负载选择从harbor仓库拉取镜像时会自动创建有关的secrets信息,从而不用事先手动创建了(有别于kuboar ...

  8. 内网部署YApi

    官网地址:https://hellosean1025.github.io/yapi/devops/index.html 环境要求 nodejs(7.6+) mongodb(2.6+),安装看这篇文章: ...

  9. 图解 Kubernetes Ingress

    文章转载自:https://www.qikqiak.com/post/visually-explained-k8s-ingress/ 原文链接: https://codeburst.io/kubern ...

  10. 第六章:Django 综合篇 - 1:配置 Django

    Django项目的设置文件位于项目同名目录下,名叫settings.py.这个模块,集合了整个项目方方面面的设置属性,是项目启动和提供服务的根本保证. 一.简述 settings.py文件本质上是一个 ...