  Although deep learning models perform remarkably well across a range of tasks
such as language translation and object recognition, it remains unclear what
high-level logic, if any, they follow. Understanding this logic may lead to
more transparency, better model design, and faster experimentation. Recent
machine learning research has leveraged statistical methods to identify hidden
units that behave (e.g., activate) similarly to human understandable logic, but
those analyses require considerable manual effort. Our insight is that many of
those studies follow a common analysis pattern, which we term Deep Neural
Inspection. There is opportunity to provide a declarative abstraction to easily
express, execute, and optimize them.
  This paper describes DeepBase, a system to inspect neural network behaviors
through a unified interface. We model logic with user-provided hypothesis
functions that annotate the data with high-level labels (e.g., part-of-speech
tags, image captions). DeepBase lets users quickly identify individual or
groups of units that have strong statistical dependencies with desired
hypotheses. We discuss how DeepBase can express existing analyses, propose a
set of simple and effective optimizations to speed up a standard Python
implementation by up to 72x, and reproduce recent studies from the NLP
literature.
