<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>blog</title>
    <description>Notes on language, machine learning, etc.</description>
    <link>http://blog.jacobandreas.net/</link>
    <atom:link href="http://blog.jacobandreas.net/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Thu, 09 Jul 2020 01:10:29 +0000</pubDate>
    <lastBuildDate>Thu, 09 Jul 2020 01:10:29 +0000</lastBuildDate>
    <generator>Jekyll v3.8.7</generator>
    
      
        <item>
          <title>Meanings and belief states</title>
          <description>&lt;p&gt;Should AI research be concerned with explicit representations of the meanings of
utterances? By “explicit representations of meaning” I mean structured variables
with a pre-defined interpretation—the kind of thing that semanticists are
concerned with. For a long time, such meaning representations were central to
successful efforts aimed at linking language to other tasks involving reasoning,
perception, and action (a line of work that runs from SHRDLU to modern semantic
parsers).
&lt;span class=&quot;aside&quot;&gt; Structured meaning representations were also
central to &lt;em&gt;unsuccessful&lt;/em&gt; work on machine translation, syntax, etc.&lt;/span&gt;
This work uses lots of different representation formalisms—proper
neo-Davidsonian logical forms
&lt;a href=&quot;http://aclweb.org/anthology/Q/Q13/Q13-1005.pdf&quot;&gt;[AZ13]&lt;/a&gt;, 
combinator logics 
&lt;a href=&quot;http://www.aclweb.org/anthology/P11-1060&quot;&gt;[LJK11]&lt;/a&gt;, 
other non-logical structures
&lt;a href=&quot;https://people.csail.mit.edu/stefie10/publications/tellex11a.pdf&quot;&gt;[TK+11]&lt;/a&gt;—but
if you squint they’re all basically predicate-argument structures implementing a
model-theoretic semantics, with perhaps a few free parameters in the bodies of
the predicates.&lt;/p&gt;

&lt;p&gt;These kinds of approaches seem to be disappearing. Now that everything is
end-to-end all the time, it’s rare to see models with explicit latent variables
taking values in hand-designed logical languages. Utterances come into our
models, behaviors come out, and we don’t worry too much about the structure of
the computation that gets performed in the middle.&lt;br /&gt;
&lt;span class=&quot;aside&quot;&gt;There are still certain kinds of generalization and inductive bias we used to
get for free with the old models that we haven’t totally figured out how to
recreate. The success of hybrid approaches like structured regularizers
&lt;a href=&quot;http://arxiv.org/abs/1706.05064&quot;&gt;[OS+17]&lt;/a&gt; and our NMN work
&lt;a href=&quot;http://arxiv.org/abs/1601.01705&quot;&gt;[AR+16]&lt;/a&gt; suggest we’ll get there eventually.&lt;/span&gt;
This is, with some qualifications, a good thing: in more formal approaches,
tight coupling between the machine learning and the representation means that
there’s always a risk that some new semantic phenomenon shows up in the data and
suddenly your model is useless. Sufficiently generic machinery for
learning (non-logical) representations makes this a little less scary.&lt;/p&gt;

&lt;p&gt;But the attitude of the end-to-end world seems to be that since we’re no longer
doing logical inference, there’s no need to think about meaning at all. Suddenly
everyone loves to cite Wittgenstein to argue that we should be 
evaluating “language understanding” in terms of success on downstream tasks
rather than predicting the right logical forms
&lt;a href=&quot;https://arxiv.org/abs/1606.02447&quot;&gt;[WLM16]&lt;/a&gt;
&lt;a href=&quot;https://arxiv.org/abs/1610.03585&quot;&gt;[GM16]&lt;/a&gt;
&lt;a href=&quot;https://arxiv.org/abs/1612.07182&quot;&gt;[LPB16]&lt;/a&gt;—which is great!—but underlying
this seems to be a philosophy that “meaning is use, so if we can predict use with
high accuracy we’ve understood everything we need to about meaning”.
&lt;span class=&quot;aside&quot;&gt;
I’ve never understood this to be the claim in &lt;em&gt;Philosophical
Investigations&lt;/em&gt;—even if use (rather than reference) is the primary thing we
should be trying to explain, &lt;em&gt;PI&lt;/em&gt; is very interested in the kinds of &lt;del&gt;mental
representations&lt;/del&gt; representations of the processes (?) in virtue of which
language use is possible. 
&lt;/span&gt;
Particularly given that we have not actually solved “use”, I think machine
learning has both lots to learn and lots to say about the meaning side of the
equation as well.&lt;/p&gt;

&lt;p&gt;In this post I want to motivate the use of explicit representations of belief
states of the form &lt;script type=&quot;math/tex&quot;&gt;p(\textsf{world state} \mid \textsf{utterance})&lt;/script&gt; &lt;em&gt;as&lt;/em&gt;
representations of meaning suitable for “unstructured” machine learning models.
These kinds of representations arise naturally in the sorts of decision-making
tasks the community is excited about about these days, but they also look a lot
like classical representational theories in linguistics. The synthesis suggests
ways of both training and interpreting language processing models.&lt;/p&gt;

&lt;h2 id=&quot;belief-states-and-intensions&quot;&gt;Belief states and intensions&lt;/h2&gt;

&lt;p&gt;Consider the problem of trying to act in a partially observed world where people
talk to you in order to help reduce your uncertainty. How should you choose the
best possible action to take? Given a single utterance &lt;script type=&quot;math/tex&quot;&gt;w&lt;/script&gt;, and possible true
states of the world &lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt;, the min Bayes risk action is&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\arg\min_a \int_x p(x \mid w) \; R(a;\,x)&lt;/script&gt;

&lt;p&gt;for some risk function &lt;script type=&quot;math/tex&quot;&gt;R&lt;/script&gt;. Any listener who hopes to succeed in the world
needs to do a good job of at least approximately solving this optimization
problem, and in practice the listener will probably need to represent the
distribution &lt;script type=&quot;math/tex&quot;&gt;p(x \mid w)&lt;/script&gt;, at least implicitly. In POMDP-land we call &lt;script type=&quot;math/tex&quot;&gt;p(x
\mid w)&lt;/script&gt; a &lt;em&gt;belief state&lt;/em&gt;; for a given &lt;script type=&quot;math/tex&quot;&gt;w&lt;/script&gt;, it’s a function that maps from
possible worlds &lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt; to scalar plausibility judgments—how likely is it that
&lt;script type=&quot;math/tex&quot;&gt;x&lt;/script&gt; is the true world given that we observed someone saying &lt;script type=&quot;math/tex&quot;&gt;w&lt;/script&gt; about it?&lt;/p&gt;

&lt;p&gt;Compare this to the notion of an &lt;em&gt;intension&lt;/em&gt; in Montague semantics: “a function
from possible worlds and moments of time to truth values”
&lt;a href=&quot;https://plato.stanford.edu/entries/montague-semantics/#IntTau&quot;&gt;[J11]&lt;/a&gt;.  Most
(model-theoretic) semantics programs represent intensions using logical
expressions (rather than e.g. tabularly). But a logical form is just one way of
expressing a function of the right type; at the end of the day, an “explicit
representation of meaning” to the Montagovian tradition is precisely an
intension—that is, something that looks like a discretized version of our
&lt;script type=&quot;math/tex&quot;&gt;p(x \mid w)&lt;/script&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A belief state is an intension with probabilities&lt;/em&gt;. Intensional representations
of meaning are useful not just because they help us solve linguistic
problems, but also because they approximate a quantity that we know helps
language users &lt;em&gt;do&lt;/em&gt; useful things with the information they’ve acquired from
language. From the other side, what the POMDP tells us we have to compute
upon hearing an utterance is approximately the thing linguists have been telling
us to compute all along.
&lt;span class=&quot;aside&quot;&gt;
Or almost the thing linguists have been telling us about—what would be even
better than a black box for answering &lt;script type=&quot;math/tex&quot;&gt;p(x \mid w)&lt;/script&gt; queries would be something
with a little structure, maybe some kind of factorized representation that let
us find the MBR action efficiently by making it possible to inspect the set of
properties that all plausible worlds have in common. Perhaps a product of
assertions about individuals, their properties, and their relations…. If
logical semantics didn’t exist we would have had to invent it. 
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;script type=&quot;math/tex&quot;&gt;p(x \mid w)&lt;/script&gt; qua “meaning” should be precisely understood as a &lt;em&gt;listener
meaning&lt;/em&gt;:  an accurate belief state already accounts for Gricean
speaker-meaning-type effects (e.g. implicatures) and also further inferences the
speaker may &lt;em&gt;not&lt;/em&gt; have wanted the listener to draw (e.g. the possibility that
&lt;script type=&quot;math/tex&quot;&gt;w&lt;/script&gt; is a lie). Our story here doesn’t care where &lt;script type=&quot;math/tex&quot;&gt;p(x \mid w)&lt;/script&gt; comes from,
so it might be computed via something like RSA
&lt;a href=&quot;http://science.sciencemag.org/content/336/6084/998&quot;&gt;[FG12]&lt;/a&gt; with a distinct
notion of sentence meaning embedded inside.&lt;/p&gt;

&lt;p&gt;One last adjustment: real-world listeners don’t start with a &lt;em&gt;tabula rasa&lt;/em&gt;:
every utterance is interpreted in the context of an existing belief state
&lt;script type=&quot;math/tex&quot;&gt;p(x)&lt;/script&gt;, and we really want to think of the meaning of a sentence as an &lt;em&gt;update
function&lt;/em&gt;; i.e. &lt;script type=&quot;math/tex&quot;&gt;p(x) \mapsto p(x \mid w)&lt;/script&gt; rather than just &lt;script type=&quot;math/tex&quot;&gt;p(x \mid w)&lt;/script&gt;.
For sentences of the “Pat loves Lou” variety I think this update is basically
always conjunctive; i.e. &lt;script type=&quot;math/tex&quot;&gt;p(x) \mapsto (1/Z) \cdot p(x) \cdot p(x \mid w)&lt;/script&gt;.
But the general version is necessary for dealing with indexicals and
&lt;a href=&quot;translation-meaning.html&quot;&gt;Quine’s problems&lt;/a&gt; with the denotation of &lt;em&gt;bachelor&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;practical-implications&quot;&gt;Practical implications&lt;/h2&gt;

&lt;p&gt;All very nice, but we led by noting that explicit denotational meaning
representations (logical, probabilistic, or otherwise) don’t actually show up in
the kinds of models that work well in practice. So why does any of this matter?&lt;/p&gt;

&lt;p&gt;For language understanding systems to work well, they must be choosing something
close to the min Bayes risk action. Hand-wavingly: a suffix of a deep network is
a function from input representations to output actions via a fixed circuit; if
this suffix can pick a good action for every input representation it’s
implementing something like an MBR decoding algorithm (though perhaps
approximate and specialized to the empirical distribution over representations);
whatever representation of language-in-context is presented to this part of the
network must then be sufficient to solve the optimization problem, so be
something like a representation of &lt;script type=&quot;math/tex&quot;&gt;p(x \mid w)&lt;/script&gt;.&lt;/p&gt;

&lt;p&gt;This is not a great argument: there may in fact be no
clear distinction between the “sentence representation” and “optimization” parts
of the model. But in practice we do see meaning-like sentence representations
emerge (especially in models where the sentence representation is computed
&lt;em&gt;independent&lt;/em&gt; of whatever initial information the listener has about the state
of the world
&lt;a href=&quot;https://distill.pub/2018/feature-wise-transformations/&quot;&gt;[DP+18]&lt;/a&gt;).
When using specialized optimization modules within larger networks
&lt;a href=&quot;https://arxiv.org/abs/1602.02867&quot;&gt;[TW+17]&lt;/a&gt;
&lt;a href=&quot;https://arxiv.org/abs/1805.02777&quot;&gt;[LFK18]&lt;/a&gt;
we can be sure of the distinction.&lt;/p&gt;

&lt;p&gt;In any case, the knowledge that some intermediate representation in our model is
(or should be) decodable into a distribution over world states gives us two
tools:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interpretability:&lt;/strong&gt; test whether representations are capturing the right
semantics (or identify what weird irregularities they’re latching onto) by
estimating &lt;script type=&quot;math/tex&quot;&gt;p(x \mid \textrm{rep}(w))&lt;/script&gt;, where &lt;script type=&quot;math/tex&quot;&gt;\textrm{rep}(w)&lt;/script&gt; is the
model’s learned representation of the utterance &lt;script type=&quot;math/tex&quot;&gt;w&lt;/script&gt;.  Determine whether this
corresponds to the real (i.e. human listener’s) denotation of &lt;script type=&quot;math/tex&quot;&gt;w&lt;/script&gt;. We got a
bunch of mileage out of this technique in our neuralese papers
&lt;a href=&quot;https://arxiv.org/abs/1704.06960&quot;&gt;[ADK17]&lt;/a&gt;
&lt;a href=&quot;https://arxiv.org/abs/1707.08139&quot;&gt;[AK17]&lt;/a&gt; and other students in the group have
been using it recently to analyze pretraining schemes for instruction-following
models. But in some ways it’s even more natural to apply it to the learning of
representations of natural language itself rather than a learned space of
messages / abstract actions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Auxiliary objectives:&lt;/strong&gt; the normal objective for an instruction following / QA
problem is &lt;script type=&quot;math/tex&quot;&gt;p(\textsf{action} \mid \textsf{utterance}, \textsf{listener
obs})&lt;/script&gt;. But if overfitting is an issue, it’s easy enough to tack on an extra
term of the form &lt;script type=&quot;math/tex&quot;&gt;p(\textsf{speaker obs, listener obs} \mid
\textsf{utterance})&lt;/script&gt; if it’s available. For some problems (e.g. GeoQuery-style
semantic parsing) there isn’t a meaningful distinction between “speaker
observation” and “action”; for others it looks like a totally different learning
problem. For referring expression games the denotational auxiliary problem is
“generate / retrieve pairs of images for which this would be a discriminative
caption”; for instruction following models it’s “generate the goal state (but
not necessarily the actions that get me there)”.&lt;/p&gt;

&lt;h2 id=&quot;conclusions&quot;&gt;Conclusions&lt;/h2&gt;

&lt;p&gt;Thinking about POMDP-style solutions to language games results in an account of
meaning that looks suspiciously like model-theoretic semantics. This analogy
provides tools for interpreting learned models and suggests auxiliary objectives
for improving their accuracy.&lt;/p&gt;
</description>
          <pubDate>Fri, 27 Jul 2018 00:00:00 +0000</pubDate>
          <link>http://blog.jacobandreas.net/meaning-belief.html</link>
          <guid isPermaLink="true">http://blog.jacobandreas.net/meaning-belief.html</guid>
          
          
        </item>
      
    
      
      
    
      
      
    
      
      
    
      
      
    
      
        <item>
          <title>Fake language: two perspectives</title>
          <description>&lt;p&gt;Is there a role for fake language datasets in the AI ecosystem?  (By “fake
language” I mean things like
&lt;a href=&quot;https://research.fb.com/downloads/babi/&quot;&gt;bAbI&lt;/a&gt;, 
&lt;a href=&quot;http://cs.stanford.edu/people/jcjohns/clevr/&quot;&gt;CLEVR&lt;/a&gt;,
Karthik’s &lt;a href=&quot;http://people.csail.mit.edu//karthikn/assets/pdf/mud-play15.pdf&quot;&gt;“Home” world&lt;/a&gt; 
[pdf link], and 
&lt;a href=&quot;https://arxiv.org/abs/1710.09867&quot;&gt;this DeepMind paper&lt;/a&gt;.) 
Claims that various learning architectures can “do language processing” based on
results from these datasets have caused a lot of hand-wringing in the NLP
community. While a lot of this is due to good old-fashioned overclaiming, I’ve
become persuaded some of it is miscommunication between two groups that mean
totally different things by “language data”.&lt;/p&gt;

&lt;p&gt;I’m going to focus here on instruction following, but I think there’s a similar
story to tell about lots of other grounded tasks like question answering,
generation, etc.&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; For a long time, an AI researcher’s view of an instruction
following problem was something like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Language -&amp;gt; Abstraction -&amp;gt; Behavior
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That is, we start with whatever utterances people are generating, map them to
some kind of clean, structured representation, and then make decisions about how
to act on the basis of that structure. Because this whole pipeline was too hard
to tackle all at once, the community mostly started working on it from different
ends.&lt;sup id=&quot;fnref:2&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;“Language people” worked on this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Language -&amp;gt; Abstraction
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this picture, language comes to you from the outside world—you don’t
control the distribution. You get to design the language of abstractions, but it
had better be able to handle (or at least fail gracefully on) whatever
utterances the world throws at you. Linguists give us a nice abstraction
formalism in the form of logic, and that the way to get from abstraction to
behavior is just logical interpretation. So it’s very easy to say “abstraction =
formal semantics” and treat the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Abstraction -&amp;gt; Behavior&lt;/code&gt; edge as someone else’s
problem.&lt;/p&gt;

&lt;p&gt;Data is &lt;em&gt;collected&lt;/em&gt; from human speakers who don’t necessarily know anything
about logical forms. Indeed, decisions about details of the logical language are
typically worked out after collecting initial annotations. What distinguishes
“language data” from other kinds of data is precisely the fact that it was
generated by human users. (If we’re generating data from a fake grammar and
mapping it onto logical forms, we generally haven’t learned anything about
language that we didn’t write down in the first place.)&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;“Policy people” (broadly understood to include everything from RL to planning
to classical control) worked on this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Abstraction -&amp;gt; Behavior
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this picture, the scope of acceptable abstractions is up to the system
designer—it’s in behavior where details of the real world (physics, etc.)
intervene. Abstraction languages range from “do one of these 10 specific things”
to “satisfy this STRIPS goal”. In particular, an abstraction language
that doesn’t support all possible goals is no more problematic than a remote
control that doesn’t operate all appliances at once.&lt;sup id=&quot;fnref:3&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; The thing that I
originally found difficult to appreciate is just how hard some of these problems
are &lt;em&gt;even when we have complete control over the input distribution&lt;/em&gt;.
Reinforcement learning is &lt;em&gt;hard&lt;/em&gt;.  Planning is &lt;em&gt;hard&lt;/em&gt;. There’s still lots of
room for interesting compositionality in these abstraction languages—if I have
some kind of structured representation of the goal, and I train on a subset of
structures, do I generalize to the rest? There’s lots we still can’t do.&lt;/p&gt;

&lt;p&gt;To come up with problems that are within reach of current methods, data is
&lt;em&gt;generated&lt;/em&gt; rather than collected. The distribution over abstractions and their
induced behaviors is hand-designed. There’s no language data here; what
distinguishes “language data” from what does get used is that language has no
precise execution semantics, but e.g. STRIPS does.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;In the last few years these two communities have run together, because the world
looks like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Language -&amp;gt; Behavior
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Everything is end-to-end all the time. Abstraction isn’t gone, but now it lives
in some uninterpretable representation space rather than a formalism we’ve
designed by hand. This is a great thing! Language people no longer have to limit
themselves to worlds where they’re clever enough to construct a good enough
logical language.&lt;/p&gt;

&lt;p&gt;And policy people (here’s where the trouble starts) no longer have to describe
their task inventory in terms of any particular formalism: they just need some
way of generating reward functions / goal tests synchronously with some kind of
(compositional?) identifier that describes them. So they generate interpretable
strings made of sequences of words. No execution semantics, uses English words:
natural language.  Whence the confusion.&lt;/p&gt;

&lt;p&gt;I think there’s a lesson in this for people in both communities:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;For “policy people” as researchers: &lt;em&gt;please please please&lt;/em&gt; signpost
explicitly when your input strings were generated synthetically. The word
&lt;em&gt;language&lt;/em&gt; is hopelessly overloaded at this point, but the bigram &lt;em&gt;natural
language&lt;/em&gt; is not: avoid using the word &lt;em&gt;natural&lt;/em&gt; unless people were involved.
(A couple of the papers linked in the first paragraph are guilty of this.)&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;For “language people” as reviewers: respond to appropriately qualified fake
language datasets by asking “Is an interesting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Abstraction -&amp;gt; Behavior&lt;/code&gt;
problem is being solved? Do strings index the target class of behaviors in an
interesting way?” There are lots of problems out there for which this is an
appropriate standard.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think we’re still at a stage where there’s something to learn from fake
language, even those of us who ultimately care about the distribution of
sentences produced by humans.&lt;/p&gt;

&lt;hr /&gt;

&lt;div class=&quot;footnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;Explicitly excluded from this discussion is work on doing linguistic
  analysis of fake language data. Such work is not about language at all,
  and is either about analyzing the formal expressive capacity of certain
  model classes, or is garbage. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot;&gt;
      &lt;p&gt;Not everyone! Both &lt;a href=&quot;https://cs.brown.edu/~stefie10/&quot;&gt;Stefanie Tellex&lt;/a&gt; and
  &lt;a href=&quot;http://people.csail.mit.edu/branavan/&quot;&gt;Branavan&lt;/a&gt; had work that was trying to
  tackle the complete pipeline well before the current end-to-end craze. I
  think this research is a model for what the field should be trying to
  accomplish, but for lots of problems our techniques just aren’t there
  yet. &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot;&gt;
      &lt;p&gt;There’s a sense in which Jonathan Berant and Percy Liang’s work on
  &lt;a href=&quot;http://www.aclweb.org/anthology/P14-1133&quot;&gt;paraphrasing for semantic parsing&lt;/a&gt; 
  [pdf link] actually belongs in this category, rather than &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Language -&amp;gt;
  Abstraction&lt;/code&gt;.  But they still hold themselves to a “real language”
  evaluation standard. &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
          <pubDate>Sat, 04 Nov 2017 00:00:00 +0000</pubDate>
          <link>http://blog.jacobandreas.net/fake-language.html</link>
          <guid isPermaLink="true">http://blog.jacobandreas.net/fake-language.html</guid>
          
          
        </item>
      
    
      
        <item>
          <title>Learning to reason with neural module networks</title>
          <description>
</description>
          <pubDate>Wed, 17 May 2017 00:00:00 +0000</pubDate>
          <link>http://blog.jacobandreas.net/nmns.html</link>
          <guid isPermaLink="true">http://blog.jacobandreas.net/nmns.html</guid>
          
          
          <category>link</category>
          
        </item>
      
    
      
        <item>
          <title>A neural network is a monference, not a model</title>
          <description>&lt;p&gt;The distinction between &lt;em&gt;models&lt;/em&gt; and &lt;em&gt;inference procedures&lt;/em&gt; is central to most
introductory presentations of artificial intelligence.  For example: HMMs are a
class of model; the Viterbi algorithm is one associated inference procedure,
the forward–backward algorithm is another, and particle filtering is a third.&lt;/p&gt;

&lt;p&gt;Many people describe (and presumably think of) neural networks as a class of
models. I want to argue that this view is misleading, and that it is more useful
to think of neural networks as hopelessly entangled model–inference pairs.
“Model–inference pair” is a mouthful, and there doesn’t seem to be good
existing shorthand, so I will henceforth refer to such objects as “monferences”.
My claim is that we should think of a neural network as an example of a
monference. (An implementation of the Viterbi algorithm, equipped with the
parameters of some &lt;em&gt;fixed&lt;/em&gt; HMM, is also a monference.)&lt;/p&gt;

&lt;p&gt;I’m about to cite a bunch of existing papers that follow naturally from the
neural-nets-as-monferences perspective—it seems like this idea is already
obvious to a lot of people. But I don’t think it’s been given a name or a
systematic treatment, and I hope others will find what follows as useful
(or at least as deconfounding) as I did.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;What are the consequences of regarding a neural net as a &lt;em&gt;model&lt;/em&gt;?
A personal example is illustrative:&lt;/p&gt;

&lt;p&gt;The first time I saw a recurrent neural network, I thought “this is an
interesting model with a broken inference procedure”. A recurrent net looks like
an HMM. An HMM has a discrete hidden state, and a recurrent net has a
vector-valued hidden state.  When we do inference in an HMM, we maintain a
distribution over hidden states consistent with the output, but when we do
inference in a recurrent net, we maintain only a single vector—a single
hypothesis, and a greedy inference procedure. Surely things would be better if
there were some way of modeling uncertainty? Why not treat RNN inference like
Kalman filtering?&lt;/p&gt;

&lt;p&gt;This complaint is &lt;em&gt;wrong&lt;/em&gt;. Our goal in the remainder of this post is to explore
why it’s wrong.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Put simply, there is no reason to regard the hidden state of a
recurrent network as a single hypothesis. After all, a sufficiently large hidden
vector can easily represent the whole table of probabilities we use in the
forward algorithm—or even represent the state of a particle filter. The
analogy “HMM hidden state = RNN hidden state” is bad; a better analogy is “HMM
&lt;em&gt;decoder&lt;/em&gt; state = RNN hidden state”.&lt;/p&gt;

&lt;!--
This _temptation to form false analogies_ is especially appealing to those of us
who grew up in the graphical models culture, and are accustomed to inference
design problems that look algorithmic. But it's only one of a variety of failure
modes associated with the neural-nets-as-models perspective. Another
failure mode seems to preferentially afflict people from the neural nets
culture, who have never needed to think about inference at all: this is a
_failure to reason about computation_. 

I don't want to pick on anyone individually. But there seems to be a recent
trend of papers that start with a basic RNN, observe that it can't solve some
simple algorithmic or reasoning problem, and conclude that some crazy new
architecture is necessary&amp;mdash;when often it would have been enough to let the
RNN run for more steps, or make a minor change to kind of recurrent unit used.
I think people get in the habit of saying &quot;everything is a function
approximator, and all function approximators are basically comparable&quot;. Whereas
if we say &quot;everything is a program&quot;, these fair comparison issues become more
complicated: we have to start worrying about equal runtimes, availability of the
right floating point operations, etc. But when building inference procedures,
these are exactly the things we should worry most about!

***

--&gt;

&lt;p&gt;Let’s look at this experimentally. (Code for
this section can be found in the accompanying &lt;a href=&quot;https://github.com/jacobandreas/blog/blob/gh-pages/notebooks/monference.ipynb&quot;&gt;Jupyter
notebook&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;If we think about the classical inference procedure with the same structure as a
(uni-directional) recurrent neural network, it’s something like this: for &lt;script type=&quot;math/tex&quot;&gt;t =
0..n&lt;/script&gt;, receive an emission &lt;script type=&quot;math/tex&quot;&gt;x_t&lt;/script&gt; from the HMM, and &lt;em&gt;immediately&lt;/em&gt; predict a
hidden state &lt;script type=&quot;math/tex&quot;&gt;y_t&lt;/script&gt;. You should be able to convince yourself that if we’re
evaluated on tagging accuracy, the min-risk monference (if HMM parameters are
known) is to run the forward algorithm, and predict the tag with maximum
marginal probability at each time &lt;script type=&quot;math/tex&quot;&gt;t&lt;/script&gt;.&lt;/p&gt;

&lt;p&gt;I generated a random HMM, drew a bunch of sequences from it, and
applied this min-risk classical procedure. I obtained the following
“online tagging” accuracy:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;62.8&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Another totally acceptable (though somewhat more labor-intensive) way of
producing a monference for this online tagging problem is to take the HMM, draw
many more samples from it, and use the (observed, hidden) sequences as training
data (x, y) for a vanilla RNN of the following form:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;figures/monference_rnn.png&quot; style=&quot;width: 300px; max-width: 100%&quot; /&gt;&lt;/p&gt;

&lt;p&gt;(where each arrow is an inner product followed by a ReLU or log-loss). In this
case I obtained the following accuracy:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;62.8&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Is it just a coincidence that these scores are the same? Let’s look at some
predictions:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;true hidden sequence: 1 0 0 1 0
classical monference: 1 0 1 1 0
neural monference:    1 0 1 1 0

true hidden sequence: 1 0 1 2 0
classical monference: 1 0 1 0 0
neural monference:    1 0 1 0 0&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So even when our two monferences are wrong, they’re wrong in the same way.&lt;/p&gt;

&lt;p&gt;Of course, we know that we can get slightly better results for this problem by
running the full forward-backward algorithm, and again making max-marginal
predictions. This improved classical procedure gave an accuracy of:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;63.3&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;better than either of the online models, as expected. Training a bidirectional
recurrent net&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;figures/monference_bdrnn.png&quot; style=&quot;width: 300px; max-width: 100%&quot; /&gt;&lt;/p&gt;

&lt;p&gt;on samples from the HMM gave a tagging accuracy of:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;63.3&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;A sample prediction:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;true hidden sequence: 0 1 0 0 1
classical monference: 0 1 0 0 1
neural monference:    0 1 0 0 1&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Notice: the neural nets we’ve used here don’t encode anything
about classical message-passing rules, and they definitely don’t encode anything
about the generative process underlying an HMM. Yet in both cases, the neural
net managed to achieve accuracy as good as (but no better than) the classical
message passing procedure with the same structure. Indeed, this neural training
procedure results in a piece of code that makes identical predictions to the
forward–backward algorithm, but it doesn’t know anything about the
forward–backward algorithm!&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Neural networks are not magic—when our data is actually generated from an HMM,
we can’t hope to beat an (information-theoretically optimal) classical
monference with a neural one. But we can empirically do just as well. 
As we augment neural architectures to match the &lt;em&gt;algorithmic structure&lt;/em&gt; of more
powerful classical inference procedures, their performance improves.
Bidirectional recurrent nets are better than forward-only ones; bidirectional
networks with &lt;a href=&quot;http://arxiv.org/abs/1602.08210&quot;&gt;multiple layers between each “real” hidden
vector&lt;/a&gt; might be even better for some tasks.&lt;/p&gt;

&lt;p&gt;Better yet, we can perhaps worry less about harder cases, when we previously
would have needed to hand-tune some approximate inference scheme. (One example:
suppose our transition matrix is a huge permutation. It might be very expensive
to do repeated multiplications for classical inference, and trying to take a
low-rank approximation to the transition matrix will lose information. But a
neural monference can potentially represent our model dynamics quite
compactly.)&lt;/p&gt;

&lt;p&gt;So far we’ve been looking at sequences, but analogues for more structured data
exist as well. For tree-shaped problems, we can run something that looks like
the &lt;a href=&quot;http://www.socher.org/uploads/Main/SocherBauerManningNg_ACL2013.pdf&quot;&gt;inside algorithm over a fixed
tree&lt;/a&gt; or
the &lt;a href=&quot;https://aclweb.org/anthology/D/D15/D15-1137.pdf&quot;&gt;inside–outside algorithm over a whole sparsified parse
chart&lt;/a&gt;.  For arbitrary graphs,
we can apply repeated &lt;a href=&quot;http://arxiv.org/pdf/1509.09292.pdf&quot;&gt;“graph
convolutions”&lt;/a&gt; that start to look a lot
like belief propagation.&lt;/p&gt;

&lt;p&gt;There’s a general principle here: anywhere you have an inference algorithm that
maintains a distribution over discrete states, instead:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;replace {chart cells, discrete distributions} with vectors&lt;/li&gt;
  &lt;li&gt;replace messages between cells with recurrent networks&lt;/li&gt;
  &lt;li&gt;unroll the “inference” procedure for a suitable number of iterations&lt;/li&gt;
  &lt;li&gt;train via backpropagation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The resulting monference has at least as much capacity as the corresponding
classical procedure. To the extent that appproximation is necessary, we can (at
least empirically) &lt;em&gt;learn&lt;/em&gt; the right approximation end-to-end from the training
data.&lt;/p&gt;

&lt;p&gt;(The version of this that backpropagates through an approximate inference
procedure, but doesn’t attempt to learn the inference function itself, has &lt;a href=&quot;http://cs.jhu.edu/~jason/papers/#stoyanov-ropson-eisner-2011&quot;&gt;been
around&lt;/a&gt;
for &lt;a href=&quot;http://www.cs.cmu.edu/~mgormley/papers/gormley+dredze+eisner.tacl.2015.pdf&quot;&gt;a while&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;I think there’s at least one more constituency parsing paper to be written
using all the pieces of this framework, and lots more for working with
graph-structured data.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;I’ve argued that the monference perspective is useful, but is it true? That is,
is there a precise sense in which a neural net is &lt;em&gt;really&lt;/em&gt; a monference, and not
a model?&lt;/p&gt;

&lt;p&gt;No. There’s a fundamental identifiability problem—we can’t really distinguish
between “fancy model with trivial inference” and “mystery model with complicated
inference”. Thus it also makes no sense to ask, given a trained neural network,
which model it performs inference for. (On the other hand, networks trained via
&lt;a href=&quot;http://arxiv.org/abs/1503.02531&quot;&gt;distillation&lt;/a&gt; seem like good candidates for
“same model, different monference”.) And the networks-as-_models_ perspective
shouldn’t be completely ignored: it’s resulted in a fruitful line of work that
replaces log-linear potentials with neural networks 
&lt;a href=&quot;https://arxiv.org/abs/1507.03641&quot;&gt;inside CRFs&lt;/a&gt;.
(Though one of the usual selling points of these methods is that “you get to
keep your dynamic program”, which we’ve argued here is true of suitably
organized recurrent networks as well.)&lt;/p&gt;

&lt;p&gt;In spite of all this, as research focus in this corner of the machine learning
community shifts towards &lt;a href=&quot;http://nips2015.sched.org/event/4G4h/reasoning-attention-memory-ram-workshop&quot;&gt;planning, reasoning, and harder algorithmic
problems&lt;/a&gt;,
I think the neural-nets-as-monferences perspective should dominate.&lt;/p&gt;

&lt;p&gt;More than that—when we look back on the “deep learning revolution” ten years
from now, I think the real lesson will be the importance of end-to-end training
of decoders and reasoning procedures, even in systems that &lt;a href=&quot;http://arxiv.org/abs/1601.01705&quot;&gt;barely
look
like neural networks at all&lt;/a&gt;. So when building
learning systems, don’t ask: “what is the probabilistic relationship among my
variables?”. Instead ask: “how do I approximate the inference function for my
problem?”, and attempt to learn this approximation directly. To do this
effectively, we can use everything we know about classical inference procedures.
But we should also start thinking of inference as a first-class part of the
learning problem.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Thanks to Matt Gormley (whose EMNLP talk got me thinking about these issues), and
Robert Nishihara and Greg Durrett for feedback.&lt;/p&gt;

&lt;p&gt;Also Jason Eisner for this gem: “An awful portmanteau, since monference should be a count 
noun like model, but you took the suffix from the mass noun.  Not that I can claim that infedel 
is much better…”&lt;/p&gt;
</description>
          <pubDate>Thu, 18 Feb 2016 00:00:00 +0000</pubDate>
          <link>http://blog.jacobandreas.net/monference.html</link>
          <guid isPermaLink="true">http://blog.jacobandreas.net/monference.html</guid>
          
          
        </item>
      
    
      
        <item>
          <title>Planning in representation space</title>
          <description>&lt;p&gt;Agents parameterized by neural nets (Atari players etc.) seem to universally
suffer from an ability to plan. This is obvious in the case of Markov reflex
agents like vanilla deep Q learners, and seems to be true even of agents with
some amount of hidden state (like the MemN2N paper at NIPS). Nevertheless
planning-like behaviors have been successfully applied to other deep models,
most notably text generation—beam decoding, and even beam-aware training, seem
to be essential for both MT and captioning. And of course, real planning is
ubiquitous among people working on non-toy control problems.&lt;/p&gt;

&lt;p&gt;Task and motion planning is a good example. At the end of the day, we need to
solve a continuous control problem, but attempting to solve this directly
(either with a generic control policy or TrajOpt-like procedure) is too hard.
Instead we come up with some highly simplified, hand-specified encoding of
the problem—perhaps a STRIPS representation that discards geometry. We solve
the (comparatively easy) STRIPS planning problem, and then project back down
into motion planning space. This projection might not correspond to a feasible
policy! (But we want things feasible in task space to be feasible in motion
space as much as possible.) We keep searching in planning space until we find a
solution that also works in task space.&lt;/p&gt;

&lt;p&gt;This is really just a coarse-to-fine pruning scheme—we want a cheap way to
discard plans that are obviously infeasible, so we can devote all of our
computational resources to cases that really require simulation.&lt;/p&gt;

&lt;p&gt;We can represent this schematically:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;figures/planning_representations_diagram.png&quot; style=&quot;width: 30%&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here we have a representation function &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt;, a true cost function &lt;script type=&quot;math/tex&quot;&gt;c&lt;/script&gt; (which
we may want to think of as a 0–1 feasibility judgment), and a “representation
cost” &lt;script type=&quot;math/tex&quot;&gt;k&lt;/script&gt;. We want to ensure that &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt; is “close to an isomorphism” from
motion costs to task costs, in the sense that &lt;script type=&quot;math/tex&quot;&gt;c(s_1, s_2) \approx k(r(s_1),
r(s_2))&lt;/script&gt;.&lt;/p&gt;

&lt;p&gt;For the STRIPS version, we assume that &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt; and &lt;script type=&quot;math/tex&quot;&gt;k&lt;/script&gt; are given to us by hand.
But can we &lt;em&gt;learn&lt;/em&gt; a better representation than STRIPS for solving task and
motion planning problems?&lt;/p&gt;

&lt;h2 id=&quot;learning-from-example-plans&quot;&gt;Learning from example plans&lt;/h2&gt;

&lt;p&gt;First suppose that we have training data in the form of successful sequences
with motion-space waypoints &lt;script type=&quot;math/tex&quot;&gt;(s_1, s_2, \ldots, s^*)&lt;/script&gt;. Then we can directly
minimize an objective of the form&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;L(\theta) = \sum_i \left[c(s_i, s_{i+1}) - k_\theta(r_\theta(s_i),
r_\theta(s_{i+1}))\right]^2&lt;/script&gt;

&lt;p&gt;for &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt; and &lt;script type=&quot;math/tex&quot;&gt;k&lt;/script&gt; parameterized by &lt;script type=&quot;math/tex&quot;&gt;\theta&lt;/script&gt;. Easiest if representation space (the codomain
of &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt;) is &lt;script type=&quot;math/tex&quot;&gt;\mathbb{R}^d&lt;/script&gt;; then we can manipulate &lt;script type=&quot;math/tex&quot;&gt;d&lt;/script&gt; to control the tradeoff
between representation quality and the cost of searching in representation space.&lt;/p&gt;

&lt;p&gt;Problem: if we only ever observe constant &lt;script type=&quot;math/tex&quot;&gt;c&lt;/script&gt; (which might be the
case if we only see good solutions), there’s no pressure to learn a nontrivial
&lt;script type=&quot;math/tex&quot;&gt;k&lt;/script&gt;. So we also want examples of unsuccessful attempts.&lt;/p&gt;

&lt;h2 id=&quot;decoding&quot;&gt;Decoding&lt;/h2&gt;

&lt;p&gt;Given a trained model, we can solve new instances by:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Sample a cost-weighted path through representation space &lt;script type=&quot;math/tex&quot;&gt;(r_1, r_2, ..., r_n)&lt;/script&gt;
such that &lt;script type=&quot;math/tex&quot;&gt;r(s^*) \approx r_n&lt;/script&gt;.&lt;/li&gt;
  &lt;li&gt;Map each representation space transition &lt;script type=&quot;math/tex&quot;&gt;r_1 \to r_2&lt;/script&gt; onto a motion space
transition &lt;script type=&quot;math/tex&quot;&gt;s_1 \to s_2&lt;/script&gt; such that &lt;script type=&quot;math/tex&quot;&gt;r(s_2) \approx r_2&lt;/script&gt;. (Easily
expressed as an opt problem if &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt; is differentiable, but harder as a
  policy.)&lt;/li&gt;
  &lt;li&gt;Repeat until one of the motion-space solutions is feasible.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At every step that involves computing a path (whether in &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt;-space or
&lt;script type=&quot;math/tex&quot;&gt;s&lt;/script&gt;-space, we can use a wide range of possible techniques, whether
optimization-based (TrajOpt), search-based (RRT, though probably not in high
dimensions), or by learning a policy parameterized by the goal state.&lt;/p&gt;

&lt;h2 id=&quot;learning-directly-from-task-feedback&quot;&gt;Learning directly from task feedback&lt;/h2&gt;

&lt;p&gt;What if we don’t have good traces to learn from?  Just interleave the above two
steps—starting from random initialization,
roll out to a sequence of predicted &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt; and &lt;script type=&quot;math/tex&quot;&gt;s&lt;/script&gt;, then treat this as
supervision, and again update &lt;script type=&quot;math/tex&quot;&gt;k&lt;/script&gt; to reflect observed costs.&lt;/p&gt;

&lt;h2 id=&quot;informed-search&quot;&gt;Informed search&lt;/h2&gt;

&lt;p&gt;So far we’re assuming we can just brute-force our way through representation
space until we get close to the goal. There’s nothing to enforce that closeness
in representation space corresponds to closeness in motion space (other than the
possible smoothness of &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt;). We might want to add an additional constraint
that if &lt;script type=&quot;math/tex&quot;&gt;r_i&lt;/script&gt; is definitely three hops from &lt;script type=&quot;math/tex&quot;&gt;r_n&lt;/script&gt;, then &lt;script type=&quot;math/tex&quot;&gt;||r_i - r_n|| &gt;
||r_{i+1} - r_n||&lt;/script&gt; or something similar. This immediately provides a useful
heuristic for the search in representation space.&lt;/p&gt;

&lt;p&gt;We can also use side-information at this stage—maybe advice provided in the
form of language or a video demonstration. (Then we need to learn another
mapping from advice space to representation space.)&lt;/p&gt;

&lt;h2 id=&quot;modularity&quot;&gt;Modularity&lt;/h2&gt;

&lt;p&gt;It’s common to define several different primitive operations in the STRIPS
domain—e.g. just “move” and “grasp”. We might analogously want to give our
agent access to a discrete inventory of different policies, with associated
transition costs &lt;script type=&quot;math/tex&quot;&gt;k_1, k_2, \ldots&lt;/script&gt;. Now the search problem involves both
(continuously) choosing a set of points, and (discretely) choosing cost
functions / motion primitives for moving between them. The associated motions of
each of these primitives might be confined to some (hand-picked) sub-manifold of
configuration space (e.g. only move the end effector, only move the first
joint).&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Thanks to Dylan Hadfield-Menell for useful discussions about task and motion
planning.&lt;/p&gt;
</description>
          <pubDate>Sun, 17 Jan 2016 00:00:00 +0000</pubDate>
          <link>http://blog.jacobandreas.net/planning-representations.html</link>
          <guid isPermaLink="true">http://blog.jacobandreas.net/planning-representations.html</guid>
          
          
        </item>
      
    
      
        <item>
          <title>Programs made of neural networks</title>
          <description>&lt;p&gt;A crude history of applied machine learning:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Whenever we have a low-capacity model with hand-engineered structural
constraints, and replace it with a high-capacity model with simple features
and few structural constraints, model quality improves [models are smaller,
take less time to develop, and generalize better to unseen data].&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;See (in NLP): linear models replacing decision lists, Jelinek’s infamous
linguists, statistical machine translation, the recent flurry of papers whose
entire substance is “replace this log-linear model (a two-layer neural net) with
a three-layer neural net”.&lt;/p&gt;

&lt;p&gt;A crude history of programming languages:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Whenever we have a programming language with lots of simple constructs, and we
replace them with a few high-level constructs, program quality
improves [programs of equivalent complexity are shorter, take less time to
develop, and are less likely to contain bugs].&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;First everyone stopped writing assembly, then everyone stopped writing C.&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;Notice: in each case we’re moving the same slider—just moving it in different
directions. Machine learning and programming language design ultimately have the
same goal: making it as easy as possible for certain problem-solving machines
(whether those are humans or optimization algorithms) to produce correct code
according to some specification.  Out in the real world, we don’t favor machine
learning because it is inherently more pure or beautiful than writing code by
hand—we use it because it’s &lt;em&gt;effective&lt;/em&gt;. If somebody released a library today
with a bunch of composable vision primitives, and suddenly Facebook to could
solve all their image-labeling problems more effectively with interns rather
than neural nets, then neural nets would be out the door tomorrow.&lt;/p&gt;

&lt;p&gt;Actually, can we write this library now?&lt;/p&gt;

&lt;p&gt;To be clear, I don’t mean something like OpenCV, where you take a bunch of
pre-implemented models for particular tasks and then do whatever
stitching-together you want in postprocessing. Instead, again, some notion of
little vision primitives from which it would be possible to write a classifier
as&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-scala&quot; data-lang=&quot;scala&quot;&gt;    &lt;span class=&quot;nf&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;n&quot;&gt;detectObjects&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;nf&quot;&gt;orderBy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;salience&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;n&quot;&gt;head&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;or a captioner as&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-scala&quot; data-lang=&quot;scala&quot;&gt;    &lt;span class=&quot;nf&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;n&quot;&gt;detectObjects&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;n&quot;&gt;describeAll&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;or a face detector as&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-scala&quot; data-lang=&quot;scala&quot;&gt;    &lt;span class=&quot;nf&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;n&quot;&gt;detectObjects&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;nf&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Face&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;n&quot;&gt;drawBoundaries&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;What do the functions &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;detectObjects&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;describeAll&lt;/code&gt;, etc. look like? Current
experience suggests that they should be neural nets, but neural nets of a very
particular kind: rather than being trained to accomplish some particular task
(like image captioning), they’re trained to be freely composable: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;describeAll&lt;/code&gt;
promises to take anything “like a list of detections” (whether directly from
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;detectObjects&lt;/code&gt; or subsequently filtered) and produce a string. Note in
particular that the inputs and outputs to these functions are all real
vectors. There is no way to structurally enforce that a thing “like a list of
detections” actually has the desired semantics, and instead we rely entirely on
the training procedure.&lt;/p&gt;

&lt;p&gt;In current real-world implementations, there’s a notion of &lt;em&gt;layers&lt;/em&gt; as modular,
pre-specified units, but &lt;em&gt;networks&lt;/em&gt; as monolithic models customized for specific
tasks (and requiring end-to-end training). Once we move to modular networks,
though, we can start to perform tasks for which no training data exists. For
example, “write a caption about the people in this image”:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-scala&quot; data-lang=&quot;scala&quot;&gt;    &lt;span class=&quot;nf&quot;&gt;load&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;n&quot;&gt;detectObjects&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; 
      &lt;span class=&quot;nf&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Face&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; 
      &lt;span class=&quot;n&quot;&gt;andThen&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;describeAll&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;using the same primitives specified above.&lt;/p&gt;

&lt;p&gt;Steps we are already taking in this direction: the fact that people use a prefix
of an image classification network to initialize models for basically every
other vision task; the fact that “attention” is suddenly being treated as a
primitive in model descriptions even though it’s a complicated sequence of
operations for combining multiple layers. Roger Grosse’s beautiful &lt;a href=&quot;http://www.cs.toronto.edu/~rgrosse/uai2012-matrix.pdf&quot;&gt;paper on
grammars over matrix factorization
models&lt;/a&gt; also kind of
looks like this, and Christopher Olah has a &lt;a href=&quot;http://colah.github.io/posts/2015-09-NN-Types-FP/&quot;&gt;discussion of the type-theoretic
niceties&lt;/a&gt; of neural nets
understood as collections of reusable modules (though to me this seems largely
secondary to the practical question of what these types are).&lt;/p&gt;

&lt;p&gt;To bring this back to the earlier programming language discussion, we observe
that:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;It’s hard for a person to write down a person-detector by hand, but easy for
a neural net.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Given appropriate functional vision primitives, it’s easy for a person to
write down a person &lt;em&gt;describer&lt;/em&gt;. But training a neural net to do this from
scratch requires a lot of examples of people descriptions to do this.  (We
might then say it’s “easy” for people but “hard” for a neural net.)&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To take this yet a step further, we can note that there are lots of machine
learning techniques that are more human-like than neural-net-like, in the sense
that they do well with tiny data sets and a good pre-specified inventory of
primitives (e.g. program induction, semantic parsing). If we really just care
about minimal human intervention, we can figure out our vision primitives and
then hand them off to a machine learning subsystem of an entirely different
kind.&lt;/p&gt;

&lt;p&gt;So let’s write this library!  There are research questions here: First, what is
the right set of functional primitives to give people (or models for program
induction)? Next, can these shared representations actually be learned? How do
we find parameter settings for these modules using the kinds of labeled data
currently available?&lt;/p&gt;

&lt;p&gt;Disclosure: I already have a model like this working on a bunch of simple
question-answering tasks about images—I think it’s a really exciting
proof-of-concept, and I’ll hopefully be able to show it off soon. But it’s not a
comprehensive solution (esp. if we want to interface between vision / language /
control applications), and I think there’s a really interesting systems problem
here too.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Followup:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://arxiv.org/abs/1511.02799&quot;&gt;Deep compositional question answering with neural networks&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://arxiv.org/abs/1601.01705&quot;&gt;Learning to compose neural networks for question answering&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;div class=&quot;footnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;Obviously this is a gross overstatement, since lots of people do continue to
  write assembly and C. But I think it’s less controversial to say that &lt;em&gt;fewer&lt;/em&gt;
  people write in low-level languages, and that it’s harder to do so correctly. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
          <pubDate>Sun, 06 Sep 2015 00:00:00 +0000</pubDate>
          <link>http://blog.jacobandreas.net/programming-with-nns.html</link>
          <guid isPermaLink="true">http://blog.jacobandreas.net/programming-with-nns.html</guid>
          
          
        </item>
      
    
  </channel>
</rss>
