<?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 Aleksa Gordić on Medium]]></title>
        <description><![CDATA[Stories by Aleksa Gordić on Medium]]></description>
        <link>https://medium.com/@gordicaleksa?source=rss-37f02ae83e8c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*q54RAGVbYTZtIBJfGC3goA.png</url>
            <title>Stories by Aleksa Gordić on Medium</title>
            <link>https://medium.com/@gordicaleksa?source=rss-37f02ae83e8c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 13 Nov 2026 21:56:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gordicaleksa/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[Neocambria]]></title>
            <link>https://gordicaleksa.medium.com/neocambria-1fe80f0a6afa?source=rss-37f02ae83e8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fe80f0a6afa</guid>
            <category><![CDATA[agi]]></category>
            <category><![CDATA[post-scarcity-economy]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Aleksa Gordić]]></dc:creator>
            <pubDate>Mon, 30 Jun 2025 20:01:05 GMT</pubDate>
            <atom:updated>2025-06-30T22:04:05.744Z</atom:updated>
            <content:encoded><![CDATA[<h4>Humans in the post-ASI world</h4><p>Unless you believe the premise that there is something metaphysical about the general nature of human intelligence, there is nothing stopping us from engineering an intelligence superior to our own.</p><p>We’ve long since built machines far more physically capable than humans.</p><p>We have machines that can lift weights far beyond human capability (BelAZ 75710 truck, Liebherr LR 13000, Bagger 293…), that can unshackle from the gravitational pull and go supersonic (SR-71 Blackbird, Concorde…), that can dive miles beneath the ocean’s surface (Deepsea Challenger, Project 941 Akula submarines…), that can leave Earth’s orbit and head for the stars (Voyager probes, Starship…), or orbit around the Earth for many years (ISS, Starlink…).</p><p>We’ve engineered sensors that stretch the boundaries of perception itself.</p><p>With LIGO, we can detect ripples in spacetime — gravitational waves — triggered by black hole collisions over a billion light-years away. Using IceCube, a cubic kilometer of ice buried in Antarctica, we can sense elusive neutrino particles that pass straight through entire planets. Our instruments span the full electromagnetic spectrum: from radio telescopes that capture long-wavelength signals to gamma-ray detectors that see the universe’s most energetic events — far beyond the narrow 380–700 nm band visible to the human eye. We’ve also built detectors that reveal invisible ionizing radiation — alpha, beta, and gamma particles — using tools like Geiger counters.</p><p>Just as we’ve extended our muscles and senses with steel and silicon, we now stand poised not merely to extend, but to surpass our own cognition.</p><p>Engineering general intelligence (AGI) is the new frontier.</p><p>But what exactly do I mean by AGI (artificial general intelligence)?</p><p>There are hundreds of definitions with varying levels of formality, but most boil down to two camps: one that’s useful but informal, and one that’s formal but not especially helpful.</p><p>Here is a formal definition from Legg &amp; Hutter’s <a href="https://arxiv.org/pdf/0712.3329">Universal Intelligence: A Definition of Machine Intelligence</a> [1] paper:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*OuuUiRFmLaI4txbi2vZYmg.png" /><figcaption>The universal intelligence of agent π</figcaption></figure><p>Roughly: compute the above score for your AI agent and once it crosses the “human score” (e.g. median human’s score) you have an AGI.</p><p>It’s not particularly useful because it relies on an infinite sum over all environments of interest, weighted by an incomputable Kolmogorov complexity function. Elegant, but impractical.</p><p>A useful, informal definition (inspired by <a href="https://openai.com/our-structure/">OpenAI’s definition</a> [2]) goes like this: we’ve achieved AGI once we have an intelligence that’s <em>useful </em>across a broad set of economically valuable tasks.</p><p>How do we define <em>useful</em>?</p><p>-&gt; Customers are willing to pay for that AI system/agent’s services because it performs those tasks on par with human experts. :)</p><p>We could also define AGI in terms of its economic impact — for example, by tying it to global GDP growth (e.g. “we’ve built AGI once we see 10% annual global GDP growth”). But structural bottlenecks — societal (e.g., resistance to adoption), physical (e.g., shortage of humanoid robots), and others — might still prevent that from happening, even after AGI is achieved.</p><p>As a natural extension, artificial superintelligence (ASI) is defined as being strictly Pareto-dominant over humans across all economically relevant tasks.</p><p>We already have datapoints of artificial superintelligence (ASI) in narrow, constrained domains — games being a notable example. DeepMind’s AlphaGo family of models is a well-known case, built to master <em>Go</em>, a complex strategic board game originating from China.</p><p>AlphaGo began with imitation learning from human gameplay (much like how infants first learn), training on hundreds of thousands of expert games (~<a href="https://www.nature.com/articles/nature16961">30 million moves</a> in total [3]).</p><p>The next iterations in the AlphaGo family — AlphaGo Zero, AlphaZero and MuZero in particular — eliminated human gameplay data entirely, allowing the systems to learn from first principles using only the reward signal and the environment (i.e., the rules of the game).</p><p>Through self-play — and a massive amount of compute — the first Go superintelligence emerged.</p><p>AlphaGo’s unexpected creativity took Lee Sedol — and the global Go community — by surprise. The now-legendary “<a href="https://en.wikipedia.org/wiki/AlphaGo_versus_Lee_Sedol">Move 37</a>” [4] entered the history books.</p><p>Subsequently, AlphaGo Zero defeated the original AlphaGo <a href="https://deepmind.google/discover/blog/alphago-zero-starting-from-scratch/">100–0</a> [5]! And AlphaZero and MuZero took it even further — generalizing beyond Go to master chess and shogi (AlphaZero) and extending to Atari games as well (MuZero).</p><p>This happened nearly a decade ago (back in 2016), and for years afterward, there seemed to be no clear path to achieving that level of superintelligence in open-ended, world-like environments — given their immense complexity.</p><p>Until recently — when we discovered <a href="https://arxiv.org/abs/2005.14165">Generative Pretraining of Transformers</a> (GPT) [6], a particular model class trained to predict the next word in a sentence (i.e., language modeling objective) across tens of trillions of words from the internet.</p><p>The GPT family was born when <a href="https://scholar.google.com/citations?user=dOad5HoAAAAJ&amp;hl=en">Alec Radford</a> pushed the scale of the transformer architecture beyond what Vaswani et al. had originally demonstrated in their seminal <a href="https://arxiv.org/abs/1706.03762"><em>Attention Is All You Need</em></a> paper [7].</p><p>It all boils down to two core ideas (<a href="http://www.incompleteideas.net/IncIdeas/BitterLesson.html">The Bitter Lesson</a> [8] was truly prescient):</p><ul><li>Use a hardware-friendly model architecture — one that is highly parallelizable (the transformer). This yields a strong scaling curve (with a steep slope), and remarkably, we’ve needed only minor architectural tweaks since 2017.</li><li>Scale ad infinitum — data, parameters, compute. The scaling laws (<a href="https://arxiv.org/abs/2001.08361">Kaplan et al.</a> [9]) and follow-ups like the <a href="https://arxiv.org/abs/2203.15556">Chinchilla</a><em> </em>paper [10] formalized this intuition.</li></ul><p>My intuition for why this works is the following:</p><ul><li>I’ll skip the mathematical rigor and keep it simple. As the number of parameters in your transformer goes to infinity, the probability of getting stuck in a strict local optimum — a point where the loss increases in every direction — drops to zero. Take a 1-trillion-parameter LLM (not hypothetical — GPT-4 reportedly had ~1.8T). You’re doing gradient descent in a trillion-dimensional space. For a point to be a strict local optimum, the loss must curve upward along every single dimension. Assume the probability that the loss increases along any one direction is p. Then the chance it increases along all directions (under simplifying assumptions) is roughly p¹⁰⁰⁰⁰⁰⁰⁰⁰⁰⁰⁰⁰ (i.e., p raised to 1 trillion). Even if p = 0.999, this evaluates to essentially zero. Consequently, gradient-based optimization is overwhelmingly unlikely to terminate in a spurious local minimum; instead it almost surely lands in wide basins separated by saddle points, which dominate high-dimensional landscapes. The loss keeps going down! :)</li><li>The world model emerges from next-token prediction. I really liked Ilya Sutskever’s example here: Imagine a 100-page crime novel. After a complex plot, on the very last page, the detective gathers everyone and says, “I know who the murderer is. The murderer is _.” How do you maximize the probability of that final token (or equivalently, minimize the loss)? You do it by understanding the entire story that came before. You have to grok the characters, the relationships, the clues — everything. In other words, you have to build a world model. The world model is not explicitly trained — it emerges as a byproduct of the prediction objective.</li></ul><p>Today, we pretrain our large language models (LLMs), with trillions of parameters, on tens of trillions of multimodal tokens (both human and synthetic). Then, during post-training, we teach them to follow instructions (via imitation learning) and to align with the “median human preference” (via RLHF — reinforcement learning from human feedback).</p><p>This was the new AlphaGo moment — <em>Proto-AGI</em>, if you will.</p><p>The problem is, imitation learning from the internet can only take us so far — it can match human capability, but not surpass it. At best, it gets us to AGI. So how do we reach the <em>AlphaZero </em>moment for real-world, open-ended intelligence?</p><p>We need an equivalent of self-play — and some sort of reward mechanism — for the open-ended world.</p><p>As OpenAI’s Noam Brown (who works on reasoning models like o3) <a href="https://www.latent.space/p/noam-brown">pointed out</a> [11], self-play converges to a minimax equilibrium in two-player zero-sum games like Go and chess — where that outcome is ideal. But in general-sum, multiplayer environments, that same (self-play) policy breaks down and fails to generalize.</p><p>This is where RLVR — reinforcement learning from verifiable rewards — enters the picture. It’s the approach behind models like o1, o3, and DeepSeek R1.</p><p>The idea is to create RL environments where outputs can be easily evaluated against ground truth. Domains like mathematics (where you can compare against the correct answer), and programming (where you can check against test cases) are ideal.</p><p>Reward model traces that lead to correct solutions; penalize those that don’t. It turns out this setup is quite powerful — various cognitive and metacognitive skills, such as self-verification, backtracking, planning, and more, begin to emerge in LLMs.</p><p>The field has evolved from a “scale only data, parameters, and compute” paradigm to one that also scales the quantity and diversity of RL environments — and it’s already showing incredible promise.</p><p>We seem to be going from “Yann LeCun’s world”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*yDVgyHa5vfZqZ9Pc" /><figcaption>cherry on top of the cake</figcaption></figure><p>to an entirely new one as described by OpenAI’s Dan Roberts in his <a href="https://x.com/danintheory/status/1920898285142716782">recent talk</a> [12]:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*WOOfOCm1NPQ3plge" /><figcaption>or cake on top of the cherry — which way AI man?</figcaption></figure><p>The <a href="https://storage.googleapis.com/deepmind-media/Era-of-Experience%20/The%20Era%20of%20Experience%20Paper.pdf">Welcome to the Era of Experience</a> [13] paper by David Silver and Rich Sutton goes a step further — proposing to drop pretraining (i.e. imitation learning) altogether and train solely through RL. Not surprising, given that David led the AlphaGo project.</p><p>In theory that sounds promising — and with infinite compute, it would likely outperform models biased by human language. But in practice (finite compute regime :) ), it may simply be too inefficient for today’s hardware.</p><p>The idea is to let LLMs evolve their own internal language (since human language is by no means optimal) as long as they can ultimately solve arbitrary problems. If a model can solve cancer, do we even care <em>how</em> it thinks?</p><p>Well, we certainly should — for reasons of safety, alignment, and interpretability. But if the choice is between an <em>alien artifact</em> that cures cancer (but we don’t understand it) and a familiar one that can’t… we might just take the risk.</p><p>In a similar vein, a recent paper from Meta — <a href="https://arxiv.org/abs/2412.06769"><em>Training Large Language Models to Reason in a Continuous Latent Space</em></a><em> [14]</em> — modifies the LLM to output latent tokens directly, skipping the decoding step into human language. As long as it can ultimately solve the problem, that might be good enough.</p><p>These new research directions seem like an incredibly promising path to ASI. Combined with geopolitical dynamics involving China, massive capital investment into ever-larger compute clusters (on the order of <a href="https://x.com/elonmusk/status/1830650370336473253?lang=en">millions of GPUs</a> [15]), and a growing concentration of talent in the field — we might get there sooner than most expect.</p><p>Some people are bullish, believing we’ll reach <a href="https://ai-2027.com/">ASI by 2027</a> [16]. My estimate falls between 2027 and 2030, with the highest likelihood somewhere in the middle.</p><p>The list of “machines can never do X” has been shrinking for centuries. From <a href="https://courses.cs.umbc.edu/471/papers/turing.pdf">Ada Lovelace’s objection</a> [17] “<em>The Analytical Engine has no pretensions to originate anything. It can do whatever we know how to order it to perform</em>” to <a href="https://garymarcus.substack.com/p/horse-rides-astronaut">Gary Marcus’s</a> [18], and I’m paraphrasing, <em>“AI is dumb — it can’t even draw a horse riding an astronaut”</em> we’ve now reached: <em>“Well, sure, but can it get a gold medal at the IOI? Is it even AGI?” </em>[19]</p><p>Even if you believe human intelligence has some kind of metaphysical quality, it seems we’re getting closer to engineering it. But on the flip side — how much understanding and intelligence do humans truly possess?</p><blockquote>Note: The following subsections reflect my current understanding of reality, along with a fair amount of speculation. Strong opinions, loosely held.</blockquote><h4>Human understanding is local — much like in the Chinese Room Argument</h4><p>Do we truly understand? Or are we merely experiencing the illusion of understanding?</p><p>When we stub our pinky toe against a wall, it feels as though the pain is located in the toe itself. But in reality, the sensation is generated in the brain — the mind simply creates the illusion and projects the pain back onto the physical location where the impact occurred.</p><p>When a person loses a limb, they often still feel sensations, sometimes even pain, as if the missing part were still there. This phenomenon, known as <em>phantom limb pain</em>, is another striking example of the brain generating and projecting bodily experiences.</p><p>If there are no retinal cells at the point where the optic nerve exits the eye — our so-called <em>blind spot</em> — why don’t we notice a hole in our vision? The brain doesn’t just leave it blank; instead, it <em>inpaints</em> the missing information by filling in the gap using surrounding visual cues. Once again, perception isn’t a direct feed from reality — it’s a constructed experience, patched together by the brain to create a seamless illusion of completeness.</p><p>Ever since I read Alan Turing’s seminal paper <a href="https://courses.cs.umbc.edu/471/papers/turing.pdf">Computing Machinery and Intelligence</a> [20] followed by John Searle’s <a href="https://plato.stanford.edu/entries/chinese-room/">Chinese Room Argument</a> [21], I’ve been struck by how closely the latter mirrors what I believe is the nature of human understanding. Rather than refuting machine intelligence, it seemed to describe us.</p><p>I believe the illusion of understanding arises from the magical performance of System 1 thinking being interpreted — and often misinterpreted — by a puzzled <a href="https://en.wikipedia.org/wiki/Thinking,_Fast_and_Slow">System 2</a> [22].</p><p>Neurons clearly aren’t intelligent. They don’t understand language.</p><p>And when we zoom out beyond the individual neuron, there’s still no true understanding in System 1. It’s just neural blobs performing classification, and pattern matching. Complex functions living in high-dimensional space, optimized by the evolutionary processes.</p><p>So the understanding should then reside in System 2?</p><p>But understanding always seems to be constrained to local computations — like that of the human in the Chinese Room.</p><p>We don’t truly understand how our own body works — it’s far too complex of a system. What we do understand is how to drive it, with varying degrees of success. If I want to grab an apple from the table, all I have to do is set a mental objective — fetch that object — and the rest unfolds automagically through neural circuitry I don’t understand.</p><p>Nor do we understand how neural networks work — biological or artificial. We know how to make useful functions emerge through gradient descent and the right data, but we don’t really understand what’s going on <em>inside </em>those functions. That’s the challenge mechinterp researchers are trying to tackle.</p><p>Going beyond the individual, we don’t understand how large companies work. Take Alphabet, for example. It’s too complex for any single human to truly comprehend, including Sundar Pichai. He operates with a low-resolution view across a broad range of areas. One could argue that while Alphabet’s employees collectively run the company, none of them truly understand it. They don’t grasp the full system — they just know how to drive their part of it.</p><p>And of course, we don’t truly understand how the economy works, a vast, dynamic graph of superorganisms we call companies, and individuals acting within them.</p><p>Our understanding feels like an illusion — much like phantom limb pain or our failure to notice the blind spot in our vision.</p><p>Do we truly understand, or do we just feel like we do?<br>I believe it’s the latter.</p><h4>Humans are carbon-based biological pattern-matching machines</h4><p>Introduce a third copy of chromosome 21 instead of the usual two, a glitch in the matrix, and you get <a href="https://en.wikipedia.org/wiki/Down_syndrome">Down syndrome</a> [23].</p><p>Mute the body’s response to growth signals and you get <a href="https://en.wikipedia.org/wiki/Growth_hormone_deficiency">growth hormone deficiency</a> (GHD) [24], leaving adults with childlike proportions.</p><p>With <a href="https://en.wikipedia.org/wiki/Progeria">Hutchinson-Gilford Progeria Syndrome</a> [25], it’s the opposite — the body speeds through aging, as if someone hit fast-forward on the biological timeline.</p><p>Each disorder is a bug report from our wetware — proof that underneath it all, we’re all just biological machines.</p><p>I remember watching the sci-fi movie A.I. Artificial Intelligence as a kid, where a boy eventually discovers he’s actually a robot. That idea really unsettled me. Imagine living your whole life thinking you’re human, deeply believing and feeling as one — only to find out you’re just a machine.</p><p>But are we really so different from the hosts in Westworld, or from David in A.I. Artificial Intelligence? Or is it merely a difference in substrate — biological versus silicon?</p><h4>We tend to overestimate the average human’s intelligence</h4><p>A few weeks ago, while riding toward San Francisco, my Uber driver gave me what he called a “difficult puzzle.” With pride in his voice, he said it had taken him 30 minutes to solve. The puzzle? “What’s the square root of 0.1?”</p><p>I gave him a symbolic answer: “1 divided by square root of 10”. He shook his head — “That’s not the answer.” Realizing he was looking for a non-symbolic answer, I said, “1 divided by roughly 3.33” and he lit up: “That’s it!”.</p><p>In return, I gave him a logic puzzle that required no domain-specific knowledge — no need to understand what a square root is, or even what a fraction means.</p><p>After 5–10 minutes, he gave up.</p><blockquote>Notably, the confounding factor might have been grit — he may have had the intelligence to solve the problem, but he “terminated with an EOS token” before reaching a solution.</blockquote><p>In general, I don’t think most people have truly internalized the shape of the IQ bell curve. We tend to surround ourselves with a very narrow slice of it. We forget that half of the population scores below the median on that bell curve.</p><h4>LLMs display jagged intelligence — and so do humans</h4><p>Jagged intelligence is a coinage introduced by Andrej Karpathy [26] in one of his banger <a href="https://x.com/karpathy/status/1816531576228053133">tweets</a>:</p><blockquote>Jagged Intelligence — The word I came up with to describe the (strange, unintuitive) fact that state of the art LLMs can both perform extremely impressive tasks (e.g. solve complex math problems) while simultaneously struggle with some very dumb problems…</blockquote><p>Chess provides a compelling case study of jagged intelligence in humans.</p><p>For generations, world champions have been held up as icons of extraordinary intellect, yet their brilliance is highly spiky/jagged. It’s possible for a grandmaster to sit in a hall, cover their eyes, and keep track of dozens of games at once. <a href="https://www.guinnessworldrecords.com/world-records/72345-most-simultaneous-blindfolded-chess-wins">The current record</a> [27] is 48 simultaneous blindfold games, set in 2016, with the grandmaster scoring 35 wins, 7 draws, and 6 losses.</p><p>But the more we studied how their minds work, the more it became clear: it’s largely pattern matching built on having observed and memorized thousands of games, both their own and those of other masters. What sets them apart is exceptional domain-specific memory.</p><p>But that memory doesn’t generalize well beyond the chessboard. In fact, <a href="https://www.sciencedirect.com/science/article/abs/pii/0010028573900042">studies show</a> [28] that grandmasters’ recall advantage disappears entirely when the board is randomized and the familiar structure is removed.</p><p>E.g. in the World Championship of Fischer Random Chess, which randomizes the starting position of the pieces on the back rank, Wesley So decisively defeated former (and four-time) World Champion Magnus Carlsen (4 wins, 0 losses, 2 draws) to become the inaugural world Fischer Random Chess champion.</p><p>They’ve overfitted to a benchmark — sound familiar?</p><blockquote>Note: None of this is to say that <em>System 2</em> thinking — deliberate reasoning and planning — doesn’t matter. It still plays a crucial role, especially in longer-duration chess variants.</blockquote><p>Similar patterns show up elsewhere — for example, elite Rubik’s Cube solvers who can solve the standard 3x3x3 cube in <a href="https://www.worldcubeassociation.org/persons/2023GENG02">just 3.05 seconds</a> [29].</p><p>But none of them go on to solve the Poincaré Conjecture à la Grigori Perelman. And conversely, I’m pretty sure Terence Tao isn’t one-shotting his way to grandmaster status either.</p><p>My goal here isn’t to argue that the present-day LLMs are less jagged than humans — only that this same quality exists in us too. But unlike humans, as AI continues to advance at a break-neck pace, its jaggedness will steadily smooth out.</p><h4>LLMs can extrapolate</h4><p>Critics often make the argument that LLMs can’t extrapolate, that they can only interpolate within their training data and therefore can’t possibly generate new scientific breakthroughs.</p><p>But that argument seems increasingly moot.</p><p>Interpolation at the knowledge level probably won’t lead to groundbreaking discoveries. But interpolation at the reasoning level just might.</p><p>LLMs could uncover new heuristics for understanding the world by combining existing ones (simple interpolation) — opening up entirely new branches on the tree of knowledge (i.e., extrapolation).</p><p>To summarize my claim: interpolation in the <em>reasoning</em> space can look like extrapolation in the <em>knowledge</em> space.</p><h4>Humans can engineer an Artificial Superintelligence (ASI)</h4><p>No matter how you look at it:</p><p>a) if human intelligence is pristine and mystical -&gt; well, it seems we have found a way to engineer this mystical emergent entity</p><p>b) if it’s just pattern matching -&gt; turns out we’ve already built some pretty damn good pattern matchers</p><p>The biggest bottlenecks I currently see on the path to ASI are:</p><ol><li>lifelong memory (~READ)</li><li>continuous learning (~WRITE)</li><li>catastrophic-forgetting (~DELETE)</li><li>multi-agent training environments</li></ol><p>The first three are prerequisites for a single ASI; the last is for societies of ASIs.</p><p>I believe all of these can be solved with more compute, and maybe a few modelling breakthroughs (or by dusting off one of Schmidhuber’s papers from the ’90s — iykyk).</p><p>Here is a highly simplified model I hold. It seems to me that humans primarily collect data and experiences during the day. Some additional data collection happens at night, through mental simulations. Dreams act as generators of synthetic data. During sleep, we initiate fine-tuning runs (brief micro-replays during quiet wakefulness add incremental updates, but the heavy lifting happens overnight). Some memories are consolidated and burned into the neural weights, while others are selectively erased. Catastrophic forgetting isn’t a bug — it’s a feature.</p><p>It’s currently just too expensive to fine-tune massive 10-trillion parameter models every single night. To a large extent it’s an infra problem. That said, we’ll likely need some algorithmic breakthroughs to fully solve it. We still don’t fully understand the <em>shape of forgetting</em> during these fine-tuning runs. But I’m optimistic — whether through mechanistic interpretability or sheer scale, we’ll eventually figure it out.</p><p>As maximum context length approaches infinity and new methods for compressing information emerge (e.g. DeepSeek’s new <a href="https://arxiv.org/pdf/2405.04434">Multi-head Latent Attention (MLA)</a> mechanism [30]), we may eventually solve lifelong memory <em>without</em> relying on external memory structures like vector databases or <a href="https://arxiv.org/abs/1410.5401">Neural Turing Machines</a> [31].</p><p>Things are accelerating.</p><p>xAI is already building Colossus III: <a href="https://www.ft.com/content/9c0516cf-dd12-4665-aa22-712de854fe2f">&gt;1 million GPUs in a single cluster</a> [32]. Other players (including Chinese companies) are taking notice and closely following suit. This is triggering an unprecedented wave of compute infrastructure buildouts.</p><p>Compute is ultimately bottlenecked by two factors: energy input on one end, and the risk of rendering the planet uninhabitable through waste heat on the other. Even if we approach the <a href="https://en.wikipedia.org/wiki/Landauer%27s_principle">Landauer limit</a> [33], there are only so many orders of magnitude we can scale before Earth heats up by several degrees — a threshold that’s likely catastrophic. Scaling will continue, but the physical limits are real. At least until we become a multiplanetary species and start building <a href="https://www.palladiummag.com/2025/04/18/the-moon-should-be-a-computer/">planet-scale computers</a> [34].</p><p>With media attention and capital pouring in like never before, more bright minds than ever are working on bold new research ideas.</p><p>The first signs of superintelligence in open-ended domains have already begun to emerge:</p><ul><li>Models like ChatGPT, Gemini, and Claude are already remarkably powerful and knowledgeable across a wide range of domains.</li><li>OpenAI’s o3-based <a href="https://openai.com/index/introducing-deep-research/">DeepResearch</a> [35] already outperforms most human analysts — and rivals the best.</li><li>OpenAI’s <a href="https://openai.com/index/introducing-operator/">Operator</a> [36] isn’t quite there yet, but with a few more iterations, we’ll have a system that can use a computer as well as most humans.</li></ul><p>This is part of a broader trend.</p><p>It’s obvious to me that the digital AI workforce is coming.</p><p>Over the next decade, everyone will have digital team members — from software engineers (with early examples like Cognition’s <a href="https://cognition.ai/blog/introducing-devin">Devin</a> [37]) to hardware and product designers shaping the physical world.</p><p>What do humans do in this new world?</p><p>In the short term, we augment ourselves. We augment our workforce. We become more efficient.</p><p>What about the long term — beyond the Singularity horizon?</p><blockquote>Note: What follows ventures into speculative, science-fiction territory — but every step is grounded in established psychology, sociology, game theory, and current scientific understanding.</blockquote><h3>Neocambria. Humanity Post-Singularity — The Great Variance Explosion.</h3><p>Definitionally, once we build an ASI, we will have created a system that is in principle Pareto-dominant across practically every task of economic value.</p><p>Thus, by definition, “Humans 1.0” can’t compete in this new economic reality. Whatever task we choose to compete on, there exists a cheaper, more efficient, and higher-performing silicon-based (embodied) intelligence ready to fulfill it.</p><p>The only solution is a human condition variance explosion (see also this related <a href="https://x.com/karpathy/status/1846448411362709980">tweet</a> [38]) — humanity forks into multiple branches. A new Cambrian event. <em>Neocambria</em>.</p><p>Game-theoretically, I believe Homo sapiens diverges into one of a few main branches:</p><p>1. Humans 1.0 — Reversionists. They reject both genetic and biomechatronic upgrades. They opt out of the brand new world, choosing instead a life in deep nature, supported by just enough self-sustaining background technology to ensure a pleasant existence. A near-biblically long, undisturbed life — until the garbage collection (death) is finally invoked. Their version of the promised Eden (or Jannah, Vaikuntha, Tian, Pure Land). All watched over by <a href="https://allpoetry.com/All-Watched-Over-By-Machines-Of-Loving-Grace">machines of loving grace</a> [39]. Today’s Amish offer a gentle preview.</p><p>2. Humans 1.5 — The Immortals. They embrace germline edits but shun biomechatronic add-ons. Imagine you could detect a disease like diabetes at the embryonic stage of your child — and cure it. Would you? Of course you would (most of us would). Assuming humans aren’t cursed by a hard biological version of the <a href="https://en.wikipedia.org/wiki/No_free_lunch_theorem">No Free Lunch theorem</a> [40] — and there is some evidence they are (see, for example, the <a href="https://en.wikipedia.org/wiki/Ashkenazi_Jews">Ashkenazi Jewish</a> [41] population that have IQ/health tradeoff) — then why stop at disease prevention? Why not ask enhance vision, stamina, cognitive ability, physical beauty, even lifespan? (Dario Amodei calls it “<a href="https://www.darioamodei.com/essay/machines-of-loving-grace">biological freedom</a>” [42]) And if the genome allows — wings? (Angels, perhaps?)</p><p>3. Humans 2.0 — Cyborgs. Building on the bio-engineered baseline of Humans 1.5, this branch replaces select biological organs and limbs with superior prosthetics, augments the body with advanced materials, and integrates deeply with synthetic sensors. Their augmented sensorium spans infrared, ultraviolet, infrasound, etc. — spectra once invisible to flesh alone.</p><p>4. Humans 3.0 — Homo Astra. Post-biological entities. These beings retain no biological substrate, yet they are the intellectual offspring of organic minds — their lineage traceable to humanity. These superintelligent entities exist as vast, planetary- or even galaxy-scale computational systems. They command self-assembling factories, producing distributed swarms of perfectly aligned machines that can act in the world.</p><p>Humans 1.0 were the bootloader for everything that followed. The four branches are just trunk lines; each will ramify into sub-species as technology, access, and culture diverge.</p><p>Consider Humans 1.5. If germline editing remains costly, IQ-boosting dynasties will arise beside unmodified households, spawning fresh caste dynamics inside the “Immortals.” Game-theoretic outcomes are murky: will high-IQ clans subsidize the rest or harden the divide?</p><p>Cyborg 2.0s and post-biological 3.0s wield overwhelming leverage. Do they conquer, curate, or cooperate? 1.0s — living museums — pose no threat; we 0.9s don’t extinguish harmless fauna, so a similar détente seems plausible.</p><p>But as 1.5+ lineages accelerate and 1.0s forget their own origins, the latter may come to revere the former as <em>gods</em>.</p><p>The only path to minimizing conflict is to escape zero sum dynamics.</p><p>Expansion is the safety valve.</p><p>Climb the <a href="https://en.wikipedia.org/wiki/Kardashev_scale">Kardashev scale</a> [43].</p><p>Build <a href="https://en.wikipedia.org/wiki/Dyson_sphere">Dyson spheres</a> [44].</p><p>Flood the void with compute.</p><p>Dilute conflict across the cosmos.</p><p>Our destiny lies among the stars. Lunar super-computers, asteroid foundries, interstellar relays.</p><p>And ultimately: to learn how it all began…and how it ends.</p><p>Open Questions:</p><ul><li>Governance OS? What operating systems handle a multi-species polity?</li><li>Post-scarcity finance?</li><li>Techno-capital markets?</li><li>New laws of physics that are undiscovered as of now?</li></ul><h4>References</h4><p><strong>[1]</strong> Shane Legg &amp; Marcus Hutter, <em>“Universal Intelligence: A Definition of Machine Intelligence”,</em> <a href="https://arxiv.org/abs/0712.3329">https://arxiv.org/abs/0712.3329</a> (2007).</p><p>[2] “Our structure”, <a href="https://openai.com/our-structure/">https://openai.com/our-structure/</a></p><p>[3] David Silver et al, “Mastering the game of Go with deep neural networks and tree search”, <a href="https://www.nature.com/articles/nature16961">https://www.nature.com/articles/nature16961</a> (2016).</p><p>[4] “AlphaGo versus Lee Sedol”, <a href="https://en.wikipedia.org/wiki/AlphaGo_versus_Lee_Sedol">https://en.wikipedia.org/wiki/AlphaGo_versus_Lee_Sedol</a></p><p>[5] “AlphaGo Zero: Starting from scratch”, <a href="https://deepmind.google/discover/blog/alphago-zero-starting-from-scratch/#:~:text=AlphaGo%20Zero%20skips%20this%20step,by%20100%20games%20to%200">https://deepmind.google/discover/blog/alphago-zero-starting-from-scratch/</a></p><p>[6] Brown et al, “Language Models are Few-Shot Learners”, <a href="https://arxiv.org/abs/2005.14165">https://arxiv.org/abs/2005.14165</a> (2020).</p><p>[7] Vaswani et al, “Attention Is All You Need”, <a href="https://arxiv.org/abs/1706.03762">https://arxiv.org/abs/1706.03762</a> (2017).</p><p>[8] “The Bitter Lesson”, <a href="http://www.incompleteideas.net/IncIdeas/BitterLesson.html">http://www.incompleteideas.net/IncIdeas/BitterLesson.html</a></p><p>[9] Kaplan et al, “Scaling Laws for Neural Language Models”, <a href="https://arxiv.org/abs/2001.08361">https://arxiv.org/abs/2001.08361</a> (2020).</p><p>[10] Hoffmann et al, “Training Compute-Optimal Large Language Models”, <a href="https://arxiv.org/abs/2203.15556">https://arxiv.org/abs/2203.15556</a> (2022).</p><p>[11] “Scaling Test Time Compute to Multi-Agent Civilizations: Noam Brown”, <a href="https://www.latent.space/p/noam-brown">https://www.latent.space/p/noam-brown</a></p><p>[12] <a href="https://x.com/danintheory/status/1920898285142716782">https://x.com/danintheory/status/1920898285142716782</a></p><p>[13] David Silver, Richard S. Sutton, “Welcome to the Era of Experience”, <a href="https://storage.googleapis.com/deepmind-media/Era-of-Experience%20/The%20Era%20of%20Experience%20Paper.pdf">https://storage.googleapis.com/deepmind-media/Era-of-Experience%20/The%20Era%20of%20Experience%20Paper.pdf</a> (2025).</p><p>[14] Hao et al, “Training Large Language Models to Reason in a Continuous Latent Space”, <a href="https://arxiv.org/abs/2412.06769">https://arxiv.org/abs/2412.06769</a> (2024).</p><p>[15] <a href="https://x.com/elonmusk/status/1830650370336473253?lang=en">https://x.com/elonmusk/status/1830650370336473253</a></p><p>[16] “AI 2027”, <a href="https://ai-2027.com/">https://ai-2027.com/</a></p><p>[17] A. M. Turing, “Computing Machinery and Intelligence”, <a href="https://courses.cs.umbc.edu/471/papers/turing.pdf">https://courses.cs.umbc.edu/471/papers/turing.pdf</a> (1950).</p><p>[18] “Horse rides astronaut”, <a href="https://garymarcus.substack.com/p/horse-rides-astronaut">https://garymarcus.substack.com/p/horse-rides-astronaut</a></p><p>[19] Twitter hivemind :)</p><p>[20] A. M. Turing, “Computing Machinery and Intelligence”, <a href="https://courses.cs.umbc.edu/471/papers/turing.pdf">https://courses.cs.umbc.edu/471/papers/turing.pdf</a> (1950).</p><p>[21] John Searle, “The Chinese Room Argument”, <a href="https://plato.stanford.edu/entries/chinese-room/">https://plato.stanford.edu/entries/chinese-room/</a> (1980).</p><p>[22] “Thinking Fast and Slow”, <a href="https://en.wikipedia.org/wiki/Thinking,_Fast_and_Slow">https://en.wikipedia.org/wiki/Thinking,_Fast_and_Slow</a></p><p>[23] “Down syndrome”, <a href="https://en.wikipedia.org/wiki/Down_syndrome">https://en.wikipedia.org/wiki/Down_syndrome</a></p><p>[24] “Growth hormone deficiency”, <a href="https://en.wikipedia.org/wiki/Growth_hormone_deficiency">https://en.wikipedia.org/wiki/Growth_hormone_deficiency</a></p><p>[25] “Progeria”, <a href="https://en.wikipedia.org/wiki/Progeria">https://en.wikipedia.org/wiki/Progeria</a></p><p>[26] <a href="https://x.com/karpathy/status/1816531576228053133">https://x.com/karpathy/status/1816531576228053133</a></p><p>[27] “Most simultaneous blindfolded chess games (total games)”, <a href="https://www.guinnessworldrecords.com/world-records/72345-most-simultaneous-blindfolded-chess-wins">https://www.guinnessworldrecords.com/world-records/72345-most-simultaneous-blindfolded-chess-wins</a></p><p>[28] Chase &amp; Simon, “Perception in Chess”, <a href="https://www.sciencedirect.com/science/article/abs/pii/0010028573900042">https://www.sciencedirect.com/science/article/abs/pii/0010028573900042</a> (1973).</p><p>[29] “Xuanyi Geng”, <a href="https://www.worldcubeassociation.org/persons/2023GENG02">https://www.worldcubeassociation.org/persons/2023GENG02</a></p><p>[30] DeepSeek-AI, “DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model”, <a href="https://arxiv.org/pdf/2405.04434">https://arxiv.org/pdf/2405.04434</a> (2024).</p><p>[31] Graves et al, “Neural Turing Machines”, <a href="https://arxiv.org/abs/1410.5401">https://arxiv.org/abs/1410.5401</a> (2014).</p><p>[32] “Elon Musk plans to expand Colossus AI supercomputer tenfold”, <a href="https://www.ft.com/content/9c0516cf-dd12-4665-aa22-712de854fe2f">https://www.ft.com/content/9c0516cf-dd12-4665-aa22-712de854fe2f</a></p><p>[33] “Landauer’s principle”, <a href="https://en.wikipedia.org/wiki/Landauer%27s_principle">https://en.wikipedia.org/wiki/Landauer%27s_principle</a></p><p>[34] “The Moon Should Be a Computer”, <a href="https://www.palladiummag.com/2025/04/18/the-moon-should-be-a-computer/">https://www.palladiummag.com/2025/04/18/the-moon-should-be-a-computer/</a></p><p>[35] “Introducing Deep Research”, <a href="https://openai.com/index/introducing-deep-research/">https://openai.com/index/introducing-deep-research/</a></p><p>[36] “Introducing Operator”, <a href="https://openai.com/index/introducing-operator/">https://openai.com/index/introducing-operator/</a></p><p>[37] “Introducing Devin, the first AI software engineer”, <a href="https://cognition.ai/blog/introducing-devin">https://cognition.ai/blog/introducing-devin</a></p><p>[38] <a href="https://x.com/karpathy/status/1846448411362709980">https://x.com/karpathy/status/1846448411362709980</a></p><p>[39] “All Watched Over By Machines Of Loving Grace”, <a href="https://allpoetry.com/All-Watched-Over-By-Machines-Of-Loving-Grace">https://allpoetry.com/All-Watched-Over-By-Machines-Of-Loving-Grace</a></p><p>[40] “No free lunch theorem”, <a href="https://en.wikipedia.org/wiki/No_free_lunch_theorem">https://en.wikipedia.org/wiki/No_free_lunch_theorem</a></p><p>[41] “Ashkenazi Jews”, <a href="https://en.wikipedia.org/wiki/Ashkenazi_Jews">https://en.wikipedia.org/wiki/Ashkenazi_Jews</a></p><p>[42] “Machines of Loving Grace&quot;, <a href="https://www.darioamodei.com/essay/machines-of-loving-grace">https://www.darioamodei.com/essay/machines-of-loving-grace</a></p><p>[43] “Kardashev scale”, <a href="https://en.wikipedia.org/wiki/Kardashev_scale">https://en.wikipedia.org/wiki/Kardashev_scale</a></p><p>[44] “Dyson sphere”, <a href="https://en.wikipedia.org/wiki/Dyson_sphere">https://en.wikipedia.org/wiki/Dyson_sphere</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fe80f0a6afa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cracked Engineers — a new tech jobs hiring platform!]]></title>
            <link>https://gordicaleksa.medium.com/cracked-engineers-a-new-tech-jobs-hiring-platform-4a516ccc7da7?source=rss-37f02ae83e8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a516ccc7da7</guid>
            <category><![CDATA[cracked]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[tech-jobs]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Aleksa Gordić]]></dc:creator>
            <pubDate>Wed, 30 Oct 2024 11:49:29 GMT</pubDate>
            <atom:updated>2024-12-02T11:30:25.640Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cracked Engineers — a new tech jobs hiring platform!</h3><blockquote>Update: Cracked Engineers has been sunset as of December 2nd, unfortunately not enough interest. Feel free to ignore this post. :)</blockquote><p>Super excited to share this: I’ve just launched a new job platform for technical roles called “Cracked Engineers”! <a href="https://www.linkedin.com/feed/update/urn:li:activity:7257009712158703616/">LinkedIn</a>, <a href="https://x.com/gordic_aleksa/status/1851247076987855063">Twitter</a>)</p><p><strong>If you want to land a job with some of the world’s best AI/tech startups</strong> — my goal is to make this the go-to place for you!</p><p>Here it is: <a href="https://www.crackedengineers.com/">https://www.crackedengineers.com/</a></p><p>And here is a YouTube walk-through of the platform:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FXmuIOdES7mQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DXmuIOdES7mQ&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FXmuIOdES7mQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6704d510f12d47026e9fd91be4f96f9d/href">https://medium.com/media/6704d510f12d47026e9fd91be4f96f9d/href</a></iframe><p>Some of the best AI startups (rising stars &amp; established ones) already posted their jobs posts! A huge thank you to:</p><ul><li><a href="https://crackedengineers.com/job/weaviate-3989be79-6d71-44c1-9a6b-ca455fcf4e77">Weaviate</a> (Bob van Luijt &amp; team, best OSS vector DB!)</li><li><a href="https://crackedengineers.com/job/unsloth-ecb33b9f-7a36-43d3-ba5a-7af3ce4add8e">Unsloth AI</a> (Daniel Han &amp; Mike, one of the hottest YC startups)</li><li><a href="https://crackedengineers.com/job/openpipe-4e14db1f-320e-4185-aaf7-9dbc30eaccd0">OpenPipe</a> (David Corbitt, amazing fine-tuning engine)</li><li><a href="https://crackedengineers.com/job/julius-441f28f2-1471-45e8-a7b3-07af6dbec5c7">Julius AI</a> (Rahul Sonwalkar, over 1M users!)</li><li><a href="https://crackedengineers.com/job/jimini-health-20537933-20c5-4fcb-888d-f4714c9a1123">Jimini AI</a> (Luis F Voloch, ex co-founder of immunai (unicorn))</li></ul><p>for using the platform while still in beta and posting first paid posts!</p><p>As of yesterday there are now 774 people who signed up for the newsletter!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*Idm6Zy-HoNA7yllZesVEEQ.png" /></figure><p>And first feedback seems to be great!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*n65aI-CN8MBdp4WoUSzskw.png" /><figcaption>From <a href="https://www.linkedin.com/in/vit-d/">Vitalii Duk</a> CEO of Dynamiq (with his permission)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*GCghs215U64O4zWum0gCOQ.png" /><figcaption><a href="https://www.linkedin.com/in/vit-d/">Vitalii Duk</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*DpGBOifmTqPA8YtDrUPqKQ.png" /><figcaption>Mike Han from <a href="https://unsloth.ai/">Unsloth AI</a>!</figcaption></figure><p>Well, these are good problems to have! :)</p><p>And talking about the newsletter — I’m also <strong>announcing a weekly tech jobs newsletter </strong>that will be sent directly to your email inbox every Thursday! The best thing is you can subscribe on your <a href="https://www.crackedengineers.com/userProfile">dashboard</a> (once you login via GitHub) only to job post tags you care about!</p><p>e.g. “CUDA”, “Triton”, “MLOps”, “Software Engineering”, “LLMs”, etc.</p><p>On the flip side — <strong>for companies that want to share a job post</strong>: i’ll be sending you weekly updates on the number of views/applicants, etc. to help you hire the most cracked engineering talent!</p><p>It’s also <strong>super simple to </strong><a href="https://www.crackedengineers.com/postJob"><strong>post a job</strong></a>: AI helps you fill up the whole form in a minute and you’re ready to post! AI also helps you review your job post and catch occasional typos, etc. You also have a job post preview before you hit that submit button, so you know exactly what you get before you pay.</p><p><strong>if you need any help please dm me </strong>(see my social at the bottom of this post), or email me and I’ll make sure to help you asap. Also, if you have any feedback I’d love to hear from you!</p><p>This is a great place to provide deeper feedback: <a href="https://crackedengineers.canny.io/cracked-engineers">https://crackedengineers.canny.io/cracked-engineers</a></p><p>Or join my Discord channel: <a href="https://www.youtube.com/redirect?event=video_description&amp;redir_token=QUFFLUhqbFhkQnNNa3QwVlFIbHJIOHRHUlZxRlIyOWd6Z3xBQ3Jtc0tueE1rV0d2ajRoNnpTZE9SM0t5RUlmT0c2eWpIQUVjS2d5d0VmU2hsWkFNMTNKYnoxeEdXV2NJcEdVZWl0ZjNrYWVMM3FaY3hvaU5aZHBOMVJvbnJjZWUzVi00TVIwRFdDdnhaaXJzQWFKT2FhZWxPbw&amp;q=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fdiscord.gg%2FpeBrCpheKE">https://discord.gg/peBrCpheKE</a></p><p>I will be sharing job posts there directly from the platform, and we have a #crackedengineers channel for any feedback, help needed, etc.</p><p>Quick note on platform’s design/style/vibes: I wanted to make it the least corporate as much as possible. <strong>This should be a place where best tech startups hire the best tech talent. Period.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uozp4thLrkpMchV2DyHMUA.png" /><figcaption>Some loved the meme aesthetics others hated it :’D Reddit users in particular didn’t like it</figcaption></figure><p>Why did I build it?</p><p>Well, over the past period a lot of fellow founders were asking me to help them with hiring ML/tech talent. Since I have access to pools of extremely talented engineers and researchers I managed to help some of them, but it really doesn’t scale, so I wanted to automate as much as possible.</p><p>Last but not least I also want to thank <a href="https://jina.ai/">Jina AI</a> (<a href="https://www.linkedin.com/in/hxiao87/">Han Xiao</a>), <a href="https://smartcat.io/">SmartCat</a> (Nenad Bozic), <a href="https://www.luminai.com/">Luminai</a> (<a href="https://x.com/hargup13">Harsh Gupta</a>), <a href="https://nousresearch.com/">Nous Research</a> (<a href="https://www.karan4d.com/">Karan</a>), in no particular order, and many friends who helped test the platform while in alpha/beta stage — thank you! I learned a lot, and you made the platform so much better!</p><p>Onto $10k MRR! :)</p><ol><li>Connect and reach me on<strong> </strong>💡 <a href="https://www.linkedin.com/in/aleksagordic/"><strong>LinkedIn</strong></a><strong> </strong>and <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a></li><li>Subscribe to my 🔔 <a href="https://www.youtube.com/c/TheAiEpiphany"><strong>YouTube channel</strong></a> for AI-related content️</li><li>Follow me on 📚 <a href="https://medium.com/@gordicaleksa"><strong>Medium</strong></a><strong> </strong>and 💻<a href="https://github.com/gordicaleksa"><strong>GitHub</strong></a></li><li>Subscribe to my 📢 <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a> and join the 👨‍👩‍👧‍👦 <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community!</li></ol><p>And if you find the content I create useful <a href="https://www.patreon.com/theaiepiphany"><strong>consider becoming a Patreon!</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a516ccc7da7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ELI5: Flash Attention]]></title>
            <link>https://gordicaleksa.medium.com/eli5-flash-attention-5c44017022ad?source=rss-37f02ae83e8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c44017022ad</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[attention-is-all-you-need]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mlsys]]></category>
            <dc:creator><![CDATA[Aleksa Gordić]]></dc:creator>
            <pubDate>Tue, 18 Jul 2023 12:19:09 GMT</pubDate>
            <atom:updated>2024-11-01T12:53:15.888Z</atom:updated>
            <content:encoded><![CDATA[<h3>ELI5: FlashAttention</h3><p>The goal of this blog post is to explain <a href="https://arxiv.org/abs/2205.14135">flash attention</a> in such a way that hopefully anyone who already understands attention will ask themselves:</p><p>“Why didn’t I think of this before?” followed by “It’s so easy”.</p><p>We’ll start from the first principles. We’ll first understand how the standard/vanilla attention is implemented and then we’ll address the inefficiencies one by one — as if we were to independently discover flash attention ourselves.</p><p>Also, my sub-goal is to demystify some of the lingo from the compilers folks’ community: <em>kernel</em>, <em>kernel fusion</em>, <em>materialization</em>, etc.</p><blockquote>Note: I won’t be explaining attention itself, for that refer to Jay Alammar’s <a href="https://jalammar.github.io/illustrated-transformer/">awesome blog</a> or <a href="https://github.com/gordicaleksa/pytorch-original-transformer">my implementation</a> of the original transformer paper.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i4tDdwgvGtXuTIyJpFUn8A.png" /><figcaption>You should understand this diagram perfectly by the end of this blog.</figcaption></figure><p>Without further ado let’s start by breaking down the paper title:</p><p>“FlashAttention: <strong>Fast </strong>and <strong>Memory-Efficient</strong> <strong>Exact </strong>Attention with <strong>IO-Awareness</strong>”</p><p>The takeaway is that FlashAttention is:</p><ul><li><strong>Fast </strong>— excerpt from the paper: “We train BERT-large (seq. length 512) 15% faster than the training speed record in MLPerf 1.1, GPT2 (seq. length 1K) 3x faster than baseline implementations from HuggingFace and Megatron-LM, and long-range arena (seq. length 1K-4K) 2.4x faster than baselines.”</li><li><strong>Memory-efficient</strong> — compared to vanilla attention, which is quadratic in sequence length, <em>O(N²)</em>, this method is sub-quadratic/linear in N (<em>O(N)</em>). We’ll see later why &amp; how.</li><li><strong>Exact </strong>— meaning it’s not an approximation of the attention mechanism (like e.g. sparse, or low-rank matrix approximation methods) — its outputs are the same as in the “vanilla” attention mechanism.</li><li><strong>IO aware</strong> — compared to vanilla attention, flash attention is <strong>sentient</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-KyXjnqv_YTNjQhj.jpg" /><figcaption>You just got “Blake Lemoine-d”</figcaption></figure><p>Joking :) — it just means that it does not treat the underlying hardware as a black box. Instead, it <strong>leverages the knowledge of the memory hierarchy</strong> of the underlying hardware (e.g. GPUs, but other AI accelerators should work as well, I’ll be using GPUs as the running example).</p><p>Let’s expand on this IO awareness part a bit more. “IO” is the reason more FLOPS doesn’t necessarily translate into longer wall-clock time (maybe somewhat counterintuitively, but obvious if you know how the HW works).</p><p>Relevant excerpt from the paper:</p><p>“Although these [approximate] methods reduce the compute requirements to linear or near-linear in sequence length, many of them do not display wall-clock speedup against standard attention and have not gained wide adoption. One main reason is that they focus on FLOP reduction (which may not correlate with wall-clock speed) and tend to ignore overheads from memory access (IO).”</p><p>What’s the trick?</p><p>It’s the hardware:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ykyAH9UomvFs-WeJ.png" /><figcaption><a href="https://www.semianalysis.com/p/nvidiaopenaitritonpytorch#%C2%A7the-memory-wall">https://www.semianalysis.com/p/nvidiaopenaitritonpytorch#%C2%A7the-memory-wall</a></figcaption></figure><p>Over the years GPUs have been adding compute capacity (FLOPS) at a faster pace than increasing the memory throughput (TB/s).</p><p><strong>It doesn’t matter if you can compute at exaFLOPS speeds if there is no data to be processed.</strong> These 2 need to be closely aligned, and since the hardware lost that balance we have to make our software compensate for it.</p><p>Hence “IO-aware”.</p><p>Depending on this ratio between computation and memory accesses, operations can be classified as either:</p><ul><li><strong>compute-bound</strong> (example: matrix multiplication)</li><li>OR <strong>memory-bound</strong> (examples: elementwise ops (activation, dropout, masking), reduction ops (softmax, layer norm, sum, etc.)…)</li></ul><blockquote>Note on the terminology: this ratio is commonly measured by the <strong>arithmetic intensity</strong>, which is the number of arithmetic operations per byte of memory access.</blockquote><blockquote>Note 2: I strongly recommend reading Horace’s blog post <a href="https://horace.io/brrr_intro.html">https://horace.io/brrr_intro.html</a> — it’ll help further clarify differences between being compute/memory/overhead-bound.</blockquote><p>It turns out <strong>attention is</strong> (on current AI accelerators) <strong>memory-bound</strong>.</p><p>Why?</p><p>Because it “mostly consists of elementwise ops” or more accurately the arithmetic density of attention is not very high.</p><p>Let’s zoom in on this diagram from the paper:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*QOpKA6V8ZQ4X_s5lD0zybQ.png" /><figcaption>Dropout, softmax, masking — all elementwise ops, all memory bound. We can see they dominate the runtime.</figcaption></figure><p>You can see on the left bar, that masking, softmax &amp; dropout are the ops that are taking the bulk of the time and not matrix multiplication (even though bulk of the FLOPS is in matmul).</p><p>But all is not lost. Memory is not a monolithic artifact, it’s hierarchical in its nature and the general rule is: the faster the memory, the more expensive it is, and the smaller its capacity.</p><p>Let’s zoom in on this part of the diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*wf7fUgSOUz-9X3-mUWkYmA.png" /><figcaption>Memory is hierarchical in its nature. We could continue the pyramid by further adding SSD (even higher capacity and even slower), HDD (hard drives), etc. (AWS S3? :) ). You get the point.</figcaption></figure><p>Being “IO-aware” in practice boils down to exploiting the fact that SRAM is so much faster than HBM (“high bandwidth memory” — unfortunate name) by making sure to reduce the communication between the two.</p><p>To make things a bit less abstract here is a concrete example:</p><p>A100 GPU has <strong>40–80GB</strong> of high bandwidth memory (HBM, the thing that gives you lovely CUDA OOMs) with a bandwidth of <strong>1.5–2.0 TB/s</strong> and <strong>192KB </strong>of on-chip SRAM per each of 108 streaming multiprocessors with bandwidth estimated around <strong>19TB/s.</strong></p><blockquote>Similar ratios still hold for H100 and other accelerators.</blockquote><p>Now, let’s see the computations behind the standard attention implementation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9CnVGnPdRrXMQ4VtSmpWtg.png" /><figcaption>Notation remark: Q — queries, K — keys, V — values, S — scores, P — probabilities, O — outputs.</figcaption></figure><p>You can see how the standard implementation shows the utmost disrespect for the way HW operates. It’s basically treating HBM load/store ops as 0 cost (it’s not “IO-aware”).</p><p>Let’s now think from the first principles about how we could make this implementation more efficient (time &amp; memory-wise).</p><p>The lowest hanging fruit is to <strong>remove redundant HBM reads/writes</strong>.</p><p>Why write <strong><em>S</em></strong> back to HBM only to (re)load it again in order to compute the softmax? Let’s keep it in SRAM instead, perform all of the intermediate steps, and only then write the final result back to HBM.</p><p>This is what compilers folks refer to as <strong>“kernel fusion”</strong>, one of the most important low-level optimizations in deep learning:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/0*soFalc0qr5_Tq5o4.jpg" /></figure><p>No, not that one, but simply this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0Yn1aLye8s6_WTOu.png" /><figcaption><a href="https://horace.io/brrr_intro.html">https://horace.io/brrr_intro.html</a></figcaption></figure><p>A <strong><em>kernel </em></strong>is basically a fancy way of saying “a GPU operation”.</p><p><strong><em>Fusion</em></strong> means you’re fusing/combining multiple ops together.</p><p>So, you are loading from the HBM only <strong>once, </strong>you execute the fused op, and only then write the results back. By doing this you reduce the communication overhead.</p><blockquote>On a side note I honestly think people should stop naming concepts with words just because they sound cool. Kernel is the most overloaded word (2nd only to maybe “model”) in the computer science world. It can mean anything: Linux kernel (core software components of Linux OS), neural tangent kernel, SVM kernel, GPU operation, etc. It’s the HIV Aladeen of the CS world. <em>😂</em></blockquote><p>One final piece of terminology you’ll find floating around is <strong>“materialization”</strong>. It refers to the fact that in the above standard attention implementation, we’ve <strong>allocated </strong>full <strong>NxN</strong> matrices (<strong><em>S</em></strong>, <strong><em>P</em></strong>). We’ll soon see that that’s the bottleneck flash attention directly tackles reducing the memory complexity from <em>O(N²)</em> to <em>O(N).</em></p><p>Now that the complete background context is set, let’s now dig deeper into the flash attention algorithm.</p><p>Flash attention basically boils down to 2 main ideas:</p><ol><li><strong>Tiling </strong>(used during both forward &amp; backward passes) — basically chunking the NxN softmax/scores matrix into blocks.</li></ol><p>2. <strong>Recomputation </strong>(used in the backward pass only — if you’re familiar with activation/gradient checkpointing, this will be trivial to understand)</p><p>That’s it.</p><p>Here is the algorithm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OJBNIb3fz6JEuisrLfSW6g.png" /><figcaption>The gist of flash attention (minus dropout/masking).</figcaption></figure><p>My job here is done. Hope you enjoyed this blog post, subscribe for more content in the future! 🚀</p><p>Just kidding.</p><p>Let’s understand a couple more ideas that are needed to get the tiling to work, and then I’ll explain the algo line by line.</p><h3>FlashAttention algorithm</h3><p>The main hurdle in getting the tiling approach to work is softmax. In particular, the fact that softmax couples all of the score columns together. Here is how we compute the <em>i-th</em> output of a softmax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*sOvo7mEBzW60Dchup8mDLA.png" /><figcaption>z_i is the i-th score (key-query dot product), and the output is the i-th token’s probability that we later use to weight the value vector (again, I assume you know how attention works).</figcaption></figure><p>You see that denominator?</p><p>That’s the issue.</p><p>To compute how much a particular<em> i-th</em> token from the input sequence pays attention to other tokens in the sequence you’d need to have all of those scores readily available (denoted here by <em>z_j</em>) in SRAM.</p><p>But let me remind you: SRAM is severely limited in its capacity. You can’t just load the whole thing. N (sequence length) can be 1000 or <a href="https://www.anthropic.com/index/100k-context-windows">even 100.000</a> tokens. So <em>N²</em> explodes fairly quickly.</p><p>So here’s the trick, we can actually chop the softmax computation down into smaller blocks and still end up with precisely the same result.</p><p>Here are the main formulas:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8nxJfYSXZvev0NE_jC5WBQ.png" /><figcaption>Formula 1. Partial computation of softmax (we’ll iteratively get to the correct softmax numbers).</figcaption></figure><p>We can grab only the first <em>B</em> scores (<em>x_1 </em>through <em>x_B</em>) and compute the softmax for them.</p><p><strong>These numbers are, at least for now, incorrect.</strong> But bear with me, through iterations, we’ll “converge” to a correct result.</p><blockquote>Note: <strong>you can ignore the m(x)</strong> part, at least for now while we’re still in Plato’s world of ideas. Its purpose is solely to avoid numerical instabilities. On some hypothetical hardware from the future that’s more precise (e.g. we represent our data using more bits) this would not be needed. <strong>m(x)</strong> does not change the final result in any way.</blockquote><blockquote>Note: also check out the original papers that introduced the online softmax: <a href="https://arxiv.org/abs/1805.02867">https://arxiv.org/abs/1805.02867</a><br><a href="https://arxiv.org/abs/2112.05682">https://arxiv.org/abs/2112.05682</a></blockquote><p>Now the trick is that we can combine those per-block partial softmax numbers in a smart way such that the final result is actually correct. Here is the main idea:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ViyWK0-Nc6twYFpxR45OqQ.png" /><figcaption>Formula 2. This is the core idea behind softmax tiling. By recursively repeating this computation across all of the blocks we end up with the correct softmax output.</figcaption></figure><p>So basically, in order to compute the softmax for the scores belonging to the first 2 blocks (of size <em>B</em>), you have to keep track of 2 statistics for each of the blocks: <strong><em>m(x)</em></strong> (maximum score) and <strong><em>l(x)</em></strong> (sum of exp scores).</p><p>And then you can seamlessly fuse them together using the normalizing coefficients.</p><blockquote>Note: if you do some super basic algebra you’ll easily convince yourself that coefficients make sense. By expanding the <strong>f(x)</strong> and <strong>l(x)</strong> terms and multiplying with e^x some terms will simply cancel each other out, that’s the basic manipulation.</blockquote><p>This logic continues recursively all the way up to the last, <em>(N/B)-th,</em> block, at which point you have the N-dimensional correct softmax output!</p><p>Ok, we now have all of the ingredients we need in order to understand the forward pass of the flash attention algorithm.</p><blockquote>Note: the algo below assumes we have a batch of size 1 (i.e. single sequence) and a single attention head, we’ll easily scale it up later (by simply parallelizing across GPU’s streaming multiprocessors — more on that later). Also we ignore dropout &amp; masking for the time being, trivial to add it later.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OJBNIb3fz6JEuisrLfSW6g.png" /><figcaption>Notation remark: d — attention head dimension, B_r (<strong>row </strong>block size), B_c (<strong>column </strong>block size) — the rest of the notation was introduced before.</figcaption></figure><p>Let’s now break it down step by step!</p><p>S<strong>tep 0:</strong> HBM’s capacity is measured in GBs (e.g. RTX 3090 has 24 GBs of VRAM/HBM, A100 has 40–80 GB, etc.) so allocating <strong><em>Q</em></strong>, <strong><em>K</em></strong>, and <strong><em>V</em></strong> is not an issue.</p><p><strong>Step 1:</strong> Let’s compute the row/column block sizes. Why <em>ceil(M/4d)</em>? Because query, key, and value vectors are d-dimensional, and, we also need to combine them into the output d-dimensional vector. So this size basically allows us to max out SRAM capacity with <em>q</em>, <em>k</em>, <em>v</em>, and <em>o</em> vectors.</p><p>Toy example: assume M = 1000, d = 5. In this example, the block size is (1000/4*5) = 50. So in this example, we would load blocks of 50 <em>q, k, v, o</em> vectors at a time, to make sure we’re reducing the number of reads/writes between HBM/SRAM.</p><p>Worth keeping this image in your mind (it will make more sense soon):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0OV7ituGlfv9EaIfmtqbmg.png" /></figure><p>As for <em>B_r</em>, I’m not exactly sure why do they perform a min op with <em>d</em>? If anyone knows feel free to leave a comment!</p><p><strong>Step 2:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zkv3FSgGyZ7-iG_Q4k8GxQ.png" /></figure><p>We initialize the output matrix <strong><em>O</em></strong> with all 0s. It’ll act as an accumulator hence that init value. Similarly for <strong><em>l</em></strong><em> </em>(remember: its purpose is to hold the cumulative denominator for the softmax - the sum of exp scores). <strong><em>m </em></strong>(that holds row-wise maximum scores)<strong><em> </em></strong>is initialized with <em>-inf </em>because we’ll be doing a max operator over it so whatever the first block’s max is — it’ll certainly be larger than <em>-inf — </em>hence this is the natural init value.</p><p><strong>Step 3:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VG8bCa1mhiXx6D32wvk7Zw.png" /></figure><p>We split the <strong><em>Q, K, </em></strong>and <strong><em>V</em></strong> into blocks using the block sizes from Step 1. See also the diagram above.</p><p><strong>Step 4:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wTgKZnd1nFJ1SkRpZ9nj8Q.png" /></figure><p>Similarly split <strong><em>O, l, m</em></strong> into blocks (same block size as <strong><em>Q</em></strong>).</p><p><strong>Step 5:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*e0_mx0OSzVNIOE-4ZIq-zw.png" /></figure><p>Let’s start looping across the columns i.e. across key/value vectors (<strong>outer loop</strong> in the diagram above).</p><p><strong>Step 6:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PaxaJ90G6aHmKP-0RYVrtw.png" /></figure><p>Let’s load the <strong><em>K_j</em></strong> and <strong><em>V_j</em></strong> blocks from HBM to SRAM. Remember because of the way we constructed the block sizes we still have 50% of the SRAM unoccupied at this point in time (dedicated to <strong>Q</strong> and <strong>O</strong>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ywl4arvMvN6HCFwZ.png" /><figcaption>Roughly &amp; abstractly. The GPU memory layout will obviously be different.</figcaption></figure><p><strong>Step 7:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*mTCUNX239DWlG-i5LGll9w.png" /></figure><p>Start the <strong>inner loop</strong> across the rows i.e. across query vectors (again, see the diagram).</p><p><strong>Step 8:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y0gyIcenDedgWkmr_s2Bug.png" /></figure><p>Load <strong><em>Q_i</em></strong> (<em>B_r x d</em>) and <strong><em>O_i (</em></strong><em>B_r x d</em><strong><em>) </em></strong>blocks, as well as <strong><em>l_i</em></strong> (<em>B_r</em>) &amp; <strong><em>m_i (</em></strong><em>B_r</em><strong><em>) </em></strong>into SRAM.</p><p>How do <strong><em>l_i</em></strong> &amp; <strong><em>m_i</em></strong> fit into the SRAM (including all of the intermediate variables) when we computed block size in such a way that we only have enough space for <strong><em>K_j</em></strong>, <strong><em>V_j</em></strong>, <strong><em>Q_i</em></strong> &amp; <strong><em>O_i</em></strong>? I think the answer is: registers (see <a href="https://www.youtube.com/watch?v=4APkMJdiudU&amp;list=PLC6u37oFvF40BAm7gwVP7uDdzmW83yHPe">this CUDA video series</a> to get some intuition on GPU memory hierarchy). But I might be wrong, someone who’s actually implemented this in CUDA please correct me. 🙏 I’m sure I’m missing out on important implementation details by just analyzing the pseudo-algorithm.</p><p><strong>Step 9:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LMZEvals-Shf7giT8slQmw.png" /></figure><p>Compute the dot product between <strong><em>Q_i</em></strong> (<em>B_r x d</em>) and <strong><em>K_j </em></strong>transposed (<em>d x B_c</em>) to get the scores (<em>B_r x B_c</em>). As you can see we don’t have the whole <em>NxN</em> <strong><em>S</em></strong> (scores) matrix “materialized”. Only a fraction of it (<strong><em>S_i_j</em></strong>)!</p><p>Toy example: assuming the outer loop index is <em>j</em> (j=3), inner loop index is <em>i</em> (i=2), <em>N</em> is 25 and the block size is 5 this is what we just computed (assuming 1-based indexing):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m0pdO7LvXYrZ503F.png" /></figure><p>Basically the attention scores for tokens 6–10 with tokens 11–15 of our input sequence. But, importantly, these are exact scores, they’ll never change (as opposed to softmax results that will gradually get refined).</p><p><strong>Step 10:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F4LNBA_VsPhqNk4VkmNrOw.png" /></figure><p>Compute <strong><em>m~_i_j</em></strong>, <strong><em>l~_i_j</em></strong>, and <strong><em>P~_i_j</em></strong> using the scores computed in the previous step. It’s trivial.</p><p><strong><em>m~_i_j</em></strong> is computed row-wise, find the max element for each of the above rows.</p><p>We get <strong><em>P~_i_j</em></strong> by applying elementwise ops:</p><ol><li>Normalization — take the row max and subtract it from row scores</li><li>Exp</li></ol><p><strong><em>l~_i_j</em></strong> is simply a row-wise sum of the matrix P.</p><p><strong>Step 11:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jFlLbR8DS5Ei5NpwgIIvWA.png" /></figure><p>Compute <strong><em>m_new_i</em></strong> and <strong><em>l_new_i</em></strong>. Again fairly simple, let’s reuse the diagram from above:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yHc4h9UJ3AiHQ7fn.png" /></figure><p><strong><em>m_i</em></strong> contains row-wise maximums for all of the blocks that came before (j=1 &amp; j=2, colored in green). <strong><em>m~_i_j</em></strong> contains the row-wise maximums for the current block (colored in yellow). To get the <strong><em>m_new_i</em></strong> we just have to apply a max between <strong><em>m~_i_j </em></strong>&amp; <strong><em>m_i</em></strong>. Similarly for <strong><em>l_new_i </em></strong>(it additionally requires multiplying by coefficients as we saw previously in <em>formula 2</em>).</p><p><strong>Step 12 (the most important step):</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KNZwy8pvXo-AwcogXBETng.png" /></figure><p>This is the hardest part of the algorithm but still not that complicated, esp. once you internalize the <em>formulas 1 &amp; 2</em> for partial softmax computation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2DlPHK6iEltHdQxW.png" /></figure><p>Let’s break down the <strong><em>diag(l)</em></strong> part first.</p><p>It basically just allows us to do row-wise scalar multiplication in a matrix form. If you have a list of scalars <strong><em>s </em></strong>(<em>N</em>)<strong><em> </em></strong>and a matrix <strong><em>A (</em></strong><em>NxN</em><strong><em>)</em></strong>, if you do <strong><em>diag(s)</em></strong>*<strong><em>A</em></strong> you’re basically doing elementwise multiplication of rows of <strong><em>A</em></strong> with those scalars.</p><p>Next up notice the similarity between <em>step 12</em> and <em>formula 1</em> (pasting it here again for convenience):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XlUH2kUNmtZzCXMfQ9Q65A.png" /></figure><p>So what the 1st term of step 12 does (underlined in green) is it updates the current softmax estimate for the blocks before the current block in the same row of blocks. In case j=1 (that is the first block in this row) the 1st term will be 0 and we’ll just end up with the 2nd term.</p><p>The multiplication of the 1st term by <strong><em>diag(l_i)</em></strong> is there to cancel the division by that same constant from the previous iteration (this constant is hidden inside of <strong><em>O_i</em></strong>).</p><p>The 2nd term of the expression (underlined in yellow) doesn’t require this canceling of terms because as you can see we’re directly multiplying the <strong><em>P~_i_j</em></strong> matrix with the block of <strong><em>V</em></strong> vectors (<strong><em>V_j</em></strong>).</p><p>The <strong><em>e^x</em></strong> terms are there to modify the matrix<strong> <em>P~_i_j</em></strong> &amp; <strong><em>O_i</em></strong> by canceling out the <strong><em>m</em></strong> from the previous iteration and instead updating it with the latest estimate (<strong><em>m_new_i</em></strong>) that contains the row-wise max so far.</p><p>The easiest way to convince yourself this makes sense is to just simulate a couple of iterations yourself — in case you still didn’t quite get it.</p><p>It literally takes 5 minutes. Here is my step-by-step analysis (hope it helps!):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RuLi2fMrkxeCkPo6_bttvw.png" /><figcaption>As you can see the main point is that these e terms outside cancel out with e terms inside of P/O matrices and we always end up having the latest m_new_1 estimate!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a4Fu3h_eL9LMLIkLgXW-1g.png" /><figcaption>The third iteration is similar and we end up with the correct and final result!</figcaption></figure><p>Recall: this is just a current estimate of the final <strong><em>O_i</em></strong>. Only after we iterated through all of the red blocks in the diagram above will we end up having the exact result. And that’s it!</p><p><strong>Step 13:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fMJPUiQQ-JhGpZFFOFTNWw.png" /></figure><p>Write the newest cumulative statistics (<strong><em>l_i</em></strong> &amp; <strong><em>m_i</em></strong>) back to HBM. Notice these are of dimension <em>B_r</em>.</p><p><strong>Steps 14, 15, 16:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*GNaqyihDrF2wo3eaFPUCLg.png" /></figure><p>Once the nested for loop is over, <strong><em>O</em></strong> (Nxd) will contain the final result: attention-weighted value vectors for each of the input tokens!</p><p>That’s it guys. That’s the forward pass of the flash attention!</p><p>This algorithm can easily be extended to “block-sparse FlashAttention”, a sparse attention algorithm that is 2–4 faster than even FlashAttention, scaling up to a sequence length of 64k! The idea is we use a block form mask matrix and we simply skip certain loads/stores from the above nested for loop and by doing so we can save proportionally to the sparsity coefficient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/0*jBov-kkiUvAv1cA0.png" /><figcaption>Example of a block form mask matrix. Assuming our block length is 3 we’d have only 3/9 iterations in this toy example. Thus 3x faster!</figcaption></figure><p>Now let’s briefly touch on the complexity.</p><h4>Complexity analysis</h4><p><strong>Space:</strong> We’ve allocated <strong><em>Q</em></strong>, <strong><em>K</em></strong>, <strong><em>V</em></strong>, <strong><em>O</em></strong> (<em>Nxd</em>), <strong><em>l</em></strong> &amp; <strong><em>m</em></strong> (<em>N</em>) in HBM. That’s 4*N*d + 2*N. Dropping the constants (big <em>O</em> stuff), and knowing that <em>d</em> is also a constant and usually much smaller than N (e.g. usually d={32, 64, 128}, N={1024, …, 100k}) we get <em>O(N)</em> for space. Big win! That helps us scale transformers to 64k sequence lengths “easily” (add to that a couple of other “tricks” like ALiBi which I’ll cover in one of the follow-up blog posts).</p><p><strong>Time:</strong> we won’t strictly do a time complexity analysis, instead we’ll use a good proxy: <strong>the number of HBM accesses</strong>.</p><p>Here is an excerpt from the paper:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*blllQ-SaDeNQoUOilvUhTg.png" /></figure><p>How do they get to that number? Well, let’s analyze the nested for loop:</p><ul><li>Our block size is <em>M/4d</em>. This means that the vectors are split into N/(M/4d) blocks.</li><li>Raise that to the power of <em>2</em> (because we’re looping across row/column blocks) and we get <em>O(N² d² / M²)</em></li><li>Now here I have <em>M²</em> and they only have <em>M¹ </em>— my hypothesis is that we probably need <em>M/4d</em> memory accesses inside of the loop to actually fetch all the vectors, i.e. we can’t fetch the whole block all at once. That would explain the missing <em>M</em>? (<em>d</em> can be ignored as a constant in big <em>O</em>).</li></ul><p>If we were to do a big <em>O</em> analysis that could lead us to think this is not much better than standard attention, but for typical numbers, this leads to up to 9x fewer accesses (as per the excerpt above).</p><p>And that’s it, you now (hopefully) understand the flash attention!</p><p>Let’s wrap it up by closing the gap with the real world. So far we were analyzing the pseudo algorithm focusing on a single attention head assuming a batch size of 1. And we also glossed over the backward pass.</p><h4>batch_size &gt; 1, num_heads &gt; 1, backward pass</h4><p>Let’s start with the low-hanging fruit. Extending the implementation we saw to support <em>batch_size </em>&gt; 1 and the <em>num_heads </em>&gt; 1 is actually not that hard.</p><p>So far the algorithm we saw is basically handled by a single <strong><em>thread block</em></strong> (CUDA programming lingo). This thread block is executed on a single <strong><em>streaming multiprocessor</em></strong> (SM) (e.g. there are 108 of these on A100). To parallelize our computation we just run <em>batch_size</em> * <em>num_heads </em>threadblocks in parallel on different SMs. The closer that number is to the number of available SMs on the system the higher the utilization will be (ideally a multiple as each SM can run multiple thread blocks).</p><p>What happens when that number is bigger than the number of available SMs? I’m not sure but I assume there is a queue that keeps track of the waiting kernels (update: <a href="https://www.youtube.com/watch?v=xwbD6fL5qC8&amp;t=760s&amp;ab_channel=TomNurkkala">apparently</a> the CUDA runtime takes care of that and it is using some sort of queues to implement that logic).</p><p>Next up let’s briefly address the backward pass.</p><p>The backward pass relies on the same set of concepts + <strong><em>recomputation</em></strong>.</p><p>To demonstrate the concept of recomputation I’ll use the example of “<em>activation/gradient checkpointing</em>” method.</p><p>We know that we need to have the activations computed during the forward pass readily available during the backward pass in order to compute the gradients w.r.t. our loss function.</p><p>The trick here is to not store them during the fwd pass (as they have a huge memory footprint), but instead, recompute them de novo during the backward pass. There is a built-in <strong>tradeoff </strong>here: we’re slowing down the backward pass in order to reduce the memory footprint.</p><blockquote>Note: This tradeoff is a spectrum, e.g. you can store the activations every <em>n</em> layers, and then when computing the activations for the i-th layer you don’t have to start from the input but instead from the closest stored activations.</blockquote><p>The same concept of recomputation is re-used here — but with a twist! Luckily for the flash attention, we don’t have to sacrifice neither runtime nor memory!</p><p>By storing the output <strong><em>O</em></strong> (<em>Nxd</em>) and the softmax normalization statistics (<em>N</em>) we can recompute the attention matrices <strong><em>S</em></strong> (<em>NxN</em>) and <strong><em>P</em></strong> (<em>NxN</em>) in the backward pass directly from blocks of <strong><em>Q</em></strong>, <strong><em>K</em></strong>, and <strong><em>V</em></strong> (<em>Nxd</em>) in SRAM! Thus keeping the memory at <em>O(N)</em>. I encourage you to read the paper if you’re curious about the details, but I assure you, you’re equipped with all of the tools you need to understand it now.</p><p>Lastly, let’s see some of the issues one could expect implementing flash attention.</p><h3>The real world is…messy</h3><p>The same thing that gives flash attention its power is the root cause of its issues. Let’s see this excerpt from the paper:</p><p>“Our current approach to building IO-aware implementations of attention requires writing a new CUDA kernel for each new attention implementation. This requires writing the attention algorithm in a considerably lower-level language than PyTorch, and requires significant engineering effort. Implementations may also not be transferrable across GPU architectures. These limitations suggest the need for a method that supports writing attention algorithms in a high-level language (e.g., PyTorch), and compiling to IO-aware implementations in CUDA…”</p><p>As a consequence, the original flash attention supported only a subset of GPUs. For example, V100 is not supported. See this issue on their GitHub:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WAgDijytJXfwz-_u1geEIg.png" /><figcaption><a href="https://github.com/HazyResearch/flash-attention/issues/148">https://github.com/HazyResearch/flash-attention/issues/148</a></figcaption></figure><blockquote>Note: here is one more relevant issue: <a href="https://github.com/HazyResearch/flash-attention/issues/190">https://github.com/HazyResearch/flash-attention/issues/190</a></blockquote><p>To make this issue a bit more visceral, here is the actual CUDA code from the original implementation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MscGQcD2J3L9KxiZQA6TnA.png" /><figcaption>a snippet of CUDA implementation from the original codebase <a href="https://github.com/HazyResearch/flash-attention/blob/main/csrc/flash_attn/src/fmha_fprop_kernel_1xN.h#L383">https://github.com/HazyResearch/flash-attention/blob/main/csrc/flash_attn/src/fmha_fprop_kernel_1xN.h#L383</a></figcaption></figure><p>As you can see, writing CUDA is…messy. Additionally — this is a research codebase which doesn’t help, but even if it wasn’t for someone coming from an ML research background, who is only comfortable with Python this is (potentially) a deal breaker.</p><p>This is where projects like <a href="https://openai.com/research/triton">OpenAI’s Triton</a> could be game changers (see their <a href="https://github.com/HazyResearch/flash-attention/blob/main/flash_attn/flash_attn_triton.py">FlashAttention implementation</a>). Triton is basically a <strong><em>DSL </em></strong>(domain-specific language) between CUDA &amp; other DSLs (e.g. <strong><em>TVM</em></strong>) in its level of abstraction. You can write Python code that’s super optimized (once compiled) instead of having to deal directly with CUDA. That very same Python code could then be deployed on an arbitrary accelerator (that responsibility lies on Triton devs and HW manufacturers).</p><p>Triton has recently been integrated with PyTorch 2.0 so definitely keep an eye out for this project! Shout out to <a href="https://github.com/ptillet\">Philippe Tillet</a> who started building Triton during his PhD and later became a part of OpenAI.</p><p>Finally, it’s worth mentioning that for certain use cases, you might still prefer other methods. E.g. for sequence lengths beyond 1K, some approximate attention methods (e.g., Linformer) start to become faster. But ultimately, to the best of my understanding, the block-sparse implementation of the flash attention outperforms all other methods.</p><h3>Outro</h3><p>You might ask yourself: why didn’t anyone invent FlashAttention before? Given how crucial this piece of computation is to all modern ML workloads. Given how many engineering hours are spent, across different tech organizations, trying to squeeze the last ounce of performance out of these systems. Why did a <a href="https://tridao.me/">Stanford student</a> (shout out to Tri Dao for the amazing work!) come up with this and not e.g. NVIDIA engineers?</p><p>There is a couple of possible explanations that I can see:</p><ul><li>FlashAttention is, as far as I can tell, easier/only possible to implement on the latest GPUs (hence V100 is not supported in the original codebase). Couple this with the phenomenon that oftentimes “outsiders” are those who see the problems with beginner’s eyes and tackle issues from the first principles and we get to the possible explanation.</li><li>Ultimately I really like <a href="https://nat.org/">Nat Friedman’s</a> perspective on the efficiency of the world:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V5FdAlPuQgFFjCxRjcLVjg.png" /><figcaption><a href="https://nat.org/">https://nat.org/</a></figcaption></figure><p>Finally, let me wrap up with some food for thought:</p><p>Given how much it costs to train these models (see <a href="https://www.mosaicml.com/blog/gpt-3-quality-for-500k">this blog</a> from MosaicML for the most optimistic estimates) being able to shave off 15% from BERT-large training, or speed up GPT training 2/3x has such a tremendous economic impact when considering all of the current, and future, model trainings at a global scale.</p><p>Imagine if we lived in a world where <strong><em>Y</em></strong> (value captured) was actually correlated with <strong><em>X</em></strong> (value produced). The author would be a trillionaire over the next few years. :)</p><p>Alas, researchers rarely capture that value, for better or worse (imagine if Pythagoras patented his theorem :P). Yet people who oftentimes just repackage stuff are those who capture most of the value. Going on a complete tangent here, until next time! ;)</p><h4>Further resources</h4><ul><li>Flashier Attention blog — <a href="https://www.adept.ai/blog/flashier-attention">https://www.adept.ai/blog/flashier-attention</a> -&gt; They show how to further optimize flash attention for highly distributed settings where batch sizes become super small (pipeline parallelism) and sequence length super long.</li><li>Tri Dao’s talk: <a href="https://www.youtube.com/watch?v=gMOAud7hZg4&amp;ab_channel=StanfordMLSysSeminars">FlashAttention — Tri Dao | Stanford MLSys #67</a></li><li>Tri Dao’s talk: <a href="https://www.youtube.com/watch?v=FThvfkXWqtE&amp;ab_channel=StanfordMedAI">MedAI #54: FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness | Tri Dao</a></li><li>Paper: <a href="https://arxiv.org/abs/2205.14135">FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness</a></li></ul><h4>Acknowledgments</h4><p>Thanks to <a href="https://twitter.com/tri_dao">Tri Dao</a>, <a href="https://twitter.com/cHHillee">Horace He</a>, and <a href="https://twitter.com/AmritSa51993336">Amrit Sahu</a> for reading earlier drafts of this blog post and providing feedback!</p><h4>BibTeX Citation</h4><pre>@article{gordiceli5flashattention,<br>  author={Aleksa Gordic},<br>  title={ELI5: FlashAttention},<br>  year={2023},<br>  url={https://gordicaleksa.medium.com/eli5-flash-attention-5c44017022ad},<br>}</pre><h4>Connect with me</h4><p>Last but not least feel free to drop me a message or:</p><ol><li>Connect and reach out on<strong> </strong><a href="https://www.linkedin.com/in/aleksagordic/"><strong>LinkedIn</strong></a><strong> </strong>and/or <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a></li><li>Subscribe to my <a href="https://www.youtube.com/c/TheAiEpiphany"><strong>YouTube channel</strong></a> for more ML</li><li>Follow me on <a href="https://medium.com/@gordicaleksa"><strong>Medium</strong></a><strong> </strong>and <a href="https://github.com/gordicaleksa"><strong>GitHub</strong></a></li><li>Subscribe to my <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a> and join the <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community!</li><li>📄 <a href="https://gordicaleksa.com/"><strong>Website</strong></a></li></ol><p>And if you find the content I create useful <a href="https://www.patreon.com/theaiepiphany"><strong>consider becoming a Patreon!</strong></a></p><p>Much love ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c44017022ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Infinite Machine: How an Army of Crypto-hackers Is Building the Next Internet with Ethereum |…]]></title>
            <link>https://gordicaleksa.medium.com/the-infinite-machine-how-an-army-of-crypto-hackers-is-building-the-next-internet-with-ethereum-5fc29594d7b2?source=rss-37f02ae83e8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fc29594d7b2</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Aleksa Gordić]]></dc:creator>
            <pubDate>Fri, 10 Dec 2021 01:08:51 GMT</pubDate>
            <atom:updated>2021-12-10T01:16:28.842Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Infinite Machine: How an Army of Crypto-hackers Is Building the Next Internet with Ethereum | learnings, thoughts, notes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GoggpTpZSfT7rSiE" /><figcaption>Ethereum — the “world computer” (Photo by <a href="https://unsplash.com/@executium?utm_source=medium&amp;utm_medium=referral">Executium</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>This blog is the second one in my series of blogs covering the fascinating world of cryptocurrencies and beyond! You can check out the first blog <a href="https://gordicaleksa.medium.com/digital-gold-bitcoin-and-the-inside-story-of-the-misfits-and-millionaires-trying-to-reinvent-d0a6c1280a61">here</a>, which covers the “Digital Gold” book.</p><p>In this one, I’ll be sharing my thoughts, learnings, and notes from the book “The Infinite Machine: How an Army of Crypto-hackers Is Building the Next Internet with Ethereum” by Camila Russo.</p><p>Similar to the last blog, you should read this book if you’re interested in the history, people, stories, and a high-level overview of what Ethereum is and the inspiring story that led to its development.</p><p>Before I share my notes and some people you should probably check out on Twitter, let me give you a short summary of the book…🌈🦄</p><h3>A TL;DR</h3><p>Ethereum’s white paper was published back in 2013 by Vitalik Buterin, a 19-year-old “kid programmer”.</p><p>He got in the crypto-space back in 2011, when he was only 17 years old. In these early days, he was trying to learn as much as he possibly could about Bitcoin, blockchains in general, and how these ideas may be leveraged to improve the world.</p><p>His passion was subsequently channeled into what came to be known as the Bitcoin Magazine, which he jointly started together with Mihai Alisie, whom Vitalik had never met personally until that moment of time.</p><p>After spending some time in crypto he started his Bitcoin tour by traveling around the world attending various Bitcoin events (he’d basically stay at friends’ apartments to spare the money he collected). This gradually got him connected with the developers of Mastercoin and Colored Coins projects.</p><p>Their idea was to build on top of the Bitcoin blockchain and extend it in various different ways so that it can support creating new coins and manipulating real-world assets, and not just currencies.</p><p>After his deep engagement with Bitcoin, Mastercoin, and Colored Coins projects the idea was born in his mind on how he could further generalize all of their ideas — that’s how Ethereum came to be.</p><p>The name “Ethereum” itself was inspired by the disproved concept of “ether” that was hypothesized to be the substance that carries the light waves through space, hinting at the ambition that Ethereum could, one day, become a decentralized global computer that would support all of the future distributed applications.</p><p>He basically thought that instead of building one feature at a time on top of Bitcoin, which obviously wouldn’t scale up as it’s impossible to anticipate all the things that’ll eventually be built on top of it, it’d be better to create a programming language (Solidity) that can simply be used to program arbitrary functionality on top of a blockchain (inside the so-called smart contracts).</p><p>The initial days of Ethereum development were hectic. There were more than 10 “co-founders” and most of them were building Ethereum from a spaceship-looking house in Zug, Switzerland.</p><p>After certain internal fights, Vitalik decided that there’ll be “only” 8 co-founders.</p><p>Since then people have been proposing various ideas that could be built on top of Ethereum, stuff like:</p><ul><li>DAOs (decentralized autonomous organizations) — the idea is to create a trustless organization whose rules will be executed by the code and not by fallible and corruptable humans.</li><li>DeFi (decentralized finance) — again the idea is to do fundamental financial operations without the unnecessary intermediaries.</li></ul><p>And many others.</p><p>The most ambitious project, back in 2016, and one of the first DAOs was the so-called <strong>“The DAO”</strong>.</p><p>It was a decentralized funding organization where investors could invest their money (via Ether), get some “dai” tokens in return, and then use those to vote for certain whitelisted organizations. The actual Ether distribution would be done automatically without any intermediaries.</p><p>The idea was beautiful and pure, but the actual implementation taught us a lot about the potential problems with blockchains and open-source code in general.</p><p>The code was open-source and developed by humans, and as such, it had a fatal flaw — a bug that made it possible for malicious hackers to start draining the funds out directly into their own wallets. Additionally, thanks to the anonymity property of blockchains, the attackers ran away without any consequences.</p><p>All of this opened up an important question — what happens if a vital smart contract has an undiscovered bug?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WbuFdDo1eWFw8FuV" /><figcaption>The fork (Photo by <a href="https://unsplash.com/@ankumpan?utm_source=medium&amp;utm_medium=referral">Anna Kumpan</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>The problem was solved by a largely <strong>controversial hard fork</strong>, that corrected the code in such a way that the original owners kept their coins and the attacker was left empty-handed. Most miners decided to pull the newest code changes.</p><p>The event was controversial because it showed that even in the world of cryptocurrencies some organizations are “too big to fail” and can be bailed out by the centralized authority. Similar to how governments bail out banks during severe recessions, the very system that cryptocurrencies were trying to replace.</p><p>Interestingly enough, some miners didn’t agree with this decision so they continued mining using the pre-hardfork code. In this parallel universe, the attacker managed to escape with the stolen money. The new-old blockchain came to be known as the Ethereum Classic.</p><p>Fast forward to today, the main improvements that Ethereum still has on its backlog can roughly be split into 2 classes:</p><ul><li>Proof of Stake</li><li>Scaling</li></ul><p>The Proof of Stake is an alternative consensus algorithm in which instead of using the amount of compute (Proof of Work) as a proxy for who should have more “voting power” in the blockchain, it uses the number of coins that a user has as a proxy. So it’s a plutocratic system in a way.</p><p>The why behind PoS is fairly simple — PoW is warming up the planet. 😂</p><p>On the other hand, scaling is much more important if Ethereum is ever to become a global computer. Compared to payment systems such as Visa, and MasterCard which can process thousands of transactions per second, Ethereum is in the double-digit realm.</p><p>Scaling techniques can approximately be divided into 2 categories:</p><ul><li>Level 1 techniques will be directly implemented on the Ethereum blockchain itself. The main one is sharding i.e. allowing the nodes in the blockchain to only keep a fraction of the whole blockchain/ledger, without (seriously) jeopardizing the security of the system.</li><li>Level 2 techniques are those that’ll be implemented in systems built on top of the Ethereum blockchain. Those include rollouts (ZK-rollouts, optimal rollouts, etc.), plasma, and others.</li></ul><p>By combining the level 1 and level 2 techniques together, Ethereum can theoretically achieve a 100x speedup.</p><blockquote>Note: I didn’t digress into what each of the concepts mentioned mean, as otherwise this summary would be worthy of a book.</blockquote><p>Similar to the last blog in the series, next up, I’ll share my private notes, in the hope their structure or the very fact I’m doing it may help somebody. You can also just extract some keywords from my notes and do your own (re)search.</p><p>Finally, I’ll share a list of Twitter influencers I extracted from the book.</p><blockquote><strong><em>Super important tip reading the book:</em></strong><em> take notes while reading it!!! Because:</em></blockquote><blockquote><em>a) You’ll be a more active learner which will further help consolidate the knowledge from the book.</em></blockquote><blockquote><em>b) There is a lot of new names/actors that you’ll need to remember to follow along the story. Thank me later.</em></blockquote><h3>The Infinite Machine book notes</h3><p><strong>Chapter 1 (Mooning)</strong></p><p>The hype of 2017, lush parties everywhere, scammers, hackers.</p><p>Vitalik as the voice of reason — is the value we produced truly worth a trillion $ market?</p><p><strong>Chapter 2 (Cypherpunk’s Fever Dream)</strong></p><p>The ideas of cypherpunks (Jude Milhon), open-source software (Richard Stallman), P2P, shaped the crypto community.</p><p>The problems of “double-spend” and “Sybil attack” (duplicating money and identities basically).</p><p>Proof-of-Work as the solution to the above attacks.</p><p>The story of the monetary crisis in Argentina.</p><p>A high-level description of how Bitcoin works and the story behind it.</p><p>“The Times 3 January 2009 Chancellor on brink of second bailout for banks.” &lt;- a message hidden inside the 1st block on the Bitcoin blockchain! Basically, the reason why we need decentralized, trustless systems such as Bitcoin.</p><p>Vitalik Buterin is introduced, when he was 17 he wrote his 1st post on the Bitcoin forum.</p><p><strong>Chapter 3 (The Magazine)</strong></p><p>Mihai Alisie and Vitalik create the first (printed) Bitcoin magazine.</p><p><strong>Chapter 4 (The Rabbit Hole)</strong></p><p>The story of Anthony (who had rich parents and would go on to become Ethereum co-founder) and the meetup he organized that Vitalik accidentally attended.</p><p>Mihai invites Vitalik to Europe (who was in Waterloo, Canada) to work on Bitcoin Magazine and his crypto startup Egora. Vitalik says yes.</p><p>They end up in Calafou community/hacklab in Spain, founded by Enric Duran the inventor of the pyramid scheme.</p><p><strong>Chapter 5 (The Swiss Knife)</strong></p><p>Vitalik’s Bitcoin tour (He “couch-surfed” in order to save up some money!).</p><p>During the tour, he got invited to Israel by a Colored Coins’ dev Amir Chetrit.</p><p>Mastercoin — the 1st blockchain startup that had raised funds by selling its digital token (coins not created by work/mining but out of thin air). It allowed others to easily create novel currencies, plus it used smart contracts.</p><p>The term “smart contract” is mentioned (Nick Szabo coined it back in the 1990s). A nice metaphor is that a smart contract is like a “digital vending machine”.</p><p>Vitalik writes the white paper for Colored coins and contributes to Mastercoin as well.</p><p>He notices problems with both of these, generalizes the approach and this is how Ethereum is born.</p><p><strong>Chapter 6 (The white paper)</strong></p><p>Since Vitalik was a kid he was exposed to maths by his parents (who were in software engineering (dad) and finance (mum)).</p><p>He wrote his first “white paper” while he was still 7, he had a private maths tutor, and he was less sociable than other kids.</p><p>During his middle school, he joins a specialized private school. He also joins the debate team that must have played a role in his exceptional ability to explain complicated concepts in a more approachable way).</p><p>Travels all around the world to compete in maths and debating.</p><p>In 2011 Dmitry (his father) mentioned Bitcoin to Vitalik.</p><p>Starts writing in exchange for bitcoins (BitcoinTalk forum).</p><p>In Ripple’s office in SF (end of his Bitcoin tour) he coins the name Ethereum based on the word “ether”.</p><p>November 27, 2013 — the Ethereum white paper is written.</p><p><strong>Chapter 7 (The First Responders)</strong></p><p>You have to pay ether to run a piece of code on the Ethereum blockchain.</p><p>2 types of accounts exist on Ethereum:</p><ul><li>external accounts (controlled by someone’s private key)</li><li>contract accounts (controlled by code)</li></ul><p>A brief story of Charles Hoskinson (founder of Cardano), and how he created Bitcoin courses that made him famous in the crypto community which eventually ended up with him meeting various Bitcoin celebs and getting funding!</p><p>Charles builds Invictus with Dan and Stan who he “met” on the forums.</p><p>Decentralized Autonomous Organization (DAO) is introduced as a concept by Dan and Stan.</p><p>Charles gets fired and at that same time joins Ethereum as the co-founder.</p><p>All the cofounders gather in Miami.</p><p><strong>Chapter 8 (The Miami House)</strong></p><p>The story of Gavin Wood and how he wrote the 1st C++ implementation of Ethereum (invited to Miami with other Ethereum “co-founders”).</p><p>Discussions on the ownership of Ethereum.</p><p>Story of Jeff Wilcke (who worked for Mastercoin) and his Go implementation of Ethereum in Amsterdam.</p><p><strong>Chapter 9 (The announcement)</strong></p><p>Story of Joseph Lubin (another co-founder) and the 1st demo of Ethereum by Gavin.</p><p>Initial fights as Gavin (rightfully) wants to become the co-founder as well.</p><p>Vitalik’s talk at the Bitcoin conference was followed by a lot of hype.</p><p><strong>Chapter 10 (The Town of Zug)</strong></p><p>Early days, more than 10 co-founders worked from a tiny flat, doing the legal stuff, building the website, etc.</p><p>Charles was initially the CEO.</p><p><strong>Chapter 11 (The Spaceship)</strong></p><p>They are working in a weird building in Zug that looks like a spaceship.</p><p>Small fights start happening, Charles, the CEO, starts pushing for the for-profit structure and hints that he is Satoshi Nakamoto (others get annoyed).</p><p>Vitalik is in Silicon Valley at that same time.</p><p><strong>Chapter 12 (The White-Shoe Lawyers)</strong></p><p>Legal problems in defining Ether: is it a security or a commodity?</p><p>Gavin publishes the “yellow paper” that contains technical details described in Vitalik’s white paper.</p><p>Pryor Cashman, a white-shoe law firm, makes a letter stating that Ether is not a security — a green light!</p><p><strong>Chapter 13 (The Red Wedding)</strong></p><p>Big fight bursts out as the crowd sale was approaching — the co-founders sit at the table in Zug and share their grievances.</p><p>Vitalik gets Peter Thiel’s grant.</p><p>The decision falls to Vitalik to decide on the co-founders and the future of Ethereum.</p><p>He decides on 8 co-founders leaving out Amir and Charles (the CEO).</p><p><strong>Chapter 14 (The (Non)Investment)</strong></p><p>The presale heat and hype are building up — many are accusing them of scamming.</p><p>Lots of effort is put into convincing people that ether is not a security.</p><p><strong>Chapter 15 (The Ether Sale)</strong></p><p>The buyers only got a wallet and a password to avoid speculative trading before the platform was up and running.</p><p>Criticisms because of the pre-mining (creating coins out of thin air). The control is, contrary to cypherpunks’ spirit, centralized among “insiders” who participated in a presale.</p><p>July 22, 2014 — They raised 18.3M$!!! (60M ether priced at 30 cents).</p><p>Co-founders and the Ethereum Foundation additionally got (out-of-thin-air) 9.9% of the total amount of coins sold (60M) during the ICO.</p><p>Ethereum’s supply strategy: Uncapped supply of Ether with the declining rate (contrast that with Bitcoin’s perfect scarcity).</p><p>Lots of controversy about the presale — it seems that the wealth was very unevenly distributed and the charts were “unusually smooth” as if somebody was tinkering with the buying process (a bot).</p><p><strong>Chapter 16 (Takeoff)</strong></p><p>The story of Aurel, Paul, and the mining operation before Ethereum went live.</p><p>Ethereum had 9 proof of concepts and rigorous testing since the presale event!</p><p>A bigger team is forming around Ethereum.</p><p>12 seconds for a transaction to get accepted vs Bitcoin’s 10 minutes.</p><p>Stages of Ethereum development: Olympic, Frontier, Homestead, Metropolis, and Serenity (PoS, sharding).</p><p>Vitalik gave a 25k ether reward for the community to try to crash the Olympic release (9th proof of concept).</p><p>Joe Lubin (Ethereum co-founder) started building a startup on top of Ethereum — ConsensSys.</p><p>July 30, 2015 day of the launch!</p><p>March 2016 Ether saw a 30/40x increase in value which made people like Ken Seiff very rich.</p><p><strong>Chapter 17 (The Shrinking Runway)</strong></p><p>The only co-founders left were Vitalik, Gavin, and Jeff (the initial C++/Go Ethereum devs) — others started their own companies.</p><p>After Bitcoin plummeted, and since the foundation kept all of its money in Bitcoin, their finances became very weak.</p><p>Ming was introduced to try to keep the Ethereum foundation afloat.</p><p>Tribalism between Jeff’s (Go) and Gavin’s (C++) teams.</p><p>Gavin is removed from the foundation because he started a for-profit company Ethcore.</p><p><strong>Chapter 18 (The First Dapps)</strong></p><p>Jack and Joey build Augur — a Dapp built on top of the Ethereum blockchain for betting (“prediction market” platform). Augur raises 5.3 M$.</p><p>ERC20 was born — a template to create coins on top of Ethereum (20 because it was the <a href="https://github.com/ethereum/eips/issues/20">20th issue on Ethereum’s GitHub</a>!)</p><p>Rune creates MakerDAO on top of Ethereum — the value prop is a stable coin pegged to USD ($).</p><p>MakerDAO brings “the best of both worlds “— decentralized but stable!</p><p>March 14, 2016 — a production-ready version released, dubbed “Homestead”.</p><p>DigixDAO — similar to MakerDAO they peg the token to 1 g of gold.</p><p><strong>Chapter 19 (The Magic Lock)</strong></p><p>Slock.it was supposed to be a decentralized alternative to Uber, Airbnb, etc.</p><p>The DAO, a decentralized venture fund, from Slock.it raises 150M$ in ether!!!</p><p><strong>Chapter 20 (The DAO Wars)</strong></p><p>A bug in The DAO logic was exploited (the fund that had over 200M$ in ether at that time!).</p><p>Soft fork proposed by Vitalik and the team as the last solution, and even worse, a hard fork that would undermine Ethereum’s legitimacy (centralized authority is bailing out a company — sounds familiar).</p><p>The white hat hackers team (“The Robin Hood group”) starts draining the main DAO using the same attack. The attacker also infiltrated their child DAOs — the “DAO wars” start.</p><p><strong>Chapter 21 (The Fork)</strong></p><p>The soft fork is out of the question because of the potential DDoS attack.</p><p>After doing a brief voting session (holders of only 5.5% of the total ether supply participated) — they decided to go for a hard fork.</p><p>The hard fork saved Ethereum and The DAO but some miners decided to keep using the pre-fork software version, and thus even the old blockchain was kept alive— it became the so-called Ethereum Classic.</p><p>The Robin Hood group wanted to return the money back to the rightful owners in ETH (Etherum), and not ETC (Ethereum Classic), but the exchanges didn’t allow the transaction to go through.</p><p>In the end, the attacker cashed out and gave a 1k ETC donation to the ETC Foundation.</p><p><strong>Chapter 22 (The Shanghai Attacks)</strong></p><p>The Geth client (Go implementation) had a bug that was exploited by the attackers just before the Shanghai Devcon2 Ethereum conference.</p><p>It was quickly patched and the community was very happy with the responsiveness of the dev team behind Ethereum.</p><p>More attacks on Ethereum followed — hard forks had to be done (this time these were not controversial as they’re not bailing out other companies).</p><p>The market and miners will decide which one of the 2 versions (after the hard fork, and if there is a disagreement) is more valuable in their opinion — that was the adopted model.</p><p><strong>Chapter 23 (The Burning Wick)</strong></p><p>The ICOs era — most new tokens were built on top of Ethereum because of ERC20 (which is a template for building new coins).</p><p>Crazy amount of hype — a gaming company raises money with a 1M$/minute rate, and subsequently closes down their sales after only 5 minutes (5.5M$)!</p><p>Taylor and Kosala are building an intuitive MyEtherWallet. During the Golem ICO they get too many buy requests and many angry responses from investors whose transactions didn’t go through — a glimpse of what is to come in 2017.</p><p><strong>Chapter 24 (Accidentally Ether Rich)</strong></p><p>It’s 2017 — event by event the prices of Bitcoin, Ether, and other altcoins are spiraling up.</p><p>Big companies like Microsoft, IBM, JPMorgan, etc. come on board the Enterprise Ethereum Alliance.</p><p>More money is being raised by selling tokens than by selling stocks.</p><p><strong>Chapter 25 (The New IPO)</strong></p><p>Brave (the browser founded by a guy who created Mozilla and JavaScript) sells 35M$ worth of BAT tokens in 30 seconds!!!</p><p>In order to get the ICO process under some control, Bancor adds gas fee limits (so that rich investors can’t skip the line), a 1-hour investing window, and an additional mechanism that’ll return all of the outstanding Ethers that went above their target funding amount.</p><p>The demand during Bancor ICO was crazy, 550M$+ worth of Ether was sent — by they took only a small amount of that as previously agreed.</p><p>A similar story with Status (<a href="https://status.im/">https://status.im/</a>)</p><p>“Ethereum wasn’t able to handle traffic from its first killer app: fundraising.” &lt;- indication of scaling problems.</p><p><strong>Chapter 26 (The Friendly Ghost)</strong></p><p>Vitalik had a meeting with Vladimir Putin! 😂</p><p>He was attending many conferences, meetups, hackathons, meetings with CEOs and government officials — that helped him further improve his presentation and debating skills.</p><p>Vitalik hates wastefulness on every level and is pushing for proof of stake (PoS) since Ethereum’s inception.</p><p>He and Vlad Zamfir create the first PoS implementations called Casper CBC and FFG respectively.</p><p>Vitalik is also thinking about scaling (methods include: sharding, plasma, zero-knowledge proofs, state channels).</p><p>Sharding is the only method that’ll be implemented in layer 1, i.e. directly to Ethereum base blockchain, other methods will be in layer 2.</p><p>PoS and Scaling should be part of the Serenity release of Ethereum.</p><p><strong>Chapter 27 (The Boom)</strong></p><p>People took photos with Vitalik and subsequently used those to pump up the prices by faking that “they have Vitalik’s support”.</p><p>Ethereum’s market cap caught up with Bitcoin (more than 25% of the market cap came from Ethereum).</p><p>Lots of scam/troll coins (Jesus Coin, TrumpCoin, etc.).</p><p>More hype coming from influencers creates a positive feedback loop.</p><p>Bitcoin millionaires flexing on the internet with Lambos.</p><p>An explosion of memes and hashtags like “hodl”, #Tothemoon, #whenmoon, #whenlambo.</p><p>Ethereum captures 32% of the market cap in June 2017 (Bitcoin at 38%).</p><p>Multi-million $ Ether sell orders start triggering stop-loss orders — the price plunges and bounces back. Somebody said that Vitalik is dead — the price plunges, Vitalik tweets with a picture of the latest Ethereum block id.</p><p>SEC makes a statement that tokens are indeed securities — lawsuits and fees are possible.</p><p>Protocol Lab organizes an unfair/undemocratic ICO where only rich investors could participate (even in the public sale, in the private sale they had Andressen Horowitz and others), as is common in IPOs. The largest ICO so far at 257M$.</p><p>Ethereum’s Metropolis release is scheduled for October 2017. Miners’ block rewards are reduced so as to incentivize the transition to PoS.</p><p>A zero-knowledge proof feature is added.</p><p><strong>Cryptokitties, </strong>collectible cats, are born (cats because they knew that the internet loves cats, so that’ll boost the virality coefficient) during the Waterloo hackathon (the idea itself was born before the actual hackathon during a brainstorm session).</p><p>ERC721 standard was created and it made it easy for others to build similar projects. Individual non-fungible “digital things” can now be traded, not just fungible currencies. NFTs (non-fungible tokens) are born.</p><p><strong>Chapter 28 (Futures and Cats)</strong></p><p>Bitcoin futures announced by the CME group — a big deal since that promises institutional investors money. ETFs were also rumored to come. Price skyrockets.</p><p>Dedicated funds for cryptocurrencies started popping up (hedge funds, etc.).</p><p>Rich crypto guys buying fancy houses.</p><p>Gavin Wood starts Polkadot (the idea is to connect all blockchains to create a decentralized web).</p><p>A bug leaves Polkadot without the money collected during their ICO.</p><p>Cryptokitties are launched in November 2017, the gaming aspect made them additionally viral.</p><p>At one point Cryptokitties accounted for 15% of total Ethereum transactions (some were sold for as much as 100k$!).</p><p>Cboe futures launch (CME a bit later as well).</p><p>PoS testnet (Casper FFG) launches on pyethereum.</p><p>If you bought Ether for 250$ back in the ICO days (when it was 30 cents) you’d be a millionaire in early 2018 (during the peak).</p><p><strong>Chapter 29 (The Crash)</strong></p><p>SEC starts charging ICO startups like Munchee (decentralized Yelp), which were legit, and fraudulent ones like AriseBank and others.</p><p>In January 2018 Bitcoin and Ether prices start plummeting — all the crypto enemies came down on crypto. The positive feedback loop.</p><p>The 2.6B$ Bitconnect scam.</p><p>Legit Ethereum projects like MakerDAO do exist.</p><p>Tether not backing up every USDT token with $ — they’re accused of pumping prices and producing coins out of thin air.</p><p>Exchanges accused of wash trading and thus of inflating the trade volume (some by as much as 95%!).</p><p>An exception to the downward slope of ICO funding was in June 2018, 4.2B$ was raised by Block.one’s EOS blockchain!!! (the idea is to replace Ethereum by having a much higher throughput)</p><p>It was the 2nd largest “IPO” in the USA just after Spotify at 9.2B$.</p><p>Accused of centralization (10 addresses account for 50% of the tokens) and market manipulation (they could trade tokens during the sale). Also, 20ish miners control the network.</p><p>The advisor to the project, Brock Pierce, was accused of sexual assaults back in the early 2000s.</p><p>Many other platforms were trying to replace Ethereum like Cardano, etc.</p><p>The bear market starts.</p><p><strong>Chapter 30 (The Party)</strong></p><p>DeFi starts getting its foothodl. An example of Ripio wallet with a “lend” button was described where you’d get the money from some random investor (who was probably somewhere in South Korea at that point in time) via a smart contract — no intermediaries!</p><p>Vitalik is sending out some of his Ethers to help out startups — VCs argued how this structure is not a sustainable way to fund startups.</p><p>“Collateral became a popular way for platforms to issue loans without having to screen each users’ credit score.”</p><p>MakerDAO is a good example of a successful DeFi platform.</p><p>The hype was reducing and the value that Ethereum was bringing was increasing — <a href="https://www.youtube.com/watch?v=7lmNpMSPu0k&amp;ab_channel=1thousandx">Vitalik happy, happy.</a></p><p>Early Ethereum dapps: Slock.it, The DAO, DigixDAO, MakerDAO, Augur.</p><p>That’s it! Hopefully, you found these somewhat useful. I know I did.</p><p>Now drum rolls.</p><h3>People you should (probably) check out on Twitter</h3><p>Here is a list of people I started following after reading the book, in no particular order (note I’ve omitted people from the last blog including Vitalik):</p><ul><li><a href="https://twitter.com/gavofyork">gavofyork</a> (Gavin Wood) — co-founder of Ethereum, wrote the 1st C++ implementation of Ethereum.</li><li><a href="https://twitter.com/IOHK_Charles">IOHK_Charles</a> (Charles Hoskinson) — Cardano (and Ethereum) co-founder.</li><li><a href="https://twitter.com/ethereumjoseph">ethereumjoseph</a> (Joseph Lubin) — co-founder of Ethereum and ConsenSys.</li><li><a href="https://twitter.com/CryptoCobain">CryptoCobain</a> — co-founder of Ethereum (didn’t find him in the book, but he claims to be the co-founder, maybe just a meme ❤️).</li><li><a href="https://twitter.com/justinsuntron">justinsuntron</a> (Justin Sun) — founder of TRON.</li><li><a href="https://twitter.com/ummjackson">ummjackson</a>, <a href="https://twitter.com/BillyM2k">BillyM2k</a> — Dogecoin founders.</li><li><a href="https://twitter.com/ChrJentzsch">ChrJentzsch</a> — founder of Slock.it</li><li><a href="https://twitter.com/roham">roham</a> — lead the group who started the NFT revolution.</li><li><a href="https://twitter.com/beeple">beeple</a> (Michael Winkelmann) — his NFT “everydays” was sold for 69M$. He created the art that went into “everydays” over the span of 14 years. (5000 pictures in a mosaic is what was sold, i.e. the “ownership”)</li><li><a href="https://twitter.com/peter_szilagyi">peter_szilagyi</a> — the main Ethereum Go dev.</li><li><a href="https://twitter.com/tayvano">tayvano</a> — co-founder of MyEtherWallet.</li><li><a href="https://twitter.com/el33th4xor">el33th4xor</a> (Emin Sirer )— a CS prof who noticed The DAO bug.</li><li><a href="https://twitter.com/nayibbukele">nayibukkele</a> — president of El Salvador or CEO as he calls himself haha.</li><li><a href="https://twitter.com/aantonop">aantonop</a> (Andreas) — co-author of the “Mastering Ethereum” book.</li><li><a href="https://twitter.com/novogratz">novogratz</a> — an ex-Fortress investor that went into crypto.</li><li><a href="https://twitter.com/BitcoinMagazine">BitcoinMagazine</a> (Vitalik stopped writing for it a long time ago)</li></ul><p>Try and explore their feeds, and based on your preference start following those people whose ideas resonate with you.</p><p>But, also try and follow some people with whose ideas you don’t necessarily agree — you need a healthy dose of different opinions in your life. Who knows maybe you’re wrong and they are right. Be open-minded.</p><p>Finally, worth mentioning, while I was reading through the book, I came across some concepts that I thought were important enough to justify the digressions I made. ❤️</p><p>E.g., I wasn’t familiar with the term “Austrian economics”, so I did some YouTube search and came across these super valuable videos:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2Fo6UXRZ2XwgU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3Do6UXRZ2XwgU&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2Fo6UXRZ2XwgU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1310d44a6e506117ed74db779e236f88/href">https://medium.com/media/1310d44a6e506117ed74db779e236f88/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2F6eL2Bq-U7GQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3D6eL2Bq-U7GQ&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2F6eL2Bq-U7GQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/273a9a1bd4ad36ea495112a81b8167ab/href">https://medium.com/media/273a9a1bd4ad36ea495112a81b8167ab/href</a></iframe><p>A second example would be Ayn Rand’s name. Her name triggered me to do some further research because I’ve stumbled upon her name way too many times. A spike occurred in my decision-making neuron — the rest is history. Here is a cool interview with her:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FlHl2PqwRcY0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DlHl2PqwRcY0&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FlHl2PqwRcY0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/95d47e61aeac49331be6a9198466aee7/href">https://medium.com/media/95d47e61aeac49331be6a9198466aee7/href</a></iframe><p>I’ve also done a mini-research on the phenomenon of <a href="https://www.youtube.com/watch?v=RtBjC5AfvOU&amp;ab_channel=Jabroney">Bitconnect</a>, I found this <a href="https://www.youtube.com/watch?v=k5uuFO8meNw&amp;ab_channel=UnchainedPodcast">great</a> interview with Vitalik, plus I’ve previously listened to him on <a href="https://www.youtube.com/watch?v=XW0QZmtbjvs">Lex Fridman</a>’s and <a href="https://www.youtube.com/watch?v=42uhsP4vvCE&amp;ab_channel=TimFerriss">TimFeriss</a>’s podcasts.</p><p>That’s it, I hope you learned something new!</p><p><strong>If there is something you would like me to write about — </strong><em>write it down in the comment section or DM me. I’d be glad to write more about mathematics &amp; statistics, ML/deep learning, CS/software engineering, landing a job at a big tech company, getting an invitation to prestigious ML camps, finance, etc., anything that could help you!</em></p><p><em>Also feel free to drop me a message or:</em></p><ol><li>Connect and reach me on<strong> </strong>💡 <a href="https://www.linkedin.com/in/aleksagordic/"><strong>LinkedIn</strong></a><strong> </strong>and <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a></li><li>Subscribe to my 🔔 <a href="https://www.youtube.com/c/TheAiEpiphany"><strong>YouTube channel</strong></a> for AI-related content️</li><li>Follow me on 📚 <a href="https://medium.com/@gordicaleksa"><strong>Medium</strong></a><strong> </strong>and 💻<a href="https://github.com/gordicaleksa"><strong>GitHub</strong></a></li><li>Subscribe to my 📢 <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a> and join the 👨‍👩‍👧‍👦 <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community!</li></ol><p>And if you find the content I create useful <a href="https://www.patreon.com/theaiepiphany"><strong>consider becoming a Patreon!</strong></a></p><p>Much love ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fc29594d7b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Digital Gold: Bitcoin and the Inside Story of the Misfits and Millionaires Trying to Reinvent…]]></title>
            <link>https://gordicaleksa.medium.com/digital-gold-bitcoin-and-the-inside-story-of-the-misfits-and-millionaires-trying-to-reinvent-d0a6c1280a61?source=rss-37f02ae83e8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0a6c1280a61</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Aleksa Gordić]]></dc:creator>
            <pubDate>Wed, 08 Dec 2021 23:29:19 GMT</pubDate>
            <atom:updated>2021-12-08T23:31:50.478Z</atom:updated>
            <content:encoded><![CDATA[<h3>Digital Gold: Bitcoin and the Inside Story of the Misfits and Millionaires Trying to Reinvent Money | learnings, thoughts &amp; notes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bpCO7qL7Eya4D9Ig" /><figcaption>Bitcoin — the “digital gold” (Photo by <a href="https://unsplash.com/@silverhousehd?utm_source=medium&amp;utm_medium=referral">André François McKenzie</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>This blog is a first in my series of blogs on crypto (both currencies and dapps (decentralized apps) more broadly).</p><p>In this one, I’ll be sharing my thoughts, learnings, and notes from the book “Digital Gold: Bitcoin and the Inside Story of the Misfits and Millionaires Trying to Reinvent Money” by Nathaniel Popper.</p><p>Let me open it up with a question.</p><h4>(when) should you read this book?</h4><p>You should read this book if you’re interested in the history, people, stories, and a high-level overview of what Bitcoin is and how it came to be.</p><p>Even though you will, arguably, learn a bit about the blockchain tech itself (the underlying tech behind all of the existing cryptocurrencies including but not limited to Bitcoin), the book itself is not designed to teach you anything about the underlying tech per se.</p><p>I found some prerequisite knowledge to be of help, but having said that, this can definitely be your first encounter with the wor(l)d (of) bitcoin.</p><p>But, before I start, let me tell you a short story…🌈🌈🌈</p><h3>My journey into crypto</h3><p>Aside from dwelling in the depths and breadths of artificial intelligence, finance, and more broadly economics, is something that deeply excites me for its <strong>potential </strong>to reform society for the better.</p><p>Economics deals with the question of how to satisfy the <strong>unlimited demands</strong> of humans with the <strong>limited resources</strong> that we have at our disposal.</p><p>Because even if AI was to bring a huge economic value to society, if the value is not distributed effectively and efficiently it’ll cause even greater inequalities.</p><p>In my mind’s eye, I imagine the society (both global and local) as a <strong>seesaw</strong>, a delicate, and fairly fragile system. The purpose of economics, finance, and politics is to keep the seesaw in balance even when the weight (the <strong>value </strong>produced) is simultaneously changing on both sides (<strong>rich </strong>and <strong>poor</strong>).</p><p>Let it lean too much to one side and we have recessions, coups, and/or wars.</p><p>One of my main life goals is to maximize my positive societal impact. That’s a common thread that goes throughout almost everything that I do, and that naturally brought me to the topic of crypto.</p><p>From all the different trends that we’ve been seeing over the last decade or so, the crypto space (i.e. apps built on top of the blockchain, like currencies but more broadly any type of a dapp (distributed application)) introduced the most interesting ideas (decentralized, trustless systems) that could play an important role in a (more) <strong>fair distribution of wealth</strong>.</p><p>The federal reserve doesn’t have an equivalent in the world of Bitcoin. There is no centralized authority that can secretly change the distribution of wealth, based on their own plutocratic decisions, by simply printing more money.</p><p>People often complain how cryptocurrencies are a “Ponzi scheme” since they’re “not backed up by anything of value”, but, IMHO, they fail to realize that:</p><p>1) Money is inherently a social construct. A $ bill has value only because you and I are willing to accept it as such. So $ is also not backed up by anything of “value” anymore, aside from the fact that the USA government will gladly accept your $ bills when it’s tax collection time.</p><p>2) Being backed up by gold is no more real than being backed up by belief.</p><p>Why is gold valuable again?</p><p>Because it’s shiny and visually appealing? Because we put it in jewelry? Or is it’s the other way around — we use it in jewelry because it’s valuable.</p><p>But where does this value come from? From its scarcity? Well, gold is not special in that regard, we have plenty of scarce material on this Earth.</p><p>If you were freezing to death and you had to pick between a gold bar and a warm coat I’m fairly sure I could guess what’s more valuable for you in that context.</p><p>So in which context is gold more valuable? Ok, we do use it to produce electronics, but again, gold is not special in that regard, we use other scarce materials as well.</p><p>No, the reason I think that gold is valuable is that it has a couple of nice properties. It’s a mix of its mythological appeal (gold ~ Sun), relative scarcity (we still keep excavating gold), the fact that somebody had to work to excavate it, etc.</p><p>All of these properties now have a perfect digital equivalent because we’re now operating in Plato’s world of ideas.</p><p>Bitcoin is perfectly scarce (21M coins, mathematically guaranteed), somebody had to “work” to get it (mining), it’s faster to transport than gold (the speed of light in coaxial/optical fibers), it can be divided into arbitrarily small pieces (e.g. 1 satoshi = 0.00000001 btc), to name a few.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ejDBeFmVzuYsYOdc" /><figcaption>The journey continues (Photo by <a href="https://unsplash.com/@mukukostudio?utm_source=medium&amp;utm_medium=referral">Mukuko Studio</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>My personal journey with crypto started back in 2017, during the bull market, which was the first time ever I heard of the word Bitcoin.</p><p>Again, it’s funny how unequal our opportunities are. We need to constantly take that into account evaluating someone’s end results, without being judgemental.</p><p>Here I was hearing about this awesome technology for the first time, almost 9 years after Satoshi’s original white paper came out (back then I wasn’t surrounded by a lot of tech-savvy people like I am right now, even though I studied EE).</p><p>On the other hand, Vitalik Buterin (the (co)founder of Ethereum) had the luck (the purpose of this reasoning is not to undermine his achievements) that his dad was a skilled software engineer who told him about Bitcoin way back in the early days.</p><p>His childhood was also fairly special. He had private math tutors, and a home education by 2 ambitious, driven, and smart parents. They were throwing arithmetic problems at him since he was 3 or 4 years old, just to give a couple of examples.</p><p>This, aside from the <a href="https://en.wikipedia.org/wiki/Judit_Polg%C3%A1r">Polgar sisters stories</a> and many others, further strengthens my belief that extraordinary nurture can create people that we call “geniuses”.</p><p>Back in 2017, I didn’t have any serious money (I was still studying) that I could use to invest in Bitcoin, but I did do my research both from the angles of technology (how blockchains work — Merkle trees, hash codes, etc.), people (heard of Vitalik, Satoshi, btc millionaires), and trends (ICOs, centralized exchanges, lots of interesting irrational behavior in general).</p><p>Since then I’ve been reading finance/business books on and off but this time I’m sharing my learnings and thoughts. That’s what changed.</p><p>Over the past 2 weeks I’ve read 2 very interesting books:</p><ul><li>“Digital Gold” by Nathaniel Popper (or is it Digital Godl?)</li><li>“The Infinite Machine” by Camila Russo</li></ul><p>In this blog, I’ll give a very short overview of the book, or more precisely I’ll share my private notes, in the hope their structure or the very fact I’m doing it may help somebody.</p><p><strong>I’ll also</strong> <strong>share a list I compiled of influential Twitter people</strong> to follow (or just check out) to stay up to date with the newest stuff happening in the crypto space. The list is very raw (I collected names from the book and did some link following) so I’ll gradually prune it as I get a better grasp for what these people are sharing, based on my own interests.</p><blockquote><strong>Super important tip reading the book:</strong> take notes while reading it!!! Because:</blockquote><blockquote>a) You’ll be a more active learner which will further help consolidate the knowledge from the book.</blockquote><blockquote>b) There is a lot of new names/actors that you’ll need to remember to follow along the story. Thank me later.</blockquote><h3>Digital Gold book notes</h3><p><strong>Intro</strong></p><p>A secret meeting at lake Tahoe with Erik Voorhees (btc evangelist), hedge fund managers like Dan Morehead, and other early adopters — the “btc millionaires”.</p><p>The origin story of this mystical money called Bitcoin (Satoshi Nakamoto introduced).</p><p>Bitcoin was introduced in the middle of the financial crisis. It has nice properties (universal — can be used across borders, low fees (back then), decentralized, anonymous, divisible, scarce, etc.).</p><h4>Part 1</h4><p><strong>Chapter 1</strong></p><p>The story of Satoshi Nakamoto and Hal Finney.</p><p>Hal was the first who believed in the idea and a couple of months later he was iterating on the initial codebase together with Satoshi.</p><p>The story of cypherpunks/extropians (concerned with privacy &amp; security).</p><p>1970/80 mathematics at Stanford/MIT enabled everyone to safely encrypt messages.</p><p>Hal was more ideologically driven rather than financially.</p><p><strong>Chapter 2</strong></p><p>Hashcash was invented by Adam Back.</p><p>Bit gold by Nick Szabo.</p><p>The origin story of Bitcoin and S.N.</p><p>The inner working of Bitcoin.</p><p>Hal Finney as the main evangelist and believer in the early days of Bitcoin</p><p><strong>Chapter 3</strong></p><p>Martti Malmi introduced. A young programmer, early Bitcoin dev.</p><p>Satoshi starts promoting btc by pushing political ideas and not just technical spec.</p><p>The problem of getting users to use btc — a need for an app (the first mention of Bitcoin exchanges)</p><p>Btc logo design.</p><p>The word cryptocurrency is born.</p><p>First $ transaction — 5050 btc was exchanged between Martti and NewLibertyStandard for 5$. The price was set based on the electrical bill needed to mine btc back then by NewLibertyStandard.</p><p><strong>Chapter 4</strong></p><p>Laszlo Hanecz was the first who started mining using GPUs!</p><p>He famously sold thousands of Bitcoins for a pizza— the 1st time somebody wanted to sell a real thing to get Bitcoins.</p><p>Gavin Andresen is introduced, as the 2nd core developer (after Martti) — he used his real name and pic on the forums that turned out to be quite important. He became the face behind the community.</p><p>Slashdot news on Bitcoin gave rise to a new influx of users.</p><p><strong>Chapter 5</strong></p><p>Jed McCaleb is introduced. He created Mt. Gox (Bitcoin exchange) out of frustration because he couldn’t buy Bitcoin during nighttime.</p><p>No deposit insurance and no regulators overseeing the safety of operation in the world of crypto.</p><p>Artzforz found a serious Bitcoin bug where somebody could spend money from another person’s account!</p><p>Wikileaks blockade (the government ordered PayPal and other providers not to allow transfers to/from Wikileaks) further increased Bitcoin’s popularity.</p><p>Satoshi stopped posting to the forum (December 2010) — the mystery of who is behind that name escalates.</p><p><strong>Chapter 6</strong></p><p>Mt. Gox ownership transfer (from Jed to Mark).</p><p>Silk Road is born (Ross Ulbricht).</p><p><strong>Chapter 7</strong></p><p>Roger Ver is introduced — a successful businessman operating in Japan.</p><p>Forbes and Times cover the phenomenon of Bitcoin.</p><p>Satoshi disappears (Martti, Gavin continue being lead devs).</p><p>Bitcoin starts getting a bad reputation: hacker attacks, Silk road, etc.</p><p><strong>Chapter 8</strong></p><p>A big breach of Mt. Gox.</p><p>Jesse Powell — Roger Ver’s friend introduced helping to fix Mt. Gox.</p><p><strong>Chapter 9</strong></p><p>Private keys on Bitomat were accidentally deleted. This further emphasizes the tradeoff — centralized platforms vs directly operating on the blockchain.</p><p>Centralized platform MyBitcoin’s CEO steals everyone’s Bitcoin and disappears.</p><p>Mike Hearn creates an email list in Google for Google employees to get involved.</p><p>Charlie Lee (creator of Litecoin) is introduced.</p><p>1st Bitcoin conference.</p><p><strong>Chapter 10</strong></p><p>Erik Vorhees is introduced (approached Roger on the conference) — Bitcoin evangelist same as Roger Ver.</p><p>Various occupy/anti central bank movements (occupy wall street, free state project) emerge that benefit Bitcoin.</p><p><strong>Chapter 11</strong></p><p>Dread Pirate Roberts is born — the idea was for Ross Ulbricht to have an alibi — “he wasn’t running the site on his own the whole time, he was just 1 man that ran it for a 1 period of time” would be the argument.</p><p>Vendor feedback/rating was keeping the Silk Road in check.</p><p>Marco Polo operation started, an agent by the name nob was about to form a relationship with Ross.</p><h4><strong>Part 2</strong></h4><p><strong>Chapter 12</strong></p><p>Roger the Bitcoin evangelist!</p><p>Casascius coin was first manufactured thanks to Roger (this is how media visualizes btc coin even today).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*qX1ZEE3BWDe2v-NhaJDKmw.png" /><figcaption>Casascius coin</figcaption></figure><p>Charlie Shrem of BitInstant (“add-on” to Mt. Gox — makes things faster and easier) was introduced (Roger invested into BitInstant).</p><p>Aside from the ideas of decentralization and anonymity Bitcoin offered faster payments back then (they gave an example of how a Japanese bank had to write a 9B$ paper check for JPMorgan because they had holidays and the e-transaction would be too slow).</p><p>David Azar introduced (Syrian Jewish as well, invests into Charlie’s BitInstant).</p><p><strong>Chapter 13</strong></p><p>Erik’s gambling site SatoshiDice is mentioned and his friend Ira.</p><p>Peter Vessenes and Patrick Murck introduced (Bitcoin Foundation)</p><p>Mt. Gox’s Mark problem stated (micromanagement issues, speed, etc.)</p><p>Roger is called the “Bitcoin Jesus”.</p><p><strong>Chapter 14</strong></p><p>Barry Silbert NYC tech guy introduced.</p><p>Tyler and Cameron Winklevoss introduced, David Azar met them and offered to invest in Charlie’s BitInstant.</p><p>David &amp; twins vs Barry and FirstMark as investors into BitInstant.</p><p><strong>Chapter 15</strong></p><p>Wences Casares — a successful Argentinean entrepreneur introduced.</p><p>The story of extreme inflations in Argentina.</p><p>David Marcus president of PayPal introduced (Wences converted him).</p><p>Wences’s friend Fede introduced (cofounder of Lemon).</p><p>Peter Briger of Fortress introduced (meetup at his place).</p><p><strong>Chapter 16</strong></p><p>Cops (user nob) are getting closer to Ross. First big arrests.</p><p><strong>Chapter 17</strong></p><p>Erik and Ira create a side company Satoshi Ltd. (they were still in BitInstant).</p><p>Fights with David and Winklevoss twins.</p><p>Erik leaves, BitInstant’s bank stops cooperating, forcing them to shut down.</p><p><strong>Chapter 18</strong></p><p>Fortress, Winklevoss, and others start investing heavily into Bitcoin.</p><p>Big secret tech leaders conference happens — Marc Andressen, Reid Hoffman (LinkedIn), Twitter representatives, and others.</p><p>Wences was the biggest evangelist.</p><p>Skepticism arises because PayPal also had big dreams before regulations kicked in.</p><p>Jed (the original creator of Mt. Gox) created Ripple — A.H., and PayPal invest.</p><p><strong>Chapter 19</strong></p><p>The dawn of ASICs. Dedicated mining machines. (CPU -&gt; GPU -&gt; ASICs)</p><p>Bitcoin pools emerge — you can be sure you’ll get a piece of the cake. Centralization concerns.</p><p>The full fork problem. BTC Guild downgrades to version 0.7 (Bitcoin once again shows that it has correct incentives in place — if BTC Guild hadn’t done it the legitimacy of Bitcoin would be at stake!)</p><p>USA government’s 1st statement on the legality of Bitcoin.</p><p>btc market cap crosses 1B$.</p><p><strong>Chapter 20</strong></p><p>Lack of trust in Mt. Gox. Wences and others put their private keys in cold storage in a bank.</p><p>Competition to Mt. Gox and BitInstant: Coinbase, Bitstamp (exchange).</p><p>Mt.Gox has very bad rates because they’re slow. Obscure code changes break clients.</p><p><strong>Chapter 21</strong></p><p>The biggest public investment into a Bitcoin company (Coinbase) to date happens (2013).</p><p>Bitcoin Foundation’s 1st conference (twins, Charlie, and others gave talks).</p><p><strong>Chapter 22</strong></p><p>Big names are buying (Pete Briger, Dan Morehead, etc.).</p><p>Operators of Liberty Reserve were arrested.</p><p>Banks are very reluctant to deal with Bitcoin (even big players like Peter Briger can’t get Wall Fargo to cooperate).</p><p>People are incentivized to hold Bitcoin since it’s truly scarce.</p><p>Charlie closes Bitinstant for legal reasons. Erik sells SatoshiDice.</p><p>Ross pays for hits, more heat on him, and on Silk Road in general.</p><h4>Part 3</h4><p><strong>Chapter 23</strong></p><p>Patrick Murck (a pro-gov guy) keeps the Bitcoin Foundation floating, regularly chats with regulators.</p><p>Regulations kick in — Bitstamp and Coinbase introduce various validations/id verifications (and they overtook Mt. Gox’s and Bitinstant’s lead).</p><p>Roger and blockchain.info (wallet company — private keys are encrypted so that the company has no info on its users) as “the last stand” against centralized Bitcoin companies.</p><p>Argentina is a great use case where anonymity can be helpful, and companies such as blockchain.info can’t be subpoenaed by the gov.</p><p>Wences sells Lemon and starts his new Bitcoin company Xapo.</p><p><strong>Chapter 24</strong></p><p>Ross is finally arrested.</p><p>btc price plummets, gov statements don’t indicate that they want to stop btc from happening — smart people (like Winklevoss twins) start buying.</p><p>Secrete gathering on lake Tahoe organized by Dan Morehead.</p><p><strong>Chapter 25</strong></p><p>BTC China exchange is formed.</p><p>Bobby Lee becomes a co-founder (his brother Charlie Lee mentioned as the founder of Litecoin (“silver to btc’s gold”)).</p><p>Tencent becomes the payment processor (and then buying became really easy in China).</p><p>Mining in China is getting bigger (rather than buying/selling because of China’s gov).</p><p>Various news in China/USA drive price changes (Baidu, PayPal).</p><p><strong>Chapter 26</strong></p><p>Patrick and other Bitcoiners present to the USA senate — very positive reactions.</p><p>Again gov dictates what happens.</p><p>Roger and other libertarians keep pushing for anonymous Bitcoin projects.</p><p>In China we have a different story: Tencent stops collaborating with BTC China (gov has declared btc as a digital commodity and thus banks/payment processors like Tencent can’t deal with btc exchanges).</p><p><strong>Chapter 27</strong></p><p>BitPagos solves the problem of receiving USA payments in Argentina. Another great application for Bitcoin.</p><p>“Bitcoin’s evolution in the United States and China was showing how the technology could become dependent on the official financial system and government approval. Argentina, on the other hand, was showing how it could develop without any of that”.</p><p>Xapo is started, 1st feature was the “vault” — safely storing private keys offline.</p><p>The wild West of China — Tencent stops collaborating but banks are still collaborating with Bitcoin businesses.</p><p>Federal reserve praises some properties of btc, more and more companies start using btc (like Overstock).</p><p><strong>Chapter 28</strong></p><p>A.H. invests heavily (Coinbase, 21e6 (mining company), etc.).</p><p>Wences’ Xapo gets more high-profile investments.</p><p>Charlie is arrested and bailed out for 1 million $.</p><p>New hearings, the day after Charlie’s arrest (twins, Barry Silbert, Fred Wilson, etc.)</p><p>Banks are increasingly reluctant to deal with btc companies.</p><p>Divesh Makan is mentioned as the “spider of Silicon Valley”. He manages money for many billionaires. The so-called family offices.</p><p><strong>Chapter 29</strong></p><p>Mt. Gox problems — Mark tells the world that Bitcoin has a bug (transaction malleability, a known “quirk”) -&gt; price plummets, but quickly bounces back.</p><p>Huge Mt. Gox “attack” (they lost 750k Bitcoins! due to the aforementioned bug). The news is leaked by the <a href="https://twitter.com/twobitidiot">twobitidiot</a>.</p><p><strong>Chapter 30</strong></p><p>Press finds random people and claims they are Satoshi (Dorian Nakamoto was the name of this one guy who got very famous).</p><p>The real Satoshi Nakamoto writes on the forum that he is not Dorian.</p><p>Big players meet secretly in a private conf at Goldman Sachs.</p><p>Internally banks and federal reserves are looking for innovative ways to use the blockchain concept.</p><p>Bitfury (a Ukrainian mining company) is introduced — they promised that they won’t have more than 40% of computer power (they were that powerful!).</p><p>Marginalization of the early Bitcoin community (ideologically inclined people).</p><p>Big conference in Austin (Silicon Valley people + celebrities).</p><p><strong>Chapter 31</strong></p><p>Meeting at lake Tahoe (Dan Morehead).</p><p>Nick Szabo may be Satoshi Nakamoto.</p><p>Bitcoin conference with huge players like Bezos &amp; Gates.</p><p>Wences converts Bill Gates! 😅</p><p>And that’s it! Hopefully, you found it somewhat useful. Now drum rolls.</p><h3>People you should (probably) check out on Twitter</h3><p>Here is a list of people I started following after reading the book (in no particular order):</p><ul><li><a href="https://twitter.com/twobitidiot">twobitidot</a> — a guy who leaked the confidential document from Mt. Gox</li><li><a href="https://twitter.com/nealstephenson">nealstephenson </a>— a guy behind the Cryptonomicon Sci-Fi book (that talks about universal money), fairly respected in the digital currency community in general</li><li><a href="https://twitter.com/pwuille">pwuille</a>, <a href="https://twitter.com/jgarzik">jgarzik</a>, <a href="https://twitter.com/marttimalmi">marttimalmi</a>, <a href="https://twitter.com/gavinandresen/">gavinandresen</a>— early Bitcoin developers</li><li><a href="https://twitter.com/NickSzabo4/">NickSzabo4</a> — a guy for whom many believe to be Satoshi Nakamoto because of his engagement in the early digital cash communities, the fact that he modified some dates on forum posts just before Bitcoin whitepaper was published, and that his permutated name acronym is the same as Satoshi’s.</li><li><a href="https://twitter.com/adam3us">adam3us</a> (Adam Back) — proposed some fundamental ideas in the cryptography space</li><li><a href="https://twitter.com/jespow">jespow</a> — Kraken co-founder, introduced as Roger Ver’s friend in the book</li><li><a href="https://twitter.com/CharlieShrem/">CharlieShrem</a> — a guy behind the BitInstant platform (made it easier to buy Bitcoins back in the days of Mt. Gox)</li><li><a href="https://twitter.com/jedmccaleb">jedmccaleb </a>— original founder of Mt. Gox and Ripple!</li><li><a href="https://twitter.com/bobbyclee">bobbyclee</a> (Bobby Lee)— founded the most famous Chinese exchange</li><li><a href="https://twitter.com/satoshilite">satoshilite</a> (Charlie Lee) — founder of Litecoin and Bobby’s brother</li><li><a href="https://twitter.com/virtuallylaw">virtuallylaw</a> (Patric Murck)— a lawyer who was vital for the survival of Bitcoin foundation in the early days</li><li><a href="https://twitter.com/BarrySilbert">BarrySilbert</a> — successful NYC entrepreneur involved in btc since the early days</li><li><a href="https://twitter.com/nejc_kodric">nejc_kodric</a> — co-founder of Bitstamp (exchange)</li><li><a href="https://twitter.com/tylercowen">tylercowen</a> — prolific blogger in the space</li><li><a href="https://twitter.com/niccary">niccary</a> — co-founder and CEO of blockchain.com, anonymous wallet</li><li><a href="https://twitter.com/TimDraper">TimDraper</a>, <a href="https://twitter.com/fredwilson">fredwilson</a> VCs involved in Bitcoin since the early days</li><li><a href="https://twitter.com/valeryvavilov">valeryvavilov</a> — co-founder of Bitfury (involved in mining business)</li><li><a href="https://twitter.com/FEhrsam">FEhrsam</a> (Fred Ehrsam)— co-founder of Coinbase</li><li><a href="https://twitter.com/balajis">balajis</a> (Balaji Srinivasan)— founder of 21e6, a famous, secretive ASIC company (producing dedicated mining chips)</li><li><a href="https://twitter.com/RealRossU/">RealRossU</a> — creator of Silk Road (a platform where you could sell/buy illegal products/services). He’s still in prison.</li><li><a href="https://twitter.com/ErikVoorhees/">ErikVoorhees</a>, <a href="https://mobile.twitter.com/rogerkver">rogerkver</a> — biggest btc evangelists back in the days</li><li><a href="https://twitter.com/tyler">tyler</a>, <a href="https://twitter.com/cameron">cameron</a> — Winklevoss twins, early Bitcoin adopters. Probably most famous for their dispute with Mark Zuckerberg around the Facebook idea.</li><li><a href="https://twitter.com/davidmarcus">davidmarcus</a> — president of PayPal back then</li><li><a href="https://twitter.com/bgarlinghouse">bgarlinghouse</a> — CEO of Ripple</li><li><a href="https://twitter.com/paulkrugman">paulkrugman</a> — Nobel prize winner in economics</li><li><a href="https://twitter.com/reidhoffman">reidhoffman</a> — founder of LinkedIn</li><li><a href="https://twitter.com/sama">sama</a> (Sam Altman) — YCombinator, OpenAI guy</li><li><a href="https://twitter.com/naval">naval</a> (Naval Ravikant) — founder of AngelList</li><li><a href="https://twitter.com/cdixon">cdixon</a> (Chris Dixon) — partner at Andreessen Horowitz</li><li><a href="https://twitter.com/pmarca">pmarca</a>, <a href="https://twitter.com/bhorowitz">bhorowitz</a> — Andressen Horowitz founders</li><li><a href="https://twitter.com/APompliano">APompliano</a> (Anthony Pompliano)— btc maximalist/evangelist</li><li><a href="https://twitter.com/saylor">saylor</a> (Michael Saylor)— founder of MicroStrategy and btc maximalist</li><li><a href="https://twitter.com/RayDalio">RayDalio</a> — founder of Bridgewater hedge fund</li><li><a href="https://twitter.com/jack">jack</a> (Jack Dorsey)— founder of Twitter</li><li><a href="https://twitter.com/VitalikButerin">VitalikButerin</a> — main co-founder of Ethereum</li><li><a href="https://twitter.com/BillyM2k">BillyM2k</a> (Billy Markus)— co-founder of Dogecoin</li></ul><p>Try and explore their feeds, and based on your preference start following those people whose ideas resonate with you.</p><p>But, also try and follow some people with whose ideas you don’t necessarily agree — you need a healthy dose of different opinions in your life. Who knows maybe you’re wrong and they are right. Be open-minded.</p><p><strong>If there is something you would like me to write about — </strong><em>write it down in the comment section or DM me. I’d be glad to write more about mathematics &amp; statistics, ML/deep learning, CS/software engineering, landing a job at a big tech company, getting an invitation to prestigious ML camps, finance, etc., anything that could help you!</em></p><p><em>Also feel free to drop me a message or:</em></p><ol><li>Connect and reach me on<strong> </strong>💡 <a href="https://www.linkedin.com/in/aleksagordic/"><strong>LinkedIn</strong></a><strong> </strong>and <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a></li><li>Subscribe to my 🔔 <a href="https://www.youtube.com/c/TheAiEpiphany"><strong>YouTube channel</strong></a> for AI-related content️</li><li>Follow me on 📚 <a href="https://medium.com/@gordicaleksa"><strong>Medium</strong></a><strong> </strong>and 💻<a href="https://github.com/gordicaleksa"><strong>GitHub</strong></a></li><li>Subscribe to my 📢 <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a> and join the 👨‍👩‍👧‍👦 <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community!</li></ol><p>And if you find the content I create useful <a href="https://www.patreon.com/theaiepiphany"><strong>consider becoming a Patreon!</strong></a></p><p>Much love ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0a6c1280a61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Got a Job at DeepMind as a Research Engineer (without a Machine Learning Degree!)]]></title>
            <link>https://gordicaleksa.medium.com/how-i-got-a-job-at-deepmind-as-a-research-engineer-without-a-machine-learning-degree-1a45f2a781de?source=rss-37f02ae83e8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a45f2a781de</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[self-education]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[deepmind]]></category>
            <dc:creator><![CDATA[Aleksa Gordić]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 12:42:12 GMT</pubDate>
            <atom:updated>2025-11-01T17:12:51.227Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Got a Job at DeepMind as a Research Engineer (without a Machine Learning Degree)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IttKB4AZWDRrd0M5zR5nzg.jpeg" /><figcaption>DeepMind is one of the best AI labs in the world.</figcaption></figure><blockquote>Note from Aleksa from the future (November, 2025): joining a prestigious company is less important than joining a great, tightly knit, ambitious team. In retrospect I had much better work experiences than that at DeepMind (I left in 2023 to start my own startup).</blockquote><blockquote>The company was already bloated (~1200 people, now it’s more like 5000–7000), the culture significantly broken (e.g. memes were being removed from internal Slack channel because they “offended” someone), and I couldn’t freely move around to work on stuff that actually interested me.</blockquote><blockquote>Having said that having that DeepMind badge opened up many doors for me — so i will not discount that nor discourage you from chasing “the current thing”. :) And I’m honestly grateful for the opportunity.</blockquote><blockquote>If I were you, on the job market right now, I’d look at the smaller companies, the next DeepMinds of the world.</blockquote><p>I recently landed a job at DeepMind as a Research Engineer! It’s a dream come true for me, I still can’t believe it! 😍 (if you feel like an imposter sometimes, trust me, you’re not alone…)</p><p>I <em>don’t have</em> a Ph.D. in ML.</p><p>I <em>don’t have</em> a master&#39;s in ML.</p><p>In fact, I <em>don’t have</em> any type of degree in ML — I did my bachelor’s in EE.</p><p>That’s it. That’s my formal education. I dropped out of my EE master’s as I figured out I could learn stuff much more <em>effectively </em>and <em>efficiently </em>on my own.</p><p>My first exposure to ML was back in <strong>2018</strong>. And my first exposure to the world of programming was when I was <strong>19 </strong>(I’m 27 now).</p><p>So how in the world did I pull it off? (hint: I’m not that smart, you can do it!)</p><p>In this blog, I’ll try to tell you the whole story. I’ll be very transparent in order to help you guys out as much as possible. This blog even contains a snapshot of my resume (very much suboptimal, I feel uncomfortable sharing it 😅), the information on how I got referred to DeepMind, and many more details that will hopefully make this blog much closer to your heart.</p><p>I’ll structure this blog post into roughly 3 parts:</p><ol><li>I’m going to give you some context on <strong>who I am</strong>,<strong> </strong>and what my <strong>learning journey</strong> so far was! As I don’t want to set <em>false expectations</em> that you can pull this off in a short period of time, without an ML degree, if you don’t already have solid foundations and experience with self-education.</li><li>I’m going to explain to you, in nitty-gritty details, how <strong>my ML curriculum</strong> looked like since my first exposure to ML back in 2018.</li><li>Finally, I’m going to tell you how exactly did my <strong>final preparations</strong> for DeepMind look like (+ more info on how I got a <strong>referral</strong>).</li></ol><p><em>Note: for all practical purposes you can read DeepMind in this post as “any top-notch AI lab/company like DeepMind, OpenAI, FAIR, AI2, etc.” because I’m fairly sure that the same (or at least similar) principles would apply there as well.</em></p><p>Well, let’s go!</p><p><em>Update: if you prefer video format I made a video based on this blog:</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FSgaN-4po_cA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DSgaN-4po_cA&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FSgaN-4po_cA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/89eacc98a6cfaf71edc90327374f588d/href">https://medium.com/media/89eacc98a6cfaf71edc90327374f588d/href</a></iframe><h3>Part 1: My background (no ML degree)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JEC0K7X5VxsFBmcw" /><figcaption>I don’t have this hat (Photo by <a href="https://unsplash.com/@mdesign85?utm_source=medium&amp;utm_medium=referral">MD Duran</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>It’s the summer of 2017. I‘m doing my first ever internship at a small German startup called <em>Telocate</em>, as an Android dev. I’m about to graduate (in September, once I return back to <em>Belgrade</em>, <em>Serbia</em>) from an EE program that had a strong focus on digital/analog electronics and less so on CS.</p><p>Sometime around the end of my studies (end of 2016), I realized I actually want to completely pivot to the software industry. It’s <em>exciting</em>, it’s much more <em>open </em>compared to the hardware industry, there are all these <em>hackathons </em>and <em>datathons</em>, and it offers <em>amazing salaries</em>.</p><p>So earlier that year (2017) I started learning Android on my own and I landed this internship in Freiburg, Germany. I was so excited — the world was mine.</p><p>Snap back to the summer of 2017, Freiburg. I’m chatting with a friend whom I knew was a very successful software engineer. He’s done multiple internships at companies such as MSFT, Facebook, Jane Street, etc. and he was my peer.</p><p>I realized I’m falling behind by a lot (along the SE dimension at least)! Some of my friends were doing competitive programming since their high school days. Algorithms and data structures were their second nature at this point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ns9hpUKEsKWgBuEhip8aEw.png" /><figcaption>Translation from Serbian: I’m telling him that I’m falling behind humorously, but I’m actually very desperate at this point. My friend replies: take your time, it’s never too late or despacito in modern English. 😂</figcaption></figure><p>I wanted to apply for big tech companies, and I suddenly realized that all of the skills I accumulated throughout the years are not that important when you’re interviewing at FAANG.</p><p>Nobody cared that <a href="https://www.youtube.com/shorts/xIbyJhVCmsk">I speak 5 languages</a>, that I know a bunch about how microcontrollers work in the tiniest of details, how an analog high-frequency circuit is built from bare metal, and how computers actually work. All of that is abstracted away. You only need…algorithms &amp; data structures pretty much.</p><p>I felt confused and angry at the same time. Some kid who’s 16 (I was 23 back then), could go and do some Leetcode problems for 9 months and he is already ahead of me in this respect. Even though he/she lacks so much of the fundamental engineering knowledge.</p><p>It’s a nasty feeling, I very much remember it. I was very ambitious throughout whole my life, and hardworking, and yet I’m falling behind. I remember hating my life for not figuring out about this earlier on in my childhood.</p><p>But, what can you do, this world is obviously not fair. Some kids get to grow up in Silicon Valley and have rich and educated parents whereas some kids are born in a “third world” country, sometimes starving to death.</p><p>This strong feeling of injustice was giving me energy. I thought to myself — I’m going to hustle really hard over the next years. <strong>Warp speed on.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Kj6baimUQZ48sTlA" /><figcaption>warp speed on! (Photo by <a href="https://unsplash.com/@marcojodoin?utm_source=medium&amp;utm_medium=referral">Marc-Olivier Jodoin</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>I came back home from my internship in Germany. I successfully graduated 3 days after that. I remember some of my friends were celebrating their graduation for 3+ weeks, drinking 🍺 and everything that goes along. Me? I celebrated my success over the weekend and I immediately started planning ahead. I felt I was on a mission.</p><p>I enrolled in a master’s program “symbolically” (you get some perks as a student) but I knew that I really wanted to land a job at a big tech company.</p><p>And so I made my own SWE curriculum, plus, I started attending an algorithms course at my university without even being enrolled. I was sitting there with students that were 2 years younger than me.</p><p>Over the next couple of months I was working like crazy, and I immediately started applying. Soon after, I got myself an interview with <em>Facebook </em>in December 2017 and I failed miserably on my first interview.</p><p>I kept learning and I got an invitation from <em>Microsoft </em>— the tests are in March 2018 they said. Got it, I’m gonna work hard until then. I was learning, I was attending hackathons and datathons, and I started doing competitive programming (mostly <a href="https://www.topcoder.com/thrive/tracks?track=Competitive%20Programming">Topcoder</a>).</p><p>Then, in February 2018, I heard about this ML summer camp being organized by Microsoft people (we have an office in Belgrade, the only big tech company we have). I applied and after nailing a 3-day long entrance test I got accepted!!! (my decent digital image processing background helped)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SDIykC89JnntvIzHahInOQ.png" /><figcaption>My acceptance letter to the ML summer camp!</figcaption></figure><p>I had a strong gut feeling that this may be my opportunity to show that I’m good enough to work at Microsoft! 💡</p><p>Around that same time, I landed an internship in Ouro Preto<em>, </em>Brazil via a student organization called IAESTE. It ended up being more of an amazing life experience (I lived in a fraternity with 11 Brazilians and I had to learn to speak Portugueses) rather than a tech internship. It was scheduled right after my ML summer camp. It’s as if the stars aligned!</p><p>March 2018 came, and I did my first tests with Microsoft. I failed the written entrance tests. Luckily 2 months later they gave me another opportunity. I tried again, passed the written entrance tests, did a round of 4 back to back interviews on-site, and 3 weeks later…they told me that there currently are no positions opened for me. I interpreted that as a rejection. Again.</p><p>So if there is somebody that can empathize with newcomers to this field that’s me. I know that it can be very mentally draining, this whole job hunt process.</p><p>Fast forward to the summer of 2018. I attended the ML summer camp and I nailed it. I was very engaged, I learned a lot and our final project was internally voted as the best one (solving Rubik’s cube with deep RL).</p><p>Immediately after the camp, I flew to Brazil in early August 2018.</p><p>3 days in and I get a call from Microsoft. You got an offer. We need you back here asap.</p><p>I was super happy and super sad at the same moment. I had to leave this beautiful country of Brazil after a bit over a month instead of after 3 months. It was either that or I wouldn’t get the job. They told me that the team that wants me is the “<a href="https://www.microsoft.com/en-us/hololens/buy"><em>HoloLens</em></a><em> </em>team“!!! The same team that ran the summer camp. The most famous, exciting team we had in Belgrade — I couldn’t miss this opportunity. I took it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/0*09yL2R-OCc3N3AI5.jpg" /><figcaption>Microsoft HoloLens is by far one of the most science-fiction devices I was able to interact with! ❤️</figcaption></figure><p>September 2018, I’m in Belgrade working at Microsoft<em> </em>as a software<em> </em>engineer! I pulled it off. I was incredibly happy.</p><p>And that’s where my SE and ML story really started.</p><p>But, ever since I attended that summer camp the idea of DeepMind and the feeling that it is almost unreachable for me was deeply in my subconsciousness. The only folks I knew there (some of them were lecturing at the camp) studied at <em>Oxford </em>or <em>Cambridge</em>.</p><p>But there is a part of me that’s very attracted to impossible challenges. I thought to myself I nailed Microsoft even though I once thought that’s very hard. Why should this be any different?</p><p>And so that idea was buried into my subconsciousness. I really enjoyed the fact that I’m at <em>Microsoft </em>now.</p><p>Throughout 2018 and 2019 I was focusing really hard on learning as much as I can about software engineering while working at Microsoft. I was reading coding books such as the C++ book from Scott Meyers, etc.</p><p>Other than that I started doing ML in my free time.</p><p>I finished all of Andrew Ng’s Coursera courses before the end of 2018. I attended internal ML hackathons, I was heavily involved around the organization of the aforementioned ML camp, and I started reading research papers!</p><p>I still remember how they made me feel (and they still do!). 😂 I felt very dumb. I was like, really? I studied EE for 4 years and I can still feel this way? (Little did I know; a semidefinite chuckle)</p><p>Somehow, around that same time, I also discovered <a href="https://www.youtube.com/c/lexfridman">Lex Fridman</a>’s podcast. That’s 3 years ago before he even had 50k subs on his YouTube channel! I remember religiously watching all of the 20ish podcasts he had back then.</p><p>I remember I started feeling increasingly confident with my ML knowledge. And so beginning of 2019 I shared my first blog ever on how to get started with ML:</p><p><a href="https://gordicaleksa.medium.com/get-started-with-ai-and-machine-learning-in-3-months-5236d5e0f230">Get started with AI and machine learning in 3 months</a></p><p><em>(My writing was terrible back then, and it still probably is, I apologize for that. I’ll try to update it over the next couple of days after publishing this blog (I won’t change the content as I want to keep it as a historical document))</em></p><p>End of 2019 I internally made a switch to an ML role (due to my religious engagement that my manager noticed). I was sent to <em>ICCV 2019 </em>conference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EvyUSMrAdrjQAvzM-ezmoA.jpeg" /><figcaption>Demoing HoloLens 2 at Microsoft booth (ICCV 2019). Demoing HL always looks funny from the outside perspective. xD</figcaption></figure><p>I returned and I got the task of implementing a paper from scratch in PyTorch. I didn’t know any PyTorch back then. Needless to say — I learned a lot.</p><p>And this is where another <strong>warp speed</strong> moment happened. But this time, I was smarter, this time I’m going to share my journey online as I progress.</p><p>So what happened? What made me change my mindset? What made a push <em>from </em>this old Aleksa, that was learning and working hard but kept everything for himself, <em>to</em> this new Aleksa?</p><p>Well, throughout 2019, as a “side quest”, I was reading a lot about entrepreneurship, marketing, and personal finance. And along the way, I found this guy called <a href="https://www.garyvaynerchuk.com/">Gary Vaynerchuk</a> who motivated me to start sharing stuff I do online. Thanks Gary! ❤️</p><p>I know most of you probably don’t like him (if you are even aware of him in the first place), but he had a positive influence on my thinking. And for that I’m grateful. He definitely wasn’t the only person that influenced my mindset (I was sharing my code <a href="https://github.com/gordicaleksa/digital-image-processing">even</a> <a href="https://github.com/gordicaleksa/MachineLearningMicrosoftPetnica">back in 2018</a>) but he finally made it click.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5BR8yN1266bDN4O6m72_Ug.jpeg" /><figcaption>My biggest public speaking stunt to date. I talked in front of 300+ colleagues from Microsoft. Cameras, lighting, reflectors, and all. I even had a coach! It was way out of my comfort zone — that’s why I did it.</figcaption></figure><p>You probably may say (if you don’t know me): “Well, this story is inspiring and all but how did you create your own SWE/ML curriculum in the first place?”</p><p>Well, before all of this happened, I already had a strong track record of learning on my own. If it still feels like magic I <strong>strongly</strong> recommend you go ahead and read this blog:</p><p><a href="https://gordicaleksa.medium.com/5-tips-to-boost-your-learning-d6eb5edfe6d">5 Tips to Boost your LEARNING</a></p><p>I’ll leave a TL;DR here: through my <a href="https://www.youtube.com/watch?v=rpOI0_FBR_U">workout routines</a>, <a href="https://www.youtube.com/shorts/xIbyJhVCmsk">learning human languages</a> throughout my life, and maths (all of that on my own) I got skillful at learning. Coursera’s <a href="https://www.coursera.org/learn/learning-how-to-learn">“Learning how to learn course”</a> helped as well.</p><p>Now that you have all of the necessary context — let me tell you about the ML curriculum I followed to land a job at DeepMind!</p><h3><strong>Part 2: ML curriculum (January 2020 — June 2021)</strong></h3><p>New Year 2020 came along. I just finished reading “<a href="https://www.amazon.com/Crushing-Great-Entrepreneurs-Business-Influence/dp/0062674676">Crushing it</a>” from garyvee and decided I should start my own YouTube channel sharing my ML learning journey along the way.</p><p>The pandemic struck and I was in warp speed again. The stars aligned. ⭐</p><p>I decided that over the next year I want to cover various subfields of AI, and I roughly decided that I want to dedicate 3 months to each one of these.</p><p>But things weren’t that smooth in the beginning, I was still figuring stuff out. My first subfield, neural style transfer (NST), took longer than 3 months because I found it enjoyable and I thought why rush it?</p><p>Along the way, I found a perfect strategy for myself.</p><p>I structured my learning the following way. I had “macro” cycles (3-month periods where I tackle a new subfield) and I had multiple micro-cycles interspersed over macro.</p><p>The micro-cycles are of 2 types:</p><ul><li><strong>Input mode</strong>: <em>I’m ingesting information</em>. The goal is to either get a high-level understanding of the structure of the subfield (blogs, videos) or an in-depth understanding of the topic at hand (research papers, books, etc.)</li><li><strong>Output mode</strong>: <em>I’m sharing information I accumulated during my input mode</em>. Teach others! Create public artifacts like YouTube videos, GitHub projects (1 project in the middle of macro), and blogs (1 blog at the end of a macro). As well as higher-frequency updates on LinkedIn. Much later I started sharing on Twitter and Discord as well.</li></ul><p>Now the tricky part was combining all of this with my full-time job at Microsoft! It took a significant amount of willpower. I’d hit the program as soon as I wake up for 2h, I’d go for a quick stroll, I’d do my job at Microsoft and a 30-minute power nap after I wrap it up, and finally I’d be working for additional 2–3 hours before going to sleep. The pandemic helped me maintain this crazy rhythm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lU9TBMw7QVpbpHn7" /><figcaption>Time management is a tricky part for many people (Photo by <a href="https://unsplash.com/@goumbik?utm_source=medium&amp;utm_medium=referral">Lukas Blazek</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>The <em>time management</em> and <em>stress handling</em> probably deserve a separate blog post, but it mostly boils down to willpower, correct mindset, as well as taking smart breaks (power naps are golden — let me know in the comments if you’d like a separate blog on the topic of time management).</p><p>Now let me go into the specifics of the macros I did on my way to DeepMind! Luckily I started writing blogs sometime around my transformers macro so if you want to know all the nitty-gritty details and the strategy I took, I’ll link the blogs in every single macro section.</p><p>For the first 3 macros (NST, DeepDream, and GANs) I, unfortunately, didn’t write a dedicated blog, but the<em> intro section</em> of the transformers blog below as well as the YouTube videos and projects I created can fill in the gaps:</p><p><a href="https://gordicaleksa.medium.com/deep-learning-journey-update-what-have-i-learned-about-transformers-and-nlp-in-2-months-eb6d31c0b848">Deep learning journey update: What have I learned about transformers and NLP in 2 months</a></p><p>Having said that, here are the TL; DRs of every macro I did:</p><h3>[1] NST (Neural Style Transfer)</h3><p>During this period I was learning about neural style transfer. I ended up reading a pile of research papers (though a lot less than later when I became proficient), implementing <a href="https://github.com/gordicaleksa/pytorch-neural-style-transfer">3</a> <a href="https://github.com/gordicaleksa/pytorch-neural-style-transfer-johnson">different</a> <a href="https://github.com/gordicaleksa/pytorch-naive-video-neural-style-transfer">projects</a>, which I then open-sourced on my GitHub, and I made an <a href="https://www.youtube.com/watch?v=S78LQebx6jo&amp;list=PLBoQnSflObcmbfshq9oNs41vODgXG-608&amp;ab_channel=TheAIEpiphany">NST playlist</a> on YouTube.</p><p>I think that this is a great topic to start with as it’s highly visual and visceral. I recently wrote some of my thoughts on a similar topic in <a href="https://www.linkedin.com/posts/aleksagordic_algorithms-datastructures-interviews-activity-6846751933915561984-hth2">this LinkedIn post</a>. Also, <a href="https://github.com/gordicaleksa/digital-image-processing">digital image processing</a> and computer vision were the fields I felt the most comfortable with and so that’s why this was a great starting point<em> for me.</em></p><p>I perfected my PyTorch knowledge, learned a lot about CNNs and optimization methods, improved my presentation skills (just check out those README files 😂), became more proficient at reading research papers, and improved my SWE skills in general — to name a few.</p><p>Here is an NST image synthesized using the code I wrote:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*k-_yfWmHn2L-ms6F.jpg" /><figcaption>You can create this using my GitHub projects (all of my projects have an MIT license)</figcaption></figure><h3>[2] DeepDream</h3><p>Ever since I first saw the pictures created with DeepDream I was fascinated. I knew I had to learn it. Every single detail. I couldn’t just use online generators and not understand what was going on.</p><p>I was reading blogs, analyzing DeepDream subreddits, and exploring various codebases. Most of the original code was written in Torch &amp; Lua combo. I remember losing a lot of time trying to set it up on Windows. Then I switched to Linux, got it to work, only to realize that I won’t be using that repo either way. 😂</p><p>My output was <a href="https://www.youtube.com/watch?v=6rVrh5gnpwk&amp;ab_channel=TheAIEpiphany">a single video</a> on the theory behind DeepDream and an open-source <a href="https://github.com/gordicaleksa/pytorch-deepdream">project</a>. I learned a lot by doing this and I enjoyed the process. I used my code to generate these beautiful images, among them the current visual identity of <a href="https://www.youtube.com/c/TheAIEpiphany/">The AI Epiphany</a>. Here is an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*OopyjSw_MAIrCi5r.png" /><figcaption>DeepDream implementation I developed, you can create pics like this one <a href="https://github.com/gordicaleksa/pytorch-deepdream">using this code</a>.</figcaption></figure><h3>[3] GANs (Generative Adversarial Networks)</h3><p>GANs were still very popular in early 2020. I felt like I’m lacking the necessary background and so I decided to tackle them next.</p><p>I’ve read all of the seminal papers (as well as other less prominent papers) and I decided to implement <a href="https://github.com/gordicaleksa/pytorch-GANs">vanilla GAN</a>, cGAN (conditional GAN), and DCGAN models. Here is an output from the DCGAN model I trained:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*mzOOEKW0IFjn0lM4.jpg" /><figcaption>man -&gt; woman (notice that the rotation and skin tone change as well)</figcaption></figure><p>At this point in time, I refined my strategy. I realized that:</p><ul><li>I need to write a blog at the end of each macro, summarizing what I’ve learned. That will help future Aleksas (and Aleksa from the future) tackle topic X.</li><li>I need to cover papers on my YouTube channel as I’m reading them. A similar thought process — by doing this I’ll learn better and I’ll help others.</li><li>I need to open-source a project in the middle of the macro. After you implement something you understand it way better. After that, all the papers I read made more sense.</li></ul><p>Unfortunately, I don’t have GAN paper overviews from this period. Back then I was experimenting with videos such as “<a href="https://www.youtube.com/watch?v=NuJB-RjhMH4">PyTorch or Tensorflow</a>” which turned out to be <em>the most popular</em> ones (proving a hypothesis I had in my mind — higher level, beginner-friendly content always does better).</p><p>But I didn’t seek popularity (not that I would mind in general), I was seeking a highly relevant audience. I’d much rather have 1 guy/gal from “DeepMind” following my work than 100 beginners — because I knew what my goals are.</p><h3>[4] NLP &amp; transformers</h3><p>I knew I wanted to learn more about <em>BERT </em>and the <em>GPT </em>family of models. Transformers were everywhere, and I didn’t quite understand them.</p><p>This time I did everything correctly and executed the plan I sketched above. I ended up <a href="https://github.com/gordicaleksa/pytorch-original-transformer">implementing the original transformer</a> paper from scratch and learned a ton! I decided to create an English-German machine translation system. Since I speak those languages, I thought that’ll make debugging easier, and it did.</p><p>I’m so grateful I did it back then — every now and then you need to understand the QKV attention, and it’s second nature to me now. You can find out much more about this journey here:</p><p><a href="https://gordicaleksa.medium.com/deep-learning-journey-update-what-have-i-learned-about-transformers-and-nlp-in-2-months-eb6d31c0b848">Deep learning journey update: What have I learned about transformers and NLP in 2 months</a></p><h3>[5] Graph/Geometric ML</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*8a44ZSkQ5Srlbqtv.png" /><figcaption>Graph ML (by <a href="http://hal.elte.hu/~nepusz/">Tamas Nepusz</a>, co-creator of <a href="https://igraph.org/">igraph</a>)</figcaption></figure><p>Even before I started doing transformers I knew I wanted to dig deeper into Graph ML (before it became as popular as it is nowadays).</p><p>And, in retrospect, I’m very glad I covered transformers/NLP first since the field of NLP had a huge influence on this field. GAT was directly inspired by the original transformer paper, DeepWalk by Word2Vec, and so on.</p><p>At this point in time, I was already chatting with <a href="https://twitter.com/PetarV_93"><em>Petar Veličković</em></a> on a fairly regular basis (I’ll tell you a bit later more about how this came to be) and he knew that I’ll be covering GNNs in the next period. He was very receptive and he told me that I can ping him whenever I felt stuck!</p><p>I realized that this is a great opportunity! I’ll be learning Graph ML, a topic that fascinated me and I’ll be communicating with Petar, a researcher at DeepMind, who was among the best researchers in this particular field.</p><p>Needless to say, I learned a lot! I made a “popular” <a href="https://www.youtube.com/watch?v=uFLeKkXWq2c&amp;list=PLBoQnSflObckArGNhOcNg7lQG_f0ZlHF5&amp;ab_channel=TheAIEpiphany">YouTube GNN series</a> that was shared by influential Graph ML researchers like <a href="https://twitter.com/mmbronstein">Michael Bronstein</a>, Petar, and others.</p><p>I also made a popular <a href="https://github.com/gordicaleksa/pytorch-GAT">PyTorch implementation of GAT</a> (Petar is the first author of GAT). The reason it became so popular is that it was, according to others, the most beginner-friendly resource out there. With 2 Jupyter notebooks, PPI and Cora datasets support, a nice README, and accompanying videos it filled the gap and made it easy for beginners to enter the field.</p><p>(It became a recommended repo for a <em>Cambridge lecture on GNNs </em>and I even got citations. 😅)</p><p>Once again, I leaned heavily on being able to reach out to Petar whenever I got stuck, and I saw this as a great opportunity for us to collaborate.</p><h3>For the whole story check out this blog:</h3><p><a href="https://gordicaleksa.medium.com/how-to-get-started-with-graph-machine-learning-afa53f6f963a">How to get started with Graph Machine Learning</a></p><h3>[6] RL (Reinforcement Learning)</h3><p>Drum roll. Surprise, surprise! I really wanted to learn RL either way but it so happens that DeepMind is famous for its RL breakthroughs. 😅</p><p>There were so many papers and projects I wanted to understand! Like AlphaGo, DQN, OpenAI’s robotic hand that could solve Rubik’s cube, etc.</p><p>This field proved to be very different compared to other ML subfields. The data point independence assumption doesn’t hold anymore, a “bad” random seed can cause your agent to fail to converge, etc.</p><p>I’m very glad I already had a decent amount of experience before tackling RL, otherwise, I might have gotten demotivated. I started with stuff that’s very close to my heart — computer vision — and I used it to ramp up my ML knowledge. Then, I slowly progressed toward topics I knew little about.</p><p>I again had some help here! Petar connected me with <a href="https://scholar.google.com/citations?user=f31mvPsAAAAJ&amp;hl=en"><em>Charles Blundell</em></a> (who’s also a DeepMinder) and so from time to time, I used that opportunity, although a lot more frugally.</p><p>For the whole story check out this blog:</p><p><a href="https://gordicaleksa.medium.com/how-to-get-started-with-reinforcement-learning-rl-4922fafeaf8c">How to get started with Reinforcement Learning (RL)</a></p><p>And those are pretty much the main macros I had. Throughout the whole journey I was making notes in my OneNote:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/197/1*pbknFaQeKxY5zq5vhFG99g.png" /><figcaption>excerpt from my OneNote</figcaption></figure><p>(<em>If there is enough interest I could maybe convert those to pdfs and share them on a public drive. Let me know in the comments!</em>)</p><p>After RL, I started focusing on the latest and greatest papers. You can clearly notice that trend looking at my newest YouTube videos over the past 4 months.</p><p>And all of you who were following along my journey knew that these were my plans — I was very transparent throughout the whole process! (<em>except for the fact that I wanted to apply for DeepMind the whole time</em>).</p><p>Aside from this main quest, early in 2020 — when I first started reading research papers — I realized that I was having difficulties with mathematics so I took some time to read the “<a href="https://mml-book.github.io/">Mathematics for Machine Learning</a>” book (and I went over 3B1B’s awesome playlists).</p><p>That turned out to be a great move. I’m so happy I did it similarly to how I took a step back and took the “Learning How to Learn” course in September of 2019. All of these actions helped boost my learning speed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cmVNQnq0gzs5FbQb" /><figcaption>Photo by <a href="https://unsplash.com/@kimberlyfarmer?utm_source=medium&amp;utm_medium=referral">Kimberly Farmer</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Here are some other books I also read in this period:</p><ul><li><a href="https://github.com/jakevdp/PythonDataScienceHandbook">Python Data Science Handbook</a>, chapter 5 — helped me get a visceral feeling for SVMs, PCA, linear regression, etc.</li><li><a href="https://automatetheboringstuff.com/">Automate the Boring Stuff with Python</a>, skipped first 11 chapters — I felt like going through at least one book on Python since I learned the language on the fly. It also shaped my mindset which improved my productivity in general (in a nutshell: “automate the repetitive stuff”).</li><li><a href="https://www.deeplearningbook.org/">Deep Learning</a>— I only read the first part as I realized I don’t really need all of that theory. It should be treated as a reference manual.</li><li><a href="https://www.amazon.com/Book-Why-Science-Cause-Effect/dp/046509760X">The Book of Why</a> — I read it because I was genuinely interested in causality and Judea Pearl’s work! Here is my <a href="https://www.linkedin.com/posts/aleksagordic_pearl-causality-intelligence-activity-6807985607432785920-Zxn2">LinkedIn summary</a>.</li></ul><p>In parallel with everything I mentioned above, I was also working full time at Microsoft on a variety of SWE and ML engineering projects. Unfortunately, I can’t tell you a lot about all of that but here are some of the high level highlights I can talk about:</p><ul><li>Developed a glasses detection algorithm as a part of the eye-tracking subsystem on the <a href="https://www.microsoft.com/en-us/hololens/hardware">HoloLens 2</a> device. The purpose of the eye-tracking subsystem is to predict the user’s eye gaze vector in real time and enable the instinctual interaction with the holograms. It also helps render graphics correctly for a particular user (everybody has different eyes, thus different <a href="https://en.wikipedia.org/wiki/Pupillary_distance">IPD</a>), etc.</li><li>Played with video encoders so as to add the <a href="https://en.wikipedia.org/wiki/Foveated_rendering">foveated rendering</a> functionality to next generation VR/MR devices. That way you save up power as you don’t need to render the details in the peripheral vision. I ended up reading the whole <a href="https://last.hit.bme.hu/download/vidtech/k%C3%B6nyvek/Iain%20E.%20Richardson%20-%20H264%20(2nd%20edition).pdf">reference manual</a> on H.264 encoders (that was, again, probably an overkill 😅).</li><li>Implemented a research paper from scratch, in PyTorch to track human body landmarks, validating a new sensor technology under consideration. <em>This project is how I learned PyTorch</em> (late 2019/early 2020).</li><li>Wrote various scripts that verified labelers are doing their job correctly, developed a part of our internal metrics pipeline, dealt with rendering and improving our synthetics data (which is great, check out the paper <a href="https://arxiv.org/abs/2007.08364">here</a>!), made various quantization and perf-vs-compute experiments (because I was working with edge devices), and so on.</li><li>Interviewed candidates for SWE/ML roles at Microsoft. This made me feel more comfortable with the interview process, and gave me a perspective on how it looks like to be on “the other side of the table”.</li><li>Taught and mentored students at the ML summer camp, including delivering lectures and running CNN workshops.</li></ul><p>In summary that’s: one year of intense SWE study, followed by 1.5 years of slower-paced ML learning, and then another 1.5 years of <strong>warp-speed</strong> ML study; the rest is captured in my “<a href="https://gordicaleksa.medium.com/5-tips-to-boost-your-learning-d6eb5edfe6d">5 Tips to Boost Your Learning</a>” blog.</p><p>And that’s my story.</p><p><em>Tip: an additional thing you could do to see more details of this whole period is to just scroll through all of my </em><a href="https://www.linkedin.com/in/aleksagordic"><em>LinkedIn</em></a><em> posts, that’s where I was (and still am) regularly sharing my updates.</em></p><h3>Part 3: How did the “DeepMind channel” open up?</h3><p>Middle of the year 2020 I reached out to Petar on LinkedIn. It turned out he was already following the content I was posting there and found it interesting, so that made things a bit easier! ❤️</p><p>During my ICCV19 conference I met other cool DeepMinders, that were also from Serbia, like <a href="https://twitter.com/relja_work"><em>Relja Arandjelović</em></a> (who did his Ph.D. with professor Andrew Zisserman at Oxford) and <a href="https://jovana-mitrovic.github.io/"><em>Jovana Mitrović</em></a> (Oxford girl as well!).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*8R7ZgioF1VvIyPxEYFBVzA.png" /><figcaption>Seoul, South Korea, ICCV 2019</figcaption></figure><p>Even though this was my first conference I immediately realized that the value of these conferences lies in:</p><ul><li>1–1 conversations with the paper authors during the poster sessions</li><li>Meeting other likely-minded people</li></ul><p>IMHO, many people get this wrong. By the time you attend the conference most of the papers were already published to arXiv months ago (and chances are somebody already covered them and shared the summary online 😂).</p><p>That’s why virtual conferences will never be a good replacement.</p><p>Then sometime around September of 2020, I made it clear to Petar and Relja that sometime next year, probably in April, I’ll start applying for DeepMind and asked them for any tips on how I could prepare! In the meanwhile, both of them offered to refer me! ❤️</p><p>Fast forward to Friday, April 2021. I was casually chatting with Petar, mentioned that I’m finally ready to apply for DeepMind, and while we were chatting he just said (without me even realizing): “ok, I just finished submitting the referral!” 😂</p><p>He then pinged a recruiter (<a href="https://www.linkedin.com/in/cameron-anderson-17872b125/">Cameron Anderson</a>, I didn’t know him back then but I can tell you now that he’s amazing at his job) on LinkedIn, mentioned who I was, and asked whether it’s fine for me to submit my LinkedIn/YouTube/GitHub instead of my resume. It turned out that Cameron was already following my work! And he said that it’s fine! My God, I was so happy.</p><p>Everything happened so fast. I just sent my LinkedIn profile and I already had my interview scheduled for Monday.</p><p>So summarizing. <strong>Having high quality connections does matter!</strong> BUT. Please don’t spam people. Instead, create genuine connections. <strong>Ask what you can do for them</strong> and not what they can do for you. None of them, including me, won’t recommend a person unless we’re familiar with that person’s work already and we can make some guarantees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2DQ0JTCd1su3vBBk" /><figcaption>Build up high-quality connections with other likely-minded people (Photo by <a href="https://unsplash.com/@alexisrbrown?utm_source=medium&amp;utm_medium=referral">Alexis Brown</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p><em>(Pro tip: contribute to an open-source project of the company you care about — that’s a great way to get noticed! That way some of them will be familiar with your work and you can later ask for a referral —that is if they don’t already offer it themselves! Why is nobody using this strategy? It beats me.)</em></p><p>At one point an automated email came asking for my resume (although Cameron confirmed that it’s not necessary). After some quick edits, I decided to send them my resume without investing too much effort into it (thinking that they probably won’t even read it).</p><p>Which in retrospect could have been a big mistake. A well-written resume matters! And my interviewers did in fact use it. It’s easier to ask questions looking at a 1/2 page resume than at a LinkedIn profile.</p><p>I’m leaving it here for legacy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WnobCo8KI7bokC9m741rqg.jpeg" /><figcaption>My (don’t do it like this) resume (that still got me to DeepMind) haha. [Written in LaTeX via the <a href="https://www.overleaf.com/">Overleaf</a> platform]</figcaption></figure><p>There are many things wrong with it. For a start, I should have written a lot more about my latest work at Microsoft. The thing is that my team at Microsoft was very secretive (for quite some time my other colleagues from Microsoft didn’t know what I was working on), and so I took the safest strategy — of not communicating anything to the outside world. 😂</p><p>Also, my resume was always a 1-pager, I should probably cut all of these older projects out. I have many other ideas on how to improve it.</p><p>Finally, let’s see how my last preps for DeepMind looked like!</p><h3><strong>Final interview preparations</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZwAlOm4m5AvDYc0x" /><figcaption><strong>Ultra-warp speed</strong>! (Photo by <a href="https://unsplash.com/@cadop?utm_source=medium&amp;utm_medium=referral">Mathew Schwartz</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>Ok, at this point I managed to build up solid foundations and I was referred for an RE position. You do need a solid background to land a job at DeepMind. I’m fairly sure I wouldn’t even get a chance to interview if I didn’t have all of my GitHub projects, prior experience, and other public artifacts.</p><p><em>(I don’t have any paper publications but I compensated in different, original ways. REs don’t necessarily need publications, as you can see. But the game may be different for RSs (research scientists). I’m fairly sure they need a strong record in publishing to top-tier conferences and a Ph.D. Take all of this with a grain of salt, I’ll update this part when I start working at DeepMind and get myself better informed.)</em></p><p>But the battle wasn’t won. As all of you know, the interviewing processes are…well, kind of dark magic.</p><p>Even when you’re really good, big tech companies may reject you. It’s safer for them to reject a great candidate (by a mistake) than to accept a really bad one (they want to reduce the false positives). Repeat after me — <em>hiring pipelines are never perfect </em>— this will save you from a lot of unnecessary stress!</p><p>Secondly, you’re often asked stuff you won’t actually be using in your daily job and that’s why you have to explicitly prepare for the interviews.</p><p>Let me now tell you how I pulled it off.</p><p>First, here are some general tips:</p><ul><li><em>Research every single one of your interviewers.</em> Understand where they are coming from and what they do, so that you can ask relevant questions. Don’t waste their time. Check out their LinkedIn/Twitter profiles (they always have at least one of those) and their Google Scholar page. Read all of their papers if possible or the ones with the most citations/the ones where they are the first author. For some of my DeepMind interviewers, I read more than 10 papers. 😅 That’s probably not needed, but I was passionate enough (read nuts) to do it.</li><li><em>Research every single one of your resume projects. </em>You should be able to talk in-depth about all of those projects. Be those your GitHub projects or the ones you did at some previous company.</li><li><em>Do some mock interviews. </em>Find friends who do AI at whatever company and are ideally interviewers themselves.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OXaLohlfPimdbmyh" /><figcaption>Artificial General Intelligence (Photo by <a href="https://unsplash.com/@yuyeunglau?utm_source=medium&amp;utm_medium=referral">Yuyeung Lau</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>For DeepMind I also did serious research around AGI. I read some of the seminal AI papers like:</p><ul><li><a href="https://arxiv.org/abs/0706.3639">A Collection of Definitions of Intelligence</a> (my <a href="https://www.linkedin.com/posts/aleksagordic_intelligence-activity-6803248648017772544-Fuc3">LI summary</a>)</li><li><a href="https://arxiv.org/abs/0712.3329">Universal Intelligence: A Definition of Machine Intelligence</a></li><li><a href="https://arxiv.org/abs/1911.01547">On the Measure of Intelligence</a> (my <a href="https://www.linkedin.com/posts/aleksagordic_intelligence-abstraction-activity-6803769601911001088-lkzK">LI summary</a>)</li></ul><p>I’ve previously also researched Alan Turing’s seminal “Computing Machinery and Intelligence” paper as well as follow-up papers from John Searle, etc. You probably don’t need these. (in case you want a summary here are my blogs, parts <a href="https://gordicaleksa.medium.com/turing-for-dummies-ai-part-1-f0f668bcd83d">one</a> and <a href="https://gordicaleksa.medium.com/turing-for-dummies-ai-part-2-848cb87e95ab">two</a>)</p><p>And I also watched YouTube videos featuring some of the following people: <em>Demis Hassabis</em>, <em>Shane Legg</em>, <em>Marcus Hutter</em>, <em>F. Chollet</em>, <em>Murray Shanahan.</em></p><p>(<em>Flex: Demis liked a couple of my tweets</em> 😍)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*uU6Z_ajNTf95oQj4PebQRA.png" /><figcaption>❤️</figcaption></figure><p>The reason I did this research, is because it’s DeepMind’s <em>mission — c</em>racking AGI and using it to solve difficult scientific problems. You can also expect “behavioral” questions around these topics so I wanted to have a sound background.</p><p>Research as much as you can about DeepMind. For me, it came naturally since I was covering papers on YouTube, implemented some of them, knew people, culture, etc.</p><p>Those were some general tips. Replace DeepMind with your dream company and map a concept like “AGI” to “whatever my dream company cares about” and do your research on it.</p><p>Now let’s see how DeepMind’s hiring pipeline looks like for an RE position at the “Core” part of the team (more on DeepMind’s org a bit later).</p><p>The pipeline consists of the following interviews (at the time I’m writing this, it may change later in the future but you should still have a general idea):</p><ul><li>The initial chat with your Recruiter. This is supposed to give your recruiter an idea of whether you’re more interested in applying for the Applied or the Core part of the team. As with any other interview, treat it with respect, there may be a behavioral component to it. (1 interview)</li><li>The “quiz”. The idea is to test your understanding of fundamental topics in maths, stats, CS, and ML. (2 back to back interviews)</li><li>The coding interview. Your classical SWE interview if you ever interviewed for Google, Microsoft, or any other big tech company. (1 interview)</li><li>Team Lead interview. You’ll be discussing various topics. Anything that’s on your resume may come up, as well as open-ended ML problems, and behavioral questions. (1 interview)</li><li>Senior Team Lead interview. Very similar in structure to the above interview. Additionally, this interview more explicitly assesses whether you’re a fit for the team. (<em>TBH, you should treat every interview with that in mind</em>) (1 interview)</li><li>People &amp; Culture interview. Your classical HR interview. (1 interview)</li></ul><p>Let me now give you some tips on how to prepare for these!</p><p>My goal here is not to give you an unfair advantage or a way to game the hiring system, but rather guidelines on how you can get better at these topics, and thus hopefully a better engineer (and a better human being)! 😜</p><p>I’m writing this for my past self — the Aleksa who would have been grateful to have this guidance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fKI3c_boS9YiOMGe" /><figcaption>Interviewing tips (Photo by <a href="https://unsplash.com/@mkvandergriff?utm_source=medium&amp;utm_medium=referral">Maranda Vandergriff</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p><strong>Interview #1: A chat with the recruiter</strong></p><p>Do your due diligence and understand what exactly it is that you want to do at DeepMind (as much as you can!). DeepMind has 2 “teams” (it’s a soft type of a division, both “teams” are working towards a common mission):</p><ul><li><strong>The “Core” research team.</strong> They do more pure research types of projects. Examples of more “production-ready” projects would be <a href="https://deepmind.com/blog/article/putting-the-power-of-alphafold-into-the-worlds-hands"><em>AlphaFold</em></a><em> </em>(I guess the Applied team was involved here as well), <a href="https://deepmind.com/research/case-studies/alphago-the-story-so-far"><em>AlphaGo</em></a>, etc. Other projects that REs in this team do may involve helping implement certain research ideas in collaboration with research scientists.</li><li><strong>The applied team. </strong>This one is<strong> </strong>self-explanatory. Some of the projects they did are the <a href="https://deepmind.com/blog/article/deepmind-ai-reduces-google-data-centre-cooling-bill-40">Data Centre energy reduction</a> project, improving the RecSys for Google Playstore, <a href="https://deepmind.com/research/case-studies/wavenet">WaveNet</a>, <a href="https://deepmind.com/blog/announcements/deepmind-meet-android">saving power on Android</a>, and much more (they’re not only Google-focused).</li></ul><p>Go over to <a href="https://deepmind.com/">DeepMind’s website</a>, read their blogs, and research all of the available positions you care about.</p><p>Also, I strongly recommend you read the first (behavioral) part of the “<a href="https://www.amazon.com/Cracking-Coding-Interview-Programming-Questions/dp/0984782850">Cracking The Coding Interview</a>” (CTCI) book. As I said every interviewer will be assessing your personality and whether you’re fit for the team — so some preps in that regard definitely won’t hurt!</p><p><strong>Interviews #2 and #3: The “quiz”</strong></p><p>This is probably the hardest part to prepare for (although TBH, it wasn’t for me, it really depends on where you’re coming from). You need solid technical foundations to pass it.</p><p>I’ll tell you how I prepared myself, although again, it might be overkill:</p><ul><li>[CS] I read an Algorithms &amp; Data structures textbook that was written by a Serbian professor so it won’t be that relevant to you. The main point is — I picked a book I was already familiar with (I went through it back in 2017 preparing for big tech companies, remember?). This knowledge will also come in handy later during the SWE interview so your time won’t be wasted. It’s a 400-page book. I skipped some parts that I knew are “too advanced” like B-trees (external-memory data structures) and certain hash function details (I probably read ~340 pages). I covered topics such as linear/non-linear data structures (graphs/trees), and various sorting and searching algorithms.</li><li>[CS] Skimmed through OS course materials at my faculty. Stuff like deadlocks, threads, virtual memory, etc. Also, I read <a href="https://realpython.com/intro-to-python-threading/">this blog</a> on threading in Python to brush up on my knowledge of the terminology.</li><li>[CS] Skimmed through the big O-notation formal theory from the “<a href="https://www.amazon.com/Introduction-Algorithms-3rd-MIT-Press/dp/0262033844">Introduction to Algorithms</a>”(CLRS) book.</li><li>[Maths, classical ML] Read the “<a href="https://mml-book.github.io/">Mathematics for ML</a>” book, again. (As you recall the first time I read it was in 2020 so I was way faster this time).</li><li>[ML] Brush up on my RL theory. I just googled stuff and found some ad hoc materials. What’s an RL framework (env-agent-reward), what is an MDP, etc. My “<a href="https://gordicaleksa.medium.com/how-to-get-started-with-reinforcement-learning-rl-4922fafeaf8c">Getting Started with RL</a>” blog is a good starting point.</li><li>[Statistics] YouTube videos (channels such as <a href="https://www.youtube.com/user/jbstatistics">jbstatistics</a> and <a href="https://www.youtube.com/c/joshstarmer">StatQuest with Josh Starmer</a> helped me), googling for unknown concepts, skimmed through <a href="https://www.dpmms.cam.ac.uk/study/IB/Statistics/">this material</a> (sheets 1 and 2) from Cambridge. I made some reasonable assumptions on what they could ask me.</li></ul><p>That should be enough. If you already feel confident with some of these — just skip it — treat this as a biased guideline rather than as ground truth.</p><p>My interview process already started at this point so this was more of a sprint rather than a month-long preparation. I strongly recommend you start preparing before you kick off the interviewing process.</p><p><strong>Interview #4: The coding challenge</strong></p><ul><li>I solved some of the CTCI problems. I didn’t go through every single section of the book — it takes too much time. I solved most of the problems from the first 8 chapters (minus chapters 5, 6 where I skimmed the solutions or quickly solved some of them in my mind). I skimmed through the solutions of section 9 on system design, I skipped chapter 10 as I have already implemented some of the most popular sorting/searching algorithms while preparing for the quiz, and I’ve completely ignored chapters 11–15.</li><li>I read a chapter on dynamic programming from the CLRS book.</li></ul><p>A couple of tips on how to read through CTCI:</p><ul><li>First, try to solve a problem yourself. Only if you’re stuck, take a look at the first hint. If that doesn’t help see the next one, and so on. In the end, even if you managed to solve the problem, go through the solutions. You’ll definitely gain some new perspectives on how to approach that problem.</li><li>Make sure to always write down the memory and time complexity of your solution before looking at the solution section.</li><li>Pick a language that you feel the most comfortable with. The first time I went through this book (back in 2017) I used Java (as I was doing Android back then and the book itself contains solutions in Java). This time I used Python. You can find solutions in any language online or just use the <a href="https://www.geeksforgeeks.org/">GeeksForGeeks</a> website.</li></ul><p>You really don’t need anything else other than CTCI! Just that. 😅</p><p><strong>Interviews #5, #6 and #7: team lead interviews and people &amp; culture</strong></p><p>Just read the behavioral/first part of the CTCI book and follow my general tips (like be ready to talk about your projects and be familiar with your interviewer’s research).</p><p>They’ll ask you questions such as: “What do you like about DeepMind?”, “Why DeepMind and not some other company?”, “Tell me something about your favorite project”. Stuff like that.</p><p>And that’s it! You should be good to go now!</p><p>Finally, let me briefly tell you what happened to me. Some of you may recall from this video that I mentioned failing to land a job at DeepMind:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FqpxTgclVlcc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DqpxTgclVlcc&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FqpxTgclVlcc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/040af96982b7175dbbf31c0b9c6469a2/href">https://medium.com/media/040af96982b7175dbbf31c0b9c6469a2/href</a></iframe><p>I failed the 6th (Senior Team Lead) interview. IMHO, it was literally just a misunderstanding more than anything else (I received the feedback via email — they were very kind to provide it). <em>His feedback was that I came across as more passionate about research than engineering — and i was applying for an RE position! Funny enough, I only emphasized research because I already felt strong on the engineering side.</em></p><p>As a “technically strong” candidate, I was rerouted to the Incubation/Applied part of the team. I again prepared myself following the general tips I gave you guys and got 4 times YES. I was accepted. Hurray!!!</p><p>The interviews were very conversational in nature. They told me what the team does, there were some behavioral questions, some ML system design, and open-ended problems. The best way to prepare for those is to have genuine work experience.</p><p>And that’s it. I guess the rest is history.</p><p>And these 2 viral posts on <a href="https://twitter.com/gordic_aleksa/status/1434786341427060740">Twitter</a> and <a href="https://www.linkedin.com/posts/aleksagordic_ai-ml-job-activity-6840546549580259328-VGCB">LinkedIn</a>. 😂</p><h3>My next steps</h3><p>I’ll be joining DeepMind later this year (December 2021) as a Research Engineer. I’m very excited about this next period of my life!</p><p>Many new things are waiting for me. I’ll be moving to London, UK. I’ll have to build new social circles. I’ll be exposed to a new culture, new languages (as London is quite multicultural), a new company, and even a new OS! 😅</p><p>As for what you can expect from me over the next period, I’ll be:</p><ul><li>Sharing everything I do on my <a href="https://twitter.com/gordic_aleksa">Twitter</a>, <a href="https://www.linkedin.com/in/aleksagordic">LinkedIn</a>, and <a href="https://discord.gg/peBrCpheKE">Discord</a>!</li><li>Covering more geometric DL papers on my <a href="https://www.youtube.com/c/TheAIEpiphany">YouTube channel</a>!</li><li>Explaining various open-source ML tools and research code as well.</li><li>Learning JAX and this time sharing the journey with you guys!</li></ul><p>On a personal note, I’ll try and travel a bit more before December and I’ll be doing some investing (I’ll be reading the “<a href="https://www.amazon.com/Intelligent-Investor-Definitive-Investing-Essentials/dp/0060555661">The Intelligent Investor</a>” book).</p><p>I got so many kind words and requests from my community at <a href="https://www.youtube.com/c/TheAIEpiphany/">The AI Epiphany</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*CKW2mTHxjy2gb2z6ASiNxw.png" /><figcaption>Some of the requests from The AI Epiphany community! ❤️</figcaption></figure><p>And so I felt obliged to share more about my journey to DeepMind in order to help you guys become better. And hopefully, by sharing this deeply personal journey I managed to help at least some of you.</p><p><strong>If there is something you would like me to write about — </strong><em>write it down in the comment section or DM me. I’d be glad to write more about mathematics &amp; statistics, ML/deep learning, CS/software engineering, landing a job at a big tech company, getting an invitation to prestigious ML camps, etc., anything that could help you!</em></p><p><em>Also feel free to drop me a message or:</em></p><ol><li>Connect and reach me on<strong> </strong>💡 <a href="https://www.linkedin.com/in/aleksagordic/"><strong>LinkedIn</strong></a><strong> </strong>and <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a></li><li>Subscribe to my 🔔 <a href="https://www.youtube.com/c/TheAiEpiphany"><strong>YouTube channel</strong></a> for AI-related content️</li><li>Follow me on 📚 <a href="https://medium.com/@gordicaleksa"><strong>Medium</strong></a><strong> </strong>and 💻<a href="https://github.com/gordicaleksa"><strong>GitHub</strong></a></li><li>Subscribe to my 📢 <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a> and join the 👨‍👩‍👧‍👦 <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community!</li><li>📄 <a href="https://gordicaleksa.com/"><strong>Website</strong></a></li></ol><p>And if you find the content I create useful <a href="https://www.patreon.com/theaiepiphany"><strong>consider becoming a Patreon!</strong></a></p><p>Much love ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a45f2a781de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to get started with Reinforcement Learning (RL)]]></title>
            <link>https://gordicaleksa.medium.com/how-to-get-started-with-reinforcement-learning-rl-4922fafeaf8c?source=rss-37f02ae83e8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4922fafeaf8c</guid>
            <category><![CDATA[self-education]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[lrs]]></category>
            <dc:creator><![CDATA[Aleksa Gordić]]></dc:creator>
            <pubDate>Sun, 23 May 2021 11:30:59 GMT</pubDate>
            <atom:updated>2021-08-14T12:28:27.687Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFI68dnuijAHqn40mnoWZQ.jpeg" /><figcaption>&lt;RL&gt; I’m gonna get that reward asap. No, I’m gonna get it in 5 years. Do I actually want this reward? (cries in <strong>quasi-AGI</strong>) &lt;/RL&gt;</figcaption></figure><p>This blog is the last one in my series of <strong>“deep learning update” </strong>blogs, where I was sharing my learnings as I was intensively researching various ML/deep learning subfields over the last 16 months.</p><p>Aside from sharing my learnings, the idea of these blogs is to give you the <strong>general learning-how-to-learn</strong> tips &amp; tricks, which I’ve built up over the last many years of self-study that started way before “my AI story” was even a thing, as well as the <strong>specific advice </strong>peculiar to a particular subfield which I’m currently working on. And as they say:</p><blockquote>To help others you only need to be one step ahead. — some{one, when, where}</blockquote><p>The goal of these blogs is to get you started really fast so that you can build up solid foundations in the ML/deep learning subfield X, where so far this variable X = {<strong>Computer Vision (CV), NLP, Graph ML, RL</strong>}.</p><p>Now, you may ask yourself (but probably not 😂)<strong>, why do I make these?</strong> Well, there are, as always, multiple reasons. The main ones I can think of are:</p><ul><li>I genuinely love helping others and hearing from you. All the feedback I get from you fuels me even more.</li><li>I wished there was a blog post like this one when I started learning each of these AI subfields, that structured the knowledge of the field in a way that’s as linear as possible guiding me through the ocean 🌊 of information (or is it a graph of information? 😜 (with cycles of course!)).</li><li>Future me will be grateful as well — in case I need to quickly overview a particular topic again.</li><li>Writing blogs helps me further consolidate my knowledge and crystalize my thoughts — I can’t recommend it enough! Start writing your own blog.</li></ul><p>In this one, I’ll give you some tips on <strong>how to get started with RL</strong>, but before that, as usual, let me give you a super short review of my previous content if you’re new here!</p><h4>Blogs 📚</h4><p>Here are some of my previous blogs 📚 you may want to check out if you’re interested in other areas of AI as well:</p><ol><li><a href="https://gordicaleksa.medium.com/deep-learning-journey-update-what-have-i-learned-about-transformers-and-nlp-in-2-months-eb6d31c0b848">How to get started with transformers and NLP</a></li><li><a href="https://gordicaleksa.medium.com/how-to-get-started-with-graph-machine-learning-afa53f6f963a">How to get started with Graph ML</a></li><li><a href="https://gordicaleksa.medium.com/get-started-with-ai-and-machine-learning-in-3-months-5236d5e0f230">How to get started with AI and ML in 3 months</a></li></ol><p>Unfortunately, I made a mistake and didn’t write these blogs during the first 6 months when I was working on <strong>Neural Style Transfer (NST)</strong>, <strong>DeepDream</strong>, and <strong>Generative Adversarial Networks</strong> — GANs.</p><p>Having said that, I did briefly describe that part of my journey in the <em>“How to get started with transformers and NLP”</em> blog, so do check it out if that’s something of interest to you!</p><p>If you need tips on how to learn more effectively and efficiently I recommend this one: <a href="https://gordicaleksa.medium.com/5-tips-to-boost-your-learning-d6eb5edfe6d">“5 Tips to Boost Your Learning”</a>.</p><h4>GitHub projects 🤓</h4><p>Also, I couldn’t be happier with the projects I open-sourced over the last 16 months. You may find them useful in your learning journey, they are super easy to get started with, just read through the setup section of the README:</p><ul><li><a href="https://github.com/gordicaleksa/pytorch-neural-style-transfer">NST (Gatys et al.)</a>, <a href="https://github.com/gordicaleksa/pytorch-neural-style-transfer-johnson">NST-fast (Johnson et al.)</a>, <a href="https://github.com/gordicaleksa/pytorch-naive-video-neural-style-transfer">NST for videos (naive)</a></li><li><a href="https://github.com/gordicaleksa/pytorch-deepdream">DeepDream (Mordvintsev et al.)</a></li><li><a href="https://github.com/gordicaleksa/pytorch-GANs">GANs</a> (original, cGAN, DCGAN)</li><li><a href="https://github.com/gordicaleksa/pytorch-original-transformer">The original transformer</a> (Vaswani et al.)</li><li><a href="https://github.com/gordicaleksa/pytorch-GAT">Graph Attention Network</a> (Veličković et al.)</li><li><a href="https://github.com/gordicaleksa/pytorch-learn-reinforcement-learning">Deep Q-Network</a> (Mnih et al.)</li></ul><p>All of these were written in <strong>PyTorch</strong>. I also strongly recommend creating your own deep learning projects. You’ll learn a lot by doing — trust me.</p><h4>YouTube videos 🔔</h4><p>I also started my YouTube channel last year, <a href="https://www.youtube.com/c/TheAIEpiphany/">The AI Epiphany</a> 🔔, whose main goal over the last period was to share my story along the way, as I was learning myself. Going forward its main focus will be on the latest and greatest ML papers and beyond!</p><h4>[New!] The monthly AI newsletter 📢 &amp; a Discord community 👨‍👩‍👧‍👦</h4><p>If you want to keep up with latest &amp; greatest stuff happening in the AI world subscribe to this <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a> and join the <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community!</p><p>Aside from <em>Medium</em>, <em>YouTube</em>, and <em>GitHub </em>where I have a somewhat lower frequency of upload, I started sharing my daily AI updates on <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a><strong> </strong>and <a href="https://www.linkedin.com/in/aleksagordic/"><strong>LinkedIn</strong></a><strong> </strong>— so if that’s something of interest to you check it out! ❤️</p><p>Before I did this ~1.5 year long deep learning exploration, my strongest background lied in computer vision, but after 16 months of strategically exploring other areas, honestly, I don’t identify myself as a “computer vision guy” anymore that’s for sure.</p><p>My goal was to build up knowledge breadth in AI (and depth as much as possible given the time I had, <a href="https://en.wikipedia.org/wiki/Breadth-first_search">BFS</a> basically 🤓) and I think I might have just done it. I decided not to pursue a <em>PhD </em>and to do it my way — and I’m happy with how things rolled out, although this path is definitely not for everybody.</p><p><em>Note: I haven’t been sharing everything I’ve been doing there was a lot of mathematics and classical ML involved as well. I found the book “</em><a href="https://mml-book.github.io/"><em>Mathematics for ML</em></a><em>” — Deisenroth et al. extremely valuable (I’ve read it twice). I started learning ML back in 2018 — so it’s not a 16-month journey in total obviously.</em></p><p>If you were following along, you knew that my next interest lied in RL, and so 2-3 months later here we are!</p><p>With that out of the way let’s start with the question “<strong>WHAT </strong>is RL?”.</p><p>✅ Intro</p><h3>What is <strong>Reinforcement Learning? (RL 101)</strong></h3><p>Simply put, RL is a framework that gives our models (more commonly referred to as <strong>agents </strong>in RL) the ability to make “intelligent” decisions that help them achieve their goal which is <strong>approximately </strong>this one:</p><p><strong>Maximize </strong>the <strong>expected </strong>amount of <strong>reward. </strong><em>(more on this later)</em></p><p>It’s super common to see a diagram like this one explaining, on a high level, what the framework is all about:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2mLlVSAY66hHq_bz.png" /><figcaption>RL framework = an agent acts in the environment and learns from scalar rewards</figcaption></figure><p>You have an agent interacting with the <strong>environment</strong>. It makes some actions and the environment sends back the reward for that particular action and also the next <strong>state </strong>of the environment.</p><p>Let me make it a bit less abstract! 😅 Abstraction is a great thing to have once you’re grounded in real examples otherwise it’s just poor pedagogy.</p><p>In the game of Pong (Atari), which I’ll be using as the running example:</p><ul><li><strong>The state</strong> <em>could </em>be a couple of last frames (images of the screen)</li><li><strong>The agent</strong> <em>could </em>be a simple CNN (like the famous DQN agent)</li><li><strong>The actions</strong> <em>could </em>be: “move the pad up”, “move the pad down”, and “don’t move at all”.</li><li><strong>The rewards</strong> <em>could </em>be +1 if you win the game else -1.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*I5e3oH6xZGDR8v4Ls_0ILw.png" /><figcaption>RL agent playing the game of Pong (Atari)</figcaption></figure><p>And the <strong>goal </strong>of the Pong agent would be to learn how to maximize this scalar reward which <strong>hopefully correlates</strong> with our goals — and that is for it to <strong>become a great player</strong> at the game of Pong in this case.</p><p>You can immediately see some of the problems in RL (definitely not a comprehensive list, trust me on this one):</p><ul><li>The <strong>sparse rewards</strong> problem (+-1 only at the end of the episode)</li><li>The <strong>credit assignment</strong> problem (which actions led to win/loss?)</li><li>The problem of<strong> effectively communicating our goals</strong> to the agent</li><li>The problem of <strong>exploration vs exploitation</strong></li></ul><p>Let me try to break these down for you. ❤️</p><h4>Sparse reward</h4><p>Unlike in supervised learning where the “reward” is dense i.e. for every single data point you have the correct solution (e.g. in image classification image-class tuples), here you don’t have a dataset that tells your agent where to move the pad in each state of the game.</p><p>For that matter, you don’t have the correct label (ground truth) in any of the states! You merely observe some rewards and you devise an algorithm that will map those rewards into some <strong>pseudo-labels.</strong></p><p>Hence RL is considered a separate category of learning alongside <strong>supervised </strong>and <strong>unsupervised </strong>(there are also s<strong>elf-supervised</strong> and <strong>semi-supervised</strong> paradigms and there are overlaps between these, it’s not a clear cut).</p><p>The main criterion of this categorization is the following question: “Were the humans in the loop? Did somebody had to create the annotations/labels for the ML algorithm?”.</p><h4>Credit assignment</h4><p>Say your Pong agent accidentally won early in the training process, which of the moves it performed led to it winning the game?</p><p>The “move up” action 40 steps ago? The “don’t move at all” action 100 steps ago?</p><p>And that’s the credit assignment problem — figuring out a strategy to basically create good pseudo-labels for each data point you collect.</p><h4>Effective communication with the RL agent</h4><p>Choosing the right goal may seem trivial in the case of Pong, but let me prove you wrong. 😅 (don’t hate me for this I know everybody wants to be right!)</p><p>Here is a super famous example where we implicitly stated a goal by asking the agent to maximize its game score, with an actual intention/goal being that the agent learns how to become great at winning races, but it ended up just learning a<strong> pathological behavior</strong>:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FtlOIHko8ySg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DtlOIHko8ySg&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FtlOIHko8ySg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/309399a1f4223f72900ee42dcbd81e92/href">https://medium.com/media/309399a1f4223f72900ee42dcbd81e92/href</a></iframe><p>It did accomplish the goal we gave it but <strong>that wasn’t the goal we meant.</strong></p><p>Now imagine a system way more complex than a simple game. Also, imagine people’s lives being at risk and you’ll understand the weight of this problem.</p><p>You could choose to<strong> shape the reward </strong>in order to be more explicit in your communication but that won’t lead us anywhere over the long run, plus it’s hard and time-consuming. Take a look at this reward function (the goal was for a robot to learn to pick up stuff):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*7fUJJCJbHSY42-hGlsDhGQ.png" /></figure><p>As you can imagine designing this reward was hard and it doesn’t generalize.</p><p>All this reward chit-chat leads us to the next important question.</p><h4>Exploration vs exploitation</h4><p>Once the agent finds high reward states should it continue to visit them (<strong>exploit</strong>) or should it allow for some <strong>exploration </strong>which may lead to a discovery of even higher-reward states?</p><p>That’s one of the main dilemmas in RL, and in humans for that matter!</p><p>Say you’ve been to 10/40 restaurants in your neighborhood and you’ve found 3 of those which you really enjoy. Will you continue visiting them from now on or will you give yourself a chance to find a better restaurant? Potentially risking eating much worse food on that exploratory journey but with a promise of something truly great (like <strong>Kentucky Fried Chicken </strong>🐥<strong>).</strong></p><p>One of the classical methods for balancing exploration with exploitation is <strong>epsilon-greedy</strong>. Basically with an <em>epsilon </em>probability you pick a random action otherwise you pick an action that promises the highest reward.</p><p>Finally, you may have asked yourself how does this maximization of a sum of scalar rewards (reward ∈ R) translate to a desired intelligent behavior?</p><p>Well, basically, RL relies on this hypothesis (aka the <strong>“reward hypothesis”</strong>):</p><blockquote><em>That all of what we mean by </em><strong><em>goals </em></strong><em>and purposes can be well thought of as </em><strong><em>maximization </em></strong><em>of the </em><strong><em>expected value</em></strong><em> of the </em><strong><em>cumulative sum </em></strong><em>of a received </em><strong><em>scalar </em></strong><em>signal (reward). — </em><a href="http://incompleteideas.net/rlai.cs.ualberta.ca/RLAI/rewardhypothesis.html"><em>Richard Sutton</em></a></blockquote><p>All of the words in the above sentence are there with a purpose, loaded with meaning, like expected and cumulative, but the goal of this blog is for it to be a meta-learning resource so I obviously won’t get into the nitty-gritty details and maths of RL but merely point you in the right direction and hopefully give you some good tips along the way.</p><p>The way we capture these cumulative sums of scalar rewards is usually via the <strong>Q-function</strong> (<strong>action-value</strong> function) or via the <strong>V-function</strong> (<strong>value-function</strong>). Q tells us the amount of reward we can expect starting from a specific state and picking a specific action whereas V tells us the amount of reward we can expect in a state. RL agents which use these are called <strong>value-based</strong> agents.</p><p>There are also <strong>policy-based</strong> agents which instead of trying to estimate the value that certain state/action will bring just try to learn which action to pick.</p><p>And there are those that combine the 2 — <strong>actor-critic</strong> methods. We could also have a model of the world or not (<strong>model-based</strong> RL vs <strong>model-free</strong> RL). The model tells you the <em>state-transition probabilities</em> but you don’t need to worry about it for now.</p><p>With that, you’re “good enough” to go. Don’t worry if you didn’t grasp everything in the first pass, you’ll have plenty of time.</p><p>With the <strong>WHAT </strong>question out of the way, let me give you a reason <strong>WHY </strong>you should even bother learning about RL! ❤️</p><p><em>Note (on how you should (probably) read the following chapters): I’d recommend not digressing too much into the resources I linked during your first read, do check out the shorter videos though. After that, I’d recommend exploring all of the resources I’ve linked in the following 2 sections just to get you hyped and to get a feeling for what RL has accomplished as well as the problems it’s facing. After that start following the resources I linked, approximately in the order I’ve linked them.</em></p><p>✅ RL 101</p><h3>The awesome world 🌍 of RL</h3><p>RL is an exciting and interesting paradigm and the only one I know of that promises the creation of an AGI. For that matter, it’s the only one which at least dares to try.</p><p>An RL agent can readily use the latest and greatest advancements from the worlds of CV, NLP, and Graph ML.</p><p>Computer vision gives it the “eyes”, the ability to represent the visual parts of its environment and to abstract the visual concepts. The breakthrough that the DQN made happened thanks to the breakthroughs in the computer vision world (<em>more on DQN later</em>).</p><p>NLP gives it the power to construct good representations of language concepts. NLP (transformers, etc.) enabled AlphaStar (<em>more on it later</em>) to better “understand” the game of StarCraft II.</p><p>Graph ML, e.g., allows it to understand the interconnectedness of visual and language concepts which I’ve mentioned above. They can be modeled as nodes in a heterogeneous graph.</p><p>Over the past decade, we had amazing accomplishments, previously unimaginable, happening in precisely the field of RL. Let me tell you about a few of those!</p><p><em>Note: Deep RL = RL + deep neural networks</em></p><h4>Deep RL — the early days 🌌⭐</h4><p>It all started with <strong>Deep Q-Network</strong> back in 2013. Before it, RL was mostly using the <strong>tabular setting</strong> for the <strong>state space</strong> (the collection of all states in the environment), which couldn’t scale to applications we actually care about since you need a slot of memory for every state in your environment.</p><p>DQN created a “new” field that we call deep RL. Deep stems from the fact that these RL algorithms are using deep neural networks as function approximations. With DNNs we only need a finite amount of parameters to capture huge state spaces (they are <strong>parametric models</strong>).</p><p>DQN managed to play ~29 Atari games at a human or super-human level. And all that with the same architecture, the same minimal setup, and directly from the raw images — something completely unimaginable in the world of RL prior to that.</p><p>Basically, the agent only receives an input frame (image), the number of actions for a particular game (which defines the number of outputs of a CNN) and the rest (the learning) is done via game specific scalar rewards.</p><p>You throw this very same setup in any one of the Atari games and it learns to play them (most of them at least — some of them like <strong>Montezuma’s revenge</strong> were a tough challenge up until recently).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*86qYKV_HdoVXuAy4TTuAfQ.gif" /><figcaption>This is actually from <a href="https://github.com/gordicaleksa/pytorch-learn-reinforcement-learning">my implementation of the DQN</a> (it could be much better)</figcaption></figure><p>A similar trend in the initial deep RL era was also made in robotics showing that we can train robots end-to-end (e2e) to perform certain dexterous tasks, like <em>screw a cap onto a bottle</em>, <em>placing a coat hanger on a rack</em>, etc., using raw vision and robot’s state (robot’s joint angles, etc.) as an input!</p><p>CNNs were powering this breakthrough as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*vtgHKPQVMuL5ik_AXu6FAw.png" /><figcaption><strong>End-to-End Training of Deep Visuomotor Policies</strong> (I’ll link the papers later, relax for now ❤)</figcaption></figure><p>Next came the almighty <strong>AlphaGo</strong>. The first program that won against the best human player in the world, Lee Sedol, in <a href="https://en.wikipedia.org/wiki/Go_(game)">the game of Go</a>. It’s also the only algorithm that came even close to doing that back at the time.</p><h4>AlphaGo lineage 🐒 -&gt; 👶</h4><p>It was a big deal. Most AI experts didn’t expect that to happen for at least 10 more years. It was considered the “holy grail” of AI, solving Go.</p><p>The huge search space of the game (~250¹⁵⁰) seemed unsolvable. Chess, the ex-drosophila of AI, is funny compared to it (35⁸⁰) and yet decades of research went into cracking chess.</p><p>Yet in 2016, AlphaGo, trained with a combination of supervised learning, RL (self-play) and Monte Carlo Search Tree (MCST) did it.</p><p>This feat was such a big deal that millions of people were following the event. DeepMind even made a movie on it. It’s got 24 million views at the time I’m writing this (and no it’s not even a Netflix series 😂). I strongly recommend it, it’s a great story even if you’re not into AI per se:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FWXuK6gekU1Y%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DWXuK6gekU1Y&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FWXuK6gekU1Y%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4943c0676d375aa4c3148a84039cee0/href">https://medium.com/media/f4943c0676d375aa4c3148a84039cee0/href</a></iframe><p>Training AlphaGo took a massive amount of compute, more than a month on 50 GPUs to train the DNNs and I’m not even counting in the hyperparam search that led to this final model!</p><p>After AlphaGo even better agents appeared, the so-called <strong>AlphaGo lineage</strong> of agents: AlphaGo Fan/Lee/Master (incremental improvements), AlphaGo Zero, AlphaZero and finally MuZero.</p><p><strong>AlphaGo Zero</strong> ditched the supervised learning part that relied on human play datasets and managed to beat the previous best AlphaGo <strong>100–0</strong>! Throughout its training it <strong>reinvented </strong>the collective knowledge which humans had to collect over the past 2000+ years. And all of that through self-play RL.</p><p><strong>AlphaZero </strong>further generalized the AlphaGo Zero agent and learned to additionally play Chess and Shogi (the so-called “Japanese Chess”) with pretty much the same model.</p><p>Finally, <strong>MuZero </strong>appeared. It had to additionally learn <strong>the rules of the game </strong>(none were given to it!) and it additionally could play all of the Atari games (on top of Go, Chess and Shogi). A new step towards more general agents.</p><p>All is not rosy though — the <strong>BIG problem</strong> with all of these is the fact they have to be retrained from scratch for every new game they play! There is no generalization that happens across the games.</p><p>But I’ll leave the problems RL faces for the next section — once the board games became “too easy” the community turned their eyes onto tougher challenges, like multiplayer real-time strategy games such as <strong>Dota 2</strong> and <strong>StarCraft II</strong>.</p><h4>The story of OpenAI Five and AlphaStar 🎮</h4><p>The really hard part about these games is that:</p><ul><li>They are <strong>partially observable</strong> compared to previous board games we looked at (e.g. the <em>fog of war</em> doesn’t allow you to see the parts where your opponent is building his/her infra unless you have your troops there)</li><li>The action and observation spaces are huge! The <strong>breadth </strong>of the decision tree is somewhere around 8k-80k in Dota 2, contrast that with Go’s ~250 or Chess’s 37 legal moves on average! Funny, right?</li><li>Also, the time horizon of the game is very long. Humans play these games in ~45-minute sessions which means a huge number of steps for an RL agent. E.g. the decision tree’s <strong>depth </strong>=~20k in Dota 2, contrast that with Go‘s 150 moves.</li></ul><p>Again, experts thought we’ll need lots of time to solve these. Some were more optimistic after Go was taken down. But soon enough we had bots winning at professional <strong>eSports </strong>games!</p><p>OpenAI started working on their Dota 2 bot called <strong>OpenAI Five</strong> back in 2016. A couple of years later in 2019, they have beaten the best human teams in the game of Dota 2.</p><p>They imposed certain restrictions on the game — like the pool of heroes humans could pick from was smaller than normally, certain parts of the bot logic were scripted instead of learned, but all in all, given more compute none of these change the fact that bots are truly better than humans in these specific constrained domains we call e-games.</p><p>You could also see a clear curriculum — they first started beating humans in the 1 vs 1 setting and only later tackled the 5 vs 5 setup. Which is smart, if you can’t win in the 1 vs 1 setting why even bother with 5 vs 5.</p><p>If you’re interested you can watch the <a href="https://www.twitch.tv/videos/410533063">finals here</a> (I personally skimmed through the interesting parts mostly on 2x playback speed):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fplayer.twitch.tv%2F%3Fvideo%3D410533063%26muted%3Dtrue%26autoplay%3Dfalse%26parent%3Dcdn.embedly.com&amp;display_name=Twitch.tv&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.twitch.tv%2Fvideos%2F410533063&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fstatic-cdn.jtvnw.net%2Fcf_vods%2Fd2nvs31859zcd8%2F094ea341ae0069c2edd4_openai_33672403264_1173172745%2Fthumb%2Fthumb0-640x360.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=twitch" width="620" height="351" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd17533992ac820e4ae27a571a9a676d/href">https://medium.com/media/cd17533992ac820e4ae27a571a9a676d/href</a></iframe><p>The main RL algorithm behind this was <strong>PPO </strong>which was invented a couple of years before. So it wasn’t that much the algorithmic innovation that got us here but the sheer compute and engineering, RL at scale!</p><p>An interesting parameter they had was “<strong>team spirit”</strong>. It basically was annealed from 0 to 1 during the training and it controlled the agent’s selfishness (0 — maximally selfish, only my score matters, 1 — only the score of team matters even if I die).</p><p>Compared to AlphaGo lineage what I found interesting here is the <strong>generalization capability </strong>— the bots were able to play against humans (compete) as well as to play with humans (collaborate) in a mixed-team setup even though they’ve never seen that play-style during their long self-play careers.</p><p><a href="https://www.linkedin.com/posts/aleksagordic_openai-dota-2-activity-6780223921716289536-nuTj">In this LinkedIn</a> post, I’ve linked additional cool resources if you want to learn more about OpenAI Five. Now onto AlphaStar!</p><p>A similar story happened with StarCraft II and DeepMind’s <strong>AlphaStar </strong>bot. They trained AlphaStar using various RL and game-theory techniques — bunch of compute and engineering later it was beating the best humans at StarCraft II.</p><p>Arguably AlphaStar team tried really hard to make the game absolutely fair. The APM (action-per-minute) of their bot, the way it could see the world (initially it could see the complete map but later it could only see parts of the map — same as humans), etc. all mimicked the way humans play the game.</p><p>Again, if you’re interested here is a cool demonstration of the finals against one of the best StarCraft II players in the world (I watched the whole thing some time back and enjoyed it):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FcUTMhmVh1qs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DcUTMhmVh1qs&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FcUTMhmVh1qs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8856779c753c371ec645101ca4542b6/href">https://medium.com/media/a8856779c753c371ec645101ca4542b6/href</a></iframe><p>The main idea of the AlphaStar paper is the concept of the <strong>league of players</strong>, because the pure self-play, that worked so well with Go, lead to a circular progress (read no progress) whereby new agents can easily be exploited by simpler agents.</p><p>The league consists of:</p><ul><li>Main agents — these are the ones we ultimately care about</li><li>Main exploiters — their goal is to find the weaknesses of main agents</li><li>League exploiters — their goal is to find systematic weaknesses</li></ul><p>In the interplay of main agents with themselves (SP) with exploiters as well as with older agents (so as to minimize forgetting), in the so-called fictitious self-play (FSP) they grow very robust.</p><p>Check out <a href="https://www.linkedin.com/posts/aleksagordic_deepmind-starcraft-ii-demonstration-activity-6781148948552835072-yb_n">this LinkedIn post</a> for more details.</p><p>Personally, one thing that I find weird is that they haven’t tried to beat the best of the best player in the world — like in Go. I can only assume why that was, and I guess it has to do with resources — even DeepMind occasionally gets to taste the reality like we, mere mortals! 😅</p><p>Shifting the focus from games onto robotics here are some amazing things that happened in robotics — RL intersection!</p><h4>Robots, robots, robots 🤖</h4><p>Learning Dexterous In-Hand Manipulation by OpenAI (codenamed <em>Dactyl</em>): This is definitely one of the projects that sparked my love for RL!</p><p>The goal of the project was to orient a cube into a specified target orientation using a robotic hand (<a href="https://www.shadowrobot.com/dexterous-hand-series/">Shadow Dexterous Hand</a>) + RL.</p><p>Now the cool thing about it is that the RL agent was <strong>trained purely in a simulation</strong>, it was deployed to a real-world and it actually worked!</p><p>Check out this short demonstration:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FjwSbzNHGflM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DjwSbzNHGflM&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FjwSbzNHGflM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/205c5c587ee0817ac086198f9d89403e/href">https://medium.com/media/205c5c587ee0817ac086198f9d89403e/href</a></iframe><p>The main algorithmic idea behind it was to use heavy randomization during the simulation so that the real-world seems like yet another incarnation of a simulation (wait, is it not? laughs in <strong><em>Elon Musk</em></strong>).</p><p>In the follow-up work they managed to improve it so that it can solve the Rubik’s cube! One of my favorite papers ever, TBH. It was such a multi-faceted project — a combination of mechanical engineering, electronics, robotics, algorithms, computer vision, RL, you name it!</p><p>Now, be careful here, the feat is not solving the Rubik’s cube per see (they use an off-the-shelf solver for that), but dexterity/controlling the hand when you know on a high-level what your next steps are (e.g. rotate the upper face 90 degrees clockwise).</p><p>Check out this awesome short demonstration:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2Fx4O8pojMF0w%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3Dx4O8pojMF0w&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2Fx4O8pojMF0w%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a8b0eb4ecda27d04893d126486977d2/href">https://medium.com/media/8a8b0eb4ecda27d04893d126486977d2/href</a></iframe><p>They improve upon Dactyl by introducing an automatic domain randomization algorithm that automatically changes the ranges of randomization params in the simulation — like gravity.</p><p>It starts being calibrated to Earth (~9.81 m/s²) and depending on how much the policy is struggling the range will, eventually, expand to say 4–12 m/s². Thus this provides the agent with an implicit curriculum learning as the envs become harder and harder.</p><p>The agent had <strong>13 000 years of cumulative experience!</strong> (counting in all the compute needed for the hyperparam search, training, etc. and keeping in mind that 1 step of simulation corresponds to 80 ms).</p><p>The part that blew my mind about this paper was the <strong>emergent meta-learning behavior.</strong> The hand learned to encode the params of the environment it is in, directly into LSTM’s hidden state.</p><p>They tested this by deleting the state at one point of the execution and noticed how the hand takes longer to perform the next few steps and later catches up to its previous speed.</p><p>They also showed that they can infer env params (like the size of the cube, gravity, cube mass, etc.) through LSTM’s hidden space — again showing that the hand learns to encode the parameters of the env it is in!</p><p>Finally, check out this <a href="https://deepmind.com/blog/article/deepmind-ai-reduces-google-data-centre-cooling-bill-40">short blog</a> on how RL was used at Google to reduce the power consumption by a massive amount (~40%). The paper never came out and I’m decently sure that they needed to add bunch of hacks to make it work — so it’s not just RL that made this happen, keep that in mind.</p><p>You may have noticed that most of these accomplishments happened in the domain of super constrained problems like constrained robotics and board/video games, and you may have asked yourself why is that?</p><p>Well, that nicely brings us to the next section.</p><p>✅ Cool RL stuff (the WHY)</p><h3>RL is not only roses (RL ∉ {🌹, 🌸, 🌻})</h3><p>There are still many problems that are making it hard for RL to be useful outside of very controlled and/or simulated environments.</p><p>For start, RL is <strong>sample inefficient</strong>, a fancy way to say that RL requires a LOT of <strong>data </strong>&amp; <strong>compute </strong>for it to work. The original DQN agent required ~200M frames for every single Atari game!</p><p>Check out this blog by OpenAI to get a feeling for the compute needed for some of the agents I mentioned in the previous section:</p><p><a href="https://openai.com/blog/ai-and-compute/">AI and Compute</a></p><p>Pretty much only big tech companies can afford this much compute.</p><p>RL <strong>sucks at</strong> <strong>generalization</strong>. E.g. even MuZero has to be retrained from scratch for every single game in order for it to work. The fact that a MuZero agent can play <em>Breakout </em>on a super-human level<em> </em>doesn’t help it to learn to play <em>Pong </em>— which is weird, from the human perspective at least.</p><p>Somewhat related is this quote:</p><blockquote>Deep RL is popular because it’s the only area in ML where it’s socially acceptable to train on the test set. — <a href="https://twitter.com/jacobandreas/status/924356906344267776">Jacob Andreas</a></blockquote><p>Made me laugh the first time I read it. 😂 But it tells a story. We’re testing our agents on the very same environments in which we’re training them. How can we expect generalization to emerge? The lack of generalization in somewhat baked-in into the current deep RL paradigm.</p><p>Also, as I mentioned reward function design is hard, agents can learn pathological behaviors that don’t match the goal we envisioned, and even when they have a reward function that matches our goal they’ll often get trapped in a poor local optima.</p><p>Other than that RL agents are not very robust to changes in hyperparams, i.e. they are utterly <strong>unstable </strong>and thus the papers are <strong>hard to reproduce</strong>. Even a random seed can make a difference between your agent working and not!</p><p>Sometimes, just changing the random seed can make a difference between the agent learning how to accomplish a goal and it failing miserably.</p><p>Rather than trying to list everything that could go wrong I strongly recommend this blog by <a href="https://www.alexirpan.com/about/">Alex Irpan</a> who works at Google Brain on the Robotics team, he’s done the work for me (thanks Alex!):</p><p><a href="https://www.alexirpan.com/2018/02/14/rl-hard.html">Deep Reinforcement Learning Doesn&#39;t Work Yet</a></p><p>Read it carefully, and let it sink in.</p><p>All those problems make it hard to reproduce RL algorithms. The <em>“But it works on my machine”</em> force is especially strong in RL.</p><p>Lastly, here is a video by Joelle Pineau from FAIR/McGill additionally explaining some of the main problems that RL is facing:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FKee4ch3miVA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DKee4ch3miVA&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FKee4ch3miVA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9644eb289e7131ba147a2aa830f7320d/href">https://medium.com/media/9644eb289e7131ba147a2aa830f7320d/href</a></iframe><p>I had a first-hand experience with RL being hard to reproduce— I’m still debugging <a href="https://github.com/gordicaleksa/pytorch-learn-reinforcement-learning">my implementation of the DQN agent</a>, I’ll update the blog as soon as I get it working!</p><p><em>Note: TBH I wasn’t invested in it 100% because of the lack of time. But it definitely is harder than your average DL project, that much I can claim.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MrEx9-7wpp4HVJVs" /><figcaption>The “good” and “bad” sides of RL (Photo by <a href="https://unsplash.com/@worthyofelegance?utm_source=medium&amp;utm_medium=referral">Alex</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>Nice, you got the yin and yang perspective of RL!</p><p>Having hopefully answered the question <strong>WHY</strong>, let me give you the tips on <strong>HOW </strong>you can get started with RL.</p><p>✅ Problems with RL</p><h3>Getting started with RL 🚦</h3><p>By listing all the stuff in the previous sections you’ve already started getting familiar with RL. Here I’ll try to structure it in a way that’s more suitable for building up solid foundations — I’m going to give you a strategy that worked for me.</p><p>I’m a huge fan of the <strong>top-down approach</strong>. You should start with high-level resources such as high-level YT videos and blogs and slowly work your way all the way down to reading papers.</p><p>Related to that I think it’s super useful to <strong>get exposed to the terminology</strong> of the field early on, so that you can let it sink in. Many confusions happen just because we don’t know the actual language, the syntax.</p><p>Tips out of the way, let’s start!</p><p>Out of all the YT videos I’ve watched I’d start with these ones:</p><ul><li><a href="https://www.youtube.com/watch?v=zR11FLZ-O9M">Intro to Deep RL</a> and <a href="https://www.youtube.com/watch?v=nZfaHIxDD5w&amp;ab_channel=AlexanderAmini">Reinforcement Learning</a> from MIT</li></ul><p>They are very basic and nicely structured, next up I’d watch this one:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2F8EcdaCk9KaQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3D8EcdaCk9KaQ&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2F8EcdaCk9KaQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8864606b15d6334755ed3dbad7cc499/href">https://medium.com/media/d8864606b15d6334755ed3dbad7cc499/href</a></iframe><p><a href="https://www.youtube.com/watch?v=8EcdaCk9KaQ&amp;ab_channel=AIPrism">Nuts and Bolts of deep RL</a> by John Schulman from OpenAI will tell you about the common problems and strategies you could use to debug your RL algorithms.</p><p>In this stage of your learning process <strong>don’t beat yourself down</strong> for not understanding everything. Feel free to stop the video, google some concept and get right back into it. You should use the benefits modern tools provide us with.</p><p><strong>Never be passive while learning.</strong> Open up a OneNote (or whatever your favourite note app is) on the other screen and write down concepts you found important. I also found it useful to write down timestamps and make a comment, others and future me will be grateful.</p><p>Also if some parts of the video are already familiar, hit that playback speed button — I often watch content on 1.5-2x speed (especially if I’m already familiar with the topic).</p><p>The bottom line is — you shouldn’t be watching YouTube videos like you’re watching your favourite Netflix series. You’re trying to learn, remember?</p><p>Lastly, I found <a href="https://www.youtube.com/watch?v=8zLzGoTp-j4&amp;ab_channel=CreativeDestructionLab">this short video</a> by Pieter Abbeel interesting as it gave hints of what it takes to make RL actually work in the real world.</p><p>After the videos, go through some high-level blogs:</p><ul><li><a href="http://karpathy.github.io/2016/05/31/rl/">Pong from Pixels</a> — Karpathy, amazing as always. You’ll learn a lot from it.</li><li><a href="https://spinningup.openai.com/en/latest/spinningup/spinningup.html">Spinning Up</a> — getting started as an RL researcher, you’ll find some nice ideas in here as well!</li><li><a href="https://towardsdatascience.com/reinforcement-learning-101-e24b50e1d292">This</a> (get exposed to terminology), <a href="https://towardsdatascience.com/crystal-clear-reinforcement-learning-7e6c1541365e">this</a> (survey of RL) and <a href="https://towardsdatascience.com/snake-played-by-a-deep-reinforcement-learning-agent-53f2c4331d36">this</a> (build a simple snake app, nice ablations) to get you started reading about RL.</li></ul><p>Then go through some simple code. I strongly recommend that you <strong>get exposed to RL code</strong> early on in your learning process. Code can sometimes be the best explanation of the concept you’re trying to understand:</p><ul><li><a href="https://gist.github.com/karpathy/a4166c7fe253700972fcbc77e4ea32c5">Vanilla Policy Gradients</a> gist by Karpathy, and a <a href="https://www.youtube.com/watch?v=tqrcjHuNdmQ&amp;ab_channel=AIPrism">great accompanying video</a>, also <a href="https://medium.com/@dhruvp/how-to-write-a-neural-network-to-play-pong-from-scratch-956b57d4f6e0">this blog</a> as well as <a href="https://towardsdatascience.com/intro-to-reinforcement-learning-pong-92a94aa0f84d">this one</a> can further help you understand Karpathy’s Vanilla PG implementation.</li><li><a href="https://github.com/higgsfield/RL-Adventure">RL adventure</a> and <a href="https://github.com/higgsfield/RL-Adventure-2">RL adventure 2</a> — I’ve consulted the code snippets in these repos after reading a paper whenever there was an implementation of that paper. The code is often times overly simplistic, there are some bugs, but it paints an overall picture!</li></ul><p>Finally take 4–7 days to go through David Silver’s course:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2F2pWv7GOvuf0%3Flist%3DPLqYmG7hTraZDM-OYHWgPebj2MfCFzFObQ&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3D2pWv7GOvuf0&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2F2pWv7GOvuf0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e5ae74425a6b021373b371a97ec044a/href">https://medium.com/media/5e5ae74425a6b021373b371a97ec044a/href</a></iframe><p>After that you’ll have heard most of the fundamental RL algorithms, problems and terminology, and David is a great lecturer so I believe you’ll enjoy it.</p><p>A word of advice here, I’ve said 4–7 days since I don’t recommend you binge-watch all of these in a day or two (even though you could). You’ll simply forget everything, you have to let it sink in.</p><p>Same goes with anything, if you hit the gym and do 4 trainings in a day that won’t make you stronger that will probably get you injured. Doing 4 trainings over a week on the other hand can bring you some progress.</p><p>Finally you can watch this <a href="https://www.youtube.com/watch?v=PtAIh9KSnjo&amp;ab_channel=LexFridman">Deep RL</a> lecture by John Schulman (again)!</p><p><strong>Note:</strong> If you really know that RL is something you want to do for the years to come I’d strongly recommend the following. Instead of jumping into reading papers in the next section, I’d invest a month of my time and I’d go through the famous <a href="http://incompleteideas.net/book/RLbook2020.pdf">Sutton’s and Barto’s book</a> with a very intensive pace. IMHO, that’s a much better strategy than reading it over a prolonged period of time.</p><p>Sutton is one of the most influential figures in RL (if not THE most). They focus on the tabular RL case and will teach you all the necessary mathematics and formalism you need in order to deeply understand RL (no pun intended).</p><p>As an accompanying resource <a href="https://github.com/ShangtongZhang/reinforcement-learning-an-introduction">this repo</a> has solutions to all of the problems in the book. Do use it while reading the book — again it’s all about <strong>being active while learning</strong> if you want to be more productive.</p><p>Having said that, I personally haven’t read the book <strong>yet </strong>(I did go through all of the other resources I mention)<strong> </strong>and I didn’t notice any bigger problems reading through the papers in the next section. There were some papers which I had problems understanding but that’s normal!</p><p>✅ A high-mid level understanding of RL</p><h3>Let’s go deeper — reading papers</h3><p>Once you have the high-level overview of the field and the terminology in place it’s time to go deeper!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*KHwLllMNb1RPfDuWqSd6tw.png" /></figure><h4>Paper collection strategy 🔍</h4><p>I’ll tell you the approach I took researching RL!</p><p>I roughly found the <strong>biggest names</strong> in the field and I’ve collected their <strong>most cited papers</strong>. I then <em>sorted </em>them according to the <strong>time </strong>they were published. Finally, I roughly split those into 2 batches again according to the timestamp.</p><p>Some of the main names I used were:</p><ul><li><a href="https://scholar.google.com/citations?user=rLdfJ1gAAAAJ&amp;hl=en">Volodymyr Mnih</a> and <a href="https://scholar.google.com/citations?user=-8DNE4UAAAAJ&amp;hl=en">David Silver</a> from DeepMind</li><li><a href="https://scholar.google.com/citations?user=itSa94cAAAAJ&amp;hl=en">John Schulman</a> from OpenAI</li><li><a href="https://scholar.google.com/citations?user=8R35rCwAAAAJ&amp;hl=en">Sergey Levine</a> and <a href="https://scholar.google.com/citations?user=vtwH6GkAAAAJ&amp;hl=en">Pieter Abbeel</a> (now at Covariant) from Berkley</li></ul><p>Now this is far from perfect and if left like this it would bias me towards 2, 3 research groups (but frankly the <a href="https://en.wikipedia.org/wiki/Power_law#:~:text=In%20statistics%2C%20a%20power%20law,as%20a%20power%20of%20another.">power law</a> is real). But, along the way as I was reading through the papers I organically found some other interesting resources and I’ve added them to my list. That was the strategy I was using.</p><p>Also, I was lucky enough to be in an email correspondence with <a href="https://scholar.google.com/citations?user=f31mvPsAAAAJ&amp;hl=en">Charles Blundell</a> and <a href="https://scholar.google.co.uk/citations?user=kcTK_FAAAAAJ&amp;hl=en">Petar Veličković</a> from DeepMind 🧠. Charles shook up the list I compiled with the above strategy and proposed some other good papers.</p><p>Finally, here is a glimpse of how one of my directories with papers looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*WYFcznkUBYBazK3nDmGbFg.png" /><figcaption>RL papers I’ve read and had (almost haha) no difficulty understanding</figcaption></figure><p>I split the papers I read into the following groups:</p><ul><li>The ones I still <strong>haven’t read </strong>(currently empty)</li><li>The ones <strong>I’ve read and understood</strong></li><li>The ones <strong>I’ve read and had problems understanding</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*1W4IVuVczTzy_EUy_yCT7Q.png" /><figcaption>I found these harder to read at the time I read them. They were either super math-heavy, poorly written, lacked visualizations or I simply wasn’t ready to read them or burned out lol.</figcaption></figure><ul><li>The ones I’ve <strong>skimmed </strong>(only R2D2 paper)</li><li>And finally the <strong>miscelaneous read </strong>— those are the papers I read along the way even though they are not necessarily related to RL. These either help me catch up on the prerequisite knowledge or they help me keep up my energy levels high! 🍎</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*Lvg0FiLyQh2j4LVfDqOVFA.png" /><figcaption>miscelaneous read — mostly NAS papers but stuff like DeepBlue paper are also there, etc.</figcaption></figure><p>Also as you can notice the first group contains papers like “Concrete Problems in AI Safety” or Evolutionary Strategies paper which arguably belong to this miscelaneous group but yeah it’s not a deal breaker.</p><p>You can also see that I’ve organized papers by the timestamp. I guess there are also platforms which could do all of this for me but this just does the job.</p><p><em>Note: don’t worry about the specific papers I’ve listed in there, in the next section I’ll list everything that you really need.</em></p><p>Hopefully this glimpse into my mind helps you a bit. And now!</p><h4>RL papers list 📜📜📜</h4><p>Let me try to introduce some structure into a pile of RL papers that’s out there.</p><p><em>Note: I’ll label the papers I had hard time reading with (#hard-read). This doesn’t necessarily mean it’s hard — it was so for me given the context I had at the time.</em></p><p>You should probably start by reading the DQN paper (Mnih et al.) which was a huge breakthrough at the time. I read both the <a href="https://arxiv.org/abs/1312.5602">arxiv</a> (13&#39;) and <a href="https://storage.googleapis.com/deepmind-media/dqn/DQNNaturePaper.pdf">Nature</a> (15&#39;) versions, and I’ve covered DQN in this video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FH1NRNGiS8YU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DH1NRNGiS8YU&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FH1NRNGiS8YU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a1030276fb423ec63866d36723aafd5/href">https://medium.com/media/3a1030276fb423ec63866d36723aafd5/href</a></iframe><p><em>Note: If you want to get a feeling for how RL is used in other subfields, like in CV, check out </em><a href="https://arxiv.org/abs/1406.6247"><em>Recurrent Models of Visual Attention</em></a><em> which has a nice example of how RL could be used in vision to emulate the way humans parse the visual space around them (multiple fixations interspersed by saccades and information integration throughout). It uses the simple REINFORCE (policy gradient) algo.</em></p><p>After the DQN was published it literally created an ImageNet-like moment for the RL world. A lot of research happened trying to improve upon DQN. Here are some of those papers:</p><ul><li><a href="https://arxiv.org/abs/1507.06527">Deep Recurrent Q-Learning for Partially Observable MDPs </a>— instead of stacking frames why not integrate the information over single frames using some sort of memory, LSTM in the case of this paper. They showed this is a viable alternative and that the model gains better robustness if the quality of observations (game frames) changes during the game.</li></ul><p>The following papers led to the famous rainbow DQN paper:</p><ul><li><a href="https://arxiv.org/abs/1511.06581">Dueling Network Architectures for Deep Reinforcement Learning</a> — basic innovation lied in its <strong>dual-stream architecture</strong>, where one stream was estimating the <em>value-function</em>, the other one <em>normalized advantage function</em> and the fusion gave the <em>action-value</em> function.</li><li><a href="https://arxiv.org/pdf/1511.05952.pdf">Prioritized Experience Replay</a> — the main idea was to improve upon the uniform sampling of experience used in DQN’s replay buffer. Instead <strong>absolute TD-error</strong> was used <em>as a proxy</em> to choose pieces of experience which are the most valuable in the sense that they’ll accelerate learning.</li><li><a href="https://arxiv.org/abs/1509.06461">Deep Reinforcement Learning with Double Q-learning</a> — deals with overestimation of Q-values by the regular DQN by <strong>separating</strong> the <strong>selection </strong>and <strong>evaluation </strong>stages of DQN (the idea was actually proposed in a tabular setting years before).</li><li><a href="https://arxiv.org/abs/1706.10295">Noisy Networks for Exploration</a> — instead of using <em>epsilon-greedy</em> like the original DQN they baked the <strong>exploration noise</strong> directly into DNN layers.</li><li><a href="https://arxiv.org/abs/1707.06887">A Distributional Perspective on Reinforcement Learning </a>— instead of finding the expectation of the reward (point estimate) this paper proposes to keep the whole <strong>value distribution</strong> during the training. (#hard-read)</li></ul><p>And finally the rainbow DQN, <a href="https://arxiv.org/abs/1710.02298">“Rainbow: Combining Improvements in Deep Reinforcement Learning”</a>, which combined the above research in order to engineer the best-performing DQN-like model back in 2017.</p><p><strong>Learning tip:</strong> some of these papers use hardcore math and you may lack the intuition and fail to understand the mathematical formalism. Try and grasp the main idea, the semantics behind the paper if you’re having problems with the formalism. Watching YouTube videos before you start reading a paper is a strategy I sometimes find useful — although for most of these, unfortunately, it’s hard to find a (good) video.</p><p>Also if you feel you’re getting tired of the theory presented in a super formal way you need to find a way to bring your mental energy up! 🍎</p><p>Try reading up some interesting paper out of chronological order or watch an interesting video. I’d suggest you read this paper by Joshua Tennenbaum:</p><ul><li><a href="https://arxiv.org/abs/1604.00289">Building Machines That Learn and Think Like People</a></li></ul><p>If you’re passionate about the whole AGI endeavor it’ll provide you with some refreshment! Or go ahead and read something lightweight so that you think you’re smart (😂) like the <a href="https://arxiv.org/abs/1606.01540">OpenAI gym</a> paper. Power naps also help.</p><p>After that I’d recommend you read these papers from 2016:</p><ul><li><a href="https://arxiv.org/abs/1602.01783">Asynchronous Methods for Deep Reinforcement Learning</a> (A3C) — seminal paper, introduced the <strong>multi-threaded</strong> <em>advantage </em><strong>actor-critic</strong> setup. The parallel actors stabilize the training without any use of replay buffer. In RL scale plays an important role and so detaching from the single-threaded setup of DQN was very important.</li><li><a href="https://arxiv.org/abs/1509.02971">Continuous Control with Deep RL</a> (DDPG) — they generalize the success of DQN to the continuous domain such as robotics tasks using deterministic policy gradient + DNNs stabilized via similar ideas like DQN. It’s an actor-critic algorithm as well.</li><li><a href="https://arxiv.org/abs/1604.06778">Benchmarking Deep RL for Continuous Control</a> — (introduces RLLib and gives a nice overview of the common tasks and overview and comparison of RL agents like TRPO, DDPG).</li></ul><p>I’d wrap up this part with <a href="https://arxiv.org/abs/1611.05397">“RL with Unsupervised Auxiliary Tasks”</a> (UNREAL agent) paper. The main idea is to cope with the sparse reward problem that RL agents are facing. So aside from maximizing the cumulative reward (extrinsic) they introduce pseudo-rewards (intrinsic) given by unsupervised <strong>auxiliary tasks</strong> like learning to maximize the pixel intensity over the input image (as a proxy to an important event in the env). It drastically improved the sample efficiency of A3C agent (~10x less data).</p><p>Now, If you’re like me one of the papers you were excited to understand is AlphaGo:</p><ul><li><a href="https://vk.com/doc-44016343_437229031?dl=56ce06e325d42fbc72">Mastering the Game of Go with DNNs and Tree Search</a></li></ul><p>It is one of those projects which couldn’t have been accomplished using any other method, where RL really shined to its fullest!</p><p>I’ve covered it in this video as well:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FZ1BELqFQZVM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DZ1BELqFQZVM&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FZ1BELqFQZVM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/779a9e3631056e7a81b7c0afef6f8683/href">https://medium.com/media/779a9e3631056e7a81b7c0afef6f8683/href</a></iframe><p>Yes, I love this picture with those glorious mustaches. Now let’s continue.</p><p>One of the main components of AlphaGo is <strong>Monte Carlo Tree Search</strong> or <strong>MCTS </strong>for short. If you’re not familiar with it I found <a href="https://www.youtube.com/watch?v=UXW2yZndl7U&amp;ab_channel=JohnLevine">this video</a> was great at explaining it.</p><p>While the AlphaGo knowledge is still fresh in your mind you can go ahead and read the whole saga (for my CS nerds: before any <em>context switching</em> occurs!):</p><ul><li><a href="http://augmentingcognition.com/assets/Silver2017a.pdf">Mastering the Game of Go without Human Knowledge</a> (AlphaGo Zero )— a step towards more general RL agents, it ditched the SL part of training that relied on human play datasets and focused purely on the self-play.</li><li><a href="https://arxiv.org/abs/1712.01815">Mastering Chess and Shogi by Self-Play with a General RL Algorithm</a> (AlphaZero )— further generalized the algorithm to play Chess and Shogi.</li></ul><p>Here is a video covering both papers (since they’re very similar):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2F0slFo1rV0EM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3D0slFo1rV0EM&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2F0slFo1rV0EM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4347bc03aab08c0d8bf7a460e9dfacdb/href">https://medium.com/media/4347bc03aab08c0d8bf7a460e9dfacdb/href</a></iframe><p>And finally, MuZero which additionally learned to play the Atari games as well as the <strong>rules of the game!</strong></p><ul><li><a href="https://arxiv.org/pdf/1911.08265.pdf">Mastering Atari, Go, Chess and Shogi by Planning with a Learned Model</a></li></ul><p>The part with how the hell can it learn the rules of the game used to bug me, I’ve explained the paper as well as that specific part in this video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FmH7f7N7s79s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DmH7f7N7s79s&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FmH7f7N7s79s%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b949a29923193285f66e2876cc77b17/href">https://medium.com/media/8b949a29923193285f66e2876cc77b17/href</a></iframe><p>There are many additional cool resources out there on AlphaGo lineage of agents. I’d recommend reading all of DeepMind’s blogs you can find like the one on <a href="https://deepmind.com/blog/article/muzero-mastering-go-chess-shogi-and-atari-without-rules">MuZero</a> and this one on <a href="https://deepmind.com/blog/article/alphago-zero-starting-scratch">AlphaGo Zero</a>.</p><p>After getting back from this tour of the AlphaGo world you can now return back to reality and start reading RL papers for mere mortals. Here are some additional papers you should read:</p><ul><li><a href="https://arxiv.org/abs/1609.05143">“Target-driven Visual Navigation in Indoor Scenes using Deep RL”</a> — the cool thing about this paper is that they try to tackle the <strong>generalization </strong>problems present in RL. Instead of baking the goal directly into DNN’s parameters they can flexible change the goal — the target location where they want the robot to go. They test the agent in progressively harder generalization tasks. Kudos.</li><li><a href="https://arxiv.org/pdf/1707.02286.pdf">“Emergence of Locomotion Behaviours in Rich Environments”</a> (aka DeepMind parkour paper) —instead of reward shaping they show that the agents can learn interesting behavior on their own when given progressively harder environments (implicit curriculum learning). Definitely check out this paper and the video below:</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2Fhx_bgoTF7bs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3Dhx_bgoTF7bs&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2Fhx_bgoTF7bs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2f1360992533f863cafd71258c82987/href">https://medium.com/media/b2f1360992533f863cafd71258c82987/href</a></iframe><ul><li><a href="https://arxiv.org/abs/1707.01495">Hindsight Experience Replay</a> (HER) — similarly to UNREAL they tackled the sparse reward problem. The main idea is the following, say you want your robot to move to a position (x1, y1) but it instead moved to (x2, y2). Instead of dropping this trajectory you can do the following, imagine your goal was precisely (x2, y2) that means that whatever robot did was correct we just need to change the goal post hoc! Hence the “hindsight” part.</li><li><a href="https://arxiv.org/abs/1705.05363">Curiosity-driven Exploration by Self-supervised Prediction</a> — proposes the <em>Intrinsic Curiosity Module</em> which acts as a source of intrinsic reward (extrinsic reward comes from the environment like in Atari the score you get after every move, intrinsic comes from well, within). Check out <a href="https://www.linkedin.com/posts/aleksagordic_i-love-the-interplay-between-psychologyneuroscience-activity-6774789693604208640-iNrz">this post</a> for more details.</li><li><a href="https://discovery.ucl.ac.uk/id/eprint/10083557/1/1708.05866v2.pdf">Survey of RL</a> — you should occasionally read these to get the breadth and organic growth of your paper list as you’re learning. Just be careful not to inflate your list just for the sake of it. (Charles recommended this one)</li></ul><p>Finally before you get to the arguably most popular and interesting RL projects (aside from AlphaGo) you’ll need to read 3 more papers:</p><ul><li><a href="https://arxiv.org/abs/1707.06347">Proximal Policy Optimization</a> (PPO, OpenAI) — very impactful paper used in many RL papers. Even DeepMind parkour paper used it. OpenAI used it for OpenAI Five bot and robotic hand project.</li><li><a href="https://arxiv.org/abs/1703.06907">Domain randomization</a> paper from OpenAI — showed how smart randomization in a simulation can help models generalize fairly well to the real-world.</li><li><a href="https://arxiv.org/abs/1802.01561">IMPALA</a> (DeepMind) — used in e.g. AlphaStar. Allows for amazing scalability, more compute = more results, remember? 😅</li></ul><p>Skill unlocked. Given infinite compute you could now solve anything in this world! That’s just an implementation detail, it shouldn’t be a deal-breaker…</p><p>Right?</p><p>Now, you could first research the <strong>AlphaStar saga</strong> by reading these 2 papers:</p><ul><li><a href="https://arxiv.org/abs/1708.04782">StarCraft II: A New Challenge for RL</a> — describes the API and some details you’ll find useful reading the AlphaStar paper I suggest you at least skim it.</li><li><a href="https://www.nature.com/articles/s41586-019-1724-z.epdf?author_access_token=lZH3nqPYtWJXfDA10W0CNNRgN0jAjWel9jnR3ZoTv0PSZcPzJFGNAZhOlk4deBCKzKm70KfinloafEF1bCCXL6IIHHgKaDkaTkBcTEv7aT-wqDoG1VeO9-wO3GEoAMF9bAOt7mJ0RWQnRVMbyfgH9A%3D%3D">Grandmaster level in StarCraft II using multi-agent RL</a> (AlphaStar)</li></ul><p>After you’ve read through the AlphaGo and AlphaStar papers I’d also recommend <a href="https://www.youtube.com/watch?v=x5Q79XCxMVc&amp;ab_channel=LondonMachineLearningMeetup">this video</a> by David Silver.</p><p>Next up you could investigate <strong>OpenAI’s robotic hand saga</strong>, start with the official blogs <a href="https://openai.com/blog/learning-dexterity/">Dactyl</a> and <a href="https://openai.com/blog/solving-rubiks-cube/">Rubik</a>. I also covered both of these in this video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FeTa-k1pgvnU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DeTa-k1pgvnU&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FeTa-k1pgvnU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/86342387779066b9c4d8b8d2e405e0ce/href">https://medium.com/media/86342387779066b9c4d8b8d2e405e0ce/href</a></iframe><p>as well as <a href="https://www.youtube.com/watch?v=zORaE0v6QBA&amp;ab_channel=MLinPL">this one</a> by Marcin Andrychowicz, one of the co-authors from OpenAI.</p><p>and only then head over and read the actual papers (remember? top-down):</p><ul><li><a href="https://arxiv.org/abs/1808.00177">Learning Dexterous In-Hand Manipulation</a> (Dactyl)</li><li><a href="https://arxiv.org/abs/1910.07113">Solving Rubik’s Cube with a Robot Hand</a></li></ul><p>Last but not least OpenAI Five!</p><ul><li><a href="https://arxiv.org/pdf/1912.06680.pdf">Dota 2 with Large Scale Deep Reinforcement Learning</a></li></ul><p>I wrapped up my RL exploration with Agent 57 lineage. The first RL agent to crack (go above the human baseline) all of the 57 Atari games, including Pitfall, Solaris, Skiing and Montezuma’s revenge:</p><p><a href="https://deepmind.com/blog/article/Agent57-Outperforming-the-human-Atari-benchmark">Agent57: Outperforming the Human Atari Benchmark</a></p><p>Search for the blogs and read these papers (Agent 57 builds right on top of R2D2 and NGU so make sure to check those out):</p><ul><li><a href="https://openreview.net/pdf?id=r1lyTjAqYX">Recurrent Experience Replay in Distributed RL</a> (R2D2)</li><li><a href="https://arxiv.org/abs/2002.06038">Never Give Up: Learning Directed Exploration Strategies</a> (NGU)</li><li><a href="https://arxiv.org/abs/2003.13350">Agent57: Outperforming the Atari Human Benchmark</a></li></ul><p>Charles Blundell, the co-author, covered these beautifully in this video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FVQEg8aSpXcU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DVQEg8aSpXcU&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FVQEg8aSpXcU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/07735e4c07655d013b04f08a20b55818/href">https://medium.com/media/07735e4c07655d013b04f08a20b55818/href</a></iframe><p>Also, something from 2021, the recently published Dreamer v2 is the first <em>single-threaded, model-based</em> agent that outperformed the Rainbow DQN that took years of incremental research to craft:</p><p><a href="https://ai.googleblog.com/2021/02/mastering-atari-with-discrete-world.html">Mastering Atari with Discrete World Models</a></p><p>Check out the paper here:</p><ul><li><a href="https://arxiv.org/abs/2010.02193">Mastering Atari with Discrete World Models</a> (Dreamer v2)</li></ul><p>Yannic Kilcher also made a nice <a href="https://www.youtube.com/watch?v=o75ybZ-6Uu8">video</a> on it.</p><p>Wrapping up, I’ve skipped some papers which are more theoretical, harder to read, and not necessarily needed in order to understand the resources I’ve linked above, but are still a good read!</p><ul><li><a href="https://arxiv.org/abs/1802.09477">Addressing Function Approximation Error in Actor-Critic Methods</a> (TD3) tackled the overestimation bias in TD methods that was present in the continuous action spaces with actor-critics (similar to what double DQN paper did for the discrete action spaces).</li><li><a href="https://arxiv.org/abs/1606.01868">Unifying Count-Based Exploration and Intrinsic Motivation</a> — another intrinsic motivation method, achieved great results with Montezuma’s Revenge at the time.</li><li><a href="https://arxiv.org/abs/1506.02438">High-Dimensional Continuous Control Using Generalized Advantage Estimation</a> — introduces GAE a novel RL method that pulled ideas from TD(lambda) and TRPO to cope with data efficiency and stability.</li><li><a href="https://arxiv.org/abs/1502.05477">Trust Region Policy Optimization</a> (TRPO)— PPO simplified it and since then I haven’t seen TRPO mentioned a lot (I may be wrong!). <a href="https://spinningup.openai.com/en/latest/algorithms/trpo.html">This blog</a> by OpenAI helped me better understand it.</li><li><a href="https://arxiv.org/abs/1504.00702">End-to-End Training of Deep Visuomotor Policies</a> and <a href="https://graphics.stanford.edu/projects/gpspaper/gps_full.pdf">Guided Policy Search </a>— lots of robotics/control theory inside that’s what makes it a harder read I have little experience with those subfields.</li><li><a href="http://proceedings.mlr.press/v32/silver14.pdf">Deterministic PG</a> — devised a method that outperforms its stochastic counterparts in high-dimensional, continuous action spaces. And it’s much more efficient as well.</li></ul><p>✅ RL papers!</p><p>And now, as always, I’m a big fan of actually coding something up and not just focusing on the theory and papers. <strong>The devil is in the details </strong>as they say!</p><p>Here are some learnings from the DQN project I did!</p><h3>Deep Q-Network project from scratch</h3><p>I didn’t have that much time lately to focus on the project but nonetheless, I can say that debugging and creating RL projects is <strong>harder than your average ML project</strong> — for the same reasons mentioned in the “RL is not only roses” section.</p><p>Nonetheless I learned a lot! And I’ll keep doing so until the project is done! ❤️</p><p>You can check out the project here:</p><p><a href="https://github.com/gordicaleksa/pytorch-learn-reinforcement-learning">gordicaleksa/pytorch-learn-reinforcement-learning</a></p><p>Here are some of the problems off the top of my head which I’ve encountered with OpenAI’s gym library:</p><ul><li>Had to downgrade to 0.17.3 because Monitor had a video recording bug</li><li>Installing atari on Windows is not smooth but there is a <a href="https://stackoverflow.com/questions/42605769/openai-gym-atari-on-windows">simple workaround</a>.</li><li>You sometimes need to dig into <a href="https://github.com/openai/gym/issues/1280">issues</a> and source code, e.g. to figure out those cryptic env naming conventions like <em>“PongNoFrameskip-v4”.</em></li><li>Gym random seeds <a href="https://harald.co/2019/07/30/reproducibility-issues-using-openai-gym/">do not work as expected.</a></li><li>Gym’s atari preprocessing has no frame-stacking, it’s simply a max-pooling over the last 2 observations.</li></ul><p>And there are some problems with all of the DQN implementations that I’ve looked at in general:</p><ul><li>Toy replay buffer — saving (1M, 4, 84, 84) bytes instead of (1M, 1, 84, 84 (even <em>stable baselines 3</em> is having problems with replay buffer! — <a href="https://github.com/DLR-RM/stable-baselines3/issues/387">my issue</a>)</li><li>Most of the repos don’t have a readme stating the achieved results. Have they managed to get results comparable to the published results?</li></ul><p>Debugging this thing is hard and slow. It takes me ~5 days to train the DQN on my machine (although I may have a bug) and so I understand why regular people haven’t been posting their results — they probably haven’t achieved the published results in the first place.</p><p>Check out <a href="https://www.linkedin.com/posts/aleksagordic_deeplearning-project-update-activity-6786939777359912960-ETeR">this LinkedIn post</a> for more rant! ❤️</p><p>Another great blog with which I can now completely relate to is <a href="http://amid.fish/reproducing-deep-rl">this one</a> by Amid Fish on reproducing deep RL projects.</p><p><em>Note: If you want to understand Atari preprocessing a bit better check out </em><a href="https://danieltakeshi.github.io/2016/11/25/frame-skipping-and-preprocessing-for-deep-q-networks-on-atari-2600-games/"><em>this blog</em></a><em>.</em></p><p>I’ll update this section of the blog as soon as I get it working.</p><p>✅ DQN project</p><h3>My next steps</h3><p>If you stuck with me until here, <strong>congrats! </strong>❤️</p><p>Hopefully this blog will inspire you to take your first step into the world of reinforcement learning! Or in general, I hope it’ll motivate you to keep self improving and learning every single day!</p><p>One thing you’ll notice after studying RL for a while is how many related subfields there are like (similarly to Graph ML):</p><ul><li><strong>AI safety </strong>— imagine this example: <em>A robot knocks over a vase because it learned that it can move a box faster to another location by doing that. Can we achieve the goal without specifying EVERYTHING that the robot SHOULDN’T do?</em> Those are the types of problems we have to think about. You could start exploring this field by reading the <a href="https://arxiv.org/abs/1606.06565">Concrete Problems in AI Safety</a> paper from OpenAI. Check out my <a href="https://www.linkedin.com/posts/aleksagordic_papersummary-ai-aisafety-activity-6774020416982835200-Hp6d">summary.</a></li><li>Robotics and <strong>control theory</strong> in particular</li><li><strong>Inverse RL</strong> and <strong>Imitation Learning</strong></li><li><strong>NAS (neural architecture search) </strong>— the <a href="https://arxiv.org/abs/1611.01578">original NAS paper</a> used RL. Since then other more compute-efficient methods have been advised but RL still has its place in the NAS subfield. I did a “detour” into the NAS field and I enjoyed it, here are some seminal papers you should read: NASNet, MnasNet, Efficient Net v1 and v2 (just recently published!), NAS survey paper, MIT OFA, Mnet v1, v2, v3, DARTS and <a href="https://www.youtube.com/watch?v=wL-p5cjDG64&amp;ab_channel=MicrosoftResearch">this video</a> and this <a href="https://heartbeat.fritz.ai/research-guide-for-neural-architecture-search-b250c5b1b2e5">high-level overview.</a> Also, I’ve recently covered Efficient v2 in this video:</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FCTsSrOKSPNo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DCTsSrOKSPNo&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FCTsSrOKSPNo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2aef0bd5611a23ef194e3886f28b4ecb/href">https://medium.com/media/2aef0bd5611a23ef194e3886f28b4ecb/href</a></iframe><ul><li><strong>Evolutionary algorithms </strong>—An alternative to RL, a type of black-box optimization method, i.e. you don’t need to know the exact structure of your loss function (like you need to when you do backprop). Perturbing the weights, evaluating them in the environment and forming a weighted average using those weights and rewards leads to better agents. <a href="https://arxiv.org/abs/1703.03864">Evolution strategies</a> paper is a good starting point and <a href="https://www.linkedin.com/posts/aleksagordic_evolution-strategies-as-a-scalable-alternative-activity-6777897780762488832-XrOU">my summary</a>. <a href="https://openai.com/blog/evolution-strategies/">This blog</a> as well+ code snippets should be enough to get you started.</li></ul><p>Also if you’re super curious and you want to understand more about this great moment from the game history skim the <a href="https://core.ac.uk/download/pdf/82416379.pdf">DeepBlue paper</a>. I’ve made a summary in this <a href="https://www.linkedin.com/posts/aleksagordic_chess-deepblue-ai-activity-6777693750358523904-PXxf">LinkedIn post</a> as well.</p><p>And as I said in my previous blog, I’ll tell you that exploring can feel overwhelming at times. You think you’re starting to grasp everything and all of a sudden a whole new subfield emerges. And I’ve been doing this for a while after I’ve finished my EE studies. So take your time and try to enjoy the process!</p><p>As for my next steps, I now feel I’m ready to start keeping up with SOTA across different AI subfields. That means that I’ll completely focus on building the <strong>AI community</strong> of people passionate about AI and tech in general.</p><p>I’ll:</p><ul><li>Start keeping up with the newest stuff in AI on a daily basis. My plan is to invest 3x15 mins daily to skim Twitter, LinkedIn and Facebook groups for AI news, which I almost never have the time to do. Consequently I’ll read the SOTA papers as they come out and I’ll cover them more regularly on my YT channel.</li><li>Make regular (hopefully daily) paper/AI news overviews on Twitter and LinkedIn so if that’s something of interest to you feel free to follow me/connect with me there!</li><li>Periodically (every 2–3 months) develop my own interesting and creative AI projects instead of implementing other people’s work.</li><li>Occasionally write on Medium, especially when I have something super interesting to tell you or something long-form.</li></ul><p>There is one more thing that I’m currently working on, which I can’t yet share, but I’m super, super excited about it. Hopefully, I’ll soon be able to share it! If that happens I can only tell you it’ll be a dream come true for me pretty much.</p><p>Hopefully, this inspires you to start creating your own plans and to keep on (deep) learning!</p><p><strong>If there is something you would like me to write about — </strong><em>write it down in the comment section or send me a DM, I’d be glad to write more about maths, statistics, ML &amp; deep learning, computer science, how to land a job at a big tech company, how to prepare for an ML summer camp, anything that could help you.</em></p><p><em>Also feel free to drop me a message or:</em></p><ol><li>Connect and reach me on<strong> </strong>💡 <a href="https://www.linkedin.com/in/aleksagordic/"><strong>LinkedIn</strong></a><strong> </strong>and <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a></li><li>Subscribe to my 🔔 <a href="https://www.youtube.com/c/TheAiEpiphany"><strong>YouTube channel</strong></a> for AI-related content️</li><li>Follow me on 📚 <a href="https://medium.com/@gordicaleksa"><strong>Medium</strong></a><strong> </strong>and 💻<a href="https://github.com/gordicaleksa"><strong>GitHub</strong></a></li><li>Subscribe to my 📢 <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a> and join the 👨‍👩‍👧‍👦 <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community!</li></ol><p>And if you find the content I create useful <a href="https://www.patreon.com/theaiepiphany"><strong>consider becoming a Patreon!</strong></a></p><p>Much love ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4922fafeaf8c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to get started with Graph Machine Learning]]></title>
            <link>https://gordicaleksa.medium.com/how-to-get-started-with-graph-machine-learning-afa53f6f963a?source=rss-37f02ae83e8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/afa53f6f963a</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[graph-theory]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[graph-neural-networks]]></category>
            <category><![CDATA[graph-machine-learning]]></category>
            <dc:creator><![CDATA[Aleksa Gordić]]></dc:creator>
            <pubDate>Sun, 07 Feb 2021 14:48:28 GMT</pubDate>
            <atom:updated>2024-11-01T12:52:55.802Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*1Po8c1FmRyUv1eqgF6rlsA.png" /><figcaption>by <a href="http://hal.elte.hu/~nepusz/">Tamas Nepusz</a>, co-creator of <a href="https://igraph.org/">igraph</a></figcaption></figure><p>This blog is a part of my <strong>“deep learning update”</strong> series and I want to open it up with a question: What have I learned about Graph ML in 2+ months?</p><p><strong>Nothing? </strong>If that was your first thought, no worries, it’s probably true. 😅</p><p>(Bad) jokes aside, my “relative knowledge” (the knowledge I “possess” vs the knowledge I’m aware of) is asymptotically approaching <strong>0</strong> whereas my “absolute knowledge” did grow by quite a lot over the last 2 months.</p><p>But you never see all the amazing things you’ve learned, you see that <strong>0</strong>. You have that weird feeling that <strong>0</strong> is staring at you. At least I have it, sometimes.</p><p>It’s always like that. You approach a new field and you have this delusional feeling that you’ll only need to learn A (e.g. word2vec/node2vec), B (e.g. GPT/GCN), and C (e.g. BERT/GAT) and you’ll master the field.</p><p>It’s finite. You can complete it. It’s like a game.</p><p>But, as you keep on learning and exploring you discover a whole new world of <em>ideas </em>and <em>terminology</em>, of <em>people</em> and <em>history</em>. And that feeling is beautiful and frightening at the same time, and I assume it’s the reason many people give up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fXDJguwf4pUr1u4d" /><figcaption>Photo by <a href="https://unsplash.com/@danielkcheung?utm_source=medium&amp;utm_medium=referral">Daniel Cheung</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Research and learning can get intimidating because it makes you feel so small. The best advice I can give you is — <strong>never give up</strong>. I mean it. I’ll delete your GitHub (or Fortnite?) account if you do. I swear.</p><p>Nice, after giving you a micro-existential crisis and then bringing you up ❤️ , let us continue.</p><p>If you were following along my journey you knew that I’m going to tackle Graph ML next. In my last <a href="https://gordicaleksa.medium.com/deep-learning-journey-update-what-have-i-learned-about-transformers-and-nlp-in-2-months-eb6d31c0b848">blog update on transformers</a>, 2 months ago, I mentioned that my next field of exploration is Graph ML, so here we are.</p><p>But first, <strong>what is Graph ML?</strong></p><p>Simply put Graph ML is a branch of machine learning that deals with graph data. <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">Graphs</a> consist of <strong>nodes</strong>, that may have feature vectors associated with them, and <strong>edges</strong>, which again may or may not have feature vectors attached.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*mF-9G1qBQk4C1YtV.png" /><figcaption>World smallest graph 😜 (<a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)">Wikipedia</a>)</figcaption></figure><p>Graphs come in different kinds, we can have <strong>undirected </strong>and <strong>directed </strong>graphs, <strong>multi</strong> and <strong>hypergraphs</strong>, graphs with or without <strong>self-edges</strong>. There is a whole field of mathematics aptly named <a href="https://en.wikipedia.org/wiki/Graph_theory"><em>graph theory</em></a> that deals with graphs.</p><p><em>And you don’t need to know all of the above definitions for now.</em></p><p><strong>Graph data is abundant</strong> all around us. You name it! Social networks are obviously graphs, molecules can be represented as graphs (atoms are nodes and bonds are edges), any kind of interaction in physics can be modeled as a graph, and so forth!</p><p>So <strong>what </strong>can we do with graphs?</p><p>Common tasks include graph classification/regression and node/edge classification/regression. Talking about abstraction, right? 😅</p><p>Let me make one of these less abstract. Maybe the nodes in your graphs are <strong>tweets </strong>and you want to regress the <em>probability </em>that a certain tweet is <strong>spreading fake news</strong>. Your model would associate a number between 0 and 1 to that node and that would be an example of a node regression task.</p><p>But <strong>how </strong>do we do that?</p><p>Usually, we have neural networks that deal with graphs and we call these Graph Neural Networks (I’m simplifying it a little bit for now). It’s ok not to understand how exactly these work for the time being, just stick with me.</p><p>Now let me tell you why you should learn more about this field. ❤️🌍</p><blockquote>Personal update: just created a <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a><strong> </strong>and a <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community! Subscribe/join those to keep in touch with the latest &amp; greatest AI news!</blockquote><h3>The awesome world of Graph ML</h3><p>There are so many exciting applications. I mean it. I’ve never seen a field with this many exciting applications!</p><p>All throughout science, you’ll find GNNs (Graph Neural Networks) being deployed as we speak. Anything you can model as a graph (and that’s pretty much everything! 😅) and you can throw a GNN at it. 💻</p><p>Massive-scale recommender systems, particle physics, computational pharmacology/chemistry/biology, traffic prediction, fake news detection, and the list goes on and on.</p><p>You still don’t believe me? That’s great. I don’t want you to take my word for granted, you’re a <em>critical thinker</em> let me prove it to you!</p><p><a href="https://eng.uber.com/uber-eats-graph-learning/">Uber Eats</a> <a href="https://www.linkedin.com/posts/aleksagordic_food-discovery-with-uber-eats-using-graph-activity-6749029088935129088-Sm5M">uses GNNs</a> to recommend you food and restaurants.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*RmiOFIsDQTn_oT843LsRWg.png" /><figcaption>Food discovery with Uber Eats: Using Graph Learning to Power Recommendations</figcaption></figure><p>Pinterest deployed <a href="https://medium.com/pinterest-engineering/pinsage-a-new-graph-convolutional-neural-network-for-web-scale-recommender-systems-88795a107f48">PinSage GNN</a> at least 2 years ago to their platform and it’s now <a href="https://www.linkedin.com/posts/aleksagordic_pinsage-a-new-graph-convolutional-neural-activity-6747234423420305408-Co0g">curating your homefeed</a> and it’s suggesting you the most relevant pins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Ensl00yDOk_KTda4" /><figcaption>PinSage: A new graph convolutional neural network for web-scale recommender systems</figcaption></figure><p>Twitter uses <a href="https://www.linkedin.com/posts/aleksagordic_fakenews-socialmedia-twitter-activity-6754862711273738241-_Z6H">GNNs</a> to <a href="https://arxiv.org/abs/1902.06673">detect (and hopefully filter out) fake news</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*L0XGqjcZp8i-pjsK" /><figcaption>The reliable users are colored in blue and the unreliable ones (prone to spreading fake news) in red.</figcaption></figure><p>This is possible thanks to the fact that fake and real news spread differently on social media! We can thus exploit the propagation pattern of fake news over time as a valuable signal.</p><p>On the above image, you can notice an interesting pattern that likely-minded people tend to cluster together — nothing new there 😎. When the graph has that property (connected nodes share a similar label) we call it homophilic (from Ancient Greek: <em>“homos”-</em>same, <em>“philie”</em>- love/friendship).</p><p>Let’s continue on into fundamental science!</p><p>We’re <a href="https://arxiv.org/abs/1809.06166">detecting neutrino particles</a> on the South Pole at the IceCube lab, and we’re classifying them <a href="https://www.linkedin.com/posts/aleksagordic_neutrino-measuring-the-unexpected-icecube-activity-6751232739476869120-isF4">using GNNs</a>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*IsS1cMbeuHLWVxrM.jpg" /><figcaption><a href="https://www.youtube.com/watch?v=iv-Rz3-s4BM&amp;ab_channel=IceCubeNeutrinoObservatory">Neutrino, measuring the unexpected — IceCube</a></figcaption></figure><p><a href="https://en.wikipedia.org/wiki/IceCube_Neutrino_Observatory">IceCube </a>is a 1 km3 neutrino observatory located at the South Pole and its primary purpose is to look for high-energy (above 100 gigaelectronvolts (GeV)) neutrinos!</p><p>It basically consists of a hexagonal grid of light-sensitive sensors that capture the <a href="https://en.wikipedia.org/wiki/Cherenkov_radiation">Cherenkov light</a> emerging from the interactions between charged particles with the ice.</p><p>You can <em>nicely model this sensor structure as a graph</em>! Each light sensor is a vertex and it has associated with it a 6-dimensional feature vector (3 XYZ coordinates + some energy and time of arrival information).</p><p>But let’s leave the tech details for a bit later and continue the Odyssey. ❤️</p><p>We can use GNNs to <a href="https://www.nature.com/articles/s41598-019-45349-y">help beat cancer</a>! By taking the protein/gene and drug interaction data and modeling the problem as a graph and throwing some <a href="https://www.linkedin.com/posts/aleksagordic_cancer-gnns-deeplearning-activity-6755122145430433793-XXeC">GNN weaponry</a> at it we can find a list of molecules that help beat/prevent cancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/0*NNWWb2RDjieKYqIW" /><figcaption>HyperFoods: Machine intelligent mapping of cancer-beating molecules in foods (the bigger the node the more diverse the set of CBMs)</figcaption></figure><p>Once we have the most effective CBMs (cancer-beating molecules) we can create a map of foods that are richest in these CBMs, also called <strong>hyperfoods</strong>.</p><p>Here is a TL;DR: the hyperfoods are: tea, grape, carrot, coriander, sweet orange, dill, cabbage, and wild celery.</p><p>But, don’t overdose with these, I beg you! 😂</p><p>I know I started drinking green tea regularly after reading this paper. Who says that reading research papers is not healthy!? 🍎</p><p>On a side note, I take my nutrition very seriously. I’m regularly pushing both my body (I lift weights, etc.) and my mind to its limits so it’s very important to think of the recovery and rest as well. High quality sleep, omega-3s, nuts, vitamin D, green tea are some of my tricks.</p><p>But if you’re not a fan of nutrition (and causality in general 😜) then the following research may excite you even more — <a href="https://academic.oup.com/bioinformatics/article/34/13/i457/5045770">predicting (polypharmacy) drug side effects</a> <a href="https://www.linkedin.com/posts/aleksagordic_gnns-polypharmacy-drugs-activity-6751820089579896832-ZIw4">using GNNs</a>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Wfx13ncLOQwKKoIB" /><figcaption>Modeling polypharmacy side effects with graph convolutional networks</figcaption></figure><p>Polypharmacy (using multiple drugs at the same time) side effects is something pretty much everyone will experience and we know that our grandparents are already experiencing it.</p><p>We basically can’t tell with certainty what will happen to you if you take 2+ random drugs.</p><p>Experimentally screening every single combination of drugs for side-effects is impossible due to the combinatorial nature of the problem — so computational methods such as GNNs to the rescue!</p><p>Aside from the polypharmacy side effects problem we’re facing an ever-growing threat from antibiotic-resistant bacteria that are evolving thanks to our irresponsible use of antibiotics.</p><p>Earlier in 2020, a super famous application of GNNs was published in Cell — <a href="https://www.sciencedirect.com/science/article/abs/pii/S0092867420301021">A deep learning approach to antibiotic discovery</a>.</p><p><em>Note: no free-access pdf, unfortunately (afaik), which makes me sad</em></p><p>Basically, by training a GNN on a dataset of molecules known to inhibit the growth of <a href="https://en.wikipedia.org/wiki/Escherichia_coli">Escherichia coli</a>, and later doing inference on a dataset of drugs under investigation, they “discovered” halicin-a molecule previously tested for its anti-diabetic properties now repurposed to be used as a potent antibiotic!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Ug-8rArBT8hGzz8Q.jpg" /><figcaption>Escherichia coli bacteria (<a href="https://www.nature.com/articles/d41586-020-00018-3">Powerful antibiotics discovered using AI</a>)</figcaption></figure><p>I’ve left out many exciting apps like predicting <a href="https://arxiv.org/abs/1704.01212">quantum properties of molecules</a>, <a href="https://arxiv.org/abs/1509.09292">predicting molecule’s X chemical property</a> (e.g. solubility), etc.</p><p>It’s an infinite list.</p><p>You can now see how dull and homogeneous the computer vision and NLP fields are! 😅</p><p>NLP: <em>I manipulate text.</em> CV: <em>I manipulate images. </em>Graph ML: <em>hold my beer!</em> 🍺</p><p>Jokes aside, there are some nice connections between CV/NLP and Graph ML. You can treat transformers as Graph Attention Networks operating on fully-connected graphs (but more on that later) and you can treat images/videos as regular graphs (aka grids).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*KAva0uM98laAA644s6BCeQ.png" /><figcaption>An example of a 4x4 pixel image — we can treat an image as a grid graph. Every node has associated a scalar (grayscale) or a 3D vector ( (RGB) with it. That’s the <strong>graph signal </strong>in this example.</figcaption></figure><p>Through this lens, everything is a graph. Now whether this abstraction makes actual sense is problem specific. Specialized models such as CNNs have some useful biases ingrained into them and you probably wouldn’t want to apply a GNN directly to image pixels (although GNNs are getting some serious traction in the CV world in one way or another).</p><p>Hopefully, I got you hyped up! Let me now show you some resources that I’ve found useful learning about Graph ML.</p><p><em>Note: I often mention GNNs but they are only a subset of the Graph ML field. Aside from GNNs there are graph embedding methods and many others.</em></p><p><em>Note 2 (on how you should (probably) read the following chapter): first read it without digressing into the resources which I’ve linked and only then start using it as a reference manual — because that’s what this blog is, it’s not your one-shot blog, read it and forget it, noup.</em></p><h3>Fantastic GNNs and Where to Find Them</h3><p>I don’t aim to provide you with an extensive overview of the Graph ML literature here, and I don’t think that would be useful at all for that matter.</p><p>Dumping a bunch of resources (which I often see people do in GitHub repos) is not that useful — especially not for beginners.</p><p>What I’ll try to do is structure some of the resources, which I’ve found useful, in a way such that 2-month younger Aleksa would be super grateful. ❤️</p><p>Let’s start! I’ll try and give you some more generally applicable research tips along the way as well.</p><h4>Graph embedding methods</h4><p>If you’re trying to dive into a new field it’s super <em>useful </em>to <strong>organize your learning resources chronologically</strong> (for nerds: the timestamp feature of the research paper is highly valuable — don’t ignore it).</p><p>Before GNNs became mainstream people used methods analogous to Word2Vec which enjoyed a great deal of popularity in the NLP world.</p><p>Most of these were actually directly inspired by the Word2Vec method and to be honest, I’m happy I built my NLP and CV backgrounds before jumping into Graph ML. The field pulled a lot of inspiration from CV and NLP fields as you’ll soon see.</p><p>Here are some papers I recommend you start your journey with:</p><ul><li><a href="https://arxiv.org/abs/1403.6652">DeepWalk</a> — it’s reduced to Word2Vec if you do the following: sample “sentences” from the graph by doing random <a href="https://www.geeksforgeeks.org/mathematics-walks-trails-paths-cycles-and-circuits-in-graph/#:~:text=A%20walk%20is%20a%20sequence,can%20be%20open%20or%20closed.">walks</a>.</li><li><a href="https://cs.stanford.edu/~jure/pubs/node2vec-kdd16.pdf">Node2Vec</a> — literally the same idea as DeepWalk with the additional control of how you’ll sample from your graph (<a href="https://en.wikipedia.org/wiki/Breadth-first_search">BFS</a>/<a href="https://en.wikipedia.org/wiki/Depth-first_search">DFS</a>). If you give more weight to BFS the tightly coupled nodes will have similar embeddings.</li><li><a href="https://arxiv.org/abs/1603.08861">Planetoid</a> — a semi-supervised setting. Aside from random walks (unsupervised), you can also leverage the labels (supervised). They additionally made sure that their method can be used in an inductive setting (check out my <a href="https://github.com/gordicaleksa/pytorch-GAT/blob/main/The%20Annotated%20GAT%20(Cora).ipynb">GAT Jupyter Notebook</a> for the short explanation of transductive vs inductive learning, just <em>ctrl+f </em>it ❤️).</li></ul><p>A brief clarification on DeepWalk: if you treat the nodes in the graph as words then if you do a random walk you’re basically sampling a random sentence from your graph.</p><p>Once you have the sentence you can do the Word2Vec magic and learn your node embeddings such that those nodes that tend to be close in your sentences have similar embeddings.</p><p>✅ Graph embedding methods</p><p>All right! Now you’re ready for some GNN magic! 😍</p><h4>Graph Neural Networks</h4><p>Historically there were 2 main approaches to developing GNNs:</p><ul><li>Spectral methods</li><li>Spatial (message passing) methods</li></ul><p>Both tried to generalize the mathematical concept of <strong>convolution </strong>(that worked so nicely in the CV world) to graphs.</p><p>The spectral methods tried to preserve the strict mathematical notion of convolution and had to resort to the frequency domain (Laplacian eigenbasis) for that.</p><p>On the other hand, the spatial methods are not convolutions in the strict mathematical sense of the word, but we still informally call them convolutions, as they were very loosely inspired by the spectral methods.</p><p>The long story short, spectral methods “died out” because they are:</p><ul><li><strong>Computationally expensive</strong></li><li><strong>Inherently transductive</strong></li></ul><p>Having said that they are definitely still worth researching and you should build up at least some basic foundations on spectral methods, IMHO.</p><p>But, before we continue with spectral/spatial GNN papers I strongly suggest you take some time off to do a superficial, high-level overview of what Graph ML is. <strong>Build up that knowledge skeleton first</strong> before you start filling in the blanks. The top to bottom approach, I’m a big fan of it.</p><p>I recommend watching this <a href="https://www.youtube.com/watch?v=zCEYiCxrL_0&amp;ab_channel=MicrosoftResearch">high-level overview</a> of GNNs by Microsoft Research folks, as well as this one by <a href="https://scholar.google.com/citations?user=9pSK04MAAAAJ&amp;hl=en">Xavier Bresson</a> (one of the big names in the Graph ML field):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FIiv9R6BjxHM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DIiv9R6BjxHM&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FIiv9R6BjxHM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf3eaf869f487099bd210bef88634d22/href">https://medium.com/media/bf3eaf869f487099bd210bef88634d22/href</a></iframe><p>Additionally here are some blogs to get you exposed to new terminology and information, let them sink in:</p><ul><li><a href="https://medium.com/@BorisAKnyazev/tutorial-on-graph-neural-networks-for-computer-vision-and-beyond-part-1-3d9fada3b80d">Tutorial on Graph Neural Networks for Computer Vision and Beyond</a> (a beginner-friendly intro to GNNs)</li><li><a href="https://towardsdatascience.com/a-tale-of-two-convolutions-differing-design-paradigms-for-graph-neural-networks-8dadffa5b4b0">A Tale of Two Convolutions: Differing Design Paradigms for Graph Neural Networks</a></li><li><a href="https://towardsdatascience.com/tutorial-on-graph-neural-networks-for-computer-vision-and-beyond-part-2-be6d71d70f49">A high-level overview of some important GNNs</a> (MoNet falls into the realm of geometric deep learning though, but more on that later)</li></ul><p>Nice!</p><p>✅ A high-level overview of Graph ML</p><p>You’re now ready to dive into the world of Graph Neural Networks. 🌍</p><h4>The spectral methods</h4><p>The main “tool” behind the spectral methods is something called the <a href="https://en.wikipedia.org/wiki/Laplacian_matrix">graph Laplacian</a>. Additionally, the <strong>undirected graph assumption</strong> is made so that we can have a <strong>symmetric </strong>graph Laplacian which has some nice mathematical properties — namely the fact that we can find an <strong>orthonormal Laplacian eigenbasis*.</strong></p><p><em>* it’s a generalization of the </em><strong><em>Fourier</em></strong><em> eigenbasis with which you’re familiar if you took any signal processing course, check out </em><a href="https://www.youtube.com/watch?v=spUNpyF58BY&amp;ab_channel=3Blue1Brown"><em>3B1B’s video</em></a><em> for a gentle intro. In a special case where the underlying graph is a grid (like image), we get sinusoids i.e. Fourier eigenfunctions!!!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/0*q9R0JYEwVaAr1bIK.png" /><figcaption>Laplacian eigenvectors visualized on one specific graph (<a href="https://towardsdatascience.com/a-tale-of-two-convolutions-differing-design-paradigms-for-graph-neural-networks-8dadffa5b4b0">image from on of the above blogs</a>)</figcaption></figure><p>Now the main idea is to <strong>project the graph signal</strong> into that eigenbasis, filter the projected graph signal directly in the spectral domain by doing an <strong>element-wise multiplication</strong> with the filter, and <strong>reproject it back</strong> into the spatial domain.</p><p>It’s ok not to understand all of this right here and right now. You’ll have your <a href="http://youtube.com/c/TheAIEpiphany/">epiphany moment</a> sooner or later. Here are the main spectral papers:</p><ul><li><a href="https://arxiv.org/abs/1312.6203">Spectral Networks and Locally Connected Networks on Graphs</a> — first introduced the concept of the convolution to graphs.</li><li><a href="https://arxiv.org/abs/1606.09375">ChebNets</a> — One of the main problems with the above method is that it’s <strong>not localized</strong> i.e. the updated node features can be affected by any node in the graph.</li></ul><p>The ChebNets paper made it so that only <strong>k-hop neighborhoods</strong> can impact the feature representation of any particular node and also made it <strong>computationally efficient</strong> to do so — by using a <em>Chebyshev polynomia</em>l of the graph Laplacian there is no need to compute the Laplacian eigenbasis which is an expensive operation (~O(n³)).</p><p><em>Note: in spectral method papers you’ll be seeing some “heavy” mathematics which is not a prerequisite for understanding the spatial methods (and they are way more popular so don’t beat yourself down if you don’t get this the first time).</em></p><p>Aside from the papers here are some other super useful resources that will help you better understand these spectral methods:</p><ul><li><a href="https://towardsdatascience.com/spectral-graph-convolution-explained-and-implemented-step-by-step-2e495b57f801">Spectral Graph Convolution Explained and Implemented Step By Step</a></li><li><a href="http://blog.shriphani.com/2015/04/06/the-smallest-eigenvalues-of-a-graph-laplacian/">The Smallest Eigenvalues of a Graph Laplacian</a></li><li><a href="https://csustan.csustan.edu/~tom/Clustering/GraphLaplacian-tutorial.pdf">A tutorial on Graph Laplacians</a></li></ul><p>And finally, <a href="https://www.youtube.com/watch?v=uxsDKhZHDcc&amp;ab_channel=ArtificialIntelligence-AllinOne">this video</a> made it click for me when it comes to understanding the spectral clustering method which leverages the Laplacian eigenvectors to cluster the nodes (any additional intuition you can collect will be useful).</p><p>That’s it. I’ve left out some less important papers to avoid the clutter (and btw. I’m only recommending the resources which I’ve <em>read </em><strong>and </strong><em>found useful</em>).</p><p>✅ Spectral methods!</p><p>Now let’s continue to the realm of spatial methods.</p><h4>Spatial/Message passing methods</h4><p>Here is a high-level, super informal, explanation of message passing methods.</p><p>The goal is to update each and every node’s representation. You have the feature vectors from your node and from his neighbors at disposal. You then do the following:</p><ol><li>You somehow transform the feature vectors (maybe a linear projection)</li><li>You somehow aggregate them (maybe weighing them with attention coefficients, voilà, we get GAT (<em>you see what I did there</em>))</li><li>You update the feature vector (somehow) of the current node by combining its (transformed) feature vector with the aggregated neighborhood representation.</li></ol><p>And that’s pretty much it, you can fit many different GNNs into this framework.</p><p>Let’s now explore some of the most famous spatial methods:</p><ul><li><a href="https://arxiv.org/abs/1609.02907">GCN </a>(Graph Convolutional Network) — simplified the ChebNets paper to operate on 1-hop neighborhoods and made GNNs much more efficient and applicable.</li></ul><p>I’ve covered the GCN paper in this video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FVyIOfIglrUM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DVyIOfIglrUM&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FVyIOfIglrUM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e64f68178213531a87c61db8ead0c487/href">https://medium.com/media/e64f68178213531a87c61db8ead0c487/href</a></iframe><ul><li><a href="https://arxiv.org/abs/1710.10903">Graph Attention Network</a> (GAT) — made GCN more expressive by allowing it to <strong>learn </strong>the neighborhood aggregation coefficients (GCN uses constants instead of learnable weights).</li></ul><p>As you’ll later see <a href="https://github.com/gordicaleksa/pytorch-GAT">I’ve even implemented GAT</a> from scratch and Petar Veličković (the first author) himself <a href="https://twitter.com/PetarV_93/status/1341032768906649600">recommended this video</a> so I guess it should be good enough! 😅</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FuFLeKkXWq2c%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DuFLeKkXWq2c&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FuFLeKkXWq2c%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c91c9496d63cb9f537c3de79c804ba2/href">https://medium.com/media/9c91c9496d63cb9f537c3de79c804ba2/href</a></iframe><p>Now the problem with GAT and GCN is they were originally<strong> not</strong> <strong>scalable </strong>which is needed for many real-world, massive-scale, graph datasets like any social network’s graph.</p><p>The following 2 papers made GNNs applicable to huge graphs:</p><ul><li><a href="https://arxiv.org/abs/1706.02216">GraphSAGE</a> — <strong>SA</strong>mple and aggre<strong>G</strong>at<strong>E</strong>, it introduced the concept of sampling your neighborhood and a couple of optimization tricks so as to constrain the compute/memory budget. It’s a direct precursor to PinSage which is deployed at Pinterest as the recommender system!</li></ul><p>Here is <a href="https://www.youtube.com/watch?v=vinQCnizqDA">my overview of GraphSage</a>. Btw. if you were wondering, Graph ML is a pretty young field so you won’t find many YT overviews of these papers that’s why I’m linking the ones I created. I only wish to link the best content — if that’s sometimes my content — well let it be. 😅 Anyways! The second paper:</p><ul><li><a href="https://arxiv.org/abs/1806.01973">PinSage</a> — One of the most famous real-world applications of GNNs — recommender system at Pinterest.</li></ul><p>And here is <a href="https://www.youtube.com/watch?v=ed0NJdqwEyg">my video overview</a>:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2Fed0NJdqwEyg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3Ded0NJdqwEyg&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2Fed0NJdqwEyg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/80b8fbb3b3e92c61c13462bed9eb5225/href">https://medium.com/media/80b8fbb3b3e92c61c13462bed9eb5225/href</a></iframe><p>Those were some of the most important spatial GNNs. Going further here is a paper that generalized all of the above nets into a so-called <strong>Message Passing</strong> framework:</p><ul><li><a href="https://arxiv.org/abs/1704.01212">MPNN </a>(message passing neural net) — aside from having a theoretical significance of unifying the spatial GNNs it also introduced an awesome application of GNNs: predicting quantum properties of molecules e.g. fundamental vibrations, the energy needed to break up the molecule in certain states, etc.</li></ul><p>Two more seminal papers you should check out are:</p><ul><li><a href="https://arxiv.org/abs/1511.05493">Gated Graph NN</a> — used GRU for neighborhood aggregation and applied the method to program verification via the separation logic. It’s not an easy read, but I think it’s worth it, it played an important role in kick-starting the spatial method revolution.</li><li><a href="https://arxiv.org/abs/1605.05273">Learning Convolutional Neural Networks for Graphs</a> — gave an idea of how we could impose some order onto the graph neighborhood (via labeling) and apply a convolution that resembles CNNs much closer. I guess it could be considered as a third way to introduce convolution to graphs, but this approach didn’t get any serious traction though.</li></ul><p>Wrapping up with one more amazing paper which showed that we clearly don’t know what we’re doing 😂:</p><ul><li><a href="https://arxiv.org/abs/1902.07153">Simplifying Graph Convolutional Networks</a> (SGC)</li></ul><p>Jokes aside, what it showed is that <strong>for certain graph families</strong> GNNs are totally unnecessary and a much simpler baseline (that acts as a simple <strong>low-pass</strong> filter) can do an even better job!</p><p>It’s a single layer GNN that first does the aggregation over the k-hop neighborhood (the majority of the benefit arises from this) followed by a simple linear projection and a softmax.</p><p>In these early days of spatial methods we were missing answers to some fundamental theoretical questions like <a href="https://towardsdatascience.com/do-we-need-deep-graph-neural-networks-be62d3ec5c59">why are GNNs so shallow</a> (compared to their extremely deep CNN cousins), what are their limitations, etc.</p><p>That brings us to the following section.</p><p>✅ Seminal spatial GNN papers</p><p>Let’s go!</p><h4>GNN <em>expressivity</em></h4><p>Early spatial methods, such as the famous GCN paper, started making some links between GNNs and old graph theory methods such as the <strong>Weisfeiler Lehman algorithm.</strong></p><p>Weisfeiler Lehman (1-WL) also known as the <em>color refinement</em> algorithm is a simple graph isomorphism test: given 2 graphs verify they are the same even though their node ids may be permuted. WL can tell you with <strong>certainty </strong>whether your 2 graphs are non-isomorphic and it can tell you, with <strong>high probability</strong>, whether they are isomorphic.</p><p>Check out <a href="https://davidbieber.com/post/2019-05-10-weisfeiler-lehman-isomorphism-test/">this awesome blog</a> for a great explanation of how WL works.</p><p>Now there are certain graph families that can “confuse” the WL test. Here is one example of where the WL algorithm outputs the same color histograms (and thus it “thinks” that these 2 graphs are isomorphic — but they’re not):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*FY4y6OSqFMjcIFhe.png" /><figcaption>Two non-isomorphic graphs on which the WL graph isomorphism test fails (<a href="https://towardsdatascience.com/expressive-power-of-graph-neural-networks-and-the-weisefeiler-lehman-test-b883db3c7c49">M. Bronstein’s blog</a>)</figcaption></figure><p>Ok, now you may think this is all nice Aleksa, you’re brushing up our fundamental graph theory knowledge, but what the heck? Well.</p><p>This seminal paper showed that MPNNs are, at best, <strong>as powerful as 1-WL</strong>:</p><ul><li><a href="https://arxiv.org/abs/1810.00826">GIN — Graph Isomorphism Network</a></li></ul><p>It introduced certain requirements needed for the MPNN to be as expressive as 1-WL like using <strong>sum </strong>as the aggregation function (hint it’s injective) instead of the popular <strong>max</strong> and <strong>mean </strong>aggregators.</p><p>Michael Bronstein has a <a href="https://towardsdatascience.com/expressive-power-of-graph-neural-networks-and-the-weisefeiler-lehman-test-b883db3c7c49">nice series of 3 blogs</a> on this topic so do check it out!</p><p>After GIN, many methods tried to unleash GNNs and give them even more expressive power, and so various methods were advised which were as powerful as <strong>k-WL</strong> algorithms.</p><p>Also, other families of methods were advised which broke up with the WL hierarchy altogether like this one:</p><ul><li><a href="https://arxiv.org/abs/2006.09252">Improving GNN expressivity via subgraph isomorphism counting</a></li></ul><p>The main idea is that since some previous research showed that GNNs lack the subgraph structure counting ability we can add those explicitly as additional node/edge features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*_qs0FE364tUOewDX-hr6eg.png" /><figcaption>counting triangles and paths and appending those numbers to node features</figcaption></figure><p>And another recent paper called <a href="https://arxiv.org/abs/2004.05718">Principal Neighborhood Aggregation</a> further improved upon GIN and made its theory applicable to realistic use cases (since the original GIN had some simplifying assumptions like only using one-hot vectors as feature vectors).</p><p>PNA showed that we need to use <strong>multiple aggregators</strong>, they used n-th statistical moments — like mean, std deviation, and higher, in order to get the <em>theoretical guarantees</em> of being able to discriminate between continuous multisets as the theorem from the paper suggests:</p><blockquote>In order to discriminate between multisets of size n whose underlying set is R, at least n aggregators are needed.</blockquote><p>Where multisets are sets where the elements may appear more than once (feature vectors of a node is a multiset in our specific case).</p><p><em>Note on expressivity: if a model is more expressive that means that it would produce different embeddings for 2 graphs that are non-isomorphic with higher probability than some less expressive model (as we saw some graphs confuse 1-WL test (and thus MPNNs) and so in those cases we’d get the same embeddings even though the 2 graphs are non-isomorphic!)</em></p><p>As you can see you could be doing just this subfield of Graph ML research as it’s fairly complex and there are still many open questions!</p><p>✅ GNN expressivity</p><p>Let’s take a step back from the hard-core theory and investigate some exciting app papers, some of which I’ve mentioned in the previous chapter.</p><h4>Papers on exciting GNN applications</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ECP-xuxjct6gvuLt" /><figcaption>Photo by <a href="https://unsplash.com/@vlisidis?utm_source=medium&amp;utm_medium=referral">Terry Vlisidis</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I’ve already mentioned some of these:</p><ul><li><a href="https://arxiv.org/abs/1809.06166">GNNs for IceCube signal classification</a></li><li><a href="https://www.nature.com/articles/s41598-019-45349-y">Hyperfoods paper</a> (anti-cancer molecules and foods) — it’s a bit harder to read than the other papers but you could skim it to get a rough idea of what they did.</li><li><a href="https://arxiv.org/abs/1802.00543">Modeling polypharmacy side effects with GNNs</a> — models the problem as a multi-modal graph (proteins/drugs), with the goal of multi-relational link prediction (given a pair of drugs there can be up to 964 different edges in between each corresponding to a different side effect!)</li><li><a href="https://arxiv.org/abs/1902.06673">Fake News Detection on Social Media using Geometric Deep Learning</a></li><li><a href="https://arxiv.org/abs/1509.09292">Convolutional Networks on Graphs for Learning Molecular Fingerprints</a> — beautiful paper it replaced the old heuristics with a learnable GNN and gave awesome results on predicting different properties of molecules.</li><li><a href="https://arxiv.org/abs/1703.06103">Modeling Relational Data with GCNs</a> — applying GNNs to knowledge base entity and link prediction.</li><li><a href="https://arxiv.org/abs/2007.06559">Graph Structure of Neural Networks</a> — uses network/graph analysis knowledge to do a smarter NAS (neural architecture search). Neural networks themself are graphs, right? So let’s apply some Graph ML knowledge! Note this is less of a GNN paper but still an interesting read.</li></ul><p>Aside from all of these and the stuff I mentioned in the previous chapter I also suggest these 2 blogs for more awesome applications:</p><ul><li><a href="https://towardsdatascience.com/geometric-ml-becomes-real-in-fundamental-sciences-3b0d109883b5">Geometric ML becomes real in fundamental sciences</a> (Michael Bronstein)</li><li><a href="https://medium.com/criteo-labs/top-applications-of-graph-neural-networks-2021-c06ec82bfc18">Top Applications of Graph Neural Networks 2021</a> (Sergey Ivanov)</li></ul><p>As well as this paper for a holistic overview of different methods used in the Graph ML field:</p><ul><li><a href="https://arxiv.org/abs/1709.05584">Representation Learning on Graphs: Methods and Applications</a></li></ul><p>✅ Exciting applications of GNNs</p><p>We’re getting closer to the end. 💪 Go drink a green tea and get back. 🍵❤️</p><h4>Handling dynamic graphs</h4><p>So far all of the papers I linked deal with the so-called <strong>static graphs</strong> i.e. graphs that <strong>don’t evolve over time</strong>. But the truth is many graphs of interest do change over time. Take Twitter/Facebook/&lt;your fav social net if any&gt; graph as an example.</p><p>Here are 2 nice papers dealing with continuous-time step dynamic graphs:</p><ul><li><a href="https://arxiv.org/abs/2006.10637">Temporal Graph Networks for Deep Learning on Dynamic Graphs</a> — this paper came straight from Twitter with M.Bronstein being one of the coauthors.</li><li><a href="https://arxiv.org/abs/2002.07962">Inductive Representation Learning on Temporal Graphs (TGAT)</a> — fairly similar to TGN above, it can actually be considered a special case.</li></ul><p>And again here is my overview of TGN paper (<a href="https://twitter.com/emaros96/status/1350889060190068736">Rossi endorses it</a> ✅❤️):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2F0tw66aTfWaI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3D0tw66aTfWaI&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2F0tw66aTfWaI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/77b393b0661baafb97449268aeeda497/href">https://medium.com/media/77b393b0661baafb97449268aeeda497/href</a></iframe><p>This was just to tickle your imagination. You can imagine dedicating a couple of years of research to only this subtopic of Graph ML. There are still many open questions and engineering problems left.</p><p>The 2 “main” tricks are:</p><ul><li>Find a way to represent time and include it as an important feature</li><li>Define a temporal neighborhood over which to aggregate</li></ul><p>✅ Dynamic graphs</p><p>Finally, let me leave you with some totally optional papers.</p><p><em>Note: pretty much every subsection, including this one on dynamic graphs, is orthogonal to other subsections. Just saying.</em></p><h4>Go unsupervised young ML human</h4><p>If you’re passionate about unsupervised learning you’ll find these 2 interesting:</p><ul><li><a href="https://arxiv.org/abs/1809.10341">Deep Graph Infomax</a> (DGI) — combines the deep infomax theory with graphs.</li><li><a href="https://arxiv.org/abs/1611.07308">VGAE</a> — combines the VAE (variational auto-encoder) with GCN.</li></ul><p>Aside from the unsupervised learning, you may wish to place your foot into the Geometric-DLandia (Geometric DL mostly deals with manifolds although there are many connections with the Graph ML field):</p><p><a href="https://arxiv.org/abs/1501.06297">Geodesic CNNs on Riemannian manifold</a> (GCNN) — this one broke my mind 😂, working on manifolds involves so many new details that I haven’t seen anywhere else across all the different deep learning fields I’ve explored so far.</p><p><a href="https://arxiv.org/abs/1611.08097">Geometric deep learning: going beyond Euclidean data</a> — again, really math-heavy and includes a complex survey on manifolds, differential geometry, graphs, different methods, and different applications.</p><p><a href="https://arxiv.org/abs/1611.08402">MoNets</a> — Geometric DL on graphs/manifolds using mixture models. It generalizes some of the previous methods like the above-mentioned GCNN.</p><p>Again, note that there is some heavy mathematics, new jargons, and terminology involved with Geometric DL — promise that you won’t get overwhelmed!</p><p>You don’t need to understand these in order to understand Graph ML.</p><p>✅ Misc</p><p>Let’s wrap up this brain dump of mine. 🧠⚡</p><h4>Graph visualization toolkit, datasets, where to next?</h4><p>Here I’ll list some of the other things you should care about. It’s not only about papers. Tooling is super important. Data is arguably even more important than the algorithms. Here we go!</p><p>This blog contains a nice overview of different graph drawing packages:</p><p><a href="https://towardsdatascience.com/large-graph-visualization-tools-and-approaches-2b8758a1cd59">Large Graph Visualization Tools and Approaches</a></p><p>I ended up using <strong>igraph </strong>as it seemed like the most powerful graph drawing tool which I could use directly from Python.</p><p>Here is a nice <a href="https://towardsdatascience.com/visualising-graph-data-with-python-igraph-b3cc81a495cf">beginner-friendly intro</a> to igraph and here is the <a href="https://igraph.org/python/doc/tutorial/tutorial.html">official tutorial</a> (it’s pretty good I’ve used it)</p><p>And again, graph drawing is a subfield for itself! You can dedicate some of your research years to researching only this topic. Similarly to how tokenization in transformers is a subfield for itself even though we usually use these “tools” as a black box.</p><p>While we’re talking about visualizations I think I should mention the graph datasets!</p><p>First of all, you’ll be seeing <strong>Cora</strong>, <strong>Citeseer</strong>, <a href="https://arxiv.org/abs/1707.04638"><strong>PPI</strong></a><strong>, </strong>and <strong>Pubmed </strong>everywhere those are the classical benchmarks (like MNIST in CV). The problem with these is, as people later found out, that they are <em>treacherous </em>— we can’t exactly discriminate between more expressive methods and the less expressive ones.</p><p>So people started advising new graph benchmarks, and we should all be cognizant of how important this is. If you’re coming from the CV background, as I do, you know what <strong>ImageNet </strong>did for the CV world.</p><p>It even became a metaphor! People say that NLP got its <strong>“ImageNet moment” </strong>with the arrival of big data, transfer learning, and deep contextualized representations. So data is a big thing! (pun probably intended)</p><p>So what’s happening with ImageNet in Graph ML?</p><p><a href="https://ogb.stanford.edu/docs/home/">Open Graph Benchmark</a> initiative looks very promising, the time will tell!</p><p>I’d like to wrap up this mind-breaking blog, which had a <strong>bold </strong>attempt to cover the Graph ML literature, with 2 additional resources you should take into consideration.</p><p>If I were you I’d read every single blog from Michael (as I did):</p><p><a href="https://medium.com/@michael.bronstein">Michael Bronstein - Medium</a></p><p>And you should follow Sergey’s newsletter. Sebastian Ruder showed that this format works wonders for the NLP world, so let’s see whether Sergey makes the same thing for the Graph ML world! 👑</p><p><a href="https://graphml.substack.com/">Graph Machine Learning</a></p><p>We’re done with the theory! Put your relaxed hat on and lemme walk you through my GAT project. 😎</p><blockquote>Edit May 2022: I strongly recommend you also check out Distill.pub’s articles on GNNs: <a href="https://distill.pub/2021/gnn-intro/">A gentle introduction to GNNs</a> and <a href="https://distill.pub/2021/understanding-gnns/">Understanding Convolutions on Graphs</a>.</blockquote><h3>Graph Attention Network (GAT) Project</h3><p>As always, I’m a strong believer that reading through theory is just not enough. You also need to test your understanding, because, how else would you know you’re not just overfitting the training dataset? 😅</p><p>And what better way to do it than to engineer it from scratch?</p><blockquote>If you can’t build it, you don’t understand it — somebody, somewhere, somewhen</blockquote><p>With that mindset, I decided to implement the Graph Attention Network. It just felt like a natural step since they are a <a href="https://thegradient.pub/transformers-are-graph-neural-networks/">generalization of transformers</a> and I’ve previously implemented <a href="https://github.com/gordicaleksa/pytorch-original-transformer">Vaswani’s transformer</a>.</p><p>I mean: <strong>attention </strong>+ <strong>GNNs </strong>= ❤️ , right?</p><p>Additionally, I am lucky enough that I get to chat with <em>Petar Veličković</em> (the first author of the GAT paper) on a regular basis — so that made it easier for me to figure out why certain design decisions were made.</p><p>So after ~3 weeks of my free time (including weekends and aside from my daily job at Microsoft, I’m crazy I know), I pulled it out:</p><p><a href="https://github.com/gordicaleksa/pytorch-GAT">gordicaleksa/pytorch-GAT</a></p><p>I’ve really learned a lot.</p><p>I never played with graphs before (aside from <a href="https://github.com/gordicaleksa/competitive_programming/tree/master/graphs">implementing </a>some classical CS graph algorithms in C++ back in the days) so this made me really excited.</p><p>Understanding graph data and visualizing it gave me a lot of satisfaction. I’ve broadened my toolkit with new packages such as <strong>igraph </strong>and <strong>NetworkX<em>, </em></strong>and I created beautiful visualizations such as this one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*XxPlAZWKYlawtVND9vgdQw.png" /><figcaption>Cora citation network visualized</figcaption></figure><p>I’ve used the <strong>Kamada Kawai</strong> layout to draw this one<strong>. </strong>Obviously<strong>, </strong>I got some background in network analysis and graph drawing.</p><p>And of course, I’ve learned how to implement GAT in many different ways (I finally ended up with 3 implementations!). The main tradeoff was between the ease of understanding and efficiency — as it often is.</p><p>After I’ve trained the model I decided to add as many visualizations as possible so that I can better understand what’s happening. The 3 main visualizations I did were:</p><ul><li>Embedding visualization via <strong>t-SNE</strong></li><li>Neighborhood <strong>attention visualization</strong> via edge thickness</li><li>Attention pattern visualization via <strong>entropy histograms</strong></li></ul><p>Once you train the GAT on the Cora dataset here is how a single neighborhood looks like (I’ve cherry-picked a high-degree node here):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*XOScrjssoQV8YHXzyHGJlg.jpeg" /><figcaption>Neighborhood attention visualized (colors = labels, edge thickness ~ attention coefficients)</figcaption></figure><p>The first thing you notice is that the edges are of the same thickness — meaning GAT learns constant attention on Cora.</p><p>For more details, you can check out the <a href="https://github.com/gordicaleksa/pytorch-GAT">README </a>and the accompanying <a href="https://github.com/gordicaleksa/pytorch-GAT/blob/main/The%20Annotated%20GAT%20(Cora).ipynb">Jupyter Notebook</a>! (this one covers Cora the other one covers PPI)</p><p>If you need additional help understanding the project I created a project walkthrough video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2F364hpoRB4PQ%3Fstart%3D519%26feature%3Doembed%26start%3D519&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3D364hpoRB4PQ&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2F364hpoRB4PQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/436260635a69a787f7fd135ae35da921/href">https://medium.com/media/436260635a69a787f7fd135ae35da921/href</a></iframe><p>I’ve put an emphasis on explaining the hardest-to-understand implementation (implementation #3 as I’ve dubbed it) so hopefully, in addition to Jupyter Notebook, this will help you get a deep understanding of how GAT works.</p><p>I also created this project update video, while I was working on GAT, which you may find interesting if you’re interested in my journey:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2F28kGxllog28%3Fstart%3D4%26feature%3Doembed%26start%3D4&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3D28kGxllog28&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2F28kGxllog28%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/14113d97d579b8e89f674f11f7179c5c/href">https://medium.com/media/14113d97d579b8e89f674f11f7179c5c/href</a></iframe><p>Aside from my GAT implementation, I want to mention that you have at your disposal an awesome framework called <a href="https://github.com/rusty1s/pytorch_geometric">PyTorch Geometric</a> which you should use if you don’t necessarily want to dig into the nitty-gritty details, but you just want to quickly test some GNN out-of-the-box.</p><p>PyTorch Geometric is to Graph ML field what HuggingFace is to NLP. 👑</p><p>Another lib worth mentioning is <a href="https://www.dgl.ai/">DGL</a> whose PPI dataset I end up using.</p><h3>My next steps</h3><p>Phew. If you made it till the very end, <strong>congrats! </strong>❤️</p><p>I hope this blog will inspire you to start exploring Graph ML on your own! Or deep learning/machine learning in general for that matter.</p><p>One thing you notice when you start exploring Graph ML is how many related fields (but with a completely new set of terminology, equations, and theory) there are.</p><p>Examples would be:</p><ul><li><a href="https://www.linkedin.com/posts/aleksagordic_geometricdeeplearning-manifold-riemannianmanifolds-activity-6744725375852568576-0gS7">Geometric deep learning</a> (learning on manifolds) — which is closely related to Graph ML since both are concerned with learning on non-Euclidean domains (graphs/manifolds).</li><li><a href="https://www.linkedin.com/posts/aleksagordic_equivariance-deeplearning-statisticalefficiency-activity-6755911831937716224-G0ny">Equivariance deep learning</a> (exploiting symmetries to make your models statistically efficient i.e. use less data to achieve the same perf) — related to CNN and geometric deep learning fields (I’ve mostly seen it in this context: <a href="https://arxiv.org/pdf/1602.07576.pdf">group CNNs</a>, <a href="https://arxiv.org/abs/1801.10130">spherical CNNs</a>, <a href="https://arxiv.org/abs/1902.04615">gauge CNNs</a> (they work on manifolds)) but is also much more generally applicable (<a href="https://fabianfuchsml.github.io/alphafold2/">equivariant transformers</a>, etc.).</li><li><a href="https://en.wikipedia.org/wiki/Knowledge_graph">KG field</a> (knowledge graphs) — which lies somewhere in between graph ML and NLP.</li></ul><p>I did some “digressions” into these fields and I tell you — it can get overwhelming. It’s not that it’s hard it’s just that there is a lot of new information and it takes time.</p><p>Especially interesting are GDL and equivariance DL where you’ll start seeing physics theory perturbing its tentacles and injecting ideas from quantum/particle/classical physics into deep learning.</p><p>You find yourself asking questions like how did the general theory of relativity end up here, but there you have it.</p><p>When it comes to my next steps nothing has changed since my last <a href="https://gordicaleksa.medium.com/deep-learning-journey-update-what-have-i-learned-about-transformers-and-nlp-in-2-months-eb6d31c0b848">blog post update</a>. In a couple of days, I’ll start exploring the (deep) RL field!</p><p>I’m super excited as some of the most famous AI breakthroughs happened exactly in RL like AlphaGo/AlphaZero/MuZero/AlphaStar line of research coming from DeepMind.</p><p>Be sure that I’ll extensively cover all of these on my YT channel and, again, I’ll probably implement one of these from scratch, although I’m still not aware of how complex it is to implement something similar — so I’ll stay flexible here. 😅</p><h4><strong>Gratitude</strong></h4><p>I also want to say that I’m super grateful and humble about all the beautiful things that have been happening over the last couple of months in my life.</p><p>I had many opportunities sent my way, like being offered to do various Graph ML research with people from <a href="https://en.wikipedia.org/wiki/CERN">CERN </a>and many different industries. I got offered to hold presentations, webinars, podcasts, and even a meetup in London (that one will probably happen so stay tuned!).</p><p>People are asking me to mentor them, Sergey Ivanov linked my video series in his newsletter, Michael Bronstein, Thomas Kipf, and many other influential AI people were sharing my work.</p><p>I’ll have to <strong>say no </strong>to many opportunities as I simply don’t have the time to manage all of them (even though I’d love to!). I’m working full-time at Microsoft and I’m following this path of mine pretty much full-time as well.</p><p>I also get tons of DMs and emails and I just want to state here that I apologize in advance if my replies are delayed (and sometime in the not-so-distant future I simply won’t be able to handle all of it myself).</p><p>I received many beautiful messages of support and love from many of you and I truly appreciate it. ❤️ It keeps me working even harder.</p><p><strong>If there is something you would like me to write about — </strong><em>write it down in the comment section or send me a DM, I’d be glad to write more about maths, ML, deep learning, software, landing a job in a big tech company, preparing for ML summer camps, electronics (I actually officially studied this beast), etc., anything that could help you.</em></p><p><em>Also feel free to drop me a message or:</em></p><ol><li>Connect and reach me on<strong> </strong>💡 <a href="https://www.linkedin.com/in/aleksagordic/"><strong>LinkedIn</strong></a><strong> </strong>and <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a></li><li>Subscribe to my 🔔 <a href="https://www.youtube.com/c/TheAiEpiphany"><strong>YouTube channel</strong></a> for AI-related content️</li><li>Follow me on 📚 <a href="https://medium.com/@gordicaleksa"><strong>Medium</strong></a><strong> </strong>and 💻<a href="https://github.com/gordicaleksa"><strong>GitHub</strong></a></li><li>Subscribe to my 📢 <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a> and join the 👨‍👩‍👧‍👦 <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community!</li><li>📄 <a href="https://gordicaleksa.com/"><strong>Website</strong></a></li></ol><p>And if you find the content I create useful <a href="https://www.patreon.com/theaiepiphany"><strong>consider becoming a Patreon!</strong></a></p><p>Much love ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afa53f6f963a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep learning journey update: What have I learned about transformers and NLP in 2 months]]></title>
            <link>https://gordicaleksa.medium.com/deep-learning-journey-update-what-have-i-learned-about-transformers-and-nlp-in-2-months-eb6d31c0b848?source=rss-37f02ae83e8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb6d31c0b848</guid>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Aleksa Gordić]]></dc:creator>
            <pubDate>Sat, 05 Dec 2020 15:00:12 GMT</pubDate>
            <atom:updated>2021-09-24T11:13:22.843Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to get started with transformers and NLP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Tp39m6xvDmxuJVHQ" /><figcaption>Photo by <a href="https://unsplash.com/@tetrakiss?utm_source=medium&amp;utm_medium=referral">Arseny Togulev</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As I often do, I’d like to share my personal story before jumping into the “core part” of the blog — if you only came to read about the transformers/NLP resources please skip this section (I still love you! ❤️). So here we go!</p><p>This year I decided to structure my deep learning journey really neatly. It all started in February 2020 with Neural Style Transfer.</p><p>After studying it for months, reading many research papers, blogs, watching videos, etc. I started my own YouTube channel <strong>“The AI Epiphany”</strong> and I kicked off the NST series:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FS78LQebx6jo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DS78LQebx6jo&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FS78LQebx6jo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8f4328caea5b6d1c7529f7cb86266508/href">https://medium.com/media/8f4328caea5b6d1c7529f7cb86266508/href</a></iframe><p>This was the first-ever video I made — not the one I am the proudest of but it was the first step and a step in the right direction!</p><p>My idea for 2020 was basically this:</p><p>I am going to take a full year to cover the 6 areas of deep learning (I’ll mention which ones a bit later) that are super interesting to me, and I’ll gain an even stronger understanding of deep learning, ML, and mathematics.</p><p>I’ll do that by covering both the <strong>theory </strong>(usually via the top-down approach) like reading blogs, watching videos, reading books, and all the relevant research papers particular to the current topic I’m working on, and by <strong>coding relevant projects from scratch</strong> (mostly reimplementing papers) in PyTorch.</p><p>This is where many make a mistake — until you’ve tried to get your hands dirty by developing some project on your own, you don’t know how many details you actually don’t know! Believe me on this one…</p><blockquote>The devil is in the details</blockquote><p>Aside from that, I won’t make the same mistake I made throughout my life, that is <strong>I’ll share my learning journey with the world</strong> along the way.</p><p>Until that point, I always thought I should first become a world-class expert before I start teaching others (and it also seemed like an unnecessary distraction at that point in time), but then I realized (at least) 3 things:</p><ol><li>You learn a looooot by teaching others (that’s 5 ‘o’s yes, a lot.)</li><li>You are best positioned to help people one step behind you (probably)</li><li>A whole world of opportunities opens up once the broader community becomes aware of your existence (most certainly)</li></ol><p>So, how I like to think about it is I have 3 main content platforms, namely:</p><ol><li>My <a href="https://www.youtube.com/c/TheAiEpiphany"><strong>YouTube channel</strong> <strong>The AI Epiphany</strong></a><strong> </strong>where I’ll keep on sharing everything AI related that I find important (I’ve been mostly covering deep learning research papers lately and I’ll continue doing that)</li><li><a href="https://github.com/gordicaleksa"><strong>GitHub</strong></a><strong> </strong>where I open-source all of my projects (I love this platform ❤️)</li><li><a href="https://gordicaleksa.medium.com/"><strong>Medium </strong></a>where I occasionally write (I definitely spend the least time here)</li></ol><p>And I reshare that content on a lot of places like Facebook AI groups, Reddit, etc., but my central social media locations where I also share my thoughts are definitely <a href="https://www.linkedin.com/in/aleksagordic"><strong>LinkedIn</strong></a> (I was really bullish about it in 2020) and <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a><strong>.</strong></p><p>I only just recently started sharing my thoughts more actively on Twitter — as of today actually (the day I wrote this blog 😅).</p><p>The AI community is super strong on Twitter. I’ve been following AI people there for 2 years but I wasn’t active myself. That’s about to change!</p><p>So long story short my <strong>Neural Style Transfer</strong> field exploration ended up with me reading 20+ research papers, uploading 7 videos in the <a href="https://www.youtube.com/watch?v=S78LQebx6jo&amp;list=PLBoQnSflObcmbfshq9oNs41vODgXG-608&amp;ab_channel=TheAIEpiphany">NST series</a>, and open-sourcing 3 GitHub projects:</p><ul><li>My implementation of the<a href="https://github.com/gordicaleksa/pytorch-neural-style-transfer"> original NST paper</a> (Gatys et al.)</li><li>My implementation of the <a href="https://github.com/gordicaleksa/pytorch-neural-style-transfer-fast">fast NST approach</a> (Johnson et al.)</li><li>My pipeline for <a href="https://github.com/gordicaleksa/pytorch-naive-video-neural-style-transfer">creating NST videos</a> (I used it to create my YT videos)</li></ul><p>Here is a nice neural style transfer pic for you!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/0*cT0WJLs_h194icso.jpg" /><figcaption>You can create these using some of the projects that I’ve linked above</figcaption></figure><p>I later covered the <strong>Deep Dream algorithm</strong> (<a href="https://github.com/gordicaleksa/pytorch-deepdream">GitHub Deep Dream</a>). And yeah a fun fact — I used this one to create my YouTube/GitHub/&lt;fill in the blank&gt; banners so I do use my own software you know!</p><p>Here is a psychedelic pic I generated (I find DeepDream truly fascinating):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Z97diWS2hkmDJLRSu2HEqQ.png" /><figcaption>DeepDream algo I developed, you can create it <a href="https://github.com/gordicaleksa/pytorch-deepdream">using this code</a>.</figcaption></figure><p>But. I hear you asking:</p><p>“But why NST and DeepDream, those things are useless?”</p><p>And they are.</p><p>I’m joking a short answer would be: they’re fun &amp; awesome and are definitely useful to artists, you’ll get really familiar with ConvNets and a DL framework of your choice, and you’ll probably learn a bit about interpretability.</p><p>Also, many ideas from NST appear elsewhere. Like the famous <a href="https://github.com/NVlabs/stylegan2">StyleGAN</a> paper used an idea from the NST literature (<a href="https://arxiv.org/abs/1703.06868">adaptive instance normalization</a>).</p><p>I love art and I’m a highly visual type of learner (I think so at least) so in my probably overly biased opinion, I think these 2 projects are a great way to get your hands dirty with deep learning.</p><p>The third area I explored was <strong>Generative Adversarial Networks</strong> (<a href="https://github.com/gordicaleksa/pytorch-gans">GitHub GANs</a>). Here is some latent space exploration for you:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*EyonNUH0JpMXpjFT.jpg" /><figcaption>from man -&gt; woman (notice that the rotation and skin tone change as well)</figcaption></figure><p>I learned a lot about GANs and they are a fascinating field. So you can probably expect me doing something related to GANs in the future.</p><p>And finally, I just “finished” exploring transformers and NLP field in general! Unfortunately, I haven’t been sharing my journey on Medium from the very onset, but I still have 2 topics left (see my <strong>next steps</strong> chapter at the end of the blog) so I’ll hopefully be at 50% coverage! 😅</p><p><em>Note: Aside from NST which took me much longer and Deep Dream which took less time, it usually takes about 2 months of intensive learning for me to feel good about my understanding of the topic. I also work full time at Microsoft — so it’s pretty intensive </em>😆<em>, but I like it a lot — I’m probably sick.</em></p><p>OK! That was a short attempt to compensate for the lack of 3 thorough blogs. Hopefully, some of you found it useful or motivating I dunno.</p><p>Now let’s jump to NLP and transformers. I’ll share the theory I found useful, some videos I created so far (which could further help you), and what I’ve learned reimplementing <a href="https://github.com/gordicaleksa/pytorch-original-transformer">the original transformer</a> paper from scratch.</p><p>A lofty goal. Here we go!</p><blockquote><em>Personal update: I just created a </em><a href="https://aiepiphany.substack.com/"><strong><em>monthly AI newsletter</em></strong></a><strong><em> </em></strong><em>and a </em><a href="https://discord.gg/peBrCpheKE"><strong><em>Discord</em></strong></a><em> community! Subscribe/join those to keep in touch with the latest &amp; greatest AI news!</em></blockquote><h3>The trigger point — Vision Transformer (ViT)</h3><p>I’ll tell you how I approached learning this subfield of deep learning. You’ll probably get the most out of it if you already have a decent background in some other subfield of deep learning. For me, that was computer vision.</p><p>So I initially wanted to cover GNNs first but on October 3rd the Vision Transformer paper (ViT) was published — and since I’m really bullish on computer vision and this paper pretty much wrecked CNNs I decided I should get a solid grasp of transformers sooner rather than later.</p><p>So I went ahead and read the <a href="https://arxiv.org/abs/2010.11929">Vision Transformer (ViT)</a> paper. At least I tried. In the first go I didn’t understand the details (I did understand the main point of the paper though) as it had a hard dependency on the original transformer paper so I took a step back and I read the original transformer paper:</p><p><a href="https://arxiv.org/abs/1706.03762">Attention Is All You Need</a>.</p><p>Now at this point, I realized many gaps in my knowledge so I took a further step back and decided I needed to learn about attention/self-attention as well, word embeddings, tokenization, etc.</p><p>I did have some notion of all of those concepts — but it was far from a deep understanding (no pun intended).</p><blockquote>Enter the dependency hell — Aleksa Gordić, October-November 2020</blockquote><p>I also knew I wanted to understand the main trends of NLP. BERT/GPT/Transformers were the recurring topics I kept hearing about, even though I was nicely cushioned in my small bubble world of computer vision.</p><p>So, on one hand, I wanted to understand NLP and its main trends and on the other hand, I really wanted to understand the Vision Transformer. Those interleaving goals helped shape my strategy.</p><p>Over the next section, I’ll group the relevant papers, blogs, and in general different resources, which helped me in achieving those goals.</p><p>I warn you — there was a lot of back and forth between different “groups” of resources and subtopics. Learning is far from a linear process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vJuq0HFweF1LPwjW" /><figcaption>Photo by <a href="https://unsplash.com/@ricardoviana?utm_source=medium&amp;utm_medium=referral">Ricardo Viana</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Sometimes you’ll read something and you won’t understand anything. So you’ll go to a completely new subtopic, new connections will form, the old ones will sink in, you’ll return back, re-read that something again and understand it a bit better.</p><p>Sometimes you’ll quickly skim papers just to get the bigger picture and form that initial skeleton of the knowledge graph and only later will you thoroughly read it.</p><p>Sometimes you’ll read the paper, then you’ll take a step back, read some blogs or watch videos that contain higher-level explanations, and get back to the paper again.</p><p>There are lots of back and forth both vertically, between the low level and high-level explanations (across the knowledge pyramid), and horizontally across different subtopics (e.g. attention/tokenization) of the subfield (e.g. NLP) you’re learning.</p><p>That’s the reason you shouldn’t consider the list of resources that follow as a chronological list which you should linearly follow in order to learn NLP.</p><p>Although that approach might just work for you — who knows — the trick is to never give up!</p><h3>NLP/Transformers learning resources</h3><p>Here we go. Let’s start with attention — that’s a key concept that you’ll be seeing everywhere going forward. Make sure you deeply understand it.</p><h4>Attention/self-attention/50 shades of attention</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KSF3WASrrVFj5jRL" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a> (Attention!)</figcaption></figure><p>Blogs (sorted approx. from the best ones towards less valuable ones IMO):</p><ul><li><a href="https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention">OG of transformers — Jay Alammar’s blog on attention</a></li><li><a href="https://medium.com/@shashank7.iitd/understanding-attention-mechanism-35ff53fc328e">Understanding attention mechanism</a></li><li><a href="https://towardsdatascience.com/attn-illustrated-attention-5ec4ad276ee3">Illustrated attention</a></li><li><a href="https://medium.com/@Alibaba_Cloud/self-attention-mechanisms-in-natural-language-processing-9f28315ff905">Self attention mechanisms in NLP</a></li><li><a href="https://towardsdatascience.com/illustrated-self-attention-2d627e33b20a">Illustrated self-attention</a></li></ul><p>The first link will probably suffice, it’s an amazing resource. Feel free to go at your own pace and check out the other links as well (I’m only linking stuff I read myself and found to be of a good/great quality).</p><p>How I would probably go about reading this blog if I were you is I’d first read it without stopping, top to bottom, and then I’d return back to sections/links that I think are the most important for me. Nice! Let’s continue!</p><p>Low level (papers) that introduced attention to the field:</p><ul><li><a href="https://arxiv.org/abs/1409.0473">Neural Machine Translation By Jointly Learning to Align and Translate</a></li><li><a href="https://arxiv.org/abs/1508.04025">Effective Approaches to Attention-based Neural Machine Translation</a></li></ul><p>Once you grasp these 2 papers you’ll understand attention.</p><p>Next, I’ll introduce a couple more concepts that are used in transformers.</p><h4>Tokenization</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ls9L3W6QYVBBKttX" /><figcaption>Photo by <a href="https://unsplash.com/@maxdelsid?utm_source=medium&amp;utm_medium=referral">Max Delsid</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a> (Let’s chop those words/sentences)</figcaption></figure><p>Tokenization is a world for itself. In most transformers papers it’s just mentioned in one line maybe but it’s really important. That being you can treat it as a black-box most of the time. Here is the best resource I found:</p><ul><li><a href="https://blog.floydhub.com/tokenization-nlp/">https://blog.floydhub.com/tokenization-nlp/</a></li></ul><p><a href="http://web.stanford.edu/class/cs224n/slides/cs224n-2019-lecture12-subwords.pdf">This one</a> from the famous Stanford professor Christopher Manning is also really nice.</p><h4>Word Embeddings</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l_OTsU5slbXrhWud" /><figcaption>Photo by <a href="https://unsplash.com/@amandagraphc?utm_source=medium&amp;utm_medium=referral">Amanda Jones</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This one is necessary to better appreciate the deep contextualized token representations we have nowadays with pretrained transformers.</p><p>Word embeddings played an important role in NLP history.</p><p>The drawback these representations have is that they aren’t contextual. What I mean by that is that e.g. <strong>Word2Vec </strong>or <strong>GloVe </strong>would give you the same embedding vector for the word/token “queen” in both of these sentences:</p><ol><li>“Queen Elizabeth II has ruled for longer than any other Monarch in British history.”</li><li>“The Queen Bee plays a vital role in the hive because she is the only female with fully developed ovaries.”</li></ol><p>Even though the semantics i.e. the meaning of these words are totally different. Here are the 2 best high-level explanations I found:</p><ul><li><a href="https://jalammar.github.io/illustrated-word2vec/">Illustrated Word2Vec</a> (Transformers OG Jay Alammar)</li><li><a href="https://machinelearningmastery.com/what-are-word-embeddings/">What are word embeddings</a> (Jason Brownlee)</li></ul><p>And here are some papers worth reading (pick only one, you don’t need both I skipped GloVe, you just want to get the idea of how these were trained):</p><ul><li><a href="https://arxiv.org/pdf/1301.3781.pdf">Word2Vec paper</a></li><li><a href="https://papers.nips.cc/paper/5021-distributed-representations-of-words-and-phrases-and-their-compositionality.pdf">Distributed Representations of Words and Phrases and their Compositionality</a> (Word2Vec second paper)</li><li><a href="https://nlp.stanford.edu/pubs/glove.pdf">GloVe</a></li></ul><p>At this point you could probably take a look at this seminal paper written in 2003 by the Turing award laureate Yoshua Bengio:</p><ul><li><a href="https://www.jmlr.org/papers/volume3/bengio03a/bengio03a.pdf">A neural probabilistic language model</a></li></ul><p>It’ll help you further consolidate your knowledge.</p><h4>Contextualized shallow representations</h4><p>I mentioned the “queen” example and how we&#39;re failing to capture the meaning of the word based on the context.</p><p>Can we do better than Word2Vec and GloVe?</p><p>And so, contextualized word-embeddings were born. The first one that I’m aware of was this method called CoVe:</p><ul><li><a href="https://arxiv.org/abs/1708.00107">Learned in Translation: Contextualized Word Vectors</a></li></ul><p>These CoVe embeddings were contextual but they still had to develop task-specific architectures and they only used the last layer information to solve the downstream NLP tasks.</p><p>Then came ELMo which further refined the idea:</p><ul><li><a href="https://arxiv.org/abs/1802.05365">Deep contextualized word representations</a></li></ul><p>They noticed that different layers contained different representations of semantic/syntax information and so they used all of those representations to solve the downstream NLP tasks and that helped.</p><p>ELMo gained some serious traction, TechCrunch even made a blog about it:</p><ul><li><a href="https://techcrunch.com/2018/06/15/machines-learn-language-better-by-using-a-deep-understanding-of-words/">Machines learn language better by using a deep understanding of words</a></li></ul><p>Now around this point in time, things were getting really intensive — lots of interesting research was happening in parallel. Transformer happened in 2017, a bit later GPT and BERT came to the scene — the rest is history.</p><p>Preceding those events, there are 2 more important dots we need:</p><ul><li><a href="https://arxiv.org/abs/1801.06146">Universal language model ULM-FiT</a></li><li><a href="https://arxiv.org/abs/1511.01432">Semi-supervised seq learning</a> (earlier in 2015)</li></ul><p>Somewhere along this point of time when ULM-FiT appeared, the NLP world started shifting. Something strange was happening. The NLP field was entering its “ImageNet moment”. All of the previous research slowly enabled the power of full-blown transfer learning in the field of NLP.</p><p>Researchers have figured out that we can do transfer learning the same way it was previously being done in the computer vision world since 2012 — when the famous AlexNet/ImageNet moment happened. Basically, the CNNs (re)appeared and left every other approach in the dust.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kwvG2u6eTPjFBQVx0xGq0g.png" /><figcaption>The ImageNet moment</figcaption></figure><p>You could see the saturation of the “top-5” error metric happening just around 25. Those were the old hand-crafted ML methods. Then CNNs made a quantum jump in 2012 and this wasn’t just the start of a new era in computer vision, this was the start of the deep learning era/hype as well.</p><p>We’ve known about CNNs since the early 70s so what was different this time? Well, powerful hardware and lots of data (like the ImageNet dataset). And a handful of people with a huge dose of “belief” that this time CNNs will shine.</p><p>Sebastian Ruder nicely documented this moment of NLP history:</p><p><a href="https://ruder.io/nlp-imagenet/">NLP&#39;s ImageNet moment has arrived</a></p><p>Sebastian also has (had? the last one happened on April 2020) an awesome monthly newsletter so do check out that one (or subscribe) as well:</p><ul><li><a href="http://newsletter.ruder.io/">NLP news by Sebastian Ruder</a></li></ul><p>He’s a scientist at DeepMind and really famous in the NLP community, it’s always a good idea to surround yourself with the best from the field if you want to stay up to date.</p><p>And now put out the red carpet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z1PxbZ-NrFF2TAqI" /><figcaption>Photo by <a href="https://unsplash.com/@roblaughter?utm_source=medium&amp;utm_medium=referral">Rob Laughter</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a> (Let the show begin!)</figcaption></figure><h4>Transformers</h4><p>Mighty transformers. This was the paper that helped start the revolution — The “ImageNet moment” of NLP:</p><p><a href="https://arxiv.org/abs/1706.03762">Attention Is All You Need</a></p><p>I created a detailed explanation of the paper that can help you understand all of the nitty-gritty details (I’ve got a lot more transformers-related resources that I’ve created scattered across the rest of this blog post):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FcbYxHkgkSVs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DcbYxHkgkSVs&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FcbYxHkgkSVs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a77b44c4bfa6d627982acd9803ebdf6/href">https://medium.com/media/6a77b44c4bfa6d627982acd9803ebdf6/href</a></iframe><p>And going further, This Blog Is All You Need:</p><ul><li><a href="https://jalammar.github.io/illustrated-transformer/">The Illustrated Transformer</a> (Again Jay Alammar ❤)</li></ul><p>Here are a couple of nice videos as well:</p><ul><li><a href="https://www.youtube.com/watch?v=rURRYI66E54&amp;ab_channel=Computerphile">AI Language Models &amp; Transformers — Computerphile</a></li><li><a href="https://www.youtube.com/watch?v=TQQlZhbC5ps&amp;ab_channel=CodeEmporium">Transformer Neural Networks — EXPLAINED! (Attention is all you need)</a></li><li><a href="https://www.youtube.com/watch?v=4Bdc55j80l8&amp;ab_channel=TheA.I.Hacker-MichaelPhi">Illustrated Guide to Transformers Neural Network: A step by step explanation</a></li><li><a href="https://www.youtube.com/watch?v=iDulhoQ2pro&amp;ab_channel=YannicKilcher">Attention Is All You Need</a> (Yannic Kilcher)</li></ul><p>For a really nice recap of attention I’d recommend this blog:</p><ul><li><a href="https://lilianweng.github.io/lil-log/2018/06/24/attention-attention.html">Attention Attention</a></li></ul><p>It’ll also introduce you to the concepts of Neural Turing Machines and Pointer networks. And finally, if you want to get your hands dirty with some code, here is the project I developed and open-sourced:</p><ul><li><a href="https://github.com/gordicaleksa/pytorch-original-transformer">PyTorch The Original Transformer</a> (I’ll mention it again a bit later)</li></ul><h4>BERT</h4><p>Let’s continue our journey through the magic world of NLP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*JICLBFQ471UdLrUIMj86zg.png" /></figure><p>I hear you cry “but BERT is just a transformer!”. No, it’s not! They even coined a separate term for exploring BERT-like models — “bertology”. Nice, right?</p><p>Anyways BERT is architecture-wise the same thing as the above transformer (it took the encoder portion of the architecture).</p><p>What it introduced were some details like e.g. the “class” token, and a new pretraining objective masked language modeling objective or MLM for short.</p><p>It was also bidirectional compared to the unidirectional/causal nature of the original transformer. That gives it an edge in many NLP tasks where it’s useful to have both the left and right context — the most obvious one predicting a word in the middle of the sentence (fill in the blank task).</p><p>And again this blog is the best resource I found:</p><ul><li><a href="https://jalammar.github.io/illustrated-bert/">Illustrated BERT</a></li></ul><p>Also, Google published 2 nice blogs on it:</p><ul><li><a href="https://ai.googleblog.com/2018/11/open-sourcing-bert-state-of-art-pre.html">Open-sourcing BERT</a></li><li><a href="https://www.blog.google/products/search/search-language-understanding-bert/">BERT is powering the Google Search</a></li></ul><p>If you like the video format this one is a nice high-level overview:</p><ul><li><a href="https://www.youtube.com/watch?v=xI0HHN5XKDo&amp;ab_channel=CodeEmporium">BERT Neural Network — EXPLAINED!</a></li></ul><p>That’s BERT. Now, the second really famous family of models was of course the GPT family.</p><h4>GPT (Generative Pretrained model)</h4><p>GPT has a totally different approach and different goals from BERT. It’s an autoregressive language model. It’s causal and it’s unidirectional. It’s really good at generating text — especially long stories humans have trouble distinguishing from human-written stories (particularly the GPT-3 model).</p><p>Architecture-wise GPT basically took the decoder part of the transformer model (contains causal masks — i.e. tokens can’t look ahead) and pushed it to its limits.</p><p>The final iteration of the GPT family, the famous GPT-3 model, is basically competing for the position of the most general language model. No fine-tuning is needed for downstream NLP tasks. Pretrain once and use it for everything.</p><p>Again this could easily be a separate blog post. Here are the papers:</p><ul><li><a href="https://s3-us-west-2.amazonaws.com/openai-assets/research-covers/language-unsupervised/language_understanding_paper.pdf">GPT 1</a> (Improving Language Understanding by <strong>G</strong>enerative <strong>P</strong>re-<strong>T</strong>raining)</li><li><a href="https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf">GPT 2</a> (Language Models are Unsupervised Multitask Learners)</li><li><a href="https://arxiv.org/abs/2005.14165">GPT 3</a> (Language Models are Few-Shot Learners)</li></ul><p>I recently also covered the monstrous (75 pages long) GPT-3 research paper on my YouTube channel as well:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FfVt387VZJe8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DfVt387VZJe8&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FfVt387VZJe8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1ae7f7b07ce7cfa8c5380c72b26d5dc/href">https://medium.com/media/a1ae7f7b07ce7cfa8c5380c72b26d5dc/href</a></iframe><p>I only recently started doing these paper distillation videos so if you found them useful I’d appreciate your feedback and I’ll start doing even more of those. Yannic also did a <a href="https://www.youtube.com/watch?v=SY5PvZrJhLE&amp;ab_channel=YannicKilcher">nice video</a>!</p><p>Again Jay did a marvelous explanation on his blog:</p><ul><li><a href="http://jalammar.github.io/illustrated-gpt2/">Illustrated GPT-2</a> and a little about <a href="https://jalammar.github.io/how-gpt3-works-visualizations-animations/">GPT-3</a></li></ul><p>And TBH I really like OpenAI’s blogs:</p><ul><li><a href="https://openai.com/blog/language-unsupervised/">OpenAI’s GPT-1 blog</a></li><li><a href="https://openai.com/blog/better-language-models/">OpenAI’s GPT-2 blog</a></li><li><a href="https://openai.com/blog/ai-and-compute/">AI and compute</a> (excellent one!) and <a href="https://openai.com/blog/preparing-for-malicious-uses-of-ai/">malicious uses of AI</a></li></ul><p>The AI development and compute power relationship is <a href="http://www.incompleteideas.net/IncIdeas/BitterLesson.html">rather interesting</a> so I thought it’d be nice mentioning that blog as well.</p><p>Finally here are some blogs covering the hype-anti-hype spectrum.</p><p><a href="https://www.theverge.com/21346343/gpt-3-explainer-openai-examples-errors-agi-potential">Verge blog </a>— a nice collection of what happened on social media and in general around GPT-3 after it was first published.</p><p><a href="https://pagestlabs.substack.com/p/gpt-3-and-a-typology-of-hype">This one</a> nicely explains the topology of the hype-spectrum, <a href="https://minimaxir.com/2020/07/gpt3-expectations/">this one</a> gives a nice overview of the hype also (and model limitations, etc.).</p><p>You can see some of the “GPT-3’s pitfalls” <a href="https://lacker.io/ai/2020/07/06/giving-gpt-3-a-turing-test.html">here</a> and finally by far the most thorough resource out there is that by Gwern:</p><p><a href="https://www.gwern.net/GPT-3">GPT-3 Creative Fiction</a></p><p>Gwern’s text is a bit more difficult to parse IMO, but it’s got all of the details you’d want to know about GPT-3&#39;s real-world behavior (compared to non-intuitive objective metrics like perplexity, etc.)</p><p>Finally, here are a couple of GPT apps you could try out:</p><ul><li><a href="https://play.aidungeon.io/">AI Dungeon</a> (it’s an interesting interactive game!)</li><li><a href="https://app.inferkit.com/demo">Talk To Transformer</a></li><li><a href="https://transformer.huggingface.co/">Write With Transformer</a></li><li><a href="https://www.tabnine.com/blog/deep/">IDE autocompletion</a></li></ul><h4>Is there life after BERT and GPT?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wnnyZQ6K4prDxb51" /><figcaption>Photo by <a href="https://unsplash.com/@monti3l?utm_source=medium&amp;utm_medium=referral">Marlon Nartea</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You bet there is! First, it’d be worth checking out these 2 nice overview blogs.</p><ul><li><a href="https://medium.com/@Moscow25/the-best-deep-natural-language-papers-you-should-read-bert-gpt-2-and-looking-forward-1647f4438797">NLP papers you should read</a> (Nikolai is an ex NVIDIA researcher)</li><li>Overview of transformers by <a href="https://medium.com/huggingface/encoder-decoders-in-transformers-a-hybrid-pre-trained-architecture-for-seq2seq-af4d7bf14bb8">HuggingFace</a></li></ul><p>Here are some of the interesting papers I’ve read:</p><ul><li><a href="https://arxiv.org/abs/1901.02860">TransformerXL</a> (Google) (smart way to widen the context of LM)</li><li><a href="https://arxiv.org/abs/1906.08237">XLNet</a> (Google) (proposes a way to unite BERT’s MLM and GPT’s LM objectives, uses Transformer XL as a backbone, 512 TPU v3s)</li><li><a href="https://arxiv.org/abs/1907.11692">RoBERTa</a> (FAIR) (strong dependency on BERT and XLNet, 1024 V100s)</li><li><a href="https://arxiv.org/abs/1909.11942">ALBERT </a>(Google) (smart way to get more efficient BERT, ≤512 TPU v3s)</li><li><a href="https://arxiv.org/abs/1910.10683">T5</a> (Google) (the best overview of the transformers landscape, TPU pods!)</li><li><a href="https://arxiv.org/abs/1905.03197">Uni LM</a> (Microsoft) (introduced prefix-causal masking, 8 V100s)</li></ul><p>I intentionally wrote the affiliation next to the paper just to paint the picture of how the current NLP landscape looks like. 90% of the highly influential research came from Google (including the original transformer).</p><p>I’ll stop here there is a lot of things that can be said on that topic! 😅</p><p>Next, I wrote the amount of compute that’s needed. Again I won’t go there either! (nervous chuckle).</p><p>You should probably readTransformerXL and XLNet in a batch. XLNet is super hard to understand IMO (and others share my opinion haha) and it’s also hard to reproduce. T5 later showed that it’s debatable whether we need those complications in the first place, but it’s still worth a read.</p><p>RoBERTa did a combinatorial space exploration around the original BERT and showed that with more data, compute and some hyperparam exploration you can gain much more out of BERT.</p><p>ALBERT experiments with parameter sharing, embedding matrix decomposition, and gradient checkpointing (to save up some memory). All of this leads to a much smaller memory footprint.</p><p>Finally, If there is one paper you should read that would be T5. Google also published a <a href="https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html">nice blog</a> on it. I also really liked the Uni LM paper (not because I work at Microsoft but it’s truly a nice read!)</p><p>The second group of papers I’ll mention here have to do with making transformers more efficient (memory/time complexity):</p><ul><li><a href="https://arxiv.org/abs/1904.10509">SparseTransformer</a> (OpenAI) (introduced new attention patterns, O(n*sqrt(n)) compare that to original transformer’s O(n²), 8–64 V100s)</li><li><a href="https://arxiv.org/pdf/2004.05150">Longformer</a> (Allen AI) (introduced new attention patterns, 8 RTX8000)</li><li><a href="https://arxiv.org/abs/2001.04451">Reformer</a> (Google), (introduces LSH, chunking, gradient checkpointing, etc. Here is the <a href="https://ai.googleblog.com/2020/01/reformer-efficient-transformer.html">official blog</a>, a <a href="https://towardsdatascience.com/illustrating-the-reformer-393575ac6ba0">nice overview</a> (cool animations) and a nice <a href="https://colab.research.google.com/github/patrickvonplaten/blog/blob/master/notebooks/03_reformer.ipynb">in-depth explanation</a>, 8 TPU v3 cores)</li><li><a href="https://arxiv.org/abs/2006.04768">Linformer</a> (FAIR) (low rank approximation, O(k*n)~ O(n)) (64 V100s)</li></ul><p>You can see that the necessary HW for training these ones is way smaller than for the above group of papers (that’s why I’ve put ALBERT in this other group).</p><p>Phew let me stop here. That was a lot of theory to go through. I explained a part of the process of how I approached learning all of this in this video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FbvBK-coXf9I%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DbvBK-coXf9I&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FbvBK-coXf9I%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/99b7ee0de9a53560a1aad386c4747ccc/href">https://medium.com/media/99b7ee0de9a53560a1aad386c4747ccc/href</a></iframe><h3>What I’ve learned implementing the transformer</h3><p>Reading through a bunch of excellent theory I still knew there are details that I don’t understand and so as always I wanted to implement at least 1 project in the field I’m interested in.</p><p>So after ~3 weeks of non-stop work I created this one:</p><p><a href="https://github.com/gordicaleksa/pytorch-original-transformer">gordicaleksa/pytorch-original-transformer</a></p><p>I learned a looot. One thing that used to confuse me was how do we start the generation process in the autoregressive architectures like the original transformer? Which is a detail none of the above blogs/papers covered.</p><p>It’s one of those <strong>“tribal knowledge”</strong> details. If you’re long enough in the field you know that stuff so it feels redundant to say it out loud.</p><p>And the answer is you trigger it with the start of the sentence (commonly denoted as <em>&lt;sos&gt;</em>) token’s embedding vector. Whatever comes out at the topmost layer you feed back as the second token and voila!</p><p>Super simple, as most things truly are, it’s just that rarely who has an incentive to make it easier for others, for whatever reason that may be.</p><p>I was also interested to see how the data is exactly fed to these transformers and how the exact training procedure looks like (KL divergence over soft targets in the case of the original transformer).</p><p>I got a much better feeling for different <a href="https://github.com/huggingface/blog/blob/master/notebooks/02_how_to_generate.ipynb">decoding methods</a> like greedy, beam search, sampling, top-k, top-p (nucleus), and most importantly I understood the exact details of the attention mechanism and how to visualize it.</p><p>I had fun along the way, although it was also rough at times — I especially had problems with PyTorch’s torchtext and BucketIterator class specifically. Their torchvision lib for computer vision is far more sophisticated.</p><p>Anyways if you’d like to learn more I created a <a href="https://github.com/gordicaleksa/pytorch-original-transformer/blob/main/The%20Annotated%20Transformer%20%2B%2B.ipynb">Jupyter Notebook here</a>. It’s really long I know but once you understand it you’ll be in a good position to understand much of the exciting research that’s happening across the deep learning field.</p><p>I also did a video where I explained the process I went through developing this project:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2Fpx4rtkWHFvM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3Dpx4rtkWHFvM&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2Fpx4rtkWHFvM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c30b0799f15df3a0d9ba958b70d6b49/href">https://medium.com/media/9c30b0799f15df3a0d9ba958b70d6b49/href</a></iframe><p>Finally, if you’d like to get a feeling for what you can do with transformers do check out HuggingFace’s <a href="https://huggingface.co/transformers/notebooks.html">official and community notebooks</a> and try out their <a href="https://github.com/huggingface/transformers/blob/master/notebooks/03-pipelines.ipynb">pipelines API</a>— it’s super easy to use and you’ll get some toy projects under your belt.</p><h3>My next steps</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K1wXy6bE5WHB-PrW" /><figcaption>Photo by <a href="https://unsplash.com/@jakehills?utm_source=medium&amp;utm_medium=referral">Jake Hills</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Phew, that was a long blog! I, unfortunately, can’t afford (time-wise) to make more than one of these for every deep learning topic that I cover.</p><p>If you’ve read the <a href="https://medium.com/@gordicaleksa/get-started-with-ai-and-machine-learning-in-3-months-5236d5e0f230">first-ever Medium blog</a>, that I wrote ~2 years ago, you could have expected me doing all of this. I mentioned that I am a strong believer in mixing theory with practical, hands-on projects.</p><p>So what are my next steps?</p><p>I’ll start exploring GNNs (Graph Neural Networks) starting from tomorrow pretty much! ❤️And after ~2 months I’ll switch my attention (pun intended) to RL (Reinforcement Learning).</p><p>You can definitely expect more YT videos during my exploration of these 2 subfields, at least 2 more (GitHub) projects, and 2 (Medium) blogs like this one.</p><p>And I’ll also try changing my DL framework a bit. One look at my <a href="https://github.com/gordicaleksa">GitHub repo </a>and you know that I love PyTorch. I’ll try experimenting with JAX &amp; GNNs.</p><p>After I finish that I’ll probably take one more month to cover a couple of topics that interest me: adversarial attacks, VAEs (variational auto-encoders), knowledge distillation and I want to build some foundations in symbolic AI.</p><p>That way I’ll (hopefully) have a holistic overview of the whole field.</p><p>Finally going longer into the future (longer into the future = 5+ months from now 😜), I’ll:</p><ul><li>Shift my focus from reimplementing other people’s work (papers) to developing my own creative/funny/useful projects.</li><li>Start covering SOTA research papers on my YouTube channel as soon as they come out and I’ll also try to cover the most exciting stuff that’s happening/trending in the AI world be it some AI breakthroughs (like I recently covered DeepMind’s AlphaFold2), social topics or something else.</li><li>Still occasionally write on Medium</li></ul><p>Also, there are some plans which I, unfortunately, can’t yet disclose — so stay tuned for those! ❤️</p><blockquote><em>A personal update September, 2021: I recently landed a job at my dream company </em><strong><em>Google DeepMind!</em></strong><em> I’ll be working there as a Research Engineer starting December, 2021. That was one of those things I couldn’t disclose back then as I was still working at Microsoft.</em></blockquote><p>A small tangent on the topic of Ph.D. as that’s something I often think about. I don’t have a Ph.D. in ML/deep learning as I didn’t want it. It just doesn’t align with my personal goals.</p><p>I think I have much more freedom like this but I’m also 100% aware that not everybody can work in a fully unsupervised manner.</p><p>People say Ph.D. gives you freedom. And that’s true — compared to undergrad/grad studies for sure. But I do believe it would be a “lesser freedom” to the thing I have. At least for me.</p><p>There are lots of tradeoffs of course and this could be an entirely separate blog post (Chris Olah wrote a <a href="https://colah.github.io/posts/2020-05-University/">beautiful blog</a> on the topic).</p><p>Briefly in my opinion the top pros of doing a Ph.D. are:</p><ul><li>Credentials (or “academic” badge as I like to call it) (oh he finished Stanford, oh he’s been to Cambridge, MIT, &lt;fill in the blank&gt;)</li><li>Networking with fellow researchers (although you definitely don’t need a Ph.D. to do this, I have a bunch of friends who are researchers at Microsoft, DeepMind, Stanford (just throwing fancy names around))</li></ul><p>Top cons:</p><ul><li>It takes a lot of your best years of life when you’re the most entrepreneurial you’ll ever be (most people at least)</li><li>No relevant experience in the industry, worse coding/engineering skills (unless you do an industrial Ph.D. that’s a nice tradeoff IMO)</li><li>Less freedom (again relative thing)</li><li>You tradeoff depth for breadth</li><li>No money (relatively speaking compared to the industry)</li></ul><p>So IMO, If you’re certain that your goal in life is to become a researcher in a particular field then you should do a Ph.D. by all means — otherwise, you probably should not.</p><p>I just feel that many people (some of which I know) are doing a Ph.D. in deep learning not because they’re interested in pursuing a research career but quite the opposite actually.</p><p>They do it to get the highest paying jobs in the industry or to become more attractive to VCs (omg he’s been to Stanford). And that’s probably a good strategy, who am I to judge — but it’s not what Ph.D. should be about IMO, it’s just hacking/exploiting the current system.</p><p><strong>If there is something you would like me to write about — </strong><em>write it down in the comment section or send me a DM, I’d be glad to write more about maths, ML, deep learning, software, landing a job in a big tech company, preparing for ML summer camps, electronics (I actually officially studied this beast), etc., anything that could help you.</em></p><p><em>Also feel free to drop me a message or:</em></p><ol><li>Connect and reach me on<strong> </strong>💡 <a href="https://www.linkedin.com/in/aleksagordic/"><strong>LinkedIn</strong></a><strong> </strong>and <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a></li><li>Subscribe to my 🔔 <a href="https://www.youtube.com/c/TheAiEpiphany"><strong>YouTube channel</strong></a> for AI-related content️</li><li>Follow me on 📚 <a href="https://medium.com/@gordicaleksa"><strong>Medium</strong></a><strong> </strong>and 💻<a href="https://github.com/gordicaleksa"><strong>GitHub</strong></a></li><li>Subscribe to my 📢 <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a> and join the 👨‍👩‍👧‍👦 <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community!</li></ol><p>And if you find the content I create useful <a href="https://www.patreon.com/theaiepiphany"><strong>consider becoming a Patreon!</strong></a></p><p>Much love ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb6d31c0b848" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Turing for Dummies (AI) — Part 2]]></title>
            <link>https://gordicaleksa.medium.com/turing-for-dummies-ai-part-2-848cb87e95ab?source=rss-37f02ae83e8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/848cb87e95ab</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Aleksa Gordić]]></dc:creator>
            <pubDate>Wed, 17 Jun 2020 20:41:48 GMT</pubDate>
            <atom:updated>2021-08-14T12:40:59.483Z</atom:updated>
            <content:encoded><![CDATA[<h3>Turing for Dummies (AI) — Part 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SuoRvZAAByloqv27" /><figcaption>What approach should we take to engineer truly intelligent machines? (Photo by <a href="https://unsplash.com/@franckinjapan?utm_source=medium&amp;utm_medium=referral">Franck V.</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>The <a href="https://medium.com/@gordicaleksa/turing-for-dummies-ai-part-1-f0f668bcd83d">last blog</a> of this series covered Turing’s famous “Computing Machinery and Intelligence” paper from 1950 and introduced his main ideas like The Imitation Game, nowadays better known as the Turing Test. It also covered the main objections that Turing himself imagined being used against his theory.</p><p>As a short recap Turing strongly believed in the <strong>computational nature</strong> of our minds, meaning it will be entirely possible for a digital computer to mimic the human mind and by doing so<em> develop a (digital) mind of its own.</em></p><p>In this blog, I’m going to cover, in more depth, the strongest objections, as well as the new proposals for the potentially better tests, that came in the decades after the original Turing’s paper was published.</p><p>As well as some fun stuff I found along the way! Let’s jump into it!</p><blockquote>Personal update: I just created a <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a><strong> </strong>and a <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community! Subscribe/join those to keep in touch with the latest &amp; greatest AI news if that’s something you care about!</blockquote><h3><strong>Minds, brains, and programs</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QYTdBpDr7YvTzloP" /><figcaption>The Chinese Room Argument (Photo by <a href="https://unsplash.com/@rikkefilbaert?utm_source=medium&amp;utm_medium=referral">Rikke Filbært</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>Written in 1980 by John Searle, <a href="https://www.law.upenn.edu/live/files/3413-searle-j-minds-brains-and-programs-1980pdf">this paper</a> is considered as one of the strongest objections to the Turing Test.</p><p>It’s more famously known as the <strong>“Chinese room”</strong> argument. But before describing how the thought experiment goes let me first explain some terminology that is helpful to have in mind (whatever that is).</p><p>Searle distinguishes between 2 types of AI:</p><ul><li><strong>Weak AI</strong> (a useful tool that helps us, humans, study the mind)</li><li><strong>Strong AI</strong> (programmed correctly the digital equivalent of the mind itself)</li></ul><p>And we can all agree about the weak AI. Without a doubt AI is making our lives easier and is helping us better understand the world around us, minds included (there are certainly bad sides to technology but those are more of social problems than ones of technology).</p><p>On the other hand, strong AI implies that those, correctly-programmed, digital computers <em>have cognitive states</em> and from that, it follows that <strong>programs explain cognition. </strong>This is something that Turing strongly <em>believed </em>in.</p><p>And here is how Searle refuted this idea:</p><p>Imagine you have a person inside a room. That person doesn’t speak Chinese* nor has any, whatsoever, understanding of it. Now outside of the room is a native Chinese speaker, he/she writes down something in Chinese and passes the paper to the person inside of the room.</p><p>The person inside the room has been given some rules (think of computer instructions) on how to react to every input (Chinese characters) that he/she gets. So the person sees “squiggle squiggle” and just <em>blindly following the rules</em>, <strong>without any understanding</strong>, forms the output that is also in the correct “squiggle squiggle” form and passes it outside of the room.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dR8zclKWo3Ix6ycT.png" /><figcaption>The Chinese Room setup (awesome visualization borrowed from <a href="https://towardsdatascience.com/@jaimezornoza">Jaime Zornoza’</a>s <a href="https://towardsdatascience.com/the-history-of-artificial-intelligence-the-turing-test-c1d6777d2970">blog</a> with his permission)</figcaption></figure><p>From the point of a native speaker, if the rules were properly engineered, it seems like he/she is communicating with another native Chinese speaker, but we know that that’s not the case and that the result was created by a blind symbol manipulation without any understanding of the Chinese language.</p><p>*- <em>I’m aware that there is no such thing as “Chinese” that would be equivalent to me saying ‘I speak Slavic’ instead of ‘I speak Serbian’. For my Chinese friends out there suppose we implicitly think of Mandarin Chinese when we say Chinese.</em></p><p>So the person in this thought experiment took the role of the computer and we see that <strong>without any understanding</strong> it is able to <strong>imitate </strong>a native Chinese speaker. We are allowed to do this since the “hardware implementation” does not matter — mind exists independent of its implementation details as per the theory we’re trying to refute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iSL74P3HBvApgccM" /><figcaption>Following rules, we could communicate in Chinese? Phew, that’s a hard one. (Photo by <a href="https://unsplash.com/@cherrybbybomb?utm_source=medium&amp;utm_medium=referral">Cherry Lin</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>And that is precisely what the Turing Test is all about — imitation.</p><p>Now there are some BUTs here that may pop into your mind. It’s one thing to make a thought experiment where the Chinese output that the person produces is perfect, but it’s a different thing whether that’s at all possible to do following a <em>finite </em>list of instructions.</p><p>My <strong>belief </strong>is the following. If and when we engineer a machine who’s behavior is truly indistinguishable from humans it will probably <strong>have to</strong> use some “novel” technology and it will produce <em>some form</em> of <em>cognition </em>in the process.</p><p>I don’t believe that it can be done using symbol manipulation that Turing proposed, which we use even today, including the learning methods that I’m aware of. We may get to ‘hey close enough’ in a 20-minute conversation, which would, from an economic standpoint, be damn useful! but that’s not it. That’s not the real AI that we’re trying to build.</p><p>Reiterating, what Searle was trying to say is that dualism* is a wrong idea to start with. You have to <strong>duplicate the causal powers of the brain</strong> in order to achieve cognition, running a program is just not enough. This idea, although it’s in conflict with a mathematician inside of me who’s prone to abstraction and simplification, resonates with me.</p><p>*- theory that we can split the mind and the brain in the same way that we split hardware and software. The opposite theory is that you can’t split them — mind <strong>requires </strong>this specific implementation that we call the brain.</p><p>I’ll leave you with an interesting formulation that Searle made:</p><blockquote>No one supposes that computer simulations of a five-alarm fire will burn the neighborhood down or that a computer simulation of a rainstorm will leave us all drenched. Why on earth would anyone suppose that a computer simulation of understanding actually understood anything?</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_DXJIpAhkJF5EcSo" /><figcaption>Rain vs rain simulation. Mind vs simulating the mind. (Photo by <a href="https://unsplash.com/@osmanrana?utm_source=medium&amp;utm_medium=referral">Osman Rana</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>Now let’s see some of the most famous proposals on how to replace the Turing Test with something better.</p><h3><strong>Total Turing Test (TTT)</strong></h3><p>Dubbed like this by Stevan Harnad, the earliest mentions of TTT I’ve found originate in his paper <a href="http://cogprints.org/1573/1/harnad89.searle.html">Minds, Machines and Searle</a> (1989), but was covered at least 1 more time in his <a href="http://www.southampton.ac.uk/~harnad/Papers/Harnad/harnad91.otherminds.html#:~:text=Other%20Bodies%2C%20Other%20Minds,of%20an%20Old%20Philosophical%20Problem&amp;text=Minds%20are%20hence%20very%20different,an%20explanation%20of%20the%20body.">Other Bodies, Other Minds</a> paper (1991).</p><p>The basic idea of TTT is this, TT only tests for the linguistic capacities of humans whereas TTT also includes our <strong>“robotic”</strong> capacities. Moving, interacting with physical objects in our environment, seeing, and all the other sense-modalities (hearing, etc.) we have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wIHRcRTOR1T3KCv7" /><figcaption>Our brains and minds evolved interacting with the world around us. (Photo by <a href="https://unsplash.com/@supernov?utm_source=medium&amp;utm_medium=referral">Edi Libedinsky</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>Or as Harnad puts it:</p><blockquote>It is hard to imagine, for example, that a TT candidate could chat with you coherently about the objects in the world till doomsday without ever having encountered any objects directly — on the basis of nothing but “hearsay,” so to speak. Some prior direct acquaintance with the world of objects through sensorimotor (TTT) interactions with them would appear to be necessary in order to <em>ground</em> the candidate’s words in something other than just more words.</blockquote><p>If by the word “world” he also thinks of the simulated world I’m happy. Now this may sound obvious and you may ask yourself why didn’t Turing include all of this, why did he abstract these “details” away?</p><p>Surely 1 reason was this:</p><blockquote>Bodily appearance clearly matters far less now than it might have in Turing’s day</blockquote><p>Back in the day, they weren’t accustomed to seeing robots everywhere. Nowadays in the post Star Wars era, we got really accustomed. We see them in cinemas, on television, in our favorite movies and series and we are quite comfortable with the idea that robots can have intelligence.</p><p>Turing thought that if the judge was to see the robot it needed to look <strong>exactly like</strong> a human (to have the same skin as we do, etc.) — which was an unfair and redundant constraint according to Turing and rightfully so, but we don’t hold the same biases anymore.</p><p>There is 1 more assumption that Turing implicitly made and Harnad made that explicit in his paper:</p><blockquote>It is unlikely that our chess-playing capacity constitutes an autonomous functional module, independent of our capacity to see, move, manipulate, reason, and perhaps even to speak. The TT itself is based on the pre-emptive <strong>assumption </strong>that our linguistic communication capacity is <strong>functionally isolable.</strong></blockquote><p>The hypothesis that Harnad is making is that it may not even be possible to pass the TT without passing TTT, because in order to develop linguistic capability we’d have to develop the robotic capability in the first place:</p><blockquote>It is highly unlikely that our linguistic capacities are independent of our robotic capacities: Successfully passing the teletype version of the Turing Test alone may be enough to convince us that the candidate has a mind (just as written correspondence with a never-seen pen-pal would), but full robotic capacities (even if only latent ones, not directly exhibited or tested in the TT) may still be necessary to generate that successful linguistic performance in the first place.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ccc0YukQjSk5NfO4" /><figcaption>The Total Turing Test also requires our “robotic” capabilities. (Photo by <a href="https://unsplash.com/@brett_jordan?utm_source=medium&amp;utm_medium=referral">Brett Jordan</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>A further benefit of introducing TTT is that we’re more likely to converge to a “right” solution in the sense that the machine will more likely have a mind if it passes the TTT.</p><p>But, an interesting question is what’s the <strong>evolutionary advantage</strong> of having a mind in the first place? How did evolution produce the mind? Natural selection “knows” as much as the judge in the Turing Test. Better performing individuals have a greater chance of survival that’s it.</p><p>Then why aren’t we all mindless robots with amazing capabilities?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rF7F_rqiGGcCncvx" /><figcaption>How and why did evolution create the mind? (Photo by <a href="https://unsplash.com/@eugenezhyvchik?utm_source=medium&amp;utm_medium=referral">Eugene Zhyvchik</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>Harnad as well as Turing both acknowledge that there is no way to know whether others (humans or robots) have a mind (an age-old problem, known in philosophy as the <em>“other minds”</em> problem) and so accepts TTT as the best thing we can do at the moment.</p><p>You know that one:</p><p><em>“If it looks like a duck, walks like a duck, quacks like a duck…it’s a duck</em>”</p><p>But there is always this one guy that still doesn’t buy it. And it’s Searle again.</p><p>Searle’s paper, discussed in the previous section, also had an objection against TTT, called “The Robot Reply (Yale)”. The argument goes like this:</p><p>By <em>adding cameras and other sensors and actuators</em> (fancy name for anything that moves objects in the physical world like a robotic hand) to a robot you <em>don’t really add anything new</em> in the sense of understanding.</p><p>The processing part of the robot still only sees a stream of meaningless formal symbols (this time coming from the camera or some other input sensor and not from a native Chinese speaker) which it just mindlessly manipulates and then sends back to actuators in the form of yet another meaningless stream of symbols.</p><p>Harnad&#39;s contra-argument is that this time Searle cannot do the job of a transducer (which converts, in the example of the camera, photons into “symbols”) and thus the <em>“systems reply”</em> holds — namely that although the person in the Chinese room experiment has no understanding, the system as a whole has.</p><p>I think I’m with Searle on this one but I still do think that from an engineering standpoint we want to go for TTT and develop amazing robots (even if we don’t unlock a true cognition by doing so).</p><p>Now if anyone is pushing robots beyond our imagination that’s Boston Dynamics — I guess most of you heard of them — take a look at this video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2F_sBBaNYex3E%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3D_sBBaNYex3E&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2F_sBBaNYex3E%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f16428fd5dc2fbe6638e37b0f2b921bf/href">https://medium.com/media/f16428fd5dc2fbe6638e37b0f2b921bf/href</a></iframe><p>A while back I <a href="https://www.youtube.com/watch?v=LiNSPRKHyvo">listened </a>to Marc Raibert, Boston Dynamic’s CEO and he said at that point in time that they had 0 machine learning in their systems.</p><p>Now I don’t know whether that’s true, but if it is, it’s utterly amazing how much can we accomplish by only using clever engineering and a bunch of domain expertise.</p><p><em>Fun fact: There is also a TTTT (Total Total Turing Test), where you also have to perfectly imitate the neuromolecular structure of humans.</em></p><p>And now for the final test!</p><h3>Lovelace Test (LT)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ziVgeuwL3zwGc_Lx" /><figcaption>Surprise, surprise! (Photo by <a href="https://unsplash.com/@benwhitephotography?utm_source=medium&amp;utm_medium=referral">Ben White</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p><a href="http://kryten.mm.rpi.edu/SELPAP/REPRINTS/LOVELACE/lovelace.pdf">Written in 2001</a> by Bringsjord and his colleagues, LT builds on the famous Lady Lovelace’s argument that we covered in the last blog that roughly states the following:</p><p><em>Computers can’t create, they can only do stuff that we program them to do i.e. only the things that we know how to do.</em></p><p>So the informal version of LT is pretty simple:</p><p><strong>A machine will pass the Lovelace test if it manages to surprise us.</strong></p><p>Now the surprise is a really vague term, so they formalize it explaining that if the architect of that AI agent <em>can’t explain</em> by <em>any possible mean</em> and given <em>enough</em> time how the agent produced some result, we say that the machine has passed the LT test.</p><p>They went on and dissected the state-of-the-art creative systems that were available back then, like BRUTUS (this one was developed by the authors of LT!) — which generated “creative” stories and COPYCAT, and they showed that these fail the Chinese Room argument by Searle (that guy again!).</p><p>They further took into account that Turing mentioned <strong>learning </strong>as the potential way to overcome Lovelace’s argument. So they ended up equating learning with <strong>deep learning</strong> by tackling only neural nets, showing that these, once fully trained, can be considered as a <strong>knowledge base,</strong> and thus they still don’t originate anything.</p><p>That’s an interesting way to look at the neural networks, but what they missed, in my opinion, is that the <em>“creativity” happened during the training.</em> We really can’t explain how the knowledge base was built in the first place, especially if we use some kind of stochasticity (randomness) in the optimization procedure*, which is a usual thing to do.</p><p>*- <em>neural networks are usually “trained” i.e. their “neurons” are slightly modified in this procedure we call the optimization procedure, where they get better at the task of interest.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aEQhiBuTCJ5lfZfv" /><figcaption>Can oracle machines help? (Photo by <a href="https://unsplash.com/@patrickian4?utm_source=medium&amp;utm_medium=referral">Patrick Fore</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>As a final desperate attempt to figure out how we can “engineer” these LT-passing machines they considered something called the <strong>oracle machines</strong>.</p><p>These are <strong>fictional</strong> machines (consider them as a helpful imaginary construct) that can basically solve problems that are proven to be unsolvable (like the halting problem, etc.) by the Turing machines *— we say that they can go past the so-called <em>Turing Limit</em>.</p><p>*- <em>without going deeper into the theory of what Turing machines are, consider your computer as one specific implementation of these Turing machines.</em></p><p>Most popular of these oracle machines are analog chaotic neural nets, trial-and-error machines, and Zeus machines.</p><p>In an attempt to make it less abstract let me briefly explain the Zeus machine. It basically enumerates all of the natural numbers in say 1 second — that’s what makes Zeus an oracle machine. It outputs 0 in <strong>1/2</strong> second, 1 in <strong>1/4</strong> second, 2 in <strong>1/8</strong> second, etc. and if you’re familiar with this sequence it adds up to 1. So 1 second elapses and you’ll end up with all of the natural numbers “printed to your screen” (better crank up those fps). Khm. Yeah.</p><p>So using this one you can solve otherwise computationally unsolvable problems. <em>But even Zeus will fail</em> in the Chinese Room experiment. Imagine Searle mindlessly manipulating Chinese symbols only this time he does it unbelievably fast, that’s it. But where does understanding emerge?</p><p>Well, nowhere.</p><p>They wrap up the paper saying well this didn’t go by the plan. 😃 And suggest that the possible way may be hidden in the <em>agent causation</em> — which would imply that certain mental activities (like when you make a decision/free will) happen without ordinary physical causal chain ever happening.</p><p>But I think we went too far into metaphysics at this point. Maybe they’ve “proved” that pure computation can not explain how the mind works and we’ll have to seek answers in quantum computing or these microtubules that Roger Penrose believes may hide some hints.</p><p>But let&#39;s step back and revisit the original question.</p><p><strong>Have machines managed to surprise us?</strong></p><p>Well starting in 1997 <a href="https://en.wikipedia.org/wiki/Deep_Blue_(chess_computer)"><strong>DeepBlue</strong></a> has beaten the world grandmaster in chess, Garry Kasparov, for the first time in history. And those chess-engines have gotten much better ever since. They are so good now that Magnus Carlsen, who is the current chess champion of the world, compares to them the same way as me and you compare to Magnus (except if you’re a grandmaster).</p><p>Take a look at this amazing video with Garry Kasparov where you’ll hear him explain how the whole story with DeepBlue went and much more:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2F8RVa0THWUWw&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3D8RVa0THWUWw&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttp%2Fi.ytimg.com%2Fvi%2F8RVa0THWUWw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b26066cd0fb6bc10e23af9d5ddade9bf/href">https://medium.com/media/b26066cd0fb6bc10e23af9d5ddade9bf/href</a></iframe><p>But I hear you say “but DeepBlue used the <strong>brute force</strong> approach”, so the “architect” would be able to exactly tell you what happened and thus DeepBlue wouldn’t pass the LT by definition. And I’d agree.</p><p>But what about <strong>AlphaGo </strong>or better yet AlphaZero and AlphaStar?</p><p>I don’t know, I’d like to know whether it’s possible for David Silver and his crew to know exactly why their algorithm did the <strong>“Move 37”</strong> for example? The famous move that AlphaGo did that made all of the best Go players in the world go what??? And it won the game, of course.</p><p>I listened to <a href="https://www.youtube.com/watch?v=uPUEq8d73JI">David’s talk</a> here, but I got the impression that he hasn’t got the faintest clue — not to say anything bad about David or anything he’s one of my heroes.</p><p>I know, that’s still not good enough for LT. Could they, the DeepMind team that was behind this marvelous feat of engineering, explain how it exactly came to be? I’ve got some friends at DeepMind I guess I’ll have to ask or hopefully somebody more knowledgeable than I am could comment on this blog, I’d really like to know.</p><p>I want to finish this blog series by recommending a movie. I know. Plot twist. You really expected to get some definite answers here, right?</p><p>I really can’t recommend it highly enough (please go and watch it!)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FWXuK6gekU1Y%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DWXuK6gekU1Y&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FWXuK6gekU1Y%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4943c0676d375aa4c3148a84039cee0/href">https://medium.com/media/f4943c0676d375aa4c3148a84039cee0/href</a></iframe><p>And as a fun fact, the algorithm that played Go against Lee Sedol lost 100–0 against the next iteration of the very same algorithm, and this went on in cycles.</p><p>They stopped developing it further because it would have turned into a massive black hole that would gulp down the whole Milky Way galaxy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y2MNVI1qr_6KUnEH" /><figcaption>Milky Way galaxy — probably. (Photo by <a href="https://unsplash.com/@jeremythomasphoto?utm_source=medium&amp;utm_medium=referral">Jeremy Thomas</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a>)</figcaption></figure><p>Just kidding it just wasn’t economical anymore, but what’s interesting is that they didn’t see any diminishing returns, the algorithm just kept on improving.</p><p>Than came <strong>AlphaZero </strong>which was even better and trained solely using self-play, no human intervention, no domain knowledge injection from human experts. And the very same algorithm generalizes to chess, Go and shogi. <strong>MuZero </strong>is their latest flagship (afaik)— and it’s even better than AlphaZero and can generalize to Atari games.</p><p>Nothing hints of AGI (artificial general intelligence) more than the stuff that DeepMind develops. These algorithms are, at the moment, deployed only in these constrained environments, but still, I’m damn impressed.</p><h3>Final thoughts v2.0</h3><p>Phew, we went all the way from 1950 to 2020, I hope you liked the journey!</p><p>I just want to wrap this journey up by mentioning that there are some concrete tests that we used and still use to test the machine intelligence.</p><ul><li>The <strong>Loebner prize</strong> — which is most similar to what the original Imitation Game was, but the competitors ended up using pure trickery to win, so the community lost interest and so this competition died off.</li><li><strong>Alexa prize</strong> — organized by Amazon obviously, is another test where the goal is to have a natural voice conversation with a bot for X minutes. But it’s only for students. It’s like a really weak form of TTT.</li><li><strong>Hutter prize</strong> — which is totally non-intuitive at a first glance, where the goal is to do a lossless compression of some knowledge base such as the Wikipedia content — Mark Hutter says this correlates with intelligence.</li><li><strong>Winograd schema challenge</strong> — where you’re trying to solve problems that require common-sense knowledge.</li></ul><p>Go ahead and explore these at your own pace.</p><p>Also, take a look at this video covered by Lex Fridman, who probably has the best tech/AI podcast in the world at the moment. I’ve been following him since 2018. It inspired me to finally take the Turing’s paper “Computing Machinery and Intelligence” off the backlog and read it!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2FMGW_Qcqr9eQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DMGW_Qcqr9eQ&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FMGW_Qcqr9eQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/07818d863d7034225cb300b73d9a2bf2/href">https://medium.com/media/07818d863d7034225cb300b73d9a2bf2/href</a></iframe><p>In one of the next blogs, I’ll cover Francois Chollet’s <a href="https://arxiv.org/pdf/1911.01547.pdf"><strong>“On the Measure of Intelligence”</strong></a> that’s one of the most beautiful tests that I’ve recently seen.</p><p>Take care, stay safe, and never stop learning and improving! ❤️</p><p><strong>If there is something you would like me to write about — </strong><em>write it down in the comment section or send me a DM, I’d be glad to write more about maths, ML, deep learning, software, landing a job in a big tech company, preparing for ML summer camps, electronics (I actually officially studied this beast), etc., anything that could help you.</em></p><p><em>Also feel free to drop me a message or:</em></p><ol><li>Connect and reach me on<strong> </strong>💡 <a href="https://www.linkedin.com/in/aleksagordic/"><strong>LinkedIn</strong></a><strong> </strong>and <a href="https://twitter.com/gordic_aleksa"><strong>Twitter</strong></a></li><li>Subscribe to my 🔔 <a href="https://www.youtube.com/c/TheAiEpiphany"><strong>YouTube channel</strong></a> for AI-related content️</li><li>Follow me on 📚 <a href="https://medium.com/@gordicaleksa"><strong>Medium</strong></a><strong> </strong>and 💻<a href="https://github.com/gordicaleksa"><strong>GitHub</strong></a></li><li>Subscribe to my 📢 <a href="https://aiepiphany.substack.com/"><strong>monthly AI newsletter</strong></a> and join the 👨‍👩‍👧‍👦 <a href="https://discord.gg/peBrCpheKE"><strong>Discord</strong></a> community!</li></ol><p>And if you find the content I create useful <a href="https://www.patreon.com/theaiepiphany"><strong>consider becoming a Patreon!</strong></a></p><p>Much love ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=848cb87e95ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>