码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • GNN 101


    GNN 101

    姚伟峰
    http://www.cnblogs.com/Matrix_Yao/

    • GNN 101
      • Why
        • Graph无处不在
        • Graph Intelligence helps
        • It’s the right time now!
      • What
        • 如何建模图
          • Different Types of Graph
        • 如何表示图
        • 如何计算图
        • 不同的图数据集规模
        • 不同的图任务
      • How
        • Workflow
        • 软件栈
        • SW Challenges
          • Graph Sampler
          • Scatter-Gather
          • More
      • Finishing words
      • References

    Why

    Graph无处不在

    Alt text

    Graph Intelligence helps

    Alt text

    It’s the right time now!

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

    Alt text

    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:
    Alt text

    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

    如何表示图

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

    Alt text

    如何计算图

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

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

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

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

    Alt text

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

    Alt text

    • Scatter
      Propagate message from source vertex to edge.

    Alt text

    • ApplyEdge
      Transform message along each edge.

    Alt text

    • Gather
      Gather transformed message to the destination vertex.

    Alt text

    • ApplyVertex
      Transform the gathered output to get updated vertex.

    Alt text

    公式如下:

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

    Alt text

    不同的图数据集规模

    • One big graph
      可能高达数十亿的结点,数百亿的边。

    Alt text

    • Many small graphs

    Alt text

    不同的图任务

    • Node-level prediction
      预测图中结点的类别或性质

    Alt text

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

    Alt text

    • Graph-level prediction
      预测整图或子图的类别或性质

    Alt text

    How

    Workflow

    Alt text

    以fraud detection为例:

    • Tabformer数据集
      Alt text

    • workflow
      Alt text

    软件栈

    Alt text

    • 计算平面

    Alt text

    • 数据平面

    Alt text

    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:
    Alt text

    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.

    Alt text
    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?

    Alt text

    A possible GNN distributed training architecture:

    Alt text

    Scatter-Gather

    • Fuse adjacent graphs ops

      One common fuse pattern for GCN & GraphSAGE:
      Alt text

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

    • How to implement fused Aggregate
      Alt text
      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。

    Alt text

    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

  • 相关阅读:
    【UVM实战 ===> Episode_3 】~ Assertion、Sequence、Property
    在Qt中,怎么获取到在mainwindow.ui文件中添加的控件
    【数仓】数据质量监控
    开仓风险计算器.xlsx(可计算:名义价值、最大资金亏损、开仓所需保证金、开仓资金杠杆、最小逐仓保证金、U本位需开张数、币本位需开张数)
    第09章 房地产行业案例实战
    python面向对象小练习-学员管理系统-eval()、__dict__
    VEX —— Functions|Transforms and Space
    这个开源项目超哇塞,手写照片在线生成
    GBase 8c 分布式核心技术—CDC数据同步
    【数据结构】二叉树相关OJ题
  • 原文地址:https://www.cnblogs.com/Matrix_Yao/p/16858882.html
  • 最新文章
  • 【JVM】编译执行与解释执行的区别是什么?JVM 使用哪种方式?
    用 Hashids 优雅解决 C 端自增 ID 暴露问题
    V8引擎 精品漫游指南--Ignition篇(上) 指令 栈帧 槽位 调用约定 内存布局 基础内容
    LLVM Pass快速入门(四):代码插桩
    milkup:桌面端 markdown AI续写和即时渲染
    基于项目工程构建SBOM(软件物料清单)的研究
    鸿蒙应用开发UI基础第二节:鸿蒙应用程序框架核心解析与实操
    .NET 中如何快速实现 List 集合去重?
    扣子Coze实战:从0到1打造抖音+小红书热点监控智能体
    浅谈数据访问层
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号