<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chaitanya K. Joshi on Medium]]></title>
        <description><![CDATA[Stories by Chaitanya K. Joshi on Medium]]></description>
        <link>https://medium.com/@chaitjo?source=rss-7768e811155d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FH1qmSqY_HXS5HcE2i_44w.jpeg</url>
            <title>Stories by Chaitanya K. Joshi on Medium</title>
            <link>https://medium.com/@chaitjo?source=rss-7768e811155d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 22:14:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chaitjo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Transformers are Graph Neural Networks]]></title>
            <link>https://medium.com/data-science/transformers-are-graph-neural-networks-bca9f75412aa?source=rss-7768e811155d------2</link>
            <guid isPermaLink="false">https://medium.com/p/bca9f75412aa</guid>
            <category><![CDATA[graph-neural-networks]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Chaitanya K. Joshi]]></dc:creator>
            <pubDate>Mon, 09 Mar 2020 03:40:33 GMT</pubDate>
            <atom:updated>2020-12-23T13:43:33.937Z</atom:updated>
            <content:encoded><![CDATA[<h4>This post aims to build intuitions behind the Transformer architecture for NLP, and its connection with neural networks on graphs.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rAeJ7jV_p3ctI_WeLZouIw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@tetrakiss?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Arseny Togulev</a> on <a href="https://unsplash.com/s/photos/transformers?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Engineer friends often ask me: Graph Deep Learning sounds great, but are there any big commercial success stories? Is it being deployed in practical applications?</p><p>Besides the obvious ones–recommendation systems at <a href="https://medium.com/pinterest-engineering/pinsage-a-new-graph-convolutional-neural-network-for-web-scale-recommender-systems-88795a107f48">Pinterest</a>, <a href="https://arxiv.org/abs/1902.08730">Alibaba</a> and <a href="https://blog.twitter.com/en_us/topics/company/2019/Twitter-acquires-Fabula-AI.html">Twitter</a>–a slightly nuanced success story is the <a href="https://arxiv.org/abs/1706.03762"><strong>Transformer architecture</strong></a>, which has <a href="https://openai.com/blog/better-language-models/">taken</a> <a href="https://www.blog.google/products/search/search-language-understanding-bert/">the</a> <a href="https://www.microsoft.com/en-us/research/project/large-scale-pretraining-for-response-generation/">NLP</a> <a href="https://ai.facebook.com/blog/roberta-an-optimized-method-for-pretraining-self-supervised-nlp-systems/">industry</a> <a href="https://blog.einstein.ai/introducing-a-conditional-transformer-language-model-for-controllable-generation/">by</a> <a href="https://nv-adlr.github.io/MegatronLM">storm</a>.</p><p>Through this post, I want to establish links between <a href="https://graphdeeplearning.github.io/project/spatial-convnets/">Graph Neural Networks (GNNs)</a> and Transformers. I’ll talk about the intuitions behind model architectures in the NLP and GNN communities, make connections using equations and figures, and discuss how we could work together to drive progress.</p><p>Let’s start by talking about the purpose of model architectures–<em>representation learning</em>.</p><h3>Representation Learning for NLP</h3><p>At a high level, all neural network architectures build <em>representations</em> of input data as vectors/embeddings, which encode useful statistical and semantic information about the data. These <em>latent</em> or <em>hidden</em> representations can then be used for performing something useful, such as classifying an image or translating a sentence. The neural network <em>learns</em> to build better-and-better representations by receiving feedback, usually via error/loss functions.</p><p>For Natural Language Processing (NLP), conventionally, <strong>Recurrent Neural Networks</strong> (RNNs) build representations of each word in a sentence in a sequential manner, <em>i.e.</em>, <strong>one word at a time</strong>. Intuitively, we can imagine an RNN layer as a conveyor belt, with the words being processed on it <em>autoregressively</em> from left to right. At the end, we get a hidden feature for each word in the sentence, which we pass to the next RNN layer or use for our NLP tasks of choice.</p><blockquote><em>I highly recommend Chris Olah’s legendary blog for recaps on </em><a href="http://colah.github.io/posts/2015-08-Understanding-LSTMs/"><em>RNNs</em></a><em> and </em><a href="http://colah.github.io/posts/2014-07-NLP-RNNs-Representations/"><em>representation learning</em></a><em> for NLP.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uOFuuG1GHfX8csmo.jpg" /><figcaption>RNNs build representations of each word in a sentence in a sequential manner, <em>i.e.</em>, <strong>one word at a time</strong>. On the other hand, Transformers use an attention mechanism to figure out how important <strong>all the other words</strong> in the sentence are w.r.t. to the aforementioned word.</figcaption></figure><p>Initially introduced for machine translation, <strong>Transformers</strong> have gradually replaced RNNs in mainstream NLP. The architecture takes a fresh approach to representation learning: Doing away with recurrence entirely, Transformers build features of each word using an <a href="https://distill.pub/2016/augmented-rnns/">attention</a> <a href="https://lilianweng.github.io/lil-log/2018/06/24/attention-attention.html">mechanism</a> to figure out how important <strong>all the other words</strong> in the sentence are w.r.t. to the aforementioned word. Knowing this, the word’s updated features are simply the sum of linear transformations of the features of all the words, weighted by their importance.</p><blockquote><em>Back in 2017, this idea sounded very radical, because the NLP community was so used to the sequential–one-word-at-a-time–style of processing text with RNNs. The title of the paper probably added fuel to the fire!</em></blockquote><blockquote><em>For a recap, Yannic Kilcher made an excellent </em><a href="https://www.youtube.com/watch?v=iDulhoQ2pro"><em>video overview</em></a><em>.</em></blockquote><h3>Breaking down the Transformer</h3><p>Let’s develop intuitions about the architecture by translating the previous paragraph into the language of mathematical symbols and vectors. We update the hidden feature <em>h</em> of the <em>i</em>’th word in a sentence <em>S </em>from layer <em>ℓ </em>to layer <em>ℓ+1 </em>as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_uKUOiG4GocCzyvjhmMhCw.png" /></figure><p>where <em>j∈ S </em>denotes the set of words in the sentence and <em>Q, K, V </em>are learnable linear weights (denoting the <strong>Q</strong>uery, <strong>K</strong>ey and <strong>V</strong>alue for the attention computation, respectively). The attention mechanism is performed parallelly for each word in the sentence to obtain their updated features in <em>one shot</em>–another plus point for Transformers over RNNs, which update features word-by-word.</p><p>We can understand the attention mechanism better through the following pipeline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P9klPGG679aP0AKKKnSt-g.png" /><figcaption>Taking in the features of the word <em>h_i^ℓ</em> and the set of other words in the sentence h_j^ℓ; ∀ j∈ S, we compute the attention weights w_{ij} for each pair (i, j) through the dot-product, followed by a softmax across all j’s. Finally, we produce the updated word feature h_i^{ℓ+1} for word i by summing over all h_j^ℓ’s weighted by their corresponding w_{ij}. Each word in the sentence parallelly undergoes the same pipeline to update its features.</figcaption></figure><h3>Multi-head Attention mechanism</h3><p>Getting this dot-product attention mechanism to work proves to be tricky–bad random initializations can de-stabilize the learning process. We can overcome this by parallelly performing multiple ‘heads’ of attention and concatenating the result (with each head now having separate learnable weights):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GW9efJOKAOW7WAFrKGNrpg.png" /></figure><p>where <em>Q^k,K^k, V^k</em> are the learnable weights of the <em>k</em>’th attention head and <em>O</em> is a down-projection to match the dimensions of <em>h_i^{ℓ+1}</em> and <em>h_i^ℓ </em>across layers.</p><p>Multiple heads allow the attention mechanism to essentially ‘hedge its bets’, looking at different transformations or aspects of the hidden features from the previous layer. We’ll talk more about this later.</p><h3>Scale issues and the Feed-forward sub-layer</h3><p>A key issue motivating the final Transformer architecture is that the features for words <em>after</em> the attention mechanism might be at <strong>different scales</strong> or <strong>magnitudes</strong>: (1) This can be due to some words having very sharp or very distributed attention weights <em>w_{ij}</em> when summing over the features of the other words. (2) At the individual feature/vector entries level, concatenating across multiple attention heads–each of which might output values at different scales–can lead to the entries of the final vector <em>h_i^{ℓ+1}</em> having a wide range of values. Following conventional ML wisdom, it seems reasonable to add a <a href="https://nealjean.com/ml/neural-network-normalization/">normalization layer</a> into the pipeline.</p><p>Transformers overcome issue (2) with <a href="https://arxiv.org/abs/1607.06450"><strong>LayerNorm</strong></a>, which normalizes and learns an affine transformation at the feature level. Additionally, <strong>scaling the dot-product</strong> attention by the square-root of the feature dimension helps counteract issue (1).</p><p>Finally, the authors propose another ‘trick’ to control the scale issue: <strong>a position-wise 2-layer MLP</strong> with a special structure. After the multi-head attention, they project <em>h_i^{ℓ+1}</em> to a (absurdly) higher dimension by a learnable weight, where it undergoes the ReLU non-linearity, and is then projected back to its original dimension followed by another normalization:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCktLUdq3TKNRHcIe83XhA.png" /></figure><blockquote><em>To be honest, I’m not sure what the exact intuition behind the over-parameterized feed-forward sub-layer was and nobody seems to be asking questions about it, too! I suppose LayerNorm and scaled dot-products didn’t completely solve the issues highlighted, so the big MLP is a sort of hack to re-scale the feature vectors independently of each other.</em></blockquote><blockquote><a href="/service/mailto:chaitanya.joshi@ntu.edu.sg"><em>Email me</em></a><em> if you know more!</em></blockquote><p>The final picture of a Transformer layer looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FPvwJMRjjXfXnSkBRo66VQ.png" /></figure><p>The Transformer architecture is also extremely amenable to very deep networks, enabling the NLP community to <a href="https://arxiv.org/abs/1910.10683"><em>scale</em></a><em> </em><a href="https://arxiv.org/abs/2001.08361"><em>up</em></a> in terms of both model parameters and, by extension, data. <strong>Residual connections</strong> between the inputs and outputs of each multi-head attention sub-layer and the feed-forward sub-layer are key for stacking Transformer layers (but omitted from the diagram for clarity).</p><h3>GNNs build representations of graphs</h3><p>Let’s take a step away from NLP for a moment.</p><p>Graph Neural Networks (GNNs) or Graph Convolutional Networks (GCNs) build representations of nodes and edges in graph data. They do so through <strong>neighbourhood aggregation</strong> (or message passing), where each node gathers features from its neighbours to update its representation of the <em>local</em> graph structure around it. Stacking several GNN layers enables the model to propagate each node’s features over the entire graph–from its neighbours to the neighbours’ neighbours, and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yfkUTt1MCUJyQZKC.jpg" /><figcaption><em>Take the example of this emoji social network: The node features produced by the GNN can be used for predictive tasks such as identifying the most influential members or proposing potential connections.</em></figcaption></figure><p>In their most basic form, GNNs update the hidden features <em>h </em>of node <em>i </em>(for example, 😆) at layer <em>ℓ </em>via a non-linear transformation of the node’s own features <em>h_i^ℓ</em> added to the aggregation of features <em>h_j^ℓ</em> from each neighbouring node <em>j∈ N(i)</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lePRCWw6_yHSSXfgrOgqTg.png" /></figure><p>where <em>U, V</em> are learnable weight matrices of the GNN layer and <em>σ </em>is a non-linearity such as ReLU. In the example, <em>N</em>(😆) <em>= { </em>😘, 😎, 😜, 🤩 <em>}</em>.</p><p>The summation over the neighbourhood nodes <em>j∈ N(i) </em>can be replaced by other input size-invariant <strong>aggregation functions</strong> such as simple mean/max or something more powerful, such as a weighted sum via an <a href="https://petar-v.com/GAT/"><strong>attention mechanism</strong></a>.</p><p>Does that sound familiar?</p><p>Maybe a pipeline will help make the connection:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rtwNCnJzQCKdF9xmGH_ikQ.png" /></figure><blockquote>If we were to do multiple parallel heads of neighbourhood aggregation and replace summation over the neighbours j with the attention mechanism, <em>i.e.</em>, a weighted sum, we’d get the <strong>Graph Attention Network</strong> (GAT). Add normalization and the feed-forward MLP, and voila, we have a <strong>Graph Transformer</strong>!</blockquote><h3>Sentences are fully-connected word graphs</h3><p>To make the connection more explicit, consider a sentence as a fully-connected graph, where each word is connected to every other word. Now, we can use a GNN to build features for each node (word) in the graph (sentence), which we can then perform NLP tasks with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*us_7FSBiUv6wLhOW.jpg" /></figure><p>Broadly, this is what Transformers are doing: they are <strong>GNNs with multi-head attention</strong> as the neighbourhood aggregation function. Whereas standard GNNs aggregate features from their local neighbourhood nodes <em>j∈ N(i)</em>, Transformers for NLP treat the entire sentence <em>S </em>as the local neighbourhood, aggregating features from each word <em>j∈ S </em>at each layer.</p><p>Importantly, various problem-specific tricks–such as position encodings, causal/masked aggregation, learning rate schedules and extensive pre-training–are essential for the success of Transformers but seldom seem in the GNN community. At the same time, looking at Transformers from a GNN perspective could inspire us to get rid of a lot of the <em>bells and whistles</em> in the architecture.</p><h3>What can we learn from each other?</h3><p>Now that we’ve established a connection between Transformers and GNNs, let me throw some ideas around…</p><h4>Are fully-connected graphs the best input format for NLP?</h4><p>Before statistical NLP and ML, linguists like Noam Chomsky focused on developing fomal theories of <a href="https://en.wikipedia.org/wiki/Syntactic_Structures">linguistic structure</a>, such as <strong>syntax trees/graphs</strong>. <a href="https://arxiv.org/abs/1503.00075">Tree LSTMs</a> already tried this, but maybe Transformers/GNNs are better architectures for bringing the world of linguistic theory and statistical NLP closer?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*iePdcySymF2I-2cQ.png" /><figcaption>Source: <a href="https://en.wikipedia.org/wiki/Syntactic_Structures#/media/File:Cgisf-tgg.svg">Wikipedia</a></figcaption></figure><h4>How to learn long-term dependencies?</h4><p>Another issue with fully-connected graphs is that they make learning very long-term dependencies between words difficult. This is simply due to how the number of edges in the graph <strong>scales quadratically</strong> with the number of nodes, <em>i.e.</em>, in an <em>n</em> word sentence, a Transformer/GNN would be doing computations over <em>n^2 </em>pairs of words. Things get out of hand for very large <em>n</em>.</p><p>The NLP community’s perspective on the long sequences and dependencies problem is interesting: Making the attention mechanism <a href="https://openai.com/blog/sparse-transformer/">sparse</a> or <a href="https://ai.facebook.com/blog/making-transformer-networks-simpler-and-more-efficient/">adaptive</a> in terms of input size, adding <a href="https://ai.googleblog.com/2019/01/transformer-xl-unleashing-potential-of.html">recurrence</a> or <a href="https://deepmind.com/blog/article/A_new_model_and_dataset_for_long-range_memory">compression</a> into each layer, and using <a href="https://www.pragmatic.ml/reformer-deep-dive/">Locality Sensitive Hashing</a> for efficient attention are all promising new ideas for better Transformers.</p><p>It would be interesting to see ideas from the GNN community thrown into the mix, <em>e.g.</em>, <a href="https://arxiv.org/abs/1911.04070">Binary Partitioning</a> for sentence <strong>graph sparsification</strong> seems like another exciting approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ohnq0OBq8Rq7-3y9.png" /><figcaption>Source: <a href="https://arxiv.org/abs/1911.04070">Ye et al., 2019</a></figcaption></figure><h4>Are Transformers learning ‘neural syntax’?</h4><p>There have been <a href="https://pair-code.github.io/interpretability/bert-tree/">several</a> <a href="https://arxiv.org/abs/1905.05950">interesting</a> <a href="https://arxiv.org/abs/1906.04341">papers</a> from the NLP community on what Transformers might be learning. The basic premise is that performing attention on all word pairs in a sentence–with the purpose of identifying which pairs are the most interesting–enables Transformers to learn something like a <strong>task-specific syntax</strong>. Different heads in the multi-head attention might also be ‘looking’ at different syntactic properties.</p><p>In graph terms, by using GNNs on full graphs, can we recover the most important edges–and what they might entail–from how the GNN performs neighbourhood aggregation at each layer? I’m <a href="https://arxiv.org/abs/1909.07913">not so convinced</a> by this view yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yTu17SmjcOz2goub.png" /><figcaption>Source: <a href="https://arxiv.org/abs/1906.04341">Clark et al., 2019</a></figcaption></figure><h4>Why multiple heads of attention? Why attention?</h4><p>I’m more sympathetic to the optimization view of the multi-head mechanism–having multiple attention heads <strong>improves learning</strong> and overcomes <strong>bad random initializations</strong>. For instance, <a href="https://lena-voita.github.io/posts/acl19_heads.html">these</a> <a href="https://arxiv.org/abs/1905.10650">papers</a> showed that Transformer heads can be ‘pruned’ or removed <em>after</em> training without significant performance impact.</p><p>Multi-head neighbourhood aggregation mechanisms have also proven effective in GNNs, <em>e.g.</em>, GAT uses the same multi-head attention and <a href="https://arxiv.org/abs/1611.08402">MoNet</a> uses multiple <em>Gaussian kernels</em> for aggregating features. Although invented to stabilize attention mechanisms, could the multi-head trick become standard for squeezing out extra model performance?</p><p>Conversely, GNNs with simpler aggregation functions such as sum or max do not require multiple aggregation heads for stable training. Wouldn’t it be nice for Transformers if we didn’t have to compute pair-wise compatibilities between each word pair in the sentence?</p><p>Could Transformers benefit from ditching attention, altogether? Yann Dauphin and collaborators’ <a href="https://arxiv.org/abs/1705.03122">recent</a> <a href="https://arxiv.org/abs/1901.10430">work</a> suggests an alternative <strong>ConvNet architecture</strong>. Transformers, too, might ultimately be doing <a href="http://jbcordonnier.com/posts/attention-cnn/">something</a> <a href="https://twitter.com/ChrSzegedy/status/1232148457810538496">similar</a> to ConvNets!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QfaQempjSCB9Xl5J.png" /><figcaption>Source: <a href="https://arxiv.org/pdf/1901.10430.pdf">Wu et al., 2019</a></figcaption></figure><h4>Why is training Transformers so hard?</h4><p>Reading new Transformer papers makes me feel that training these models requires something akin to <em>black magic</em> when determining the best <strong>learning rate schedule, warmup strategy</strong> and <strong>decay settings</strong>. This could simply be because the models are so huge and the NLP tasks studied are so challenging.</p><p>But <a href="https://arxiv.org/abs/1906.01787">recent</a> <a href="https://arxiv.org/abs/1910.06764">results</a> <a href="https://arxiv.org/abs/2002.04745">suggest</a> that it could also be due to the specific permutation of normalization and residual connections within the architecture.</p><h3>Chaitanya Joshi on Twitter</h3><p>I enjoyed reading the new @DeepMind Transformer paper, but why is training these models such dark magic? &quot;For word-based LM we used 16, 000 warmup steps with 500, 000 decay steps and sacrifice 9,000 goats.&quot; https://t.co/dP49GTa4ze</p><p>At this point I’m ranting, but this makes me skeptical: Do we really need multiple heads of expensive pair-wise attention, overparameterized MLP sub-layers, and complicated learning schedules?</p><p>Do we really need massive models with <a href="https://www.technologyreview.com/s/613630/training-a-single-ai-model-can-emit-as-much-carbon-as-five-cars-in-their-lifetimes/">massive carbon footprints</a>?</p><p>Shouldn’t architectures with good <a href="https://arxiv.org/abs/1806.01261">inductive biases</a> for the task at hand be easier to train?</p><h3>Further Reading</h3><p>To dive deep into the Transformer architecture from an NLP perspective, check out these amazing blog posts: <a href="http://jalammar.github.io/illustrated-transformer/">The Illustrated Transformer</a> and <a href="http://nlp.seas.harvard.edu/2018/04/03/attention.html">The Annotated Transformer</a>.</p><p>Also, this blog isn’t the first to link GNNs and Transformers: Here’s <a href="https://ipam.wistia.com/medias/1zgl4lq6nh">an excellent talk</a> by Arthur Szlam on the history and connection between Attention/Memory Networks, GNNs and Transformers. Similarly, DeepMind’s <a href="https://arxiv.org/abs/1806.01261">star-studded position paper</a> introduces the <em>Graph Networks</em> framework, unifying all these ideas. For a code walkthrough, the DGL team has <a href="https://docs.dgl.ai/en/latest/tutorials/models/4_old_wines/7_transformer.html">a nice tutorial</a> on seq2seq as a graph problem and building Transformers as GNNs.</p><p><strong>In our next post, we’ll be doing the reverse: using GNN architectures as Transformers for NLP (based on the Transformers library by </strong><a href="https://github.com/huggingface/transformers"><strong>🤗 HuggingFace</strong></a><strong>).</strong></p><p>Finally, we wrote <a href="https://graphdeeplearning.github.io/publication/xu-2019-multi/">a recent paper</a> applying Transformers to sketch graphs. Do check it out!</p><h4>Updates</h4><p><em>Transformers are GNNs</em> was published with <a href="https://thegradient.pub/transformers-are-graph-neural-networks/"><em>The Gradient</em></a><em> </em>in September 2020!</p><p>The post originally appeared on the <a href="https://graphdeeplearning.github.io/post/transformers-are-gnns/">NTU Graph Deep Learning lab website</a>, and has also been translated to <a href="https://mp.weixin.qq.com/s/DABEcNf1hHahlZFMttiT2g">Chinese</a> and <a href="https://habr.com/ru/post/491576/">Russian</a>. Do join the discussion on <a href="https://twitter.com/chaitjo/status/1233220586358181888?s=20">Twitter</a>, <a href="https://www.reddit.com/r/MachineLearning/comments/fb86mo/d_transformers_are_graph_neural_networks_blog/">Reddit</a> or <a href="https://news.ycombinator.com/item?id=22518263">HackerNews</a>!</p><h3>Oriol Vinyals on Twitter</h3><p>Transformers are a special case of Graph Neural Networks. This may be obvious to some, but the following blog post does a good job at explaining these important concepts. https://t.co/H8LT2F7LqC</p><h4>Citation</h4><p><em>For attribution in academic contexts or books, please cite this work as</em></p><blockquote><em>Chaitanya K. Joshi, “Transformers are Graph Neural Networks”, The Gradient, 2020.</em></blockquote><p><em>BibTeX citation:</em></p><blockquote><em>@article{joshi2020transformers,<br>author = {Joshi, Chaitanya},<br>title = {Transformers are Graph Neural Networks},<br>journal = {The Gradient},<br>year = {2020},<br>howpublished = {\url{</em><a href="https://thegradient.pub/transformers-are-gaph-neural-networks/"><em>https://thegradient.pub/transformers-are-gaph-neural-networks/</em></a><em> } },<br>}</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bca9f75412aa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/transformers-are-graph-neural-networks-bca9f75412aa">Transformers are Graph Neural Networks</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Valedictory Speech at NTU Convocation 2019]]></title>
            <link>https://medium.com/@chaitjo/my-valedictory-speech-at-ntu-convocation-2019-33ffa8e53d2?source=rss-7768e811155d------2</link>
            <guid isPermaLink="false">https://medium.com/p/33ffa8e53d2</guid>
            <category><![CDATA[valedictorian]]></category>
            <category><![CDATA[ntu]]></category>
            <category><![CDATA[community]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[singapore]]></category>
            <dc:creator><![CDATA[Chaitanya K. Joshi]]></dc:creator>
            <pubDate>Wed, 31 Jul 2019 08:39:53 GMT</pubDate>
            <atom:updated>2020-10-07T06:29:32.933Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Last week, I officially <strong>graduated from NTU, Singapore</strong> with a Bachelor’s Degree in Computer Science, and had the good fortune to be chosen <strong>Valedictorian</strong> of my cohort.</blockquote><blockquote>Looking back, the past 4 years have been a journey of maturity and growth, fuelled not only by the excellent technical education and skills I gained, but more so by<strong> a supportive community </strong>of friends, family, mentors, and connections.</blockquote><blockquote>Our degrees may have our names on them, but hidden between the lines are the stories of our communities. Through my speech, I wanted to highlight the importance of building and growing our communities. I also wanted to thank all those that stood by me and supported me as I navigated the ups and downs of university life.</blockquote><blockquote>Read on for the full transcript…</blockquote><blockquote>P.S. You can listen to the actual speech <a href="https://www.youtube.com/watch?v=tS1h4WTx6Rs">on YouTube</a>.</blockquote><p>Madam Pro-Chancellor, graduates, ladies and gentlemen,</p><p>Good afternoon and thank you for being here. First and foremost, Class of 2019, <strong>congratulations for graduating</strong>, and thank you for choosing me to represent our batch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*whkE3Vd0ykFxemt-31FVDA.jpeg" /><figcaption>Listen to the speech from the 1:39:30 mark of the <a href="https://livestream.com/NTU/convo2019/videos/194132071"><strong>official recording by NTU</strong></a><strong>.</strong></figcaption></figure><p>When I first came to Singapore, I was an 18-year old international student, leaving my home and my comfort zone for the first time. The past 4 years have been a journey of <strong>maturity</strong> and <strong>growth</strong> for me, as I’m sure they’ve been for all of us. Today, I’d like to share something important I’ve learnt along the way.</p><p>Something that the degrees conferred on us today will not mention.</p><p>Something that no resume can reflect.</p><p>I want to talk about <strong>Community</strong>: the community we inherited at NTU, the community we built over the years, and the community of our shared future.</p><p>At NTU, we are a <strong>diverse</strong> student body: all of us have different backgrounds, different stories, different beliefs. But the <strong>differences</strong> are what make it such a great environment for us to come together, learn from each other, and <strong>thrive, as a community</strong>.</p><p>I’m talking about large communities: our classes, our halls, our student clubs; as well as small communities: our project groups, our mentors, and, of course, our friends.</p><p>Over the past 4 years, it’s these strong, organic communities that shaped us and helped us <strong>go far beyond</strong> our own expectations. Today, I invite all of us to travel back in time and recall our NTU community.</p><p>I’ll go first.</p><p>I was fortunate to find a likeminded community through attending and organising events with student clubs. It all started with the <strong>IEEE Student Branch</strong>, who organized <em>iNTUition</em>, NTU’s first annual hackathon: over the past 4 years, we pulled multiple all-nighters, wrote thousands of funding emails, and lugged so many pizzas across campus. And we successfully grew the hackathon from 70 participants in its first iteration, to over 250 today.</p><p>Next, the hackers at the <strong>Open Source Society</strong>, who held free programming workshops week-after-week, and the attendees I met at the workshops: your passion to constantly learn something new, and your enthusiasm to share it with the world inspires me every day.</p><p>As I started becoming interested in <strong>academic research</strong>, I was lucky to find mentors at SCSE who took the time to guide and nurture me. Professor Sinno: your Machine Learning course gave me a direction to pursue in university. Professor Cambria: you held my hand as I entered the research world. And Professor Bresson: you became a mentor not just in research, but also in life.</p><p>Most importantly, I found <strong>lifelong friends</strong> in hall and in the classroom. You guys kept me sane through the 4 years of lectures, quizzes and assignments. Today, I have the confidence to stand here because of <strong>you</strong>, and countless others.</p><p>This was <strong>my </strong>NTU community.</p><p>Now, I also want to take this moment to appreciate the <strong>SCSE leadership and staff</strong> for creating an environment of <strong>freedom</strong> for young people to go beyond the classroom and form their own communities.</p><p>Looking back, I believe that for most of us, our focus, what we spent most of our energy on, has always been something <strong>outside </strong>the classroom: clubs, exchange, internships, volunteering.</p><p>I think this helped us find our individual sense of <strong>purpose</strong> and <strong>ambition</strong>. I think this environment of freedom is by design: A testament of this vision is the fact that seated among us today, are not only brilliant technical people, joining the <strong>best engineering companies </strong>and research labs; but also those of us heading to the biggest<strong> banking or consulting</strong> firms; or those following their <strong>creative passions</strong> in design and music; or others among us starting their own companies.</p><p>I see <strong>future leaders </strong>from every field, and I am lucky to represent such a diverse and talented community!</p><p>Finally, I want to thank all those that <strong>blindly </strong>believed in us and cheered us on at our lowest points: when we faced a terrifying exam after MC-ing all the quizzes, when we got rejections from our dream internships, and when it was already week 10 and the MDP robot didn’t even start!</p><p>In these moments, the strongest, most supportive community is usually the one at <strong>home</strong>: our parents, our grandparents, our guardians, <strong>our family</strong>. This is your day as well.</p><p>Graduates, let us rise, turn around, and give them a <strong>round of applause</strong> for their love and support.</p><p>I’ll end this speech where I began: our degrees may have our names on them, but hidden between the lines are <strong>our stories</strong> and <strong>our communities</strong>, which we are here to celebrate today.</p><p>As we begin the next phase of our lives, let’s continue supporting and motivating each other, and keeping the spirit of the NTU community alive.</p><p><strong>Congratulations for graduating</strong> and <strong>good luck for the future!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33ffa8e53d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Short Note on Artificial General Intelligence]]></title>
            <link>https://medium.com/@chaitjo/a-short-note-on-artificial-general-intelligence-e05643b2f9b9?source=rss-7768e811155d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e05643b2f9b9</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[agi]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai-safety]]></category>
            <dc:creator><![CDATA[Chaitanya K. Joshi]]></dc:creator>
            <pubDate>Fri, 19 Jul 2019 03:56:06 GMT</pubDate>
            <atom:updated>2019-07-19T03:56:47.954Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern Artificial Intelligence systems are reaching <strong>superhuman </strong>levels of performance and speed at very specific tasks such as <a href="https://www.forbes.com/sites/michaelthomsen/2015/02/19/microsofts-deep-learning-project-outperforms-humans-in-image-recognition/">recognizing objects</a> and sounds, or playing games such as <a href="https://science.sciencemag.org/content/early/2019/07/10/science.aay2400">Poker</a> and <a href="https://en.wikipedia.org/wiki/AlphaGo">Go</a>. The success of <em>narrow</em> AI systems has re-ignited the dream of building <em>broad</em> or general AI which can mirror human intelligence (<em>aka</em> <strong>Artificial General Intelligence</strong>). One of the reigning debates among futurologists today is <a href="https://www.youtube.com/watch?v=aCCotxqxFsk">a revival of the age-old <em>Nature</em> vs. <em>Nurture</em> debate</a> that scientists and philosophers love:</p><blockquote>“All morality, logic and reasoning shall emerge from raw environmental signals interpreted by AGI systems that can learn about the world like human beings,” <em>says the </em>Connectionist<em> or Deep Learning camp.</em></blockquote><blockquote>“But what about certain innate priors and beliefs that are fundamental to us as human beings, and by extension, intelligent beings?” <em>argues the </em>Symbolist <em>and Expert Systems camp.</em></blockquote><p>This debate further extends into discussions about AI safety and <a href="https://www.vox.com/future-perfect/2018/12/21/18126576/ai-artificial-intelligence-machine-learning-safety-alignment">the AI Alignment Problem</a>. Journalists also like to add fuel to the fire: By 2030 we shall have completely self-driving cars. By 2040, AI would have discovered the cure for cancer. And by 2050, the Earth will be ruled by AGI overlords.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*Aaan7D7cV2JAJfthnK0ESg.jpeg" /><figcaption>Photo credit: <a href="https://thebulletin.org/2019/04/the-possibility-and-risks-of-artificial-general-intelligence/">Bulletin of the Atomic Scientists</a></figcaption></figure><p>I have an <strong>alternate perspective</strong> that may appeal to engineers:</p><blockquote>Let’s focus less on AGI and more on fusing human bodies and minds with modern AI’s superhuman capabilities.</blockquote><p>Why start from ‘scratch’ and try to learn everything about the world when human beings already come with all the innate priors for the emergence of morality, logic and reasoning that we want?</p><p>Why not use superhuman, task-specific learning algorithms interfaced with the biology of our body to <strong>augment and enhance </strong>the skills we have.</p><p>Or to gain completely new ones!</p><p>I like to use the analogy of an internet-enabled smartphone. You have <strong>infinite memory </strong>as soon as you hold this device in your hand: you need not remember anybody’s phone number or care to commit to memory any factual knowledge about the world. You need to know how to operate the interface to look up a contact or to search for facts on the internet.</p><p>Imagine if there was no interface anymore…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e05643b2f9b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interning at SAP Leonardo Machine Learning]]></title>
            <link>https://medium.com/@chaitjo/interning-at-sap-leonardo-machine-learning-c79eb4129968?source=rss-7768e811155d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c79eb4129968</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[enterprise-technology]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Chaitanya K. Joshi]]></dc:creator>
            <pubDate>Fri, 28 Jun 2019 07:21:44 GMT</pubDate>
            <atom:updated>2019-06-28T07:28:19.311Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MtRDgitM3KLAj3IZrfdQCw.png" /></figure><p>Every Computer Science undergraduate at NTU has to do a semester-long <em>Professional Internship Attachement</em> as part of their degree requirement. In January 2018, I had the pleasure to do my internship at the <a href="https://www.sap.com/sea/products/cash-application.html">Cash Application team</a> at <a href="https://www.sap.com/sea/products/leonardo.html">SAP Leonardo Machine Learning, Singapore</a> as a Research Intern.</p><p>I feel very lucky to have gotten the chance to build unique software products that only SAP has the capabilities to build, while working with a very talented and brilliant team. I learnt about how Machine Learning and Artificial Intelligence is taken out of the research lab and put into production. I was also able to genuinely connect with my teammates, in both a professional and a personal sense. At the end of the internship, my direct work and contributions lead to the delivery of a major feature in our product and resulted in three patent applications. I was also awarded the <a href="http://scse.ntu.edu.sg/Programmes/CurrentStudents/Undergraduate/Pages/medals-ce.aspx">Professional Internship Book Prize</a> by NTU for the best performance among all interns from the Computer Science department. <strong>I could not have dreamt of a better internship!</strong></p><h3>About SAP and Cash Application</h3><p>Started in Germany in 1972, SAP (Systems Applications and Products) is one of the world’s biggest software companies today. It is the industry leader in enterprise software for managing business operations and customer relations. The biggest organizations, governments and companies in the world run on SAP’s Enterprise Resource Planning (ERP) systems.</p><p>SAP’s Machine Learning platform, called SAP Leonardo, offers SAP ERP users advanced analytics services based on the latest technologies such as Machine Learning, Blockchain, IoT, and other buzzwords. The Cash Application team’s work revolved around building automated machine learning solutions in the fields of accounting and finance within SAP Leonardo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rkes0IYEtdwRLzxu.jpg" /><figcaption>The SAP Leonardo product portfolio</figcaption></figure><p>The main ‘use-case’ being developed was the automation of generic low-level accounting departments. In every company, the accountants’ main job is to receive <strong>bank statements</strong> of payments made by their customers, and match these to open <strong>invoices</strong> of the orders placed by these customers. SAP had been building the software interface for accountants to do this repetitive task and had the trust of its customers to share their financial records and data with it. Hence, they were in a unique position where they could now build tools to automate this process and free up time for accountants or help downsize workforces.</p><p>No other company in the world had both the financial data as well as the engineering skills required to build products such as Cash Application (<em>CashApp</em>). I felt very passionate to work on this problem as soon as I realized how unique of an opportunity this was!</p><h3>Onboarding into the team</h3><p>On my first day, I was welcomed by my to-be supervisor, <a href="https://www.linkedin.com/in/seansaito/">Sean Saito</a>, who had been working as an ML Developer at SAP after finishing his Bachelor’s degree a year ago. I shook hands with all my teammates for the first time and was introduced to the big Directors and Managers at the office. (I later learnt that Sean was the youngest person in the office and the only Bachelor hire doing ML at SAP at that time. In the whole world. Ever.)</p><p>All teams at SAP Leonardo were designed to be self-sufficient in terms of both development and sales. Mini startups of sorts, who share knowledge and office space. Over the next few days, I was onboarded by each sub-team within <em>CashApp</em>: The Machine Learning team, the Back-end team, the Front-end team, and the Business Development team.</p><p>I remember feeling excited to start working, and slightly out of depth at the same time. I had studied some of the concepts that were part of <em>CashApp</em>’s system architecture at NTU but was not confident about my knowledge. I was also extremely intimidated by how large and complicated the production codebase seemed!</p><p>At the end of my first week, Sean helped me narrow down a list of topics I could tackle at my internship: (1) How to optimize/speed up the current bank statement to invoice matching pipeline, and (2) How to convert this pipeline to a fully deep learning-based approach. (The current approach used non-deep learning methods.)</p><h3>Pipeline optimizations and speed</h3><p>I implemented new techniques to handle character string comparisons and operations, which were the main bottleneck for the <em>CashApp</em> pipeline. Extending Python libraries with code in (considerably faster) C, <strong>I was able to speed up our machine learning models by over 40 times without any decrease in performance.</strong> This helped me get familiar with the entire codebase as I was required to constantly benchmarks the pipeline’s speed and performance metrics.</p><p>I learnt a lot about low level programming optimization and the importance of good engineering, even for the smallest parts of a large system. This work was completed in the first month of my internship.</p><h3>Transition to a Deep Learning pipeline</h3><p>Working on a deep learning solution to the bank statement to invoice matching problem was my longest project: the Machine Learning team started working on it from my second month at <em>CashApp</em>, and drew it to a conclusion on the final day of my internship by submitting three patent applications related to it.</p><p>In general, we were building neural networks for understanding and reasoning about extremely structured, tabular financial data without resorting to feature engineering. Such data is typically handled by more traditional machine learning models such as decision trees. Hence, there was not much academic research that we could leverage for our models. Drawing heavily from research in natural language processing and person re-identification/facial recognition, my teammates and I brainstormed many complicated ideas for our use case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*MEzsqPb8GDcn1QiW.png" /><figcaption>The CashApp ML Pipeline</figcaption></figure><p>Over the course of three-and-a-half months, we were able to take the most basic version of our idea from the whiteboards and integrate it into the full product released to customers. We started by dividing the project into three sub-parts (I was leading the development of one of these) which we treated as individual projects. Once the three were at a stage where we felt confident in the components, we integrated them together to build a completely new pipeline for the problem.</p><p>Through a combination of rigorous tests and benchmarks for each component, we ensured that the new system was performing better than our previous approach in terms of speed and performance. We also tested its ability to scale up to millions of data points that <em>CashApp</em> was currently handling and were pleasantly surprised by how efficiently neural networks allowed us to do so.</p><p>Once the Team Manager and Director were convinced by our new benchmarks, we decided to go ahead with implementation in a production environment. In the final two weeks of my internship, I finally got to write production code for my component and integrate it into the new version of the system, scheduled to release to customers in less than a month.</p><p>The deep learning pipeline was the coolest feature of this new release: <strong>we were able to improve system accuracy by 8% and reduced computation time by 99% compared to the previous approach.</strong> Since our ideas were rather novel, we were also encouraged to write three patent applications, one each for the three parts of the pipeline.</p><p>Through the course of formulating and implementing the new solution, I learnt all about the ins and outs of taking machine learning research into production. I felt very proud of my work and that I was able to make a meaningful contribution to a real software product which is relied upon by thousands of companies around the world.</p><h3>Genuine Connections</h3><p>Technical contributions aside, I would like to make some personal reflections. I felt very lucky that I was part of a great team: people were bonded by a passion for building a great product and the desire and skill to work towards it. Being part of the team, staying late, figuring things out together; all of it felt like I was integrated into something substantial and much bigger than myself.</p><p><strong>I was genuinely excited to go to work every Monday morning!</strong></p><h3>Trust in My Work</h3><p>I wanted to perform as best as I could during the internship, but I never expected myself to do anything worth writing three patents about. I cannot help but feel overwhelmed, satisfied and extremely lucky to have gelled so well with my teammates and my work. It was a big deal for me that my team put as much trust as they did in my work and in myself.</p><p>I’m very thankful to the <em>CashApp</em> team, the leadership at SAP and my university for giving me this opportunity. I am also grateful to Sean for being the best supervisor, mentor and friend I could hope for throughout my internship. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c79eb4129968" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>