<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="localhost:4000//feed.xml" rel="self" type="application/atom+xml" /><link href="localhost:4000//" rel="alternate" type="text/html" /><updated>2026-09-17T19:25:59+00:00</updated><id>localhost:4000//feed.xml</id><title type="html">Kevin Kaichuang Yang (楊凱筌)</title><subtitle>Website</subtitle><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><entry><title type="html">Books of 2020</title><link href="localhost:4000//2021/01/02/books-of-2020.html" rel="alternate" type="text/html" title="Books of 2020" /><published>2021-01-02T08:00:00+00:00</published><updated>2021-01-02T08:00:00+00:00</updated><id>localhost:4000//2021/01/02/books-of-2020</id><content type="html" xml:base="localhost:4000//2021/01/02/books-of-2020.html"><![CDATA[<p>At the beginning of 2020, I wrote about the <a href="https://yangkky.github.io/2020/01/02/books-of-2019.html">books I read in 2019</a>. Now, it’s time to look back at the books of 2020 and look ahead to 2021.</p>

<p>In 2020, my overall goal was still to read 50 books, and I met that goal by reading 65. Once again, although I don’t spend much time purposely diversifying my reading, most of what I met was fiction (51 / 65), by Asians (29 / 65), and by women (57 / 65).</p>

<p>Here are the full comparisons between 2019 and 2020 overall:</p>

<p><img src="/assets/demo2020.png" alt="demographics" /></p>

<p>And broken down by fiction vs non-fiction:</p>

<p><img src="/assets/demo_facet2020.png" alt="demo by genre" /></p>

<p>The 65 books were written by 54 unique authors. Of those authors, 41 were authors I had not read before.</p>

<h2 id="2020-resolutions">2020 Resolutions</h2>

<p>First, let’s review my 2020 reading resolutions and see how I did.</p>

<h4 id="i-should-read-a-little-bit-more-non-fiction">I should read a little bit more non-fiction.</h4>
<p>Success! I increased my non-fiction reading in both absolute and relative terms.</p>

<h4 id="i-should-read-more-books-by-black-hispanic-and-indigenous-authors">I should read more books by Black, hispanic, and indigenous authors.</h4>
<p>Mixed! I doubled the number of books I read by Black authors, but the number of books by hispanic and indigenous authors stayed the same. Most of the increase came from books by white authors.</p>
<h4 id="i-should-read-more-older-books">I should read more older books.</h4>
<p>Fail! 29 / 65 books were written in 2020, and another 15 were written in 2019. Like last year, I only read 2 books written before 2000. This one is pretty difficult for me because there’s so many good new books coming out.</p>

<p><img src="/assets/years_2020.png" alt="books by year" /></p>

<h2 id="some-light-2021-resolutions">Some Light 2021 resolutions</h2>
<h4 id="i-should-read-more-books-by-hispanic-and-indigenous-authors">I should read more books by hispanic and indigenous authors.</h4>
<h4 id="i-should-read-more-older-books-1">I should read more older books.</h4>

<p>Yes, I’m being lazy and just re-using the ones I didn’t do great on in 2020.</p>

<h2 id="a-look-back-at-my-most-anticipated-books-for-2020">A Look Back at My Most-Anticipated Books for 2020</h2>

<ul>
  <li><em>The Burning God</em>, by Rebecca F. Kuang: The highlight of my reading year.</li>
  <li><em>The Paper Menagerie</em>, by Ken Liu: A masterful short-story collection, as anticipated.</li>
  <li><em>The City We Became</em>, by N. K. Jemisin in March: sharp and hilarious. A very steep-departure from Jemisin’s earlier books in tone, but nevertheless very good.</li>
  <li><em>The Empire of Gold</em>, by S. A. Chakraborty: A brilliant conclusion to the Daevabad triology.</li>
  <li><em>A Desolation Called Peace</em>, by Arkady Martine: This one is now slated to come out in 2021.</li>
  <li><em>Big Sister, Little Sister, Red Sister</em>, by Jung Chang: I managed to finish this crash-course in modern Chinese history, which helped a lot in understanding the historical background for the <em>Poppy War</em> series.</li>
  <li><em>Tears We Cannot Stop: A Sermon to White America</em>, by Michael Eric Dyson: I don’t have much memory of this, but I did read it!</li>
</ul>

<h2 id="highlights">Highlights</h2>

<h3 id="the-burning-god-by-rebecca-f-kuang"><em>The Burning God</em>, by Rebecca F. Kuang</h3>
<p>The searing conclusion to <em>The Poppy War</em> and <em>The Dragon Republic</em> was absolutely the highlight of my reading year. Nobody weaves brilliant story-telling, flawed yet compelling characters, and pain together as well as Kuang. I’ve written more about how much this series means to me <a href="https://readbytiffany.com/2020/10/19/what-the-poppy-war-means-to-me-a-guest-post-by-kevin-yang/">here</a>, and helped to write a post on the historical and cultural <a href="https://readbytiffany.com/2020/11/15/everything-you-need-to-know-before-you-read-the-poppy-war-by-r-f-kuang/">background</a> behind the series.</p>

<h3 id="jesus-and-john-wayne-by-kristin-kobes-du-mez"><em>Jesus and John Wayne</em>, by Kristin Kobes Du Mez</h3>

<p>Kobes Du Mez weaves many threads together to show modern white evangelicalism’s roots in preserving a certain vision of white manhood and patriarchy against 20th century gains by women and racial minorities. Along with Katherine Stewart’s <em>The Power Worshippers</em>, it clarified for me how white evangelicalism arose as reactions against the Civil Right Movement, Feminism, and continues now  to react against the LBGTQ+ rights movement and Black Lives Matter as well as how evangelical social conservatives in the United States united with economic libertarians to create the American Right, the current iteration of the Republican Party, and Donald Trump. This one was also personal for me, as I grew up in enough of evangelicalism to recognize many of the figures in <em>Jesus and John Wayne</em>.</p>

<h3 id="the-third-son-by-julie-wu"><em>The Third Son</em>, by Julie Wu</h3>
<p><em>The Third Son</em> tells the story of Saburo as he grows up in an abusive Taiwanese family underneath Japanese and then Nationalist rule and manages to break free by marrying his love, coming to the United States, and earning his PhD. The historical background is personal to me, as my parents also grew up in Taiwan and earned their PhDs in the United States (although they were firmly on the Nationalist side…).</p>

<h3 id="the-first-sister-by-linden-a-lewis"><em>The First Sister</em>, by Linden A. Lewis</h3>
<p>The blurb describes <em>First Sister</em> as space opera x Handmaid’s Tale, but that doesn’t really do justice to the book’s originality in conception and execution. I’ve read enough fiction now to often anticipate what’s coming in a novel, but every turn in this one surprised me.</p>

<h3 id="the-mountains-sing-by-phan-qué̂-mai-nguyẽ̂n"><em>The Mountains Sing</em>, by Phan Qué̂ Mai Nguyẽ̂n</h3>
<p>An epic account of a family’s experience in the Vietnamese War, as seen through the eyes of a girl and her grandmother. Nguyẽ̂n manages to capture the sweep of history along with intimate familial relationships.</p>

<h3 id="an-ember-in-the-ashes-by-sabaa-tahir"><em>An Ember in the Ashes</em>, by Sabaa Tahir</h3>
<p>I read all four of the books in this series this year. Tahir weaves a dark yet hopeful adventure in a dystopia that loosely resembles the Roman Empire. Like <em>The Poppy War</em>, this is another series where not many good things happen to the characters, but it never felt quite as dark and real to me as Kuang’s series.</p>

<h3 id="minor-feelings-by-cathy-park-hong"><em>Minor Feelings</em> by Cathy Park Hong</h3>
<p>Hong perfectly encapsulates the experience of being a “model minority” in the United States in a series of honest, emotional, and raw essays about shame and depression, the English language, and poetry. The titular “minor feelings” are “the racialized range of emotions that are negative, dysphoric,” yet not so spectacularly horrible as to be telegenic.</p>

<h2 id="books-im-looking-forward-to-in-2021">Books I’m looking forward to in 2021</h2>

<p><em>A Desolation Called Peace</em> should finally come out in March. Ken Liu’s Dandelion Dynasty trilogy has been expanded to a Quartet, and I believe both books are releasing in 2021. I’ve been seeing a lot of hype in Asian book circles for <em>She Who Became the Sun</em>, by Shelley Parker-Chan, and we can always use more modern, fantasy, queer, re-imaginings of ancient Chinese history.  <em>Jade Legacy</em>, the conclusion to Fonda Lee’s <em>Jade City</em> series, is due out in September. <em>The Second Rebel</em>, which follows <em>The First Sister</em>, comes out in November.</p>

<h2 id="the-complete-list-and-source-code">The Complete List and Source Code</h2>

<p>The full list is available <a href="https://github.com/yangkky/books/blob/master/books.csv">here</a>. The code to generate the plots is <a href="https://github.com/yangkky/books/blob/master/analysis_2020.py">here</a></p>]]></content><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><summary type="html"><![CDATA[At the beginning of 2020, I wrote about the books I read in 2019. Now, it’s time to look back at the books of 2020 and look ahead to 2021.]]></summary></entry><entry><title type="html">Two approaches to faster attention</title><link href="localhost:4000//2020/06/22/attention.html" rel="alternate" type="text/html" title="Two approaches to faster attention" /><published>2020-06-22T08:00:00+00:00</published><updated>2020-06-22T08:00:00+00:00</updated><id>localhost:4000//2020/06/22/attention</id><content type="html" xml:base="localhost:4000//2020/06/22/attention.html"><![CDATA[<p>Two recent papers introduce approximations to <a href="https://arxiv.org/abs/1706.03762">Transformer</a> self-attention with runtime $\ll L^2$.</p>

<ol>
  <li><a href="https://arxiv.org/abs/2006.03555">Masked Language Modeling for Proteins via Linearly Scalable Long-Context Transformers
</a> introduces <em>Fast attention via orthogonal random features</em> (FAVOR).</li>
  <li><a href="https://arxiv.org/abs/2006.04768">Linformer: Self-Attention with Linear Complexity</a> introduces <em>linear self-attention</em>.</li>
</ol>

<p>I’m going to summarize the main contribution of each paper, but you should definitely go read them for details such as theorems and theoretical insights. I also write everything using the notation from the FAVOR paper for consistency.</p>

<h2 id="transformer-dot-product-attention">Transformer dot-product attention</h2>

<p>Let $L$ be the size of an input sequence of tokens. Then transformer dot-product attention is a mapping which accepts matrices $\mathbf{Q}$, $\mathbf{K}$, $\mathbf{V} \in \mathbb{R}^{L×d}$ as input where $d$ is the hidden dimension. Matrices $\mathbf{Q}$, $\mathbf{K}$, and $\mathbf{V}$ are intermediate representations of the input and their rows can be interpreted as queries, keys and values of the continuous dictionary data structure respectively. Transformer dot-product attention is defined as</p>

\[\operatorname{Att}(\mathbf{Q}, \mathbf{K}, \mathbf{V}) = \mathbf{D}^{-1}\mathbf{AV}\]

<p>where the attention matrix is $\mathbf{A} = \operatorname{exp}\left(\frac{\mathbf{QK^T}}{\sqrt{d}}\right)$ and $\mathbf{D} = \operatorname{diag}(\mathbf{A1_L})$ is the normalizing factor. For details, see the original paper or this <a href="https://nlp.seas.harvard.edu/2018/04/03/attention.html">post</a> from Harvard NLP.</p>

<p>While dot-product attention has proven very useful, its runtime and memory scale as $O(L^2d + Ld)$ and $O(L^2)$, respectively, because $\mathbf{A}\in \mathbb{R}^{L\times L}$ must be computed and stored explicitly. In practice, applications in natural language processing commonly limit the sequence length to 512 or 1024. This is also a significant constraint when modeling proteins. For example, <em>Streptococcus pyogenes</em> CRISPR-Cas9 is 1368 amino acids long.</p>

<h2 id="fast-attention-via-orthogonal-random-features-favor">Fast attention via orthogonal random features (FAVOR)</h2>

<p>The attention matrix $\mathbf{A}$ can be decomposed as 
\(\mathbf{A} = \mathbf{D_Q B D_K}\)
with</p>

\[\mathbf{D_T} = \operatorname{diag}\left[  \operatorname{exp}\left(\frac{\|\mathbf{T}_1\|_2^2}{2\sqrt{d}}\right)\ldots  \operatorname{exp}\left(\frac{\|\mathbf{T}_L\|_2^2}{2\sqrt{d}}\right)\right]
\forall \: \mathbf{T} \in \{\mathbf{Q}, \mathbf{K}\}\]

<p>and</p>

\[\mathbf{B} \in \mathbb{R}^{L \times L}, B_{i, j} = \operatorname{exp}\left(-\frac{\|\mathbf{Q}_i - \mathbf{K}_j\|}{2\sqrt{d}}\right)\]

<p>Naively, $\mathbf{D_T}$ requires $O(Ld)$ time to compute while $\mathbf{B}$ requires $O(L^2d)$, arriving at the overall time complexity of $O(L^2d + Ld)$ for dot-product attention.</p>

<p>FAVOR is a fast method for approximating $\mathbf{B}$. $\mathbf{B}$ is a the Gaussian (squared-exponential) kernel matrix between the rows of $\mathbf{Q}$ and $\mathbf{K}$ with $\sigma = d ^ {\frac{1}{4}}$. Like most kernels used in machine learning, the Gaussian kernel has a fast random feature approximation. Given a random mapping $\phi: \mathbb{R}^d \to \mathbb{R}^M$ of the form</p>

\[\phi(\mathbf{x}) = \sqrt{\frac{2}{M}}\operatorname{cos}(\mathbf{Wx} + \mathbf{b})^T\]

<p>where $W_{i, j} \sim \mathcal{N}(0, \sigma^2)$ and $b_i ~\sim \operatorname{Unif}(0, 2\pi)$. As described in the paper, choosing orthogonal random features instead of sampling independently decreases the variance of the approximation.</p>

\[K(\mathbf{x}, \mathbf{y}) = \mathbb{E}\left[\phi(\mathbf{x})^T\phi(\mathbf{y})\right]\]

<p>Define randomly-featurized keys and queries as $\mathbf{\hat{Q}} = \sqrt{\frac{2}{M}}\operatorname{cos}(\mathbf{WQ}^T + \mathbf{b})^T$ and $\mathbf{\hat{K}} = \sqrt{\frac{2}{M}}\operatorname{cos}(\mathbf{WK}^T + \mathbf{b})^T$. Combine these with $\mathbf{D_T}$: $\mathbf{Q’} = \mathbf{D_Q}\mathbf{\hat{Q}}$ and $\mathbf{K’} = \mathbf{D_K}\mathbf{\hat{K}}$. Therefore,
\(\mathbf{A} = \mathbb{E}\left[\mathbf{Q'}\mathbf{K'}^T\right]\)</p>

<p>And $\mathbf{\hat{A}} = \mathbf{Q’}\mathbf{K’}^T$ is an unbiased estimator of $\mathbf{A}$. However, would still like to avoid computing and storing the full $L \times L$ attention matrix. We can do this when calculating approximate dot-product attention by being clever in how we group the matrix multiplications:</p>

\[\operatorname{\hat{Att}}(\mathbf{Q}, \mathbf{K}, \mathbf{V}) = \mathbf{\hat{D}}^{-1}\mathbf{\hat{A}V}
 = \mathbf{\hat{D}}^{-1}(\mathbf{Q'}(\mathbf{K'}^T\mathbf{V}))\]

<p>with</p>

\[\mathbf{\hat{D}}^{-1} = \operatorname{diag}(\mathbf{Q'}(\mathbf{K'}^T\mathbf{1}_L))\]

<p>This requires $O(LMd)$ time and $O(Md + Ld + ML)$ space.</p>

<!--Estimate of $B$ is unbiased -- estimate of $A$ is not
-->
<!--introduces a notion of generalized attention, where the attention matrix $\mathbf{A}$ is decomposed into $\mathbf{A} = \mathbf{D_Q B D_K}$, with $\mathbf{D_Q}$ and $\mathbf{D_K}$ being -->

<h2 id="linear-self-attention">Linear self-attention</h2>

<p>Instead of approximating the attention matrix $\mathbf{A}$, the second paper directly approximates the result of dot-product attention using <em>linear attention</em>. First, they prove that dot-product attention is low-rank, and then propose to replace the $L \times L$ attention matrix with a $L \times k$ approximation by using a learned weight matrix $\mathbf{E} \in \mathbb{R}^{k \times L}$ to project $\mathbf{K}$ into $\mathbb{R}^{k \times d}$:</p>

\[\mathbf{\hat{A}} = \operatorname{exp}\left(\frac{\mathbf{Q}(\mathbf{EK})^T}{\sqrt{d}}\right)\]

<p>Likewise, the values are also projected to $\mathbb{R}^{k \times d}$, and</p>

\[\operatorname{\hat{Att}}(\mathbf{Q}, \mathbf{K}, \mathbf{V}) = \mathbf{\hat{D}}^{-1}\mathbf{\hat{A}FV}\]

<p>with  $\mathbf{F} \in \mathbb{R}^{k \times L}$ and</p>

\[\mathbf{\hat{D}}^{-1} = \operatorname{diag}(\mathbf{\hat{A}}\mathbf{1}_L)\]

<p>This requires $O(Lk)$ time. In practice, the authors find that $k \geq 256$ seems to perform well.</p>

<h2 id="discussion">Discussion</h2>

<p>Some random thoughts on these papers.</p>

<ul>
  <li>While both of these approximations perform comparably well to dot-product attention in the experiments presented in the papers, those experiments seem pretty perfunctory to me. I’d be more impressed if they demonstrated for a real problem that using one of these approximations opens up new possibilities. Concatenating random proteins together to length 8096 isn’t a real problem!</li>
  <li>The FAVOR paper presents a general kernel framework for attention and investigate the performance of some simple kernels in their experiments. It’d be fun to try and design attention kernels for specific problem domains.</li>
  <li>FAVOR makes a big deal about how they have an unbiased estimator for $\mathbf{A}$, but I’m pretty sure their $\operatorname{\hat{Att}}$ is not an unbiased estimator of dot-product attention.</li>
  <li>The linear projections in linear self-attention ($\mathbf{E}$ and $\mathbf{F}$) are dependent on the sequence length, which would make dealing with variable-length inputs messy.</li>
</ul>]]></content><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><summary type="html"><![CDATA[Two recent papers introduce approximations to Transformer self-attention with runtime $\ll L^2$.]]></summary></entry><entry><title type="html">Moving to Microsoft Research</title><link href="localhost:4000//2020/04/26/msr.html" rel="alternate" type="text/html" title="Moving to Microsoft Research" /><published>2020-04-26T08:00:00+00:00</published><updated>2020-04-26T08:00:00+00:00</updated><id>localhost:4000//2020/04/26/msr</id><content type="html" xml:base="localhost:4000//2020/04/26/msr.html"><![CDATA[<p>I’ve been explaining to people that I’m leaving <a href="https://generatebiomedicines.com/">Generate Biomedicines</a> to move to <a href="https://www.microsoft.com/en-us/research/lab/microsoft-research-new-england/">Microsoft Research (MSR) Lab New England</a> because it better fits what I want to do long-term in my career. I want to expand and clarify what I mean.</p>

<p>First, I really enjoyed my time at Generate. I got to work on interesting scientific problems with very smart, nice people. They paid half my way to <a href="https://yangkky.github.io/2019/05/15/reflections-on-aistats2019.html">AISTATS</a> and all my way to <a href="https://yangkky.github.io/2019/12/19/neurips-workshops-reflections.html">NeurIPS</a>. I especially want to credit <a href="https://www.hsph.harvard.edu/andrew-beam/">Andrew Beam</a> for essentially giving me a postdoc’s worth of learning how to be a machine learning scientist. However, as I thought more about the kind of work I want to do and how I want to be evaluated for career advancement, I realized that there was a mismatch between what I wanted and what Generate needed.</p>

<p>As I realized that, my friend <a href="https://www.microsoft.com/en-us/research/people/lmackey/">Lester Mackey</a> at MSR told me I should apply for their new Comp Bio posting, which stated in part:</p>

<blockquote>
  <p>Microsoft Research offers an exhilarating and supportive environment for cutting-edge, multidisciplinary research, both theoretical and applied, with access to an extraordinary diversity of big and small data sources, an open publications policy, and close links to top academic institutions. We seek applicants with the passion and ability to craft and pursue an independent research program, including a strong publication record at top research venues.</p>
</blockquote>

<p>As it turns out, that description aligns very well with what I want to do!</p>

<h2 id="what-i-want-to-do-in-my-work">What I want to do in my work</h2>

<p>Through my time teaching, in my PhD, and at Generate, I’ve distilled what I want from my work into two parts:</p>

<h3 id="1-discover-and-learn-new-science">1. Discover and learn new science</h3>

<p>I’d like intellectual ownership of a research agenda:</p>

<ul>
  <li>To work on problems that have the potential to improve society</li>
  <li>In fields I think are interesting (currently machine learning, biology, and to some extent social science)</li>
  <li>And to be able to take my work with me and talk about it if I change employers.</li>
</ul>

<p>In my PhD and at Generate, I focused on applying machine learning to proteins. I’m still interested in that, but I’d also like to broaden my research scope.</p>

<p>Conversely, I am not interested in developing products, and I’ve been telling people for years that one of my career goals is to not think about business questions. Generate, and probably other Flagship startups, are great places to work if you want to build a biotech company as a scientist. They’re generally well-run and scientifically sound, and you get to be part of a team effort to solve hard problems. However, one limitation of working in biotech, especially at a startup, is that the need to make money in the medium term strongly constrains what you can work on, as does the underlying philosophy that <code class="language-plaintext highlighter-rouge">creates value for investors</code> ↔ <code class="language-plaintext highlighter-rouge">creates value for society</code>. The downstream effect of this is that scientists (and everybody else) are not rewarded directly for what they discover but for how they are helping the company create value. To progress in their career, even individual contributors have to map their scientific efforts to business questions.</p>

<h3 id="2-tell-people-about-new-science">2. Tell people about new science</h3>

<p>Dissemination and being part of a global research community is an essential part of science. This includes:</p>

<ul>
  <li>Publications</li>
  <li>Talks</li>
  <li>Teaching</li>
  <li>Conferences</li>
  <li>Other writing</li>
  <li>Mentoring other scientists</li>
</ul>

<p>I want to be somewhere where these essential scientific activities are easy to do and rewarded. I don’t want to ask lawyers or a board for permission months in advance to publish or give a talk. However, biotech companies create investor value in part by obtaining proprietary data and inventing methods and protecting it all as trade secrets or with patents. Publishing or otherwise communicating your best models and data is obviously antithetical to this way of creating value. Therefore, even when/if scientists at biotech companies are allowed to publish, give talks, teach, or review papers, it’s not how they’re evaluated for career progression.</p>

<h2 id="some-other-thoughts">Some other thoughts</h2>

<p>Given all this, it’s fair to ask why I worked for Generate in the first place. Coming out of grad school, I didn’t have all this sorted myself, nor did I anticipate exactly what working in biotech would be like. I do want to be clear that any mismatch between expectations and reality were due to my inexperience and naivety, not because anybody at Generate misled me.</p>

<p>I also want to note that I’m not advocating for researchers to “only care about the science” without regard for the societal impacts of their work. Instead, I’m arguing that startup-style “value-creation” and business questions in general are insufficient (and uninteresting to me) proxies for societal impact. The most obvious cases are therapeutics that are not pursued because they wouldn’t be profitable, such as coronavirus vaccines pre-2019 or treatments for diseases that primarily affect poor countries. In another example, the siloing and privatization of biomedical science impairs our ability to build on earlier research to speed up the development of life-saving drugs.</p>

<p>I considered applying for academic jobs. My dad’s a professor, and most tenured professors I know seem to have really nice lives. Unfortunately, trying to earn tenure with a toddler seems very challenging for me and unfair to my wife for how limited I would be as a parent.</p>

<p>Furthermore, the incentives in academia (to build one’s personal brand by publishing and getting grants) also do not align perfectly with societal impact. I’m not so naive as to think Microsoft or any other tech giant aligns perfectly with societal impact either. However, I’m hoping that being away from the directly profit-making part of the company will provide some insulation from business questions.</p>

<p>When I was looking for jobs at the end of my PhD (after not getting chosen for the Google AI Residency), <a href="http://www.yisongyue.com/index.php">Yisong Yue</a> asked me what my ideal position would be, and I told him working as a researcher at a prominent industrial research lab. Here’s hoping MSR is everything I hope it will be!</p>]]></content><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><summary type="html"><![CDATA[I’ve been explaining to people that I’m leaving Generate Biomedicines to move to Microsoft Research (MSR) Lab New England because it better fits what I want to do long-term in my career. I want to expand and clarify what I mean.]]></summary></entry><entry><title type="html">Masked batchnorm in PyTorch</title><link href="localhost:4000//2020/03/16/masked-batch-norm.html" rel="alternate" type="text/html" title="Masked batchnorm in PyTorch" /><published>2020-03-16T08:00:00+00:00</published><updated>2020-03-16T08:00:00+00:00</updated><id>localhost:4000//2020/03/16/masked-batch-norm</id><content type="html" xml:base="localhost:4000//2020/03/16/masked-batch-norm.html"><![CDATA[<p>If you just want to see the code, it’s in a <a href="https://gist.github.com/yangkky/364413426ec798589463a3a88be24219">gist</a>.</p>

<h2 id="introduction-sequence-tokenization-and-padding">Introduction: Sequence tokenization and padding</h2>

<p>Sometimes the fact that all proteins are not the same length is the bane of my existence.</p>

<p>One way we deal with variable-length sequences in machine learning is to pad them all to the same length. For example, if I have the following nucleotide sequences:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>AGCTAG
AGCTAGA
AGCTA
</code></pre></div></div>

<p>I can right-pad them by introducing a special padding token, let’s call it <code class="language-plaintext highlighter-rouge">p</code>.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>AGCTAGp
AGCTAGA
AGCTApp
</code></pre></div></div>

<p>And then I can use this as a batch input to the machine-learning model of my choice by assigning each nucleotide and the padding token an integer:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>x = torch.tensor(
    [
		[0, 2, 1, 3, 0, 2, 4],
		[0, 2, 1, 3, 0, 2, 0],
		[0, 2, 1, 3, 0, 4, 4]
    ]
)
</code></pre></div></div>

<p>If I want to put sequences through a transformer or RNN or CNN and I don’t want the model to be affected by the padding, I can also pass in a mask (<code class="language-plaintext highlighter-rouge">mask = (x != 4)</code>) and use that mask to set things to zero where appropriate. For example, the PyTorch <a href="https://pytorch.org/docs/stable/nn.html#transformer"><code class="language-plaintext highlighter-rouge">Transformer</code></a> class uses this sort of mask (but with a <code class="language-plaintext highlighter-rouge">ByteTensor</code>) for its [<code class="language-plaintext highlighter-rouge">src</code>/<code class="language-plaintext highlighter-rouge">tgt</code>/<code class="language-plaintext highlighter-rouge">mask</code>]<code class="language-plaintext highlighter-rouge">_padding_mask</code> arguments.</p>

<h2 id="trying-to-extend-pytorchs-batchnorm">Trying to extend PyTorch’s <a href="https://arxiv.org/abs/1502.03167">batchnorm</a></h2>

<p>Unfortunately, <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.BatchNorm1d"><code class="language-plaintext highlighter-rouge">nn.BatchNorm1d</code></a> doesn’t support this type of masking, so if I zero out padding locations, then my minibatch statistics get artificially lowered by the extra zeros. Given Pytorch’s object-oriented nature, the most elegant way to implement masked batchnorm would be to extend one of their classes and modify the way minibatch statistics are calculated.</p>

<p>Starting at <a href="https://pytorch.org/docs/stable/_modules/torch/nn/modules/batchnorm.html#BatchNorm1d"><code class="language-plaintext highlighter-rouge">nn.BatchNorm1d</code></a>, we find that all this class implements is a method for checking input dimensions:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    def _check_input_dim(self, input):
        if input.dim() != 2 and input.dim() != 3:
            raise ValueError('expected 2D or 3D input (got {}D input)'
                             .format(input.dim()))
</code></pre></div></div>

<p>It’s superclass (<a href="https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/batchnorm.py#L76">nn._BatchNorm</a>) has a <code class="language-plaintext highlighter-rouge">forward</code> method, which checks whether to use <code class="language-plaintext highlighter-rouge">train</code> or <code class="language-plaintext highlighter-rouge">eval</code> mode, retrieves the parameters needed to calculate the moving averages, and then calls <a href="https://github.com/pytorch/pytorch/blob/8bae1ed14489f1fbdd1272807779e7a615fda020/torch/nn/functional.py#L1887"><code class="language-plaintext highlighter-rouge">F.batch_norm</code></a>. <code class="language-plaintext highlighter-rouge">F.batch_norm</code> in turn calls <code class="language-plaintext highlighter-rouge">torch.batch_norm</code>. Clicking on that in github leads back to <code class="language-plaintext highlighter-rouge">F.batch_norm</code>: I think it must be actually implemented in the lower-level cpp code.</p>

<p>In any case, it looks like there’s no straight-forward way to extend PyTorch’s batchnorm implementation, so time to write it from scratch.</p>

<h2 id="maskedbatchnorm1d">MaskedBatchNorm1d</h2>

<p>Given a <code class="language-plaintext highlighter-rouge">(B, 1, L)</code> mask, we first mask and then compute the number of unmasked locations over which to calculate the minibatch statistics:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>if input_mask is not None:
    masked = input * input_mask
    n = input_mask.sum()
</code></pre></div></div>
<p>Then calculate the minibatch mean:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>masked_sum = masked.sum(dim=0, keepdim=True).sum(dim=2, keepdim=True)
current_mean = masked_sum / n

</code></pre></div></div>

<p>And the minibatch variance:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>current_var = ((masked - current_mean) ** 2)
current_var = current_var.sum(dim=0, keepdim=True).sum(dim=2, keepdim=True) / n

</code></pre></div></div>

<p>The full module is available as a <a href="https://gist.github.com/yangkky/364413426ec798589463a3a88be24219">gist</a>.</p>

<h2 id="limitations">Limitations</h2>

<p>Because I didn’t want to dig deeper into PyTorch source, there’s a few limitations here.</p>

<ol>
  <li>It’s almost certainly not as fast as the native PyTorch implementation.</li>
  <li>If you’re doing <a href="https://yangkky.github.io/2019/07/08/distributed-pytorch-tutorial.html">multi-GPU training</a>, minibatch statistics won’t be synced across devices as they would be with Apex’s <a href="https://github.com/NVIDIA/apex/blob/master/apex/parallel/sync_batchnorm.py">SyncBatchNorm</a>.</li>
  <li>If you’re doing mixed-precision training with <a href="https://nvidia.github.io/apex/amp.html">Apex</a>, you can’t use level <code class="language-plaintext highlighter-rouge">O2</code> because it won’t detect that this is a batchnorm layer and keep it in float precision.</li>
</ol>]]></content><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><summary type="html"><![CDATA[If you just want to see the code, it’s in a gist.]]></summary></entry><entry><title type="html">Books of 2019</title><link href="localhost:4000//2020/01/02/books-of-2019.html" rel="alternate" type="text/html" title="Books of 2019" /><published>2020-01-02T08:00:00+00:00</published><updated>2020-01-02T08:00:00+00:00</updated><id>localhost:4000//2020/01/02/books-of-2019</id><content type="html" xml:base="localhost:4000//2020/01/02/books-of-2019.html"><![CDATA[<p>Reading, especially science fiction/fantasy (SFF), has always been one of my greatest joys. Unfortunately, after college busy work schedules (teaching, then grad school) and the intenet really ate away at time to read books. At the beginning of 2019, I set a goal to read 50 books; I managed to get to 53 by reading consistently on my commutes with occasional binges.</p>

<h2 id="some-statistics">Some Statistics</h2>

<p>I read mostly for pleasure, and still mostly fiction and mostly SFF (43 / 53 books). When I do read non-fiction, I tend to read history and sociology, especially pertaining to race in the United States. Although I don’t actively try to diversify my reading or seek out <a href="https://triketora.com/2019/03/16/the-year-of-reading-female/">books by women</a>, my taste does tend towards books by Asians (28 / 53) and books by women (34/53). Knowing the importance of reading diverse books by diverse authors, I wanted to see how I did in this aspect in 2019 and be more intentional about the books I seek out in 2020.</p>

<p>Note that the numbers for race and gender don’t add to 53 because I didn’t include author statistics for the anthology <em>A People’s Future of the United States.</em></p>

<p><img src="/assets/demo.png" alt="demographics" /></p>

<p>Things get a little but more interesting if I break by fiction/non-fiction and consider race x gender. Some observations:</p>

<ul>
  <li>The gap between male and female authors is entirely because I didn’t read any fiction by non-Asian male authors.</li>
  <li>I only read one book by a Hispanic author.</li>
  <li>I didn’t plot the publication years, but I only read two books published before 2000 (and for one of those, the English translation appeared in 2019), and 26 of the books were published in 2019. In large part, this is due to me getting a lot of book recommendations from Twitter. However, it’s also true that SFF has undergone a <a href="https://www.wired.com/story/best-books-2010s-science-fiction-fantasy/">revolution</a> in the last decade or so, and I have a definite preference for these new voices in the genre. There’s also been a surge in SFF translated from Chinese, spearheaded by the inimitable Ken Liu.</li>
  <li>I don’t have time right now, but it would be interesting to disaggregate the Asians.</li>
  <li>Another thing this plot doesn’t show is the number of distinct authors: for example, both the books by Indigenous authors are by Rebecca Roanhorse.</li>
</ul>

<p><img src="/assets/demo_facet.png" alt="demo by genre" /></p>

<h3 id="some-light-resolutions-for-2020">Some light resolutions for 2020</h3>

<ul>
  <li>I should read a little bit more non-fiction.</li>
  <li>I should read more books by black, hispanic, and indigenous authors.</li>
  <li>I should read more older books.</li>
</ul>

<h2 id="highlights">Highlights</h2>

<h3 id="the-dragon-republic-by-rebecca-f-kuang"><em>The Dragon Republic</em>, by Rebecca F. Kuang</h3>
<p>My first SFF stories were excerpts from Chinese mythology read to me by my dad. I didn’t know I could read SFF in English that incorporated that world and history until I came across RF Kuang’s 2018 book <em>The Poppy War</em>. I read all 544 pages in one day. <em>The Dragon Republic</em> is the sequel, and if anything even better written and more gut-wrenching. Seriously, Kuang really likes to torment her characters. Following her on Twitter is also what’s biased my reading towards SFF by Asian women, and I have no regrets.</p>

<h3 id="little-fires-everywhere-by-celeste-ng"><em>Little Fires Everywhere</em>, by Celeste Ng</h3>
<p>This is probably the best-written novel I read in 2019. Ng masterfully weaves seemingly disparate threads into a cohesive story that speaks to intimate familial connections, the complex intersections of race and class, and the ramifications of choices and secrets. Interestingly, the story is set in suburban Ohio, where I grew up, and Ng now lives in Boston, where I now live.</p>

<h3 id="how-to-be-an-antiracist-by-ibram-x-kendi"><em>How to Be An Antiracist</em>, by Ibram X. Kendi</h3>
<p>In <em>Stamped from the Beginning</em>, Kendi lays out a thesis that there are two strains of anti-black thought. Segregationists contend that some races are inherently inferior, and so our current racial hierarchy is the natural order. Assimilationists contend that some races act in inferior ways, whether because of culture or past discrimination, and so our current racial hierarchy will go away when those races learn to not act in inferior ways. While almost everybody now recognizes segregationist ideas as racist, it’s important to realize that assimilationist ideas are also racist. Both posit that some racial groups are superior to others. Anti-racist ideas hold that racial groups are equal, and that the only thing inferior about black people is their opportunities. <em>How to Be An Antiracist</em> is primarily a memoir describing how Kendi came to these conclusions. However, it also introduces some new ideas, some of which went against what I knew about anti-racism. For example, Kendi pushes back against the idea that black people cannot be racist and the concept of “microaggressions.”</p>

<!--### Jade War

### The Calculating Stars

### A Memory Called Empire

### Empire of Sand

### Trail of Lightning


### City of Brass-->

<h3 id="downstairs-girl-by-stacey-lee"><em>Downstairs Girl</em> by Stacey Lee</h3>

<p>I think this book about a sassy Chinese girl in segregated Atlanta is technically Young Adult fiction. I really enjoyed the main character’s voice and Lee’s sense of humor.</p>

<h2 id="books-im-looking-forward-to-in-2020">Books I’m looking forward to in 2020</h2>

<ul>
  <li><em>The Burning God</em> is the final installment in the <em>Poppy War</em>. Kuang keeps putting out screenshots and teasers on Twitter, and I’m a little upset I have to wait until November.</li>
  <li>Ken Liu’s short story <em>The Paper Menagerie</em> is the first and only work of any sort to win a Hugo, a Nebula, and a Locus. He’s coming out with his second short story collection, <em>The Hidden Girl and Other Stories</em>, in February.</li>
  <li>After wrapping up the Broken Earth Trilogy, which won three Hugos in a row, N. K. Jemisin releasing <em>The City We Became</em> in March. Kuang keeps mentioning on Twitter that she’s read the ARC and that it’s really good.</li>
  <li>The first two installments of S. A. Chakraborty’s Daevabad trilogy have an entracing world and captivating story. The third book, <em>The Empire of Gold</em> comes out in May.</li>
  <li><em>A Memory Called Empire</em> is one of those books that feels totally fresh and opens the genre to new directions. In May, Arkady Martine will release the sequel <em>A Desolation Called Peace</em>.</li>
  <li>I started reading <em>Big Sister, Little Sister, Red Sister</em>, by Jung Chang, but then had to return it to the library before I finished. It’s ostensibly a biography of the three Soong sisters, but really it’s a gripping crash-course in 20th-century Chinese history. I’d really like to know more Chinese history! From what I’ve read, I’ve already been questioning a lot of the bits I picked up from going to the Sun Yat-Sen and Chiang Kai-Shek memorials in Taipei. In retrospect, I should probably have expected those to be slightly biased.</li>
  <li>I got <em>Tears We Cannot Stop: A Sermon to White America</em> as a Christmas present, and it looks really good.</li>
</ul>

<p>Looking at these, I don’t think they’re going to help me that much towards the resolutions I listed above…</p>

<h2 id="the-complete-list">The Complete List</h2>

<p>The full list is available <a href="https://github.com/yangkky/books/blob/master/books.csv">here</a></p>]]></content><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><summary type="html"><![CDATA[Reading, especially science fiction/fantasy (SFF), has always been one of my greatest joys. Unfortunately, after college busy work schedules (teaching, then grad school) and the intenet really ate away at time to read books. At the beginning of 2019, I set a goal to read 50 books; I managed to get to 53 by reading consistently on my commutes with occasional binges.]]></summary></entry><entry><title type="html">NeurIPS workshops and reflections</title><link href="localhost:4000//2019/12/19/neurips-workshops-reflections.html" rel="alternate" type="text/html" title="NeurIPS workshops and reflections" /><published>2019-12-19T08:00:00+00:00</published><updated>2019-12-19T08:00:00+00:00</updated><id>localhost:4000//2019/12/19/neurips-workshops-reflections</id><content type="html" xml:base="localhost:4000//2019/12/19/neurips-workshops-reflections.html"><![CDATA[<p>NeurIPS was my second ML conference (after AISTATS). Attending with co-workers, having people reach out to set up meetings (and respond to my requests for meetings), and running into people from AISTATS really made me feel much more a part of the community even though the conference was much bigger.</p>

<p>See previous posts (<a href="https://yangkky.github.io/2019/12/10/neurips-day-1.html">1</a>, <a href="https://yangkky.github.io/2019/12/12/neurips-day-2.html">2</a>, <a href="https://yangkky.github.io/2019/12/13/neurips-day-3.html">3</a>) for thoughts on the first three days.</p>

<h2 id="themes-and-observations">Themes and observations</h2>

<h3 id="unexpected-companies-venturing-into-biology">Unexpected companies venturing into biology</h3>

<p>The Expo only had two biotech companies (BenevolentAI and Novartis), but there are some unexpected companies interested in machine learning on proteins. I talked to scientists or saw papers from Google, Salesforce, Amazon, and Facebook. It will be interesting to see whether this remains a fun side-project for scientists at big tech companies, or if they’ll be making bigger investments.</p>

<h3 id="how-people-spend-their-time">How people spend their time</h3>

<p>In general, the talks are not as full as you’d expect given the scale of the conference. Relatedly, multiple people have told me that their strategy for NeurIPS is to mostly ignore the talks and meet with friends and colleagues new and old. With that said, the keynotes do tend to fill up, and the poster sessions were basically science mosh pits.</p>

<h3 id="machine-learning-beyond-black-box-predictive-accuracy">Machine learning beyond black-box predictive accuracy</h3>

<p>I noticed a lot of momentum in expanding deep learning and machine learning beyong achieving high predictive accuracy. I have a particular soft spot for all the work on Bayesian deep learning and uncertainty quantification, and the first half of the BDL workshop was a definite highlight. Yoshua Bengio gave a keynote on how the field needs to move to models with stronger “consciousness” priors that generalize better to unseen situations. This would out of distribution generalization and transfer would be the first step towards higher-level cognition and agents with internal world models that can reason about causality and seek out knowledge.</p>

<p>There’s also a lot more (and very necessary) interest in fairness, ethics, and safety. I missed the opening keynote, but moving from not wanting to change the conference name to having an opening keynote mention the #MeToo movement is encouraging. There were workshops on safety, climate change, and fairness in healthcare.</p>

<h2 id="interesting-workshop-papers-and-posters">Interesting workshop papers and posters</h2>

<p><a href="https://ml4physicalsciences.github.io/files/NeurIPS_ML4PS_2019_141.pdf"><strong>Biological Sequence Design using Batched Bayesian Optimization</strong></a><br />
David Belanger, Suhani Vora, Zelda Mariet, Ramya Deshpande, David Dohan, Christof Angermueller, Kevin Murphy, Olivier Chapelle, Lucy Colwell.<br />
You know your subfield is getting popular when Kevin Murphy shows up on the author list. Well-done overview of some of the difficulties of applying Bayesian optimization to biological sequences, with comparisons between some methods.</p>

<p><a href="http://bayesiandeeplearning.org/2019/papers/90.pdf"><strong>Wat heb je gezegd? Detecting Out-of-Distribution Translations with Variational Transformers</strong></a><br />
Tim Z. Xiao Aidan N. Gomez Yarin Gal.<br />
Comes up with a way to estimate epistemic uncertainty on sequence predictions and some good ideas on how to measure the quality of an uncertainty measure.</p>

<p><a href="https://arxiv.org/abs/1901.08098"><strong>Deep Mean Functions for Meta-Learning in Gaussian Processes</strong></a><br />
Vincent Fortuin, Gunnar Rätsch.<br />
Using a NN for the mean function in a GP seems like it should lead to better performance, but maximizing the marginal likelihood leads to overfitting because the marginal likelihood does not regularize the hyperparameters of the mean function. We can get around that by using meta-learning to learn a prior mean parameterized by a NN. This seems related to <a href="https://arxiv.org/abs/1807.01622">neural processes</a>.</p>

<p><a href="https://arxiv.org/abs/1909.05215"><strong>Reconstructing continuous distributions of 3D protein structure from cryo-EM images</strong></a><br />
Ellen D. Zhong, Tristan Bepler, Joseph H. Davis, Bonnie Berger.<br />
Recent advances in hardware have enabled much higher resolution cryo-EM structures. However, most protein structure work ignores the fact that proteins exist as dynamic ensembles of structures. This work uses a VAE to reconstruct the entire ensemble from cryo-EM images.</p>

<h3 id="personal-lessons">Personal lessons</h3>

<ul>
  <li>Walking up to people I don’t know is very hard and stressful, but if I set up an appointment with somebody, then talking to them isn’t stressful at all.</li>
  <li>However, having conversations in two emails, Twitter, Whova, FB messenger, SMS, and WeChat all going at once <em>is</em> a little stressful.</li>
  <li>I wish I’d contacted more non-bio people doing work I’m interested in. All the ones I talked to were delightful!</li>
</ul>]]></content><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><summary type="html"><![CDATA[NeurIPS was my second ML conference (after AISTATS). Attending with co-workers, having people reach out to set up meetings (and respond to my requests for meetings), and running into people from AISTATS really made me feel much more a part of the community even though the conference was much bigger.]]></summary></entry><entry><title type="html">NeurIPS Day 3</title><link href="localhost:4000//2019/12/13/neurips-day-3.html" rel="alternate" type="text/html" title="NeurIPS Day 3" /><published>2019-12-13T15:00:00+00:00</published><updated>2019-12-13T15:00:00+00:00</updated><id>localhost:4000//2019/12/13/neurips-day-3</id><content type="html" xml:base="localhost:4000//2019/12/13/neurips-day-3.html"><![CDATA[<p>I spent most of today meeting with friends and colleagues new and old. I think everybody from my company is here now, but I still haven’t seen some of them because this place is so big. It’s also nice to see some Arnold lab representation from <a href="https://twitter.com/zvxywu?lang=en">Zach Wu</a> and <a href="https://www.linkedin.com/in/kadina-johnston">Kadina Johnston</a>.</p>

<h2 id="ethics-at-neurips">Ethics at NeurIPS</h2>

<p>There are a few papers here with clear ethical issues. For example:</p>

<p><img src="/assets/political-bias.jpeg" alt="political-bias" /></p>

<p>Also see <a href="https://twitter.com/hannes_brt/status/1205380141385338880">this</a></p>

<p>The worst part is that a lot of these are trying to extract information that we have no reason to believe exists in the data.</p>

<p>And no, rejecting papers for ethical reasons is no more censorship than is rejecting papers for poor methodology. In other fields, certain topics or experiments require ethical review before doing the work, and publications won’t even review papers that were done without this initial approval.</p>

<h2 id="some-papers-i-think-are-interesting">Some papers I think are interesting</h2>

<p>Not as many papers today because I was too tired to do as much pushing through crowds at the poster session.</p>

<p><a href="https://arxiv.org/abs/1908.04970"><strong>Thompson Sampling and Approximate Inference</strong></a><br />
My Phan, Yasin Abbasi-Yadkori, Justin Domke.<br />
Variational inference is much faster than exact methods for computing Bayesian posteriors, but even small errors in the approximate posteriors lead to very poor performance (linear regret) when they are used in Thompson sampling. If the posterior estimates are under-dispersed, forced exploration can restore strong performance.</p>

<p><a href="https://arxiv.org/abs/1907.04944"><strong>Can Unconditional Language Models Recover Arbitrary Sentences?</strong></a><br />
Nishant Subramani, Sam Bowman, Kyunghyun Cho<br />
Given a language model decoder and a sentence, we can find an encoding that reconstructs the sentence perfectly when passed through the decoder.</p>

<p><a href="https://papers.nips.cc/paper/9174-practical-two-step-lookahead-bayesian-optimization.pdf"><strong>Practical Two-Step Look-Ahead Bayesian Optimization</strong></a>
Jian Wu, Peter I. Frazier.<br />
Bayesian optimization algorithms typically only look one step ahead during the acquisition function because methods that look two or more steps ahead are either too expensive or too inaccurate to be useful. This paper combines a few techniques to make accurate two-step look-ahead feasible.</p>]]></content><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><summary type="html"><![CDATA[I spent most of today meeting with friends and colleagues new and old. I think everybody from my company is here now, but I still haven’t seen some of them because this place is so big. It’s also nice to see some Arnold lab representation from Zach Wu and Kadina Johnston.]]></summary></entry><entry><title type="html">NeurIPS Day 2</title><link href="localhost:4000//2019/12/12/neurips-day-2.html" rel="alternate" type="text/html" title="NeurIPS Day 2" /><published>2019-12-12T05:00:00+00:00</published><updated>2019-12-12T05:00:00+00:00</updated><id>localhost:4000//2019/12/12/neurips-day-2</id><content type="html" xml:base="localhost:4000//2019/12/12/neurips-day-2.html"><![CDATA[<p>Today started with a meetup for Boston-area people. It’s always a little strange to fly across the continent to meet with people from the same city, but it was really fun to meet people who I could concievably easily see again. In my past conferences, I haven’t really known anybody and would often wander around awkwardly at mealtimes, so I’ve gone a little bit overboard this time with setting up meals with people beforehand. It also helps that people are starting to reach out to me asking to meet. End result is that I’ve gotten to meet a lot of interesting people the last couple days, including:</p>

<ul>
  <li><a href="https://twitter.com/TrentonBricken">Trenton Bricken</a></li>
  <li><a href="https://www.jonathannilesweed.com/">Jonathan Niles-Weed</a></li>
  <li><a href="https://twitter.com/amyxlu">Amy Lu</a></li>
  <li><a href="https://twitter.com/alexijielu">Alex Lu</a></li>
  <li><a href="http://www.moseslab.csb.utoronto.ca/">Alan Moses</a></li>
  <li><a href="https://ppaquette.io/">Philip Paquette</a></li>
  <li><a href="https://twitter.com/davidkmyang">David Yang</a></li>
  <li><a href="https://twitter.com/samsinai">Sam Sinai</a></li>
  <li><a href="https://twitter.com/elooopy?lang=en">Elīna Locāne</a></li>
  <li><a href="https://twitter.com/countablyfinite?lang=en">Neil Thomas</a></li>
  <li><a href="https://rmrao.github.io/">Roshan Rao</a></li>
  <li><a href="https://nickbhat.github.io/">Nicholas Bhattacharya</a></li>
</ul>

<p>I also ran into <a href="https://inverseprobability.com/">Neil Lawrence</a> in the elevator and <a href="https://las.inf.ethz.ch/krausea">Andreas Krause</a> in front of a poster today. I recognized Neil’s voice from <a href="https://www.thetalkingmachines.com/">Talking Machines</a>. I’ve worked with several people who had previously worked with Andreas Krause, and refer to a few of his papers frequently, so I was very excited to hear that he’d read one of my papers.</p>

<h2 id="some-papers-i-think-are-interesting">Some papers I think are interesting</h2>

<p><a href="https://arxiv.org/abs/1906.07282"><strong>The Cells Out of Sample (COOS) dataset and benchmarks for measuring out-of-sample generalization of image classifiers</strong></a><br />
Alex X. Lu, Amy X. Lu, Wiebke Schormann, Marzyeh Ghassemi, David W. Andrews, Alan M. Moses.<br />
Neural networks often learn confounders in biological data, such as the day of the experiment, the facility, or the position in a plate. The COOS dataset tests classifier performance when generalizing across these effects. Surprisingly, a vanilla supervised learner generalizes better than pre-trained models.<br />
<img src="/assets/coos.png" alt="COOS" /></p>

<p><a href="https://arxiv.org/abs/1811.00908"><strong>Single-Model Uncertainties for Deep Learning</strong></a><br />
Natasa Tagasovska, David Lopez-Paz.<br />
Separately model aleatoric uncertainty using quantile regression and epistemic uncertainty by training a classifier to predict whether test examples are from the training distribution.</p>

<p><a href="https://arxiv.org/abs/1906.09453"><strong>Image Synthesis with a Single (Robust) Classifier</strong></a><br />
Shibani Santurkar, Dimitris Tsipras, Brandon Tran, Andrew Ilyas, Logan Engstrom, Aleksander Madry.<br />
If you make your image classifier robust to adversarial examples, you can use it to generate realistic samples.</p>

<p><a href="https://arxiv.org/abs/1902.05981"><strong>Adaptive Sequence Submodularity</strong></a><br />
Marko Mitrovic, Ehsan Kazemi, Moran Feldman, Andreas Krause, Amin Karbasi.<br />
Problems that involve finding the optimal ordering of edges in a graph, such as choosing the order in which to recommend movies or video games, turn out to be submodular. Therefore, once the graph is computed, the order can be greedily optimized with strong optimality guarantees.<br />
<img src="/assets/adaptive-submodularity.png" alt="adaptive sequence submodularity" /></p>

<p><a href="https://arxiv.org/abs/1909.09365"><strong>Computing Full Conformal Prediction Set with Approximate Homotopy</strong></a><br />
Eugene Ndiaye, Ichiro Takeuchi.<br />
Transductive conformal regression traditionally involves calculating conformal scores for an intractible number of possible predictions. We can get around that by making some assumptions about the smoothness of the underlying predictive function. This results in slightly looser prediction intervals but maintains validity. Unlike inductive conformal regression methods, there’s no need to split the training data into a proper training set and a conformal scoring set.</p>]]></content><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><summary type="html"><![CDATA[Today started with a meetup for Boston-area people. It’s always a little strange to fly across the continent to meet with people from the same city, but it was really fun to meet people who I could concievably easily see again. In my past conferences, I haven’t really known anybody and would often wander around awkwardly at mealtimes, so I’ve gone a little bit overboard this time with setting up meals with people beforehand. It also helps that people are starting to reach out to me asking to meet. End result is that I’ve gotten to meet a lot of interesting people the last couple days, including:]]></summary></entry><entry><title type="html">NeurIPS Day 1</title><link href="localhost:4000//2019/12/10/neurips-day-1.html" rel="alternate" type="text/html" title="NeurIPS Day 1" /><published>2019-12-10T08:00:00+00:00</published><updated>2019-12-10T08:00:00+00:00</updated><id>localhost:4000//2019/12/10/neurips-day-1</id><content type="html" xml:base="localhost:4000//2019/12/10/neurips-day-1.html"><![CDATA[<p>I got to Logan at 4am yesterday and got to Vancouver 4 flights and 20 hours later. No, that was not the itinerary I’d originally planned. The first thing I did in Vancouver was get Taiwanese food in Richmond. The second thing was to go to the hotel and sleep. So I was pleasantly surprised to not feel too bad for the first day!</p>

<h2 id="some-random-thoughts">Some random thoughts</h2>

<ul>
  <li>NeurIPS is humongous. It’s spread over two multiple rooms in two buildings, and the whole place is crawling with people desperately trying to charge their phones and laptops. At one point, the evening poster session was full and they were turning people away.<br />
<img src="/assets/full.jpg" alt="steps 2 and 3" /></li>
  <li>With that said, this is the first conference I’ve been to where I know people. Between people from my company, people I met at AIStats, and people who have reached out to me asking to meet, I really feel much more comfortable here than I have at any other conference.</li>
  <li>I wish the oral and spotlight titles were in the printed program. The conference app is ok, but it’s a fair number of clicks to find the talk titles.</li>
  <li>The sponsor booths here are much more impressive than they were at ISMB.</li>
  <li>Novartis and Benevolent AI are the only Biotech companines in the sponsor area. The rest of them really need to step it up and stop letting the financial companies have such an outsize presence.</li>
  <li>Sometimes it’s fun to go to a session about things I don’t really study (reinforcement learning, in this case)</li>
  <li>The dynamic range of talk quality is huge. I’ve started to just tune out talks after the second slide if I can’t follow.</li>
</ul>

<h2 id="some-papers-i-think-are-interesting">Some papers I think are interesting</h2>

<p><a href="https://arxiv.org/abs/1810.00337"><strong>Combinatorial Bayesian Optimization using the Graph Cartesian Product</strong></a><br />
Changyong Oh, Jakub M. Tomczak, Efstratios Gavves, Max Welling
If you want to optimize over combinatorial input spaces, then it makes a lot of sense to encode them as graphs and use graph kernels.</p>

<p><a href="https://arxiv.org/abs/1810.00337"><strong>Learning to Perform Local Rewriting for Combinatorial Optimization</strong></a><br />
Xinyun Chen, Yuandong Tian<br />
<img src="/assets/rewriter.png" alt="Local rewriting" /><br />
More combinatorial optimization, this time by learning one policy that chooses what to change, and another policy that chooses how to change it. The policies are rewarded based on the final result, so this should do better than greedy.</p>

<p><a href="https://arxiv.org/abs/1902.02476"><strong>A Simple Baseline for Bayesian Uncertainty in Deep Learning</strong></a><br />
Wesley Maddox, Timur Garipov, Pavel Izmailov, Dmitry Vetrov, Andrew Gordon Wilson.<br />
A simple method for approximating the true posterior over neural network weights. Somebody needs to see how this does on the <a href="https://arxiv.org/abs/1802.09127">Deep Bayesian Bandits Showdown</a>.</p>

<p><a href="https://arxiv.org/abs/1910.01739"><strong>Scalable Global Optimization via Local Bayesian Optimization</strong></a><br />
David Eriksson, Michael Pearce, Jacob R Gardner, Ryan Turner, Matthias Poloczek<br />
Bayesian optimization often breaks down in high-dimensional spaces because samples are too sparse or the uncertainty is too large near the edges of the search space, leading to over-exploration. Trust-region algorithms overcome this by limiting the search to an area around the current best solution and then fitting very simple models (linear, quadratic) in that region. The region grows or expands based on whether evaluations improve the optimum. Logically, fitting a GP and doing BO within the trust region performs much better.</p>

<p><a href="https://arxiv.org/abs/1902.05546"><strong>Learning to control self-assembling morphologies via modular co-evolution of control and morphology</strong></a><br />
Deepak Pathak, Chris Lu, Trevor Darrell, Phillip Isola, Alexei A. Efros
Just as biology began with simple structures (cells) and gained physical complexity in parallel with behavioral complexity, it can be easier to evolve a control policy in parallel with the thing being controlled. For example, we can learn a behavioral policy for simple magnetic arms that allows them to assemble in order to perform complex tasks.<br />
<img src="/assets/modular.png" alt="modular" /></p>

<p><a href="https://arxiv.org/abs/1904.00956"><strong>Guided meta-policy search</strong></a><br />
Russell Mendonca, Abhishek Gupta, Rosen Kralev, Pieter Abbeel, Sergey Levine, Chelsea Finn<br />
Naively training a meta reinforcement learning policy that does well with few examples on new tasks requires an intractable number of samples. Instead, we can train on each of the training tasks individually, and then train the meta-policy using the individual policies as supervision signals.<br />
<img src="/assets/gmps.png" alt="gmps" /></p>

<p><a href="https://arxiv.org/abs/1906.04358"><strong>Weight agnostic neural networks</strong></a><br />
Adam Gaier, David Ha<br />
Optimize over architectures instead over weights finds networks that are surprisingly good at RL and image classification even when all their weights are the same.<br />
<img src="/assets/agnostic.png" alt="architecture search" /></p>]]></content><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><summary type="html"><![CDATA[I got to Logan at 4am yesterday and got to Vancouver 4 flights and 20 hours later. No, that was not the itinerary I’d originally planned. The first thing I did in Vancouver was get Taiwanese food in Richmond. The second thing was to go to the hotel and sleep. So I was pleasantly surprised to not feel too bad for the first day!]]></summary></entry><entry><title type="html">Transferable skills from teaching</title><link href="localhost:4000//2019/12/09/teaching.html" rel="alternate" type="text/html" title="Transferable skills from teaching" /><published>2019-12-09T08:00:00+00:00</published><updated>2019-12-09T08:00:00+00:00</updated><id>localhost:4000//2019/12/09/teaching</id><content type="html" xml:base="localhost:4000//2019/12/09/teaching.html"><![CDATA[<h2 id="introduction">Introduction</h2>

<p>I taught high school math and physics for three years as a <a href="https://www.teachforamerica.org/">Teach for America</a> (TFA) corps member between college and grad school. I have mixed opinions about TFA and its role in American education, but I recently did a small interview for them, and some of the questions were about how I use skills from my time in the classroom in my current career.</p>

<p>Jumping into first-year PhD classes after taking three years off was definitely a big challenge. Even though I had worked in Frances Arnold’s lab as a summer researcher while teaching, it turns out that first-year classes don’t have much to do with your PhD research, and having my undergraduate material on thermodynamics and fluid mechanics fresher would definitely have made things easier. As I got deeper into research and now into my first scientist job, transferable skills became clearer.</p>

<h2 id="consistently-doing-hard-things-well">Consistently doing hard things well</h2>

<p>While there were some long nights finishing problem sets or debugging code, on average I worked much less as a graduate student than I did as a teacher. For context, I often got to my school before 7am, taught 8am - 3pm, had meetings or coached robotics or caught up on grading until 6pm, then prepped for 2+ hours at home. There’s not much pressure like knowing you have 25 9th-graders waiting for you at 8am, and that any time you don’t have planned they’ll happily fill in with unproductive shenanigans, and then later they’ll be resentful if you do plan well and they don’t have time for unproductive shenanigans.</p>

<p>Being required to perform at a high level in the classroom every day pushed me to use my planning time well, to prioritize, and to develop sustainable procedures. While I don’t need to have such important outputs each and every day as a scientist planning and prioritizing are definitely essential when there’s so many interesting problems to solve, and different managers may need different deliverables on different timescales. Giving continual, steady effort is also an important skill during a PhD, especially if you work in a large group with a busy professor who won’t check in on you much but will expect results when she does.</p>

<h2 id="teaching-mentoring-and-feedback">Teaching, mentoring, and feedback</h2>

<p>The first procedure I felt like I really mastered was designing assessments that I could grade quickly. This allowed me to spend more time on everything else while also providing students with the quickest possible concrete feedback on assignments. This carried over directly the TAing in grad school, as the primary responsibility in most of my classes was writing and grading assignments. As a TA, I also led discussions, held office hours, and gave an occasional lecture. Planning and executing these sessions directly used my experience planning and executing these sessions for high schoolers.</p>

<p>In addition to formal teaching responsibilities, graduate students also mentor undergraduate researchers and newer students looking to join their group. As an industry scientist, I still spend time mentoring and teaching newer scientists and receive weekly feedback from one or more managers. As a new teacher, my administration and more experienced teachers invested a lot of time in observing my lessons and then giving me useful, actionable feedback. This feedback was pretty much the only reason I became a competent instructor after my first year.</p>

<p>As a graduate student, I mentored one student who then used the experience to win an NSF Graduate Research Fellowship, and another who has since earned internships with Microsoft. While both these students were brilliant when I met them, I’d like to think I helped them along.</p>

<h2 id="communicating-results">Communicating results</h2>

<p>It doesn’t matter how good your work is if nobody understands it. In Frances’s group, students gave a formal group meeting presentation about their ongoing work twice a year. At my current company, I give a variety of updates to the machine learning team or the whole company. My classroom experience taught me to communicate complicated topics to an audience with a range of backgrounds. I know how to check for understanding to make sure I’m not boring people or leaving anybody behind. I definitely don’t get nervous about speaking in front of people anymore after doing it every day for 3 years.</p>

<p>Furthermore, making slides is an art. I got really good at making animations for physics and for stepping through math (because my handwriting is bad and it’s hard to watch your classroom while writing on the board). I still make fancy slides, but now it’s to explain machine learning to biologists and biologists to machine learning people.</p>

<h2 id="equity-and-inclusion">Equity and inclusion</h2>

<p>TFA’s mission is to end educational inequity. It turns out that, even outside the world of K-12 education, there are a lot of <a href="https://twitter.com/HumansOfML/status/1146752376646377474">inequitable outcomes</a>, and it’s very hard to unsee once you know to look. This is directly applicable when I’m helping to write <a href="https://www.insidehighered.com/news/2018/06/19/study-finds-recommendation-letters-inadvertently-signal-doubt-about-female">recommendation letters</a> for students, or involved in hiring at a machine-learning startup.</p>]]></content><author><name>Kevin Kaichuang Yang (楊凱筌)</name></author><summary type="html"><![CDATA[Introduction]]></summary></entry></feed>