understanding deep learning with reasoning layer

27
000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 Understanding Deep Learning with Reasoning Layer Anonymous Authors 1 Abstract Recently, there is a surge of interest in combin- ing deep learning models with reasoning in or- der to handle more sophisticated learning tasks. In many cases, a reasoning task can be solved by an iterative algorithm. This algorithm is of- ten unrolled, and used as a specialized layer in the deep architecture, which can be trained end- to-end with other neural components. Although such hybrid deep architectures have led to many empirical successes, theoretical understandings of such architectures, especially the interplay be- tween algorithm layers and other neural layers, remains largely unexplored. In this paper, we take an initial step toward an understanding of such hybrid deep architectures by showing that proper- ties of the algorithm layers, such as convergence, stability and sensitivity, are intimately related to the approximation and generalization abilities of the end-to-end model. Furthermore, our analysis matches nicely with experimental observations under various conditions, suggesting that our the- ory can provide useful guidelines for designing deep architectures with reasoning layers. 1. Introduction Many real world applications require perception and reason- ing to work together to solve a problem. Perception refers to the ability to understand and represent inputs, while rea- soning refers to the ability to follow prescribed steps and derive answers satisfying certain structures or constraints. To tackle such sophisticated learning tasks, recently, there is a surge of interests in combining deep perception models with reasoning modules. Typically, a reasoning module is stacked on top of a neu- ral module, and treated as an additional layer of the overall deep architecture; then all the parameters in the architec- 1 Anonymous Institution, Anonymous City, Anonymous Region, Anonymous Country. Correspondence to: Anonymous Author <[email protected]>. Preliminary work. Under review by the International Conference on Machine Learning (ICML). Do not distribute. x E (x,y) Alg (E (x,)) reasoning module neural module Figure 1. Hybrid architecture ture are optimized end-to-end with loss gradients (Fig 1). Very often these reasoning modules can be implemented as unrolled iterative algorithms, which can solve more so- phisticated tasks with carefully designed and interpretable operations. For instance, SATNet [1] integrated a satisfi- ability solver into its deep model as a reasoning module; E2Efold [2] used a constrained optimization algorithm on top of a neural energy network to predict and reasoning about RNA structures. [3] used optimal transport algorithm as a reasoning module for learning to sort. Other algorithms such as ADMM [4, 5], Langevin dynamics [6], inductive logic programming [7], DP [8], k-means clustering [9], be- lief propagation [10], power iterations [11] are also used as differentiable reasoning modules in deep models for various learning tasks. Thus in the reminder of the paper, we will use reasoning layer and algorithm layer interchangeably. While these previous works have demonstrated the effective- ness of combining deep learning with reasoning, theoretical understandings of such hybrid deep architectures remain largely unexplored. For instance, what is the benefit of us- ing a reasoning module based on unrolled algorithms com- pared to generic architectures such as RNN? How exactly will the reasoning module affect the generalization ability of the deep architecture? For different algorithms which can solve the same task, what are their differences when used as reasoning modules in deep models? Despite the rich literature on rigorous analysis of algorithm properties, there is a paucity of work leveraging these analyses to formally study the learning behavior of deep architectures containing algorithm layers. This motivates us to ask the intriguing and timely question of How will the algorithm properties of a reasoning layer affect the learning behavior of deep archi-

Upload: others

Post on 30-May-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Understanding Deep Learning with Reasoning Layer

000001002003004005006007008009010011012013014015016017018019020021022023024025026027028029030031032033034035036037038039040041042043044045046047048049050051052053054

Understanding Deep Learning with Reasoning Layer

Anonymous Authors1

AbstractRecently, there is a surge of interest in combin-ing deep learning models with reasoning in or-der to handle more sophisticated learning tasks.In many cases, a reasoning task can be solvedby an iterative algorithm. This algorithm is of-ten unrolled, and used as a specialized layer inthe deep architecture, which can be trained end-to-end with other neural components. Althoughsuch hybrid deep architectures have led to manyempirical successes, theoretical understandingsof such architectures, especially the interplay be-tween algorithm layers and other neural layers,remains largely unexplored. In this paper, we takean initial step toward an understanding of suchhybrid deep architectures by showing that proper-ties of the algorithm layers, such as convergence,stability and sensitivity, are intimately related tothe approximation and generalization abilities ofthe end-to-end model. Furthermore, our analysismatches nicely with experimental observationsunder various conditions, suggesting that our the-ory can provide useful guidelines for designingdeep architectures with reasoning layers.

1. IntroductionMany real world applications require perception and reason-ing to work together to solve a problem. Perception refersto the ability to understand and represent inputs, while rea-soning refers to the ability to follow prescribed steps andderive answers satisfying certain structures or constraints.To tackle such sophisticated learning tasks, recently, thereis a surge of interests in combining deep perception modelswith reasoning modules.

Typically, a reasoning module is stacked on top of a neu-ral module, and treated as an additional layer of the overalldeep architecture; then all the parameters in the architec-

1Anonymous Institution, Anonymous City, Anonymous Region,Anonymous Country. Correspondence to: Anonymous Author<[email protected]>.

Preliminary work. Under review by the International Conferenceon Machine Learning (ICML). Do not distribute.

timebetw

eenstep

s.Theultim

ateaim

isto

concurrentlypropose,

create,and

characterizenew

materials,w

itheach

component

transmitt-

ing

and

receiving

datasim

ultaneously.

This

processiscalled

“closingtheloop,”

andinverse

designisacriticalfacet

(12,15).

Inverse

desig

n

Quan

tumch

emical

meth

odsreveal

propertiesof

amolecular

systemon

lyafter

specifyingthe

essentialparam

etersof

thecon

stituentatom

icnuclei

andtheir

three-dim

ension

al(3D

)coor-

dinatepositions

(16).Inversedesign,as

itsnam

esuggests,inverts

thisparadigm

bystarting

with

thedesired

function

alityan

dsearch

ingfor

anideal

molecular

structure.Here

theinput

isthe

function

alityan

dtheoutput

isthestructure.

Function

alityneed

not

necessarily

map

toon

eun

iquestructure

butto

adistribution

ofprob-

ablestru

ctures.

Inverse

design

(Fig.

2)uses

optimization

,sam

pling,

and

searchmeth

odsto

navigate

theman

ifoldof

function

alityof

chem

icalsp

ace(17,

18).Oneof

theearliest

effortsin

inverse

designwas

themethodology

ofhigh-throughputvirtual

screening(H

TVS).

HTVShas

itsroots

inthe

pharmaceuticalindustry

fordrugdiscovery,w

heresim

ulationisan

exploratorytoolfor

screeninga

largenum

berof

molecules

(19,20).HTVSstarts

with

aninitial

libraryof

molecules

builton

thebasis

ofresearch

ers’intuition

,which

narrow

sdow

nthepoolofpossible

candidate

molecules

toatractable

range

ofathousan

dto

amillion

.Initial

candidates

arefiltered

onthebasis

offocused

targetssuch

asease

ofsyn

thesis,

sol-ubility,toxicity,stability,activity,and

selectivity.Molecules

arealso

filteredby

expertopin

ion,

eventually

considered

aspoten

tiallead

com-

pounds

fororgan

icsyn

thesis.Successfulm

otifsan

dsubstructures

arefurth

erincorporated

infuture

cyclesto

further

optimize

function

ality.Although

HTVSmight

seemlike

anensem

bleversion

ofthe

directapproach

formaterial

design,it

differsin

itsun

derlyingph

ilosophy

(4).HTVSisfocused

ondata-driven

discovery,which

incorporatesautom

ation,time-criticalper-

formance,and

computationalfunnels;prom

isingcan

didatesare

further

processedby

more

ex-pen

sivemeth

odologies.Acrucialcom

ponen

tisfeedback

between

theory

andexperim

ent.

TheHTVSmeth

odologyhas

beenquite

suc-cessfulatgen

eratingnew

andhigh

-performing

materials

inoth

erdom

ains.In

organic

photo-

voltaics,molecules

have

beenscreen

edon

the

basisoffrontierorbitalenergies

andphotovoltaic

conversionefficiency

andorbitalenergies

(21–24).In

organicredox

flowbatteries,redox

potential,

solubility,an

dease

ofsyn

thesis

(25,26)

areprioritized.

Fororgan

icligh

t-emittin

gdiodes,

molecules

have

beenscreen

edfor

their

singlet-

tripletgap

andphotolum

inescentem

ission(27).

Massive

explorationsof

reactionsfor

catalysis(28)

orredox

potentials

inbioch

emistry

have

beenun

dertaken(28).For

inorgan

icmaterials,

theMaterials

Project

(29)spaw

nsman

yappli-

cationssuch

asdielectric

andopticalm

aterials(30),

photoan

odematerials

forgen

erationof

chem

icalfuels

fromsun

light(31),an

dbattery

electrolytes(32).

Arguably,an

optimization

approachis

pref-erable

toHTVSbecau

seit

generally

visitsa

smaller

number

ofcon

figuration

swhen

ex-plorin

gtheman

ifoldof

function

ality.Anop

-tim

izationincorp

oratesan

dlearn

sgeom

etricinform

ationofthe

functionalitymanifold,guided

bygeneraltrends,directions,and

curvature(17 ).

Within

discreteoptim

izationmethods,E

volu-tion

Strategies(ES)is

apopular

choicefor

globaloptim

ization(33–35)

andhas

beenused

tomap

chem

icalspace

(36).ESinvolves

astructured

searchthat

incorporates

heuristics

andproce-

duresinspired

bynaturalevolution

(37).Ateach

iteration,param

etervectors

(“genotypes”)

ina

populationare

perturbed(“m

utated”)and

theirobjective

function

value(“fitn

ess”)evaluated.

EShas

beenliken

edto

hill-clim

bingin

high

-dim

ension

alspace,

followingthenumerical

finitedifference

acrossparam

etersthatare

more

successfu

latop

timizin

gthefitn

ess.With

ap-

prop

riatelydesign

edgen

otypes

and

muta-

tionop

erations,E

Scan

bequ

itesu

ccessfulat

hard

optimization

problems,even

overcoming

state-of-the-artmachine

learningapproaches

(38).In

other

cases,inverse

designis

realizedby

incorp

oratingexp

ertkn

owled

geinto

theop

-tim

izationprocedure,

viaim

provedBayesian

samplin

gwith

sequen

tialMon

teCarlo

(39),invertible

systemHam

iltonian

s(18),

deriving

analytical

gradients

ofproperties

with

respectto

amolecular

system(40),optim

izingpotential

energysurfaces

ofchem

icalsystems(41),or

dis-covering

designpatterns

viadata-m

iningtech-

niques

(42,43).Finally,another

approachinvolves

generativemodels

stemmingfrom

thefield

ofmach

ine

learning.

Before

delvinginto

thedetails,

itis

appropriateto

highlightthedifferences

between

generative

anddiscrim

inative

models.

Adis-

criminative

modeltries

todeterm

ineconditional

probabilities(p(y|x)):th

atis,th

eprobability

ofobservin

gproperties

y(such

astheban

dgapen

ergyor

solvationen

ergy),given

x(a

mole-

cularrepresen

tation).B

ycon

trast,agen

erativemodelattem

ptsto

determine

ajoint

probabilitydistribution

p(x,y):theprobability

ofobserving

boththe

molecular

representationand

thephys-

icalproperty.

Bycon

ditioningtheprobability

onamolecule

(x)or

aproperty

(y),weretrieve

thenotion

ofdirect(p(y|x))an

dinverse

design(p(x|y)).Asexpected,deep

generativemodels

aremore

challengingto

createthan

directMLapproaches,

butDLalgorithm

sand

computationalstrategies

haveadvanced

substantiallyin

thelastfew

years,producin

gaston

ishingresults

forgen

erating

natural-looking

images

(44),constructin

ghigh

-quality

audiowaveform

scon

tainingspeech

(45),gen

eratingcoh

erentan

dstru

ctured

text(46),

andmost

recently,d

esigningmolecu

les(47).

There

areseveralw

aysofbu

ildinggen

erativemodels,butfor

thepurposes

ofthisReview

,we

willfocus

onthree

main

approaches:variational

autoencoders(VAEs)(48),reinforcem

entlearn

-ing(R

L)(49),an

dgen

erativeadversarial

net-

works

(GANs)

(44).Before

describinghow

eachapproach

differs,weconsider

representationsofm

olecules,which

inturn

determine

thetypes

oftoolsavailable

andthe

typesofinform

ationthat

canbe

exploitedin

themodels.

Rep

resentatio

nof

molecu

les

Tomodelm

olecularsystem

saccurately,w

emust

solvetheSch

rödinger

equation(SE

)for

the

molecular

electronicHam

iltonian

,fromwhich

weobtain

propertiesrelating

tothe

energy,geom-

etry,an

dcu

rvature

ofthepoten

tialen

ergysu

rfaceofou

rsystem

.IntheSE

,themolecu

leisrep

resented

asaset

ofnuclear

charges

and

thecorresp

ondingCartesian

coordinates

oftheatom

icposition

sin

3Dspace.M

eanwhile,

Sanch

ez-Len

gelinget

al.,Science

361,360–365(2018)

27July

20182of

6

Fig.2.S

chem

aticof

thedifferen

tap

proach

estow

ardmolecu

lardesig

n.Inverse

designstarts

fromdesired

propertiesand

endsin

chemicalspace,unlike

thedirect

approachthat

leadsfrom

chemicalspace

tothe

properties.

IMAGE: ADAPTED BY K. HOLOSKI

on June 4, 2020 http://science.sciencemag.org/ Downloaded from

timebetw

eenstep

s.Theultim

ateaim

isto

concurren

tlypropose,

create,an

dcharacterize

new

materials,w

itheach

compon

enttran

smitt-

ing

and

receiving

data

simultan

eously.

This

processiscalled

“closingtheloop,”

andinverse

design

isacriticalfacet

(12,15).

Inverse

desig

n

Quan

tum

chem

icalmeth

odsreveal

propertiesof

amolecu

larsystem

only

afterspecifyin

gthe

essentialparam

etersof

thecon

stituen

tatom

icnuclei

andtheir

three-d

imen

sional

(3D)coor-

dinate

positions(16).In

versedesign

,asits

nam

esuggests,in

vertsthis

paradigmby

startingwith

thedesired

function

alityan

dsearch

ingfor

anideal

molecular

structure.Here

theinput

isthe

function

alityan

dtheou

tputis

thestru

cture.

Function

alityneed

not

necessarily

map

toon

euniqu

estru

cture

butto

adistribu

tionof

prob-ab

lestru

ctures.

Inverse

design

(Fig.

2)uses

optimization

,sam

pling,

and

searchmeth

ods

tonavigate

theman

ifoldof

function

alityof

chem

icalsp

ace(17,

18).Oneof

theearliest

effortsin

inverse

design

was

themethodology

ofhigh-throughputvirtual

screening(H

TVS).

HTVShas

itsroots

inthe

pharmaceuticalindustry

fordrug

discovery,where

simulation

isan

exploratorytoolfor

screeninga

largenum

berof

molecules

(19,20).HTVSstarts

with

aninitial

libraryof

molecules

builton

thebasis

ofresearch

ers’intuition

,which

narrow

sdow

nthepoolof

possiblecan

didate

molecu

lesto

atractable

range

ofathou

sandto

amillion

.Initial

candidates

arefiltered

onthebasis

offocu

sedtargets

such

asease

ofsyn

thesis,

sol-ubility,toxicity,stability,activity,and

selectivity.Molecu

lesare

alsofiltered

byexpert

opinion

,even

tually

consid

eredas

potential

leadcom

-pou

ndsfor

organicsyn

thesis.Su

ccessfulm

otifsan

dsubstru

ctures

arefurth

erincorporated

infuture

cyclesto

furth

eroptim

izefunction

ality.Although

HTVSmight

seemlike

anen

semble

versionof

the

direct

approachfor

material

design

,it

differs

inits

underlyin

gph

ilosophy

(4).HTVSisfocu

sedon

data-d

rivendiscovery,

which

incorporatesautom

ation,time-criticalper-

formance,and

computationalfunnels;prom

isingcan

didates

arefurth

erprocessed

bymore

ex-pen

sivemeth

odologies.A

crucialcom

ponen

tis

feedback

between

theory

andexperim

ent.

TheHTVSmeth

odology

has

beenqu

itesuc-

cessfulatgen

eratingnew

andhigh

-performing

materials

inoth

erdom

ains.In

organic

photo-

voltaics,molecu

leshave

beenscreen

edon

the

basisoffron

tierorbitalenergies

andphotovoltaic

conversionefficiency

andorbitalenergies

(21–24).In

organicred

oxflow

batteries,redox

potential,

solubility,

and

easeof

synthesis

(25,26)

areprioritized

.For

organic

light-em

ittingdiod

es,molecu

leshave

beenscreen

edfor

their

singlet-

tripletgap

andphotolum

inescen

tem

ission(27).

Massive

explorationsof

reactionsfor

catalysis(28)

orred

oxpoten

tialsin

biochem

istryhave

beenundertaken

(28).For

inorgan

icmaterials,

theMaterials

Project

(29)spaw

nsman

yappli-

cationssuch

asdielectric

andopticalm

aterials(30),

photoan

odematerials

forgen

erationof

chem

icalfuels

fromsunligh

t(31),

andbattery

electrolytes(32).

Argu

ably,anoptim

izationapproach

ispref-

erable

toHTVSbecau

seit

generally

visitsa

smaller

number

ofcon

figuration

swhen

ex-plorin

gtheman

ifoldof

function

ality.Anop

-tim

izationincorp

oratesan

dlearn

sgeom

etricinform

ationofthe

functionalitymanifold,guided

bygen

eraltrends,directions,andcurvature

(17 ).Within

discreteoptim

izationmethods,E

volu-tion

Strategies(ES)is

apopular

choicefor

globaloptim

ization(33–35)

andhas

beenused

tomap

chem

icalspace

(36).ESinvolves

astru

ctured

searchthat

incorporates

heu

risticsan

dproce-

duresinspired

bynaturalevolution

(37).Ateach

iteration,param

etervectors

(“genotypes”)

ina

populationare

perturbed(“m

utated”)an

dtheir

objectivefunction

value(“fitn

ess”)evalu

ated.

EShas

been

likened

tohill-clim

bingin

high

-dim

ension

alspace,

followingthenumerical

finite

difference

acrossparam

etersthatare

more

successfu

latop

timizin

gthefitn

ess.With

ap-

prop

riatelydesign

edgen

otypes

and

muta-

tionop

erations,E

Scan

bequite

successfu

lathard

optimization

problems,even

overcoming

state-of-the-artmachine

learningapproaches

(38).In

other

cases,inverse

design

isrealized

byincorp

oratingexp

ertkn

owled

geinto

theop

-tim

izationproced

ure,

viaim

provedBayesian

samplin

gwith

sequen

tialMon

teCarlo

(39),invertible

systemHam

iltonian

s(18),

derivin

gan

alyticalgrad

ients

ofproperties

with

respectto

amolecular

system(40),optim

izingpotential

energysurfaces

ofchem

icalsystems(41),or

dis-coverin

gdesign

patternsvia

data-miningtech-

niqu

es(42,43).

Finally,an

otherapproach

involves

generative

mod

elsstem

mingfrom

thefield

ofmach

ine

learning.

Before

delvin

ginto

thedetails,

itis

appropriateto

highlightthe

differences

between

generative

anddiscrim

inative

mod

els.A

dis-

criminative

modeltries

todeterm

inecon

ditional

probabilities(p(y|x)):th

atis,th

eprobability

ofobservin

gproperties

y(su

chas

theban

dgap

energy

orsolvation

energy),

givenx(a

mole-

cular

representation

).Bycon

trast,agen

erativemodelattem

ptsto

determineajoin

tprobability

distribution

p(x,y):theprobability

ofobserving

boththe

molecular

representationand

thephys-

icalproperty.

Bycon

dition

ingtheprobability

onamolecu

le(x)

oraproperty

(y),weretrieve

thenotion

ofdirect

(p(y|x))

andinverse

design

(p(x|y)).Asexpected,deep

generative

models

aremore

challengin

gto

createthan

directMLapproaches,

butDLalgorithm

san

dcom

putationalstrategies

haveadvan

cedsubstan

tiallyin

thelastfew

years,prod

ucin

gaston

ishingresu

ltsfor

generatin

gnatural-lookin

gim

ages(44),con

structin

ghigh

-qu

alityaud

iowaveform

scon

tainingspeech

(45),gen

eratingcoh

erentan

dstru

ctured

text(46),

andmost

recently,d

esigningmolecu

les(47).

There

areseveralw

aysofb

uild

inggen

erativemod

els,butfor

thepu

rposesofth

isReview

,we

willfocu

son

threemain

approaches:variational

autoencoders(VAEs)(48),rein

forcement

learn-

ing(R

L)(49),

andgen

erativead

versarialnet-

works

(GANs)

(44).Before

describinghow

eachapproach

differs,wecon

siderrepresen

tationsofm

olecules,which

inturn

determine

thetypes

oftoolsavailable

and

thetypes

ofinform

ationthat

canbe

exploitedin

themodels.

Rep

resentatio

nofmolecu

les

Tomodelm

olecularsystem

saccurately,w

emust

solvetheSch

rödinger

equation

(SE)for

the

molecu

larelectron

icHam

iltonian

,fromwhich

weobtain

propertiesrelating

tothe

energy,geom-

etry,an

dcu

rvature

ofthepoten

tialen

ergysu

rfaceofou

rsystem

.IntheSE

,themolecu

leisrep

resented

asaset

ofnuclear

charges

and

thecorresp

ondingCartesian

coordinates

oftheatom

icposition

sin

3Dspace.M

eanwhile,

Sanch

ez-Len

gelinget

al.,Science

361,360

–365(2018)

27Ju

ly2018

2of

6

Fig.2

.Sch

ematic

ofth

edifferen

tap

pro

aches

toward

molecu

lardesig

n.Inverse

designstarts

fromdesired

propertiesand

endsin

chemicalspace,unlike

thedirect

approachthat

leadsfrom

chemicalspace

tothe

properties.

IMAGE: ADAPTED BY K. HOLOSKI

on June 4, 2020 http://science.sciencemag.org/ Downloaded from

x

E𝜃 (x,y)

Alg

𝜙 (E𝜃 (x,・

))

reasoning moduleneural module

Figure 1. Hybrid architecture

ture are optimized end-to-end with loss gradients (Fig 1).Very often these reasoning modules can be implementedas unrolled iterative algorithms, which can solve more so-phisticated tasks with carefully designed and interpretableoperations. For instance, SATNet [1] integrated a satisfi-ability solver into its deep model as a reasoning module;E2Efold [2] used a constrained optimization algorithm ontop of a neural energy network to predict and reasoningabout RNA structures. [3] used optimal transport algorithmas a reasoning module for learning to sort. Other algorithmssuch as ADMM [4, 5], Langevin dynamics [6], inductivelogic programming [7], DP [8], k-means clustering [9], be-lief propagation [10], power iterations [11] are also used asdifferentiable reasoning modules in deep models for variouslearning tasks. Thus in the reminder of the paper, we willuse reasoning layer and algorithm layer interchangeably.

While these previous works have demonstrated the effective-ness of combining deep learning with reasoning, theoreticalunderstandings of such hybrid deep architectures remainlargely unexplored. For instance, what is the benefit of us-ing a reasoning module based on unrolled algorithms com-pared to generic architectures such as RNN? How exactlywill the reasoning module affect the generalization abilityof the deep architecture? For different algorithms whichcan solve the same task, what are their differences whenused as reasoning modules in deep models? Despite the richliterature on rigorous analysis of algorithm properties, thereis a paucity of work leveraging these analyses to formallystudy the learning behavior of deep architectures containingalgorithm layers. This motivates us to ask the intriguing andtimely question of

How will the algorithm properties of a reasoninglayer affect the learning behavior of deep archi-

Page 2: Understanding Deep Learning with Reasoning Layer

055056057058059060061062063064065066067068069070071072073074075076077078079080081082083084085086087088089090091092093094095096097098099100101102103104105106107108109

Understanding Deep Learning with Reasoning Layer

tectures containing such layers?

In this paper, we provide a first step toward an answer to thisquestion by analyzing the approximation and generalizationabilities of such hybrid deep architectures. To the best ourknowledge, such analysis has not been done before and ischallenging in the sense that: 1) The analysis of certainalgorithm properties such as convergence can be complexby itself; 2) Models based on highly structured iterativealgorithms have rarely been analyzed before; 3) The boundneeds to be sharp enough to match empirical observations.In this new setting, the complexity of algorithm analysisand generalization analysis intertwined together, making theanalysis even more challenging.

Summary of results. We find that standard Rademachercomplexity analysis, widely used for neural networks [12,13, 14], becomes insufficient for explaining behaviors ofhybrid architectures. Thus we resort to a more refined localRademacher complexity analysis [15, 16], and find that:

• Relation to algorithm properties. Algorithm propertiessuch as convergence, stability and sensitivity all play impor-tant roles in generalization ability of the hybrid architecture.Generally speaking, an algorithm layer that is faster con-verging, more stable and less sensitive will be able to betterapproximate the joint perception and reasoning task, whileat the same time generalize better.• Which algorithm? The tradeoff is that a faster converg-ing algorithm has to be less stable [17]. Therefore, depend-ing on the actual scenarios, the choice of a better algorithmlayer can be different. Our theorem reveals that when theneural module is over- or under-parameterized, stabilityof the algorithm layer can be more important than its con-vergence; but when the neural module is about-the-right-parameterized, a faster converging algorithm layer may givea better generalization.• What depth? With deeper algorithm layers, the repre-sentation ability gets better, but the generalization becomesworse if the neural module is over/under-parameterized.Only when it has about-the-right complexity, deeper al-gorithm layers can induce both better representation andgeneralization.• What if RNN? It has been shown that RNN/GNN canalso represent reasoning and iterative algorithms [18, 14].We use RNN as an example in Appendix B to demonstratethat these generic reasoning modules can also be analyzedunder our framework, which explains that RNN layers in-duce a better representation power but a worse generaliza-tion ability compared to traditional algorithm layers.• Experiments. We conduct empirical experiments to val-idate our theory and show that it matches nicely with ex-perimental observations under various conditions. Theseresults suggest that our theory can provide useful practicalguidelines for designing deep architectures with reasoninglayers. Experimental results are presented in Appendix C.

Contributions and limitations. To the best of our knowl-edge, this is the first result to quantitatively characterize theeffects of algorithm properties on the learning behavior ofhybrid deep architectures with reasoning layers. Our resultreveals an intriguing and previously unknown interplay andtradeoff between algorithm convergence, stability and sensi-tivity on the model generalization, and thus provides designprinciples for deep architectures with reasoning layers. Tosimplify analysis, our initial study is limited to a settingwhere the reasoning module is an unconstrained optimiza-tion algorithm and the neural module outputs a quadraticenergy function. However, our analysis framework can beextended to more complicated case and the insights willapply beyond our current setting.

Related theoretical works. Our analysis borrows prooftechniques for analyzing algorithm properties from the opti-mization literature [17, 19] and for bounding Rademachercomplexity from the statistical learning literature [12, 15, 16,20, 21], but our focus and results are new. More precisely,the ‘leave-one-out’ stability of optimization algorithms hasbeen used to derive generalization bounds [22, 23, 24, 17,25, 26]. However, all existing analyses are in the contextwhere the optimization algorithms are used to train andselect the model, while our analysis is based on a funda-mentally different viewpoint where the algorithm itself isunrolled and integrated as a layer in the deep model. Also,existing works on the generalization of deep learning mainlyfocus on generic neural architectures such as feed-forwardneural network, recurrent neural network, graph neural net-work, etc [12, 13, 14]. Complexity of models based onhighly structured iterative algorithms and the relation toalgorithm properties have not been investigated. Further-more, we are not aware of previous use of local Rademachercomplexity analysis in this context.

2. Setting: Optimization Algorithms asReasoning Modules

Very often reasoning can be accomplished by solving anoptimization problem defined by a neural perceptual mod-ule. For instance, visual SUDOKU puzzle can be solvedusing a neural module to perceive the digits and then us-ing a quadratic optimization module to maximize a logicsatisfiability objective [1]. RNA folding problem can betackled using a neural energy model to capture pairwiserelations between RNA bases and a constrained optimiza-tion module to minimize the energy with additional pairingconstraints to obtain a folding [2]. In a broader context,MAML [27, 28] also has a neural module for joint initial-ization and a reasoning module that performs optimizationsteps for task-specific adaptation. Other examples include[29, 6, 30, 31, 32, 33, 34].

As an initial attempt to analyze deep architectures with

Page 3: Understanding Deep Learning with Reasoning Layer

110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164

Understanding Deep Learning with Reasoning Layer

reasoning layers, we will restrict our analysis to a simplecase where Eθ(x,y) in Fig.1 is quadratic in y. A reason isthat the analysis of advanced algorithms such as Nesterovaccelerated gradients will become very complex for generalcases. Similar problems occur in [17] which also restrictsthe proof to quadratic objectives. Specifically:

Problem Setting: Consider a hybrid architecture wherethe neural module is an energy function in form ofEθ((x, b),y) = 1

2y>Qθ(x)y + b>y, where Qθ is a neu-

ral network that maps x to a matrix. Each energy can beuniquely represented by (Qθ(x), b), so we can write theoverall architecture as

fφ,θ(x, b) := Algkφ(Qθ(x), b). (1)

Given samples Sn = {((x1, b1),y∗1), · · · , ((xn, bn),y∗n)},where the labels y∗ are given by the exact minimizer Optof the corresponding Q∗, i.e., y∗ = Opt(Q∗(x), b), thelearning problem is to find the best model fφ,θ from thespace F := {fφ,θ : (φ, θ) ∈ Φ × Θ} by minimizing theempirical loss function

minfφ,θ∈F1n

∑ni=1`φ,θ(xi, bi), where (2)

`φ,θ(x, b) := ‖Algkφ (Qθ(x), b)− Opt(Q∗(x), b)‖2. Fur-thermore, we assume:

• BothQθ andQ∗ mapX to Sd×dµ,L where Sd×dµ,L is the spaceof symmetric positive definite (SPD) matrices with µ and Las its smallest and largest singular values. Thus the inducedenergy functionEθ will be µ-strongly convex andL-smooth,and the output of Opt is unique.• The input (x, b) is a pair of random variables where x ∈X ⊆ Rm and b ∈ B ⊆ Rd. Assume b has mean E[b] = 0and variance Σb = σ2

b I . Assume x and b are independent,and their joint distribution follows a probability measure P .Assume samples in Sn are drawn i.i.d. from P .• Assume B is bounded, and let M =sup(Q,b)∈Sd×dµ,L ×B

‖Opt(Q, b)‖2.

Though this setting does not encompass the full complexityof hybrid deep architectures, it already reveals interestingconnections between algorithm properties of the reasoningmodule and the learning behaviors of hybrid architectures.

3. Properties of AlgorithmsIn this section, we formally define the algorithm propertiesof the reasoning module Algkφ, under the problem settingpresented in Sec 2. After that, we compare the correspond-ing properties of gradient descent, GDkφ, and Nesterov’saccelerated gradients, NAGkφ, as concrete examples.

(I) Convergence rate of an algorithm portrays how fastthe optimization error decreases as k grows. Formally,we say Algkφ has a convergence rate Cvg(k, φ) if for

any Q ∈ Sd×dµ,L , b ∈ B, ‖Algkφ(Q, b) − Opt(Q, b)‖2 ≤Cvg(k, φ)‖Alg0

φ(Q, b)− Opt(Q, b)‖2.

(II) Stability of an algorithm characterizes its robustness tosmall perturbations in the optimization objective, which cor-responds to the perturbation ofQ and b in the quadratic case.For the purpose of this paper, we say an algorithm Algkφis Stab(k, φ)-stable if for any Q,Q′ ∈ Sd×dµ,L and b, b′ ∈ B,‖Algkφ(Q, b)−Algkφ(Q′, b′)‖2 ≤ Stab(k, φ)‖Q−Q′‖2 +Stab(k, φ)‖b− b′‖2, where ‖Q−Q′‖2 is the spectral normof the matrix Q−Q′.

(III) Sensitivity characterizes the robustness to small pertur-bations in the algorithm parameters φ. We say the sensitiv-ity of Algkφ is Sens(k) if it holds for all Q ∈ Sd×dµ,L , b ∈ B,and φ, φ′ ∈ Φ that ‖Algkφ(Q, b) − Algkφ′(Q, b)‖2 ≤Sens(k)‖φ − φ′‖2. This concept is referred in the deeplearning community to “parameter perturbation error” or“sharpness” [35, 36, 37]. It has been used for derivinggeneralization bounds of neural networks, both in theRademacher complexity framework [12] and PAC-Bayesframework [38].

(IV) Stable region is the range Φ of the parameters φwherethe algorithm output will remain bounded as k grows toinfinity, i.e., numerically stable. Only when the algorithmsoperate in the stable region, the corresponding Cvg(k, φ),Stab(k, φ) and Sens(k) will remain finite for all k. It isusually very difficult to identity the exact stable region, buta sufficient range can be provided.

GD and NAG. Now we will compare the above four algo-rithm properties for gradient descent and Nesterov’s accel-erated gradient method, both of which can be used to solvethe quadratic optimization in our problem setting. Let GDφand NAGφ denote the algorithm update steps of GD andNAG, where the hyperparameter φ corresponds to the stepsize. Denote the results of k-step update of GD and NAGby GDkφ(Q, b) and NAGkφ(Q, b), respectively. The initializa-tions in the algorithms are set to be zero vectors throughoutthis paper. Then their algorithm properties are summarizedin Table 2 in Appendix D, which shows (i) Convergence:NAG converges faster than GD. (ii) Stability: However, as kgrows, NAG is less stable than GD for a fixed k, in contrastto their convergence behaviors. This is pointed out in [17],which proves that a faster converging algorithm has to beless stable. (iii) Sensitivity: The sensitivity behaves similarto the convergence, where NAG is less sensitive to step-sizeperturbation than GD. Also, the sensitivity of both algo-rithms gets smaller as k grows larger. (iv): Stable region:The stable region of GD is larger than that of NAG. It meansa larger step size is allowable for GD that will not lead toexploding outputs even if k is large. Note that all the otheralgorithm properties are based on the assumption that φ isin the stable region Φ. Furthermore, as k →∞, the space

Page 4: Understanding Deep Learning with Reasoning Layer

165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219

Understanding Deep Learning with Reasoning Layer

Theorem 3.1. Assume the problem setting in Sec 2. Then we have for any t > 0, it holds true that

ERn`locF (r) ≤√

2dn−12 Stab(k)

(√(Cvg(k)M +

√r)2C1(n) + C2(n, t) + C3(n, t) + 4

)+ Sens(k)BΦ, (3)

where BΦ = 12 supφ,φ′∈Φ ‖φ− φ′‖2, Stab(k) = supφ Stab(k, φ), Cvg(k) = supφ Cvg(k, φ), and Ci are constants monotone

in the covering number N ( 1√n, `Q, L∞) of `Q with radius 1√

nand L∞ norm. We refer their exact definitions to Appendix F.

{Algkφ : φ ∈ Φ} will finally shrink to a single function,which is the exact minimizer {Opt}.

How will the algorithm properties affect the learning behav-ior of deep architecture with reasoning layers? We providethe approximation ability analysis in Appendix A and thegeneralization analysis in the next section.

4. Generalization AbilityHow will algorithm properties affect the generalizationability of deep architectures with reasoning layers? Weare interested in the generalization gap between the ex-pected loss and empirical loss, P`φ,θ = Ex,b`φ,θ(x, b)and Pn`φ,θ = 1

n

∑ni=1`φ,θ(xi, bi), respectively, where

Pn is the empirical probability measure induced by thesamples Sn. Let `F := {`φ,θ : φ ∈ Φ, θ ∈ Θ} bethe function space of losses of the models. The gener-alization gap, P`φ,θ − Pn`φ,θ, can be bounded by theRademacher complexity, ERn`F , which is defined asthe expectation of the empirical Rademacher complexity,Rn`F := Eσ supφ∈Φ,θ∈Θ

1n

∑ni=1 σi`φ,θ(xi, bi), where

{σi}ni=1 are n independent Rademacher random variablesuniformly distributed over {±1}. Generalization boundsderived from Rademacher complexity have been studied inmany works [39, 40, 41].

Main Results: [Theorem 3.1]. More specifically, the lo-cal Rademacher complexity of `F at level r is definedas ERn`locF (r) where `locF (r) := {`φ,θ : φ ∈ Φ, θ ∈Θ, P `2φ,θ ≤ r}. This notion is less general than the onedefined in [15, 16] but is sufficient for our purpose. Here wealso define a losses function space `Q := {‖Qθ − Q∗‖F :θ ∈ Θ} for the neural module Qθ. With these definitions,Theorem 3.1 shows that the local Rademacher complexityof the hybrid architecture is intimately related to all aspectsof algorithm properties, namely convergence, stability andsensitivity, and there is an intriguing trade-off.

Trade-offs between convergence, stability and sensitiv-ity. Generally speaking, the algorithm convergence Cvg(k)and sensitivity Sens(k) have similar behavior, but Stab(k)behaves opposite to them. See illustrations in Fig 2. There-fore, the way these three quantities interplay in Theorem 3.1introduces an intriguing trade-off among them, suggestingin different regime, one may see different generalizationbehavior. More specially, depending on the parameteriza-tion of Qθ, the coefficients C1, C2, and C3 in Eq. 3 may

have different scale, making the local Rademacher com-plexity bound dominated by different algorithm properties.Since the coefficients Ci are monotonely increasing in thecovering number of `Q, we expect that: (i) WhenQθ is over-parameterized, the covering number of `Q becomes large, soas the three coefficients. Large Ci will reduce the effect ofCvg(k) and make Eq. 3 dominated by Stab(k); (ii) Inversely,when Qθ is under-parameterized, the three coefficients getsmall, but they still reduce the effect of Cvg(k) given theconstant 4 in Eq. 3, again making it dominated by Stab(k);(iii) When Qθ has about-the-right parameterization, wecan expect Cvg(k) to play critical roles in Eq. 3 which willthen behave similar to the product Stab(k)Cvg(k), as illus-trated schematically in Fig 2. We experimentally validatethese implications in Sec C.

Conv(k) or Sens(k)GDNAG

Stab(k)GDNAG

Conv(k) * Stab(k)GDNAG

Figure 2. Overall trend of algorithm properties.

Trade-off of the depth. Combining the above implicationswith the approximation ability analysis in Sec A, we cansee that in the above-mentioned cases (i) and (ii), deeperalgorithm layers will lead to better approximation accuracybut worse generalization. Only in the ideal case (iii), adeeper reasoning module can induce both better representa-tion and generalization abilities. This result provides prac-tical guidelines for some recently proposed infinite-depthmodels [42, 43].

5. Conclusion and DiscussionIn this paper, we take an initial step toward the theoreticalunderstanding of deep architectures with reasoning layers.Our theorem indicates intriguing relation between algorithmproperties of the reasoning module and the approximationand generalization of the hybrid architecture, which in turnsprovide practical guideline for designing reasoning layers.The assumptions we made in the problem setting are only foravoiding the non-uniqueness of the reasoning solution andthe instability of the mapping from the reasoning solutionto the neural module. The assumptions could be relaxed ifwe can involve other techniques to resolve these issues.

Page 5: Understanding Deep Learning with Reasoning Layer

220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274

Understanding Deep Learning with Reasoning Layer

References[1] Po-Wei Wang, Priya Donti, Bryan Wilder, and Zico

Kolter. Satnet: Bridging deep learning and logicalreasoning using a differentiable satisfiability solver. InInternational Conference on Machine Learning, pages6545–6554, 2019.

[2] Xinshi Chen, Yu Li, Ramzan Umarov, Xin Gao,and Le Song. Rna secondary structure predictionby learning unrolled algorithms. arXiv preprintarXiv:2002.05810, 2020.

[3] Marco Cuturi, Olivier Teboul, and Jean-Philippe Vert.Differentiable sorting using optimal transport: Thesinkhorn cdf and quantile operator. arXiv preprintarXiv:1905.11885, 2019.

[4] Harsh Shrivastava, Xinshi Chen, Binghong Chen,Guanghui Lan, Srinivas Aluru, Han Liu, and Le Song.GLAD: Learning sparse graph recovery. In Interna-tional Conference on Learning Representations, 2020.

[5] Y Yang, J Sun, H Li, and Z Xu. Admm-net: A deeplearning approach for compressive sensing mri. corr.arXiv preprint arXiv:1705.06869, 2017.

[6] John Ingraham, Adam Riesselman, Chris Sander, andDebora Marks. Learning protein structure with a dif-ferentiable simulator. In International Conference onLearning Representations, 2019.

[7] Robin Manhaeve, Sebastijan Dumancic, AngelikaKimmig, Thomas Demeester, and Luc De Raedt. Deep-problog: Neural probabilistic logic programming. InAdvances in Neural Information Processing Systems,pages 3749–3759, 2018.

[8] Arthur Mensch and Mathieu Blondel. Differentiabledynamic programming for structured prediction and at-tention. In 35th International Conference on MachineLearning, volume 80, 2018.

[9] Bryan Wilder, Eric Ewing, Bistra Dilkina, and MilindTambe. End to end learning and optimization ongraphs. In Advances in Neural Information ProcessingSystems, pages 4674–4685, 2019.

[10] Justin Domke. Parameter learning with truncatedmessage-passing. In CVPR 2011, pages 2937–2943.IEEE, 2011.

[11] Wei Wang, Zheng Dang, Yinlin Hu, Pascal Fua, andMathieu Salzmann. Backpropagation-friendly eigen-decomposition. In Advances in Neural InformationProcessing Systems, pages 3156–3164, 2019.

[12] Peter L Bartlett, Dylan J Foster, and Matus J Telgarsky.Spectrally-normalized margin bounds for neural net-works. In Advances in Neural Information ProcessingSystems, pages 6240–6249, 2017.

[13] Minshuo Chen, Xingguo Li, and Tuo Zhao. On gen-eralization bounds of a family of recurrent neural net-works. arXiv preprint arXiv:1910.12947, 2019.

[14] Vikas K Garg, Stefanie Jegelka, and Tommi Jaakkola.Generalization and representational limits of graphneural networks. arXiv preprint arXiv:2002.06157,2020.

[15] Peter L Bartlett, Olivier Bousquet, Shahar Mendelson,et al. Local rademacher complexities. The Annals ofStatistics, 33(4):1497–1537, 2005.

[16] Vladimir Koltchinskii et al. Local rademacher com-plexities and oracle inequalities in risk minimization.The Annals of Statistics, 34(6):2593–2656, 2006.

[17] Yuansi Chen, Chi Jin, and Bin Yu. Stability and con-vergence trade-off of iterative optimization algorithms.arXiv preprint arXiv:1804.01619, 2018.

[18] Marcin Andrychowicz, Misha Denil, Sergio Gomez,Matthew W Hoffman, David Pfau, Tom Schaul, Bren-dan Shillingford, and Nando De Freitas. Learningto learn by gradient descent by gradient descent. InAdvances in Neural Information Processing Systems,pages 3981–3989, 2016.

[19] Yurii Nesterov. Introductory lectures on convex opti-mization: A basic course, volume 87. Springer Science& Business Media, 2013.

[20] Andreas Maurer. A vector-contraction inequality forrademacher complexities. In International Conferenceon Algorithmic Learning Theory, pages 3–17. Springer,2016.

[21] Corinna Cortes, Vitaly Kuznetsov, Mehryar Mohri,and Scott Yang. Structured prediction theory basedon factor graph complexity. In Advances in NeuralInformation Processing Systems, pages 2514–2522,2016.

[22] Olivier Bousquet and Andre Elisseeff. Stability andgeneralization. Journal of machine learning research,2(Mar):499–526, 2002.

[23] Shivani Agarwal and Partha Niyogi. Generalizationbounds for ranking algorithms via algorithmic stability.Journal of Machine Learning Research, 10(Feb):441–474, 2009.

Page 6: Understanding Deep Learning with Reasoning Layer

275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329

Understanding Deep Learning with Reasoning Layer

[24] Moritz Hardt, Benjamin Recht, and Yoram Singer.Train faster, generalize better: Stability of stochas-tic gradient descent. arXiv preprint arXiv:1509.01240,2015.

[25] Omar Rivasplata, Emilio Parrado-Hernandez, John SShawe-Taylor, Shiliang Sun, and Csaba Szepesvari.Pac-bayes bounds for stable algorithms with instance-dependent priors. In Advances in Neural InformationProcessing Systems, pages 9214–9224, 2018.

[26] Saurabh Verma and Zhi-Li Zhang. Stability and gen-eralization of graph convolutional neural networks. InProceedings of the 25th ACM SIGKDD InternationalConference on Knowledge Discovery & Data Mining,pages 1539–1548, 2019.

[27] Chelsea Finn, Pieter Abbeel, and Sergey Levine.Model-agnostic meta-learning for fast adaptation ofdeep networks. In Proceedings of the 34th Interna-tional Conference on Machine Learning-Volume 70,pages 1126–1135. JMLR. org, 2017.

[28] Aravind Rajeswaran, Chelsea Finn, Sham M Kakade,and Sergey Levine. Meta-learning with implicit gradi-ents. In Advances in Neural Information ProcessingSystems, pages 113–124, 2019.

[29] David Belanger, Bishan Yang, and Andrew McCallum.End-to-end learning for structured prediction energynetworks. In Proceedings of the 34th InternationalConference on Machine Learning-Volume 70, pages429–439. JMLR. org, 2017.

[30] Priya Donti, Brandon Amos, and J Zico Kolter. Task-based end-to-end model learning in stochastic opti-mization. In Advances in Neural Information Process-ing Systems, pages 5484–5494, 2017.

[31] Brandon Amos and J Zico Kolter. Optnet: Differen-tiable optimization as a layer in neural networks. InProceedings of the 34th International Conference onMachine Learning-Volume 70, pages 136–145. JMLR.org, 2017.

[32] Marin Vlastelica, Anselm Paulus, Vıt Musil, GeorgMartius, and Michal Rolınek. Differentiation ofblackbox combinatorial solvers. arXiv preprintarXiv:1912.02175, 2019.

[33] Michal Rolınek, Paul Swoboda, Dominik Zietlow,Anselm Paulus, Vıt Musil, and Georg Martius. Deepgraph matching via blackbox differentiation of com-binatorial solvers. arXiv preprint arXiv:2003.11657,2020.

[34] Quentin Berthet, Mathieu Blondel, Olivier Teboul,Marco Cuturi, Jean-Philippe Vert, and Francis Bach.Learning with differentiable perturbed optimizers.arXiv preprint arXiv:2002.08676, 2020.

[35] Nitish Shirish Keskar, Dheevatsa Mudigere, JorgeNocedal, Mikhail Smelyanskiy, and Ping Tak PeterTang. On large-batch training for deep learning: Gen-eralization gap and sharp minima. arXiv preprintarXiv:1609.04836, 2016.

[36] Kenji Kawaguchi, Leslie Pack Kaelbling, and YoshuaBengio. Generalization in deep learning. arXivpreprint arXiv:1710.05468, 2017.

[37] Behnam Neyshabur, Srinadh Bhojanapalli, DavidMcAllester, and Nati Srebro. Exploring generalizationin deep learning. In Advances in Neural InformationProcessing Systems, pages 5947–5956, 2017.

[38] Behnam Neyshabur, Srinadh Bhojanapalli, and NathanSrebro. A PAC-bayesian approach to spectrally-normalized margin bounds for neural networks. In In-ternational Conference on Learning Representations,2018.

[39] Vladimir Koltchinskii and Dmitriy Panchenko.Rademacher processes and bounding the risk of func-tion learning. In High dimensional probability II,pages 443–457. Springer, 2000.

[40] Vladimir Koltchinskii. Rademacher penalties andstructural risk minimization. IEEE Transactions onInformation Theory, 47(5):1902–1914, 2001.

[41] Peter L Bartlett and Shahar Mendelson. Rademacherand gaussian complexities: Risk bounds and struc-tural results. Journal of Machine Learning Research,3(Nov):463–482, 2002.

[42] Shaojie Bai, J Zico Kolter, and Vladlen Koltun. Deepequilibrium models. In Advances in Neural Informa-tion Processing Systems, pages 688–699, 2019.

[43] Laurent El Ghaoui, Fangda Gu, Bertrand Travacca,and Armin Askari. Implicit deep learning. arXivpreprint arXiv:1908.06315, 2019.

Page 7: Understanding Deep Learning with Reasoning Layer

330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384

Understanding Deep Learning with Reasoning Layer

A. Approximation AbilityHow will the algorithm properties affect the approximation ability of deep architecture with reasoning layers? Given a modelspace F := {Algkφ (Qθ(x), b) : φ ∈ Φ, θ ∈ Θ}, we are interested in its approximation ability to functions of the formOpt (Q∗(x), b). More specifically, we define the loss `φ,θ(x, b) := ‖Algkφ (Qθ(x), b)− Opt(Q∗(x), b)‖2, and measurethe approximation ability by infφ∈Φ,θ∈Θ supQ∗∈Q∗ P`φ,θ, where Q∗ := {X × B 7→ Sd×dµ,L } and P`φ,θ = Ex,b[`φ,θ(x, b)].Intuitively, using a faster converging algorithm, the model Algkφ could represent the reasoning-task structure, Opt, betterand improve the overall approximation ability. Indeed we can prove the following lemma confirming this intuition.

Lemma A.1. (Faster Convergence ⇒ Better Approximation Ability). Assume the problem setting in Sec 2. Theapproximation ability can be bounded by two terms:

infφ,θ

supQ∗∈Q∗

P`φ,θ ≤σbµ−2 infθ

supQ∗

P‖Qθ(x)−Q∗(x)‖F︸ ︷︷ ︸approximation ability of the neural module

+M infφ∈Φ

Cvg(k, φ)︸ ︷︷ ︸best convergence

.

With Lemma A.1, we conclude that: A faster converging algorithm can define a model with better approximation ability.For example, for a fixed k and Qθ, NAG converges faster than GD, so NAGkφ can approximate Opt more accurately thanGDkφ, which is experimentally validated in Sec C.

Similarly, we can also reverse the reasoning, and ask the question that, given two hydrid architectures with the sameapproximation error, which architecture has a smaller error in representing the energy function Q∗? We show that this erroris also intimately related to the convergence of the algorithm.

Lemma A.2. (Faster Convergence⇒ Better Representation of Q∗). Assume the problem setting in Sec 2. ∀φ ∈ Φ, θ ∈Θ, Q∗ ∈ Q∗ := {X × B 7→ Sd×dµ,L }, it holds true that

P`2φ,θ = ε =⇒ P‖Qθ −Q∗‖2F ≤ σ−2b L4(

√ε+M · Cvg(k, φ))2. (4)

Lemma A.2 implies the benefit of using an algorithmic layer that aligns with the reasoning-task structure. Here the taskstructure is represented by Opt, the minimizer, and convergence measures how well Algkφ is aligned with Opt. Lemma A.2essentially indicates that if the structure of a reasoning module can better align with the task structure, then it can betterconstrain the search space of the underlying neural module Qθ, making it easier to learn, and further lead to better samplecomplexity, which we will explain more in the next section.

As a concrete example for Lemma A.2, if GDkφ (Qθ, ·) and NAGkφ (Qθ, ·) achieve the same accuracy for approximatingOpt (Q∗, ·), then the neural module Qθ in NAGkφ (Qθ, ·) will have a better accuracy for approximating Q∗ than the Qθ inGDkφ (Qθ, ·). In other words, a faster converging algorithm imposes more constraints on the energy function Qθ, making itapproach Q∗ faster.

B. Pros and Cons for RNN as a Reasoning LayerIt has been shown that RNN (or GNN) can represent reasoning and iterative algorithms over structures [18, 14]. For example,it is proposed to use RNN to learn an optimization algorithm [18] where the update steps in each iteration are given by theoperations in an RNN cell

yk+1 ← RNNcell (Q, b,yk) := V σ(WLσ

(WL−1 · · ·W 2σ

(W 1

1 yt +W 12 gt)))

. (5)

In the above equation, we take a specific example where the RNNcell is a multi-layer perception (MLP) with activationsσ = RELU that takes yk and the gradient gt = Qyt + b as inputs. Suppose we denote RNNkφ as a recurrent neural networkthat has k unrolled RNN cells and view it as a neural algorithm. Can our analysis framework also be used to understandRNNkφ and how will its behavior compare with other more interpretable algorithm layers such as GDkφ and NAGkφ?

We view RNNkφ as an algorithm and summarize its algorithm properties in Table 1. Assume φ = {V,W 11 ,W

12 ,W

2:L}is in a stable region cφ := supQ‖V ‖2‖W 1

1 + W 12Q‖2

∏Ll=2 ‖W l‖2 < 1, so that the operations in RNNcell are strictly

contractive, i.e., ‖yk+1 − yk‖2 < ‖yk − yk−1‖2. In this case, the stability and sensitivity of RNNkφ is guaranteed to bebounded. Table 1 only shows the best-case convergence, due to a fundamental disadvantage of RNN compared to GD and

Page 8: Understanding Deep Learning with Reasoning Layer

385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439

Understanding Deep Learning with Reasoning Layer

NAG. For an arbitrarily fixed φ in the stable region, the outputs of RNNkφ with different k can form a convergent sequence,which could coincide with the outputs of GDkφ or NAGkφ with suitable choices of φ. However, in general the outputs of RNNkφmay not converge to the minimizer Opt. In contrast, GDkφ and NAGkφ has the worst-case convergence guarantee. This propertyalso allows their sensitivities to decrease to 0 as k grows. In generalization analysis, the worst-case matters more, so GD andNAG are advantageous.

Table 1. Properties of RNNkφ. (Details are givenin Appendix G.)

Stable region Φ cφ < 1Stab(k, φ) O(1− ckφ)

Sens(k) O(1− (infφ cφ)k)minφ Cvg(k, φ) O(ρk) with ρ < 1

The advantage of RNN is its expressiveness, especially given the universalapproximation ability of MLP in the RNNcell. Using existing algorithm as areasoning layer restricts the deep model to perform a specific type of reason-ing. When the needed type of reasoning is unknown or beyond what existingalgorithm is capable of, RNN has the potential to learn new reasoning givensufficient data.

C. Experimental ValidationOur experiments aim to validate our theoretical prediction with computational simulations, rather than obtaining state-of-the-art results. We hope the theory together with these experiments can lead to practical guidelines for designing deeparchitectures with reasoning layers.

The experiments follow the problem setting in Sec 2. 10000 pairs of (x, b) are uniformly sampled and used as the overalldataset. During training, n samples are randomly drawn from these 10000 data points as the training set. Each Q∗(x) isproduced by a rotation matrix and a vector of eigenvalues parameterized by a randomly fixed 2-layer dense neural networkwith hidden dimension 3. Then the labels are generated according to y = Opt(Q∗(x), b). We train the model Algkφ(Qθ, ·)on Sn using the loss in Eq. ??. Qθ has the same overall architecture as Q∗ but the hidden dimension could vary. Note thatin all figures, each k corresponds to an independently trained model with k iterations in the algorithm layer, instead ofthe sequential outputs of a single model. Each model is trained by ADAM and SGD with learning rate grid-searched from[1e-2,5e-3,1e-3,5e-4,1e-4], and only the best result is reported. Furthermore, error bars are produced by 20 independentinstantiations of the experiments. See Appendix H for more details.

0 5 10 15 20 25 30k

0

10

20

30

empi

rical

erro

r

dim=16GDNAG

Figure 3. Approximation error.

Approximation ability. To validate Lemma A.1, we compare GDkφ (Qθ, ·) andNAGkφ (Qθ, ·) in terms of approximation accuracy. For various hidden sizes of Qθ,the results are similar, so we report one representative in Fig 3. The approxima-tion accuracy aligns with the convergence of the algorithms, showing that fasterconverging algorithm can induce better approximation ability.

Faster convergence⇒better Qθ. We report the error of the neural module Qθin Fig 4. Note that Algkφ(Qθ, ·) is trained end-to-end, without supervision onQθ. In Fig 4, the error of Qθ decreases as k grows, in a rate similar to algorithmconvergence. This validates the implication of Lemma A.2 that, when Algkφ is closer to Opt, it can help the underlyingneural module Qθ to get closer to Q∗.

0 5 10 15 20 25 30k

0.0

0.1

0.2

0.3

0.4

P|Q−Q

* |2 F

dim=16GDNAG

0 5 10 15 20 25 30k

0.1

0.2

0.3

0.4

P|Q−Q

* |2 F

dim=32GDNAG

Figure 4. P‖Qθ −Q∗‖2F

0 5 10 15 20 25 30k

0.0

0.5

1.0

gene

raliz

atio

n ga

p dim=0GDNAG

0 5 10 15 20 25 30k

0.0

0.5

1.0

1.5

2.0

gene

raliz

atio

n ga

p dim=16GDNAG

0 5 10 15 20 25 30k

0

1

2

3

gene

raliz

atio

n ga

p dim=32GDNAG

Figure 5. Generalization gap

5 10 15 20k

0

2

4

6

8

train

ing

erro

r GDNAGRNN

5 10 15 20k

0

10

20

30

40

gene

raliz

atio

n ga

p

GDNAGRNN

Figure 6. Algorithm layers vs RNN.

Generalization gap. In Fig 5, we report the generalization gaps, withhidden sizes ofQθ being 0, 16, and 32, which corresponds to the threecases (ii), (iii), and (i) discussed under Theorem 3.1, respectively.Comparing Fig 5 to Fig 2, we can see that the experimental resultsmatch very well with the theoretical implications.

RNN. As discussed in Sec B, RNN can be viewed as neural algo-rithms. To have a cleaner comparison, we report their behaviors underthe ‘learning to optimize’ senario where the objectives (Q, b) are given. Fig 6 shows that RNN has a better representationpower but worse generalization ability.

Page 9: Understanding Deep Learning with Reasoning Layer

440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494

Understanding Deep Learning with Reasoning Layer

D. Proof of Algorithm PropertiesIn this section, we study several important properties of gradient descent algorithm (GD) and Nesterov’s accelerated gradientalgorithm (NAG), which have been summarized in Table 2. To simplify the presentation, we shall focus on quadraticminimization problems as in Section 2 and estimate the sharp dependence on the iteration number k.

Table 2. algorithm properties comparison between GD and NAG. For simplicity, only the order in k is presented. Complete statementswith detailed coefficients and proofs are given in Appendix D.

Alg Cvg(k, φ) Stab(k, φ) Sens(k) Stable region Φ

GDkφ O((1− φµ)k

)O(1− (1− φµ)k

)O(k(1− c0µ)k−1

)[c0,

2µ+L ]

NAGkφ O(k(1−

√φµ)k

)O(1− (1−

√φµ)k

)O(k3(1−√c0µ)k

)[c0,

4µ+3L ]

More precisely, in the subsequent analysis, we shall fix the constants L ≥ µ > 0 and assume the objective function isin the function class Qµ,L, which contains all µ-strongly convex and L-smooth quadratic functions on Rd. Then, forany given f ∈ Qµ,L, the eigenvalue decomposition enables us to represent the Hessian matrix of f , denoted by Q, asQ = UΛU>, where Λ is a diagonal matrix comprising of the eigenvalues (λi)

di=1 of Q sorted in ascending order, i.e.,

µ ≤ λ1 ≤ . . . ≤ λd ≤ L, and U ∈ Rd×d is an orthogonal matrix whose columns constitute an orthonormal basis ofcorresponding eigenvectors of Q. Moreover, we shall denote by Id the d× d identity matrix, and by ||A||2 the spectral normof a given matrix A ∈ Rd×d.

We start with the GD algorithm. Let f ∈ Qµ,L, s ≥ 0 be the stepsize, and x0 ∈ Rd be the initial guess. For eachk ∈ N ∪ {0}, we denote by xk+1 the k + 1-th iterate generated by the following recursive formula (cf. the output yk+1 ofGDφ in Section 3):

xk+1 = xk − s∇f(xk). (6)

The following theorem establishes the convergence of Eq. 6 as k tends to infinity, and the Lipschitz dependence of the iterates(xsk)k∈N in terms of the stepsize s (i.e., the sensitivity of GD). Similar results can be established for general µ-stronglyconvex and L-smooth objective functions.

Theorem D.1. Let f ∈ Qµ,L admit the minimiser x∗ ∈ Rd, x0 ∈ Rd and for each s ≥ 0 let (xsk)k∈N∪{0} be the iteratesgenerated by Eq. 6 with stepsize s. Then we have for all k ∈ N, c0 > 0, s, t ∈ [c0,

2µ+L ] that

‖xsk − x∗‖2 ≤ (1− sµ)k‖x0 − x∗‖2, ‖xtk − xsk‖2 ≤ Lk(1− c0µ)k−1|t− s|‖x0 − x∗‖2. (7)

Proof. Let Q be the Hessian matrix of f and (λi)di=1 be the eigenvalues of Q. By using the fact that∇f(x∗) = 0 and Eq. 6,

we can obtain for all k ∈ N ∪ {0} and s ≥ 0 that xsk − x∗ = (Id − sQ)(xsk−1 − x∗) = (Id − sQ)k(x0 − x∗).

Since the spectral norm of a matrix is invariant under orthogonal transformations, we have for all s ∈ [c0,2

µ+L ] that

‖Id − sQ‖2 = ‖Id − sΛ‖2 = maxi=1,...,d

|1− sλi| = max(|1− sµ|, |1− sL|)

≤ 1− sµ.(8)

Hence, for any given k ∈ N ∪ {0}, the inequality that ‖xsk − x∗‖2 ≤ (‖Id − sQ‖2)k‖x0 − x∗‖2 leads us to the desiredestimate for (‖xsk − x∗‖2)k∈N∪{0}.

Now let t, s ∈ [c0,2

µ+L ] be given, by using the fact that ddsx

sk = k(Id − sQ)k−1Q(x0 − x∗) for all s > 0, we can deduce

from the mean value theorem that

‖xsk − xtk‖2 ≤(

supr∈(c0,

2µ+L )

‖ ddrxrk‖2)|t− s|

≤(

supr∈(c0,

2µ+L )

k(‖Id − rQ‖2)k−1‖Q‖2‖x0 − x∗‖2)|t− s|

≤ k

(sup

r∈[c0,2

µ+L ]

‖Id − rQ‖2

)k−1

L|t− s|‖x0 − x∗‖2,

Page 10: Understanding Deep Learning with Reasoning Layer

495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549

Understanding Deep Learning with Reasoning Layer

which along with Eq. 8 finishes the proof of the desired sensitivity estimate.

The next theorem shows that Eq. 6 with stepsize s ∈ (0, 2µ+L ] is Lipschitz stable in terms of the perturbations of f . In

particular, for a quadratic function f ∈ Qµ,L, we shall establish the Lipschitz stability with respect to the perturbations inthe parameters of f . For notational simplicity, we assume x0 = 0 as in Section 3, but it is straightforward to extend theresults to an arbitrary initial guess x0 ∈ Rd.

Theorem D.2. Let x0 = 0, for each i ∈ {1, 2} let fi ∈ Qµ,L admit the minimizer x∗,i ∈ Rd and satisfy∇fi(x) = Qix+ bifor a symmetric matrix Qi ∈ Rd×d and bi ∈ Rd, for each i ∈ {1, 2}, s > 0 let (xsk,i)k∈N∪{0} be the iterates generated byEq. 6 with f = fi and stepsize s, and let M = min(‖x∗,1‖2, ‖x∗,2‖2). Then we have for all k ∈ N, c0 > 0, s ∈ [c0,

2µ+L ]

that:

‖xsk,1 − xsk,2‖2 ≤[

1

µ

(1− (1− sµ)k

)+ sk(1− sµ)k−1

]M‖Q1 −Q2‖2

+1

µ

(1− (1− sµ)k

)‖b1 − b2‖2.

Proof. Let us assume without loss of generality that ‖x∗,2‖2 ≤ ‖x∗,1‖2 and c0 ≤ 2µ+L . We write δxk = xsk,1 − xsk,2 for

each k ∈ N ∪ {0}. Then, by using Eq. 6 and the fact that∇f1(x)−∇f1(y) = Q1(x− y) for all x, y ∈ Rd, we can deducethat δx0 = 0 and for all k ∈ N ∪ {0} that

δxk+1 = (Id − sQ1)δxk + ek =

k∑i=0

(Id − sQ1)iek−i,

where ek = −s(∇f1 −∇f2)(xsk,2) for each k ∈ N ∪ {0}. Note that it holds for all k ∈ N ∪ {0} that

‖ek‖2 ≤ s‖(∇f1 −∇f2)(xsk,2)‖2 ≤ s(‖Q2 −Q2‖2‖xsk,2‖2 + ‖b1 − b2‖2

)≤ s(‖Q2 −Q2‖2(‖x∗,2‖2 + ‖xsk,2 − x∗,2‖2) + ‖b1 − b2‖2

)≤ s(‖Q2 −Q2‖2(‖x∗,2‖2 + (1− sµ)k‖x0 − x∗,2‖2) + ‖b1 − b2‖2

),

where we have applied Theorem D.1 for the last inequality. Thus for each k ∈ N, we can obtain from Eq. 8 and x0 = 0 that

‖δxk‖2 ≤k−1∑i=0

(‖Id − sQ1‖2)i‖ek−1−i‖2

≤k−1∑i=0

(1− sµ)is[(1 + (1− sµ)k−1−i)‖x∗,2‖2‖Q2 −Q2‖2 + ‖b1 − b2‖2

]=

[1

µ

(1− (1− sµ)k

)+ sk(1− sµ)k−1

]min(‖x∗,1‖2, ‖x∗,2‖2)‖Q2 −Q2‖2

+1

µ

(1− (1− sµ)k

)‖b1 − b2‖2.

which leads to the desired conclusion due to the fact that M = min(‖x∗,1‖2, ‖x∗,2‖2).

We now proceed to investigate similar properties of the NAG algorithm, whose proofs are more involved due to the fact thatNAG is a multi-step method.

Recall that for any given f ∈ Qµ,L, initial guess x0 ∈ Rd and stepsize s ≥ 0, the NAG algorithm generates iterates(xk, yk)k∈N∪{0} as follows: y0 = x0 and for each k ∈ N ∪ {0},

xk+1 = yk − s∇f(yk), yk+1 = xk+1 +1−√µs1 +√µs

(xk+1 − xk). (9)

Note that xk+1, yk+1 are denoted by yk+1, zk+1, respectively, in Section 3.

Page 11: Understanding Deep Learning with Reasoning Layer

550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604

Understanding Deep Learning with Reasoning Layer

We first introduce the following matrix RNAG,s for Eq. 9 for any given function f ∈ Qµ,L and stepsize s ∈ [0, 43L+µ ]:

RNAG,s :=

((1 + βs)(Id − sQ) −βs(Id − sQ)

Id 0

)(10)

where βs =1−√µs1+√µs and Q is the Hessian matrix of f . The following lemma establishes an upper bound of the spectral norm

of the k-th power of RNAG,s, which extends [17, Lemma 22] to block matrices, a wider range of stepsize (s is allowed to belarger than 1/L) and a momentum parameter βs depending on the stepsize s.

Lemma D.1. Let f ∈ Qµ,L, s ∈ (0, 43L+µ ], βs =

1−√µs1+√µs and RNAG,s be defined as in Eq. 10. Then we have for all k ∈ N

that ‖RkNAG,s‖2 ≤ 2(k + 1)(1−√µs)k.

Proof. Let Q = UΛUT be the eigenvalue decomposition of the Hessian matrix Q of f , where Λ is a diagonal matrixcomprising of the corresponding eigenvalues of Q sorted in ascending order, i.e., 0 < µ ≤ λ1 ≤ . . . ≤ λd ≤ L. Then wehave that

RNAG,s =

(U 00 U

)((1 + βs)(Id − sΛ) −βs(Id − sΛ)

Id 0

)(UT 00 UT

),

which together with the facts that any permutation matrix is orthogonal, and the spectral norm of a matrix is invariant underorthogonal transformations, gives us the identity that: for all k ∈ N,

‖RkNAG,s‖2 =

∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣(

(1 + βs)(Id − sΛ) −βs(Id − sΛ)Id 0

)k∣∣∣∣∣∣∣∣∣∣∣∣∣∣∣2

= maxi=1,...n

‖T ks,i‖2, (11)

where Ts,i =(

(1+βs)(1−sλi) −βs(1−sλi)1 0

)for all i = 1, . . . , d.

Now let s ∈ (0, 43L+µ ] and i = 1, . . . , d be fixed. If 1− sλi ≥ 0, by using [? ]Lemma 22]chen2018stability (with α = µ,

β = 1/s, h = 1− sλi and κ = β/α = 1/(µs)), we can obtain that

‖T ks,i‖2 ≤ 2(k + 1)

(1−√µs1 +√µs

(1− µs))k/2

≤ 2(k + 1)(1−√µs)k.

We then discuss the case where 1− sλi < 0. Let us write T ks,i =(ak bkck dk

)for each k ∈ N∪ {0}, then we have for all k ∈ N

that

ak = (1 + βs)(1− sλi)ak−1 − βs(1− sλi)ck−1, ck = ak−1,

bk = (1 + βs)(1− sλi)bk−1 − βs(1− sλi)dk−1, dk = bk−1,

with a1 = (1 + βs)(1− sλi), b1 = −βs(1− sλi), c1 = 1 and d1 = 0. Since the conditions 1− sλi < 0 and s ≤ 43L+µ

imply that λi > 1s ≥

3L+µ4 ≥ µ, we see the discriminant of the characteristic polynomial satisfies that

∆ = (1 + βs)2(1− sλi)2 − 4βs(1− sλi) =

4(1− sλi)(1 +

õs)2

s(µ− λi) > 0,

which implies that there exist l1, l2, l3, l4 ∈ R such that it holds for all k ∈ N ∪ {0} that ak = l1τk+1+ + l2τ

k+1− and

bk = l3τk+1+ + l4τ

k+1− , with τ± = (1+βs)(1−sλi)±

√∆

2 , l1 = 1τ+−τ− , l2 = − 1

τ+−τ− , l3 = −τ−τ+−τ− and l4 = τ+

τ+−τ− . Thus, by

letting ρi := max(|τ+|, |τ−|), we have that |ak| = |∑kj=0 τ

k−j+ τ j−| ≤ (k+1)ρki and |bk| = |(−τ+τ−)

∑k−1j=0 τ

k−1−j+ τ j−| ≤

kρk+1i for all k ∈ N ∪ {0}.

Now we claim that the conditions 1 − sλi < 0 and 0 < s ≤ 43L+µ imply the estimate that ρi ≤ 1 − √µs < 1. In fact,

the inequality s ≤ 43L+µ gives us that µs ≤ 4µ

3L+µ ≤ 1, which implies that βs =1−√µs1+√µs ≥ 0. Hence we can deduce from

1− sλi < 0 that√

∆ ≥ (1 + βs)(sλi − 1) and

|τ+| ≤ |τ−| ≤sλi − 1 +

√(sλi − 1)s(λi − µ)

1 +õs

≤sL− 1 +

√(sL− 1)s(L− µ)

1 +õs

.

Page 12: Understanding Deep Learning with Reasoning Layer

605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659

Understanding Deep Learning with Reasoning Layer

Note that 2− (µ+ L)s ≥ 2− 4(µ+L)3L+µ ≥ 0, we see that

ρi ≤ 1−√µs ⇐= |τ−| ≤ 1−√µs ⇐= sL− 1 +√

(sL− 1)s(L− µ) ≤ 1− µs⇐⇒ (sL− 1)s(L− µ) ≤ (2− (µ+ L)s)2

⇐⇒ (us− 1)((3L+ µ)s− 4) ≥ 0.

Therefore, we have that max(|ak|, |bk|, |ck|, |dk|) ≤ (k + 1)(1−√µs)k, which, along with the relationship between thespectral norm and Frobenius norm, gives us that ‖T ks,i‖2 ≤ ‖T ks,i‖F ≤ 2(k + 1)(1−√µs)k, and finishes the proof of thedesired estimate for the case with 1− sλi < 0.

As an important consequence of Lemma D.1, we now obtain the following upper bound of the error (‖xk − x∗‖2)k∈N forany given objective function f ∈ Qµ,L and stepsize s ∈ (0, 4

3L+µ ].

Theorem D.3. Let f ∈ Qµ,L admit the minimizer x∗ ∈ Rd, x0 ∈ Rd, s ∈ (0, 43L+µ ] and (xsk, y

sk)k∈N∪{0} be the iterates

generated by Eq. 9 with stepsize s. Then we have for all k ∈ N ∪ {0} that

‖xsk+1 − x∗‖22 + ‖xsk − x∗‖22 ≤ 8(1 + k)2(1−√µs)2k‖x0 − x∗‖22.

Proof. For any f ∈ Qµ,L, and s ∈ (0, 43L+µ ], by letting βs =

1−√µs1+√µs , we can rewrite Eq. 9 as follows: xs0 = x0,

xs1 = x0 − s∇f(x0) and for all k ∈ N,

xsk+1 = (1 + βs)xsk − βsxk−1 − s∇f((1 + βs)x

sk − βsxk−1), (12)

which together with the fact that∇f(x∗) = 0 shows that(xsk+1 − x∗xsk − x∗

)= RNAG,s

(xsk − x∗xsk−1 − x∗

)= RkNAG,s

(xs1 − x∗xs0 − x∗

)where RNAG,s is defined as in Eq. 10. Hence by using xs1 = x0 − s∇f(x0) and Theorem D.1, we can obtain that

‖xsk+1 − x∗‖22 + ‖xsk − x∗‖22 ≤ ‖RkNAG,s‖22(‖xs1 − x∗‖22 + ‖xs0 − x∗‖22)

≤ ‖RkNAG,s‖222‖x0 − x∗‖22,

which together with Lemma D.1 leads to the desired convergence result.

Remark D.1. It is well-known that for a general µ-strongly convex and L-smooth objective function f , one can employa Lyapunov argument and establish that the iterates obtained by Eq. 9 with stepsize s ∈ [0, 1

L ] satisfy the estimate that‖xk − x∗‖22 ≤ 2L

µ (1 − √µs)k‖x0 − x∗‖22. Here by taking advantage of the affine structure of ∇f , we have obtained asharper estimate of the convergence rate for a wider range of stepsize s ∈ (0, 4

3L+µ ].

We also would like to emphasize that the upper bound in Theorem D.3 is tight, in the sense that the additional quadraticdependence on k in the error estimate is inevitable. In fact, one can derive a closed-form expression of RkNAG,s and show that,for an index i such that the eigenvalue λi is sufficiently close to µ, the squared error for that component is of the magnitudeO((k

√µs+ 1)2(1−√µs)2k).

We then proceed to analyze the sensitivity of Eq. 9 with respect to the stepsize. The following theorem shows that theiterates (xk, yk)k∈N∪{0} generated by Eq. 9 depend Lipschitz continuously on the stepsize s.

Theorem D.4. Let f ∈ Qµ,L admit the minimiser x∗ ∈ Rd, x0 ∈ Rd, and for each s ∈ (0, 43L+µ ] let (xsk, y

sk)k∈N∪{0} be

the iterates generated by Eq. 9 with stepsize s. Then we have for all k ∈ N, c0 > 0 and t, s ∈ [c0,4

3L+µ ] that:

‖xtk − xsk‖2 ≤(

2L(1 + k) +4

3k(k + 1)(k + 5)

(õ

c0+ 2L

))(1−√µc0)k|t− s|‖x0 − x∗‖2.

Page 13: Understanding Deep Learning with Reasoning Layer

660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714

Understanding Deep Learning with Reasoning Layer

Proof. Throughout this proof we assume without loss of generality that c0 ≤ s < t ≤ 43L+µ . Let Q be the Hessian matrix

of f , for each r ∈ [c0,4

3L+µ ] let βr =1−√µr1+√µr , and for each k ∈ N ∪ {0} let δxk = xtk − xsk . Then we can deduce from

Eq. 12 that δx0 = 0, δx1 = −(t− s)∇f(x0) and for all k ∈ N that

xtk+1 − xsk+1 = [(1 + βt)xtk − βtxtk−1 − t∇f((1 + βt)x

tk − βtxtk−1)]

− [(1 + βs)xsk − βsxsk−1 − s∇f((1 + βs)x

sk − βsxsk−1)],

which together with the fact that∇f(x)−∇f(y) = Q(x− y) for all x, y ∈ Rd shows that(δxk+1

δxk

)= RNAG,t

(δxkδxk−1

)+

(ek0

)with RNAG,t defined as in Eq. 10 and the following residual term

ek := [(1 + βt)xsk − βtxsk−1 − t∇f((1 + βt)x

sk − βtxsk−1)]

− [(1 + βs)xsk − βsxsk−1 − s∇f((1 + βs)x

sk − βsxsk−1)].

Hence we can obtain by induction that: for all k ∈ N,(δxk+1

δxk

)= RkNAG,t

(δx1

δx0

)+

k−1∑i=0

RiNAG,t

(ek−i

0

). (13)

Now the facts that ∇f(x∗) = 0 and ∇2f ≡ Q gives us that

ek = (βt − βs)(xsk − xsk−1)− t∇f((1 + βt)xsk − βtxsk−1) + s∇f((1 + βs)x

sk − βsxsk−1)

= (βt − βs)((xsk − x∗)− (xsk−1 − x∗)

)− tQ

((1 + βt)(x

sk − x∗)− βt(xsk−1 − x∗)

)+ sQ

((1 + βs)(x

sk − x∗)− βs(xsk−1 − x∗)

)=[(βt − βs)− (t+ tβt − s− sβs)Q

](xsk − x∗)−

[(βt − βs)− (tβt − sβs)Q

](xsk−1 − x∗).

Note that one can easily verify that the function g1(r) = βr is√µ/c0-Lipschitz on [c0,

43L+µ ], and the function g2(r) = rβr

is 1-Lipschitz on [0, 43L+µ ]. Moreover, the fact that f ∈ Qµ,L implies that ‖Q‖2 ≤ L. Thus we can obtain from Theorem

D.3 that

‖ek‖2 ≤(√

µ

c0+ 2L

)|t− s|‖xsk − x∗‖2 +

(õ

c0+ L

)|t− s|‖xsk−1 − x∗‖2

≤(√

µ

c0+ 2L

)|t− s|

√2(‖xsk − x∗‖22 + ‖xsk−1 − x∗‖22)

≤(√

µ

c0+ 2L

)|t− s|4(1 + k)(1−√µs)k‖x0 − x∗‖2.

This, along with Eq. 13, Lemma D.1 and s < t, gives us that

√‖δxk+1‖22 + ‖δxk‖22 ≤ ‖RkNAG,t‖2‖δx1‖2 +

k−1∑i=0

‖RiNAG,t‖2‖ek−i‖2

≤ 2(1 + k)(1−√µt)k|t− s|L‖x0 − x∗‖2

+

k−1∑i=0

2(1 + i)(1−√µt)i

(õ

c0+ 2L

)|t− s|4(1 + k − i)(1−√µs)k−i‖x0 − x∗‖2

=

(2L(1 + k) +

4

3k(k + 1)(k + 5)

(õ

c0+ 2L

))|t− s|(1−√µs)k‖x0 − x∗‖2,

which finishes the proof of the desired estimate due to the fact that s ≥ c0.

Page 14: Understanding Deep Learning with Reasoning Layer

715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769

Understanding Deep Learning with Reasoning Layer

The next theorem is an an analog of Theorem D.2 for the NAC scheme Eq. 9, which shows that the outputs of Eq. 9 withstepsize s ∈ (0, 4

3L+µ ] is Lipschitz stable with respect to the perturbations of the parameters in f .

Theorem D.5. Let x0 = 0, for each i ∈ {1, 2} let fi ∈ Qµ,L admit the minimizer x∗,i ∈ Rd and satisfy∇fi(x) = Qix+ bifor a symmetric matrix Qi ∈ Rd×d and bi ∈ Rd, for each i ∈ {1, 2}, s > 0 let (xsk,i)k∈N∪{0} be the iterates generated byEq. 9 with f = fi and stepsize s, and let M = min(‖x∗,1‖2, ‖x∗,2‖2). Then we have for all k ∈ N, s ∈ [c0,

43L+µ ] that:

‖xsk,1 − xsk,2‖2 ≤[

2

µ

(1− (1−√µs)k−1

)+ s

8(k − 1)k(k + 4)

3(1−√µs)k−1

]M‖Q1 −Q2‖2

+2

µ

(1− (1−√µs)k

)‖b1 − b2‖2.

Proof. Let us assume without loss of generality that ‖x∗,2‖2 ≤ ‖x∗,1‖2. We first fix an arbitrary s ∈ [c0,4

3L+µ ] and writeδxk = xsk,1 − xsk,2 for each k ∈ N ∪ {0}. Then, by using Eq. 12 and the fact that∇f1(x)−∇f1(y) = Q1(x− y) for allx, y ∈ Rd, we can deduce that δx0 = 0, δx1 = −s(∇f1 −∇f2)(x0) and for all k ∈ N,(

δxk+1

δxk

)= RNAG,s

(δxkδxk−1

)+

(ek0

)= RkNAG,s

(δx1

δx0

)+

k−1∑j=0

RjNAG,s

(ek−j

0

), (14)

where RNAG,s is defined as in Eq. 10 (with Q = Q1) and the residual term ek is given by

ek := −s(∇f1 −∇f2)((1 + βs)xsk,2 − βsxsk−1,2) ∀k ∈ N.

Note that, by using Theorem D.3 and the inequality that x+y ≤√

2(x2 + y2) for all x, y ∈ R, we have for each k ∈ N that

‖ek‖2 = s‖(Q1 −Q2)((1 + βs)xsk,2 − βsxsk−1,2) + (b1 − b2)‖2

≤ s‖Q1 −Q2‖2(‖x∗,2‖2 + 2‖xsk,2 − x∗,2‖2 + ‖xsk−1,2 − x∗,2‖2) + s‖b1 − b2‖2≤ s‖Q1 −Q2‖2(‖x∗,2‖2 + 2‖xsk,2 − x∗,2‖2 + ‖xsk−1,2 − x∗,2‖2) + s‖b1 − b2‖2≤ s‖Q1 −Q2‖2(‖x∗,2‖2 + 8(1 + k)(1−√µs)k‖x0 − x∗,2‖2) + s‖b1 − b2‖2.

Hence we can obtain from Eq. 14, Lemma D.1 and x0 = 0 that√‖δxk+1‖22 + ‖δxk‖22 ≤ 2(k + 1)(1−√µs)k‖δx1‖2 +

k−1∑j=0

2(j + 1)(1−√µs)j‖ek−j‖2

≤ 2(k + 1)(1−√µs)ks‖b1 − b2‖2 +

k−1∑j=0

2(j + 1)(1−√µs)j[s‖b1 − b2‖2

+ s‖Q1 −Q2‖2(1 + 8(1 + k − j)(1−√µs)k−j)‖x∗,2‖2]

≤ 2s

k∑j=0

(j + 1)(1−√µs)j‖b1 − b2‖2 + 2s

k−1∑j=0

[(j + 1)(1−√µs)j

+ 8(j + 1)(1 + k − j)(1−√µs)k]‖Q1 −Q2‖2 min(‖x∗,1‖2, ‖x∗,2‖2).

Let p = 1−√µs ∈ [0, 1), then we can easily show for each k ∈ N ∪ {0} that (1− p)∑kj=0(j + 1)pj =

∑kj=0 p

j − pk+1,

which implies that∑kj=0(j+1)(1−√µs)j ≤ 1−(1−√µs)k+1

µs . Moreover, we have that∑k−1j=0 (j+1)(1+k−j) = k(k+1)(k+5)

6for all k ∈ N. Thus we can simplify the above estimate and deduce for each k ∈ N that

‖δxk+1‖2 ≤2

µ

(1− (1−√µs)k+1

)‖b1 − b2‖2 +

[2

µ

(1− (1−√µs)k

)+ s

8k(k + 1)(k + 5)

3(1−√µs)k

]‖Q1 −Q2‖2 min(‖x∗,1‖2, ‖x∗,2‖2).

Moreover, the condition that s ≤ 43L+µ ≤

1µ implies that ‖δx1‖2 = s‖b1 − b2‖2 ≤ 2

µ

(1− (1−√µs)

)‖b1 − b2‖2, which

shows that the same upper bound also holds for ‖δx1‖2 and finishes the proof of the desired estimate.

Page 15: Understanding Deep Learning with Reasoning Layer

770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824

Understanding Deep Learning with Reasoning Layer

E. Proof of Approximation AbilityLemma A.1. (Faster Convergence ⇒ Better Approximation Ability). Assume the problem setting in Sec 2. Theapproximation ability can be bounded by two terms:

infφ,θ

supQ∗∈Q∗

P`φ,θ ≤σbµ−2 infθ

supQ∗

P‖Qθ(x)−Q∗(x)‖F︸ ︷︷ ︸approximation ability of the neural module

+M infφ∈Φ

Cvg(k, φ)︸ ︷︷ ︸best convergence

.

Proof. For each φ ∈ Φ, θ ∈ Θ, Q∗ ∈ Q∗,

`φ,θ(x, b) = ‖Algkφ(Qθ(x), b)− Opt(Q∗(x), b)‖2 (15)

≤ ‖Algkφ(Qθ(x), b)− Opt(Qθ(x), b)‖2 + ‖Opt(Qθ(x), b)− Opt(Q∗(x), b)‖2 (16)

≤ Cvg(k, φ)‖Alg0φ(Qθ(x), b)− Opt(Q∗(x), b)‖2 + ‖Qθ(x)−1b−Q∗(x)−1b‖2 (17)

≤ Cvg(k, φ) ·M + ‖(Qθ(x)−1 −Q∗(x)−1

)b‖2, (18)

where in the last inequality we have used the facts that the initialization is assumed to be zero vector, i.e., Alg0φ(Qθ(x), b) =

0, and that M ≥ supx∈X ,b∈B Opt(Q∗(x), b). Note that the independence of (x, b) and the fact that Ebb> = σ2b I imply

that

Eb‖(Qθ(x)−1 −Q∗(x)−1

)b‖22 (19)

= Tr((Qθ(x)−1 −Q∗(x)−1)>(Qθ(x)−1 −Q∗(x)−1)σ2

b I)

(20)

= σ2b‖Qθ(x)−1 −Q∗(x)−1‖2F (21)

= σ2b‖Qθ(x)−1(Qθ(x)−Q∗(x))Q∗(x)−1‖2F (22)

≤ µ−4σ2b‖Qθ(x)−Q∗(x)‖2F (23)

Therefore, we see from Holder’s inequality that

Eb‖(Qθ(x)−1 −Q∗(x)−1

)b‖2 ≤ µ−2σb‖Qθ(x)−Q∗(x)‖F . (24)

Collecting all the above inequalities, we have

P`φ,θ ≤ Cvg(k, φ) ·M + σbµ−2P‖Qθ −Q∗‖F . (25)

Taking supremum over Q∗, we have

supQ∗∈Q∗

P`φ,θ ≤ Cvg(k, φ) ·M + σbµ−2 sup

Q∗∈Q∗P‖Qθ −Q∗‖F . (26)

Taking infimum over φ and θ, we have

infφ∈Φ,θ∈Θ

supQ∗∈Q∗

P`φ,θ ≤ infφ∈Φ

Cvg(k, φ) ·M + σbµ−2 inf

θ∈Θsup

Q∗∈Q∗P‖Qθ −Q∗‖F . (27)

Lemma A.2. (Faster Convergence⇒ Better Representation of Q∗). Assume the problem setting in Sec 2. ∀φ ∈ Φ, θ ∈Θ, Q∗ ∈ Q∗ := {X × B 7→ Sd×dµ,L }, it holds true that

P`2φ,θ = ε =⇒ P‖Qθ −Q∗‖2F ≤ σ−2b L4(

√ε+M · Cvg(k, φ))2. (4)

Proof. We shall prove the same conclusion under a slightly weaker assumption that P`2φ,θ ≤ ε. For any x ∈ X , b ∈ B, wehave

`φ,θ(x) ≥ ‖Opt (Qθ(x), b)− Opt (Q∗(x), b) ‖2 − ‖Algkφ (Qθ(x), b)− Opt (Qθ(x), b) ‖2≥ ‖Qθ(x)−1b−Q∗(x)−1b‖2 − Cvg(k, φ)‖Opt (Qθ(x), b) ‖2 (28)

≥ ‖Qθ(x)−1b−Q∗(x)−1b‖2 −M · Cvg(k, φ). (29)

Page 16: Understanding Deep Learning with Reasoning Layer

825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879

Understanding Deep Learning with Reasoning Layer

Rearranging the terms in the above inequality, we have

‖Qθ(x)−1b−Q∗(x)−1b‖2 ≤ `φ,θ(x) +M · Cvg(k, φ). (30)

By Eq. 22 and the inequality that ‖AB‖F ≤ ‖A‖2‖B‖F for any given A ∈ Rm×r and B ∈ Rr×n, we have that

Eb‖Qθ(x)−1b−Q∗(x)−1b‖22 (31)

= σ2b‖Qθ(x)−1(Qθ(x)−Q∗(x))Q∗(x)−1‖2F (32)

≥ σ2b

‖Qθ(x)−Q∗(x)‖2F‖Q∗(x)‖22‖Qθ(x)‖22

(33)

≥ σ2b‖Qθ(x)−Q∗(x)‖2F /L4, (34)

which implies that,

‖Qθ(x)−Q∗(x)‖2F ≤ σ−2b L4Eb‖Qθ(x)−1b−Q∗(x)−1b‖22. (35)

Combining it with Eq. 30 and the fact that (P`φ,θ)2 ≤ P`2φ,θ, we have

P‖Qθ(x)−Q∗(x)‖2F ≤ σ−2b L4P (`φ,θ +M · Cvg(k, φ))2 (36)

= σ−2b L4

(P`2φ,θ + (M · Cvg(k, φ))2 + 2(M · Cvg(k, φ))P`φ,θ

)(37)

≤ σ−2b L4

(ε+ (M · Cvg(k, φ))2 + 2(M · Cvg(k, φ))

√ε)

(38)

= σ−2b L4

(√ε+M · Cvg(k, φ)

)2, (39)

which completes the proof.

Page 17: Understanding Deep Learning with Reasoning Layer

880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934

Understanding Deep Learning with Reasoning Layer

F. Proof of Generalization AbilityIn this section, we shall prove the following result, which is a refined version of Theorem 3.1.

Theorem F.1. Assume the problem setting in Sec 2 and let r > 0. Then for any t > 0, with probability at least 1− e−t, theempirical Rademacher complexity of `locF (r) can be bounded by

Rn`locF (r) ≤

√2dn−

12 Stab(k)

(√(√r +MCvg(k))2C1(n) + C2(n, t, k, r) + 4

)+ Sens(k)BΦ,

where

C1(n) = 216σ−2b L4 logN (n−

12 , `Q, L2(Pn))

C2(n, t, k, r) =

(768B2

Qt

n+ 720BQERn`locQ (rq)

)logN (n−

12 , `Q, L2(Pn)),

rq = σ−2b L4(

√r + MCvg(k))2, `locQ (rq) = {‖Qθ − Q∗‖F : θ ∈ Θ, P‖Qθ − Q∗‖2F ≤ rq}, BQ = 2L

√d, and BΦ =

12 supφ1,φ2∈Φ ‖φ1 − φ2‖2.

Furthermore, for any t > 0, the expected Rademacher complexity of `locF (r) can be bounded by

ERn`locF (r) ≤√

2dn−12 Stab(k)

(√(√r +MCvg(k))2C1(n) + C2(n, t) + C3(n, t) + 4

)+ Sens(k)BΦ,

where

C1(n) = 216σ−2b L4 logNQ,

C2(n, t) =

(1 + 3BQe

−t√logNQ +45√nBQ logNQ

)2880√nBQ logNQ + t

768B2Q

nlogNQ,

C3(n, t) = 12BQe−t√logNQ +

360√nBQ logNQ,

and NQ = N (n−12 , `Q, L∞).

In order to prove Theorem F.1, we first prove the following theorem, which reduces bounding the empirical Rademachercomplexity of `locF (r) to that of `locQ (rq), and plays an important role in our complexity analysis.

Theorem F.2. Assume the problem setting in Sec 2. Then it holds for any r > 0 that

Rn`locF (r) ≤

√2d Stab(k)Rn`

locQ (rq) + Sens(k)BΦ, (40)

with rq = σ−2b L4(

√r + MCvg(k))2, `locQ (rq) = {‖Qθ − Q∗‖F : θ ∈ Θ, P‖Qθ − Q∗‖2F ≤ rq} and BΦ =

12 supφ1,φ2∈Φ ‖φ1 − φ2‖2.

Proof. Let k ∈ N be fixed throughout this proof. We first show that the loss `φ,θ is Stab(k)-Lipschtiz in Qθ and Sens(k)-Lipschitiz in φ. For any (x, b) ∈ X × B, by using the triangle inequality and the definitions of Stab(k, φ′) and Sens(k), wecan obtain the following estimate of the loss:

|`φ,θ(x)− `φ′,θ′(x)|= |‖Algkφ(Qθ(x), b)− Opt(Q∗(x), b)‖2 − ‖Algkφ′(Qθ′(x), b)− Opt(Q∗(x), b)‖2|≤ ‖Algkφ(Qθ(x), b)− Algkφ′(Qθ′(x), b)‖2≤ ‖Algkφ′(Qθ(x), b)− Algkφ′(Qθ′(x), b)‖2 + ‖Algkφ(Qθ(x), b)− Algkφ′(Qθ(x), b)‖2≤ Stab(k, φ′)‖Qθ(x)−Qθ′(x)‖2 + Sens(k)‖φ− φ′‖2≤ Stab(k)‖Qθ(x)−Qθ′(x)‖2 + Sens(k)‖φ− φ′‖2.

(41)

Page 18: Understanding Deep Learning with Reasoning Layer

935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989

Understanding Deep Learning with Reasoning Layer

where we write Stab(k) = supφ∈Φ Stab(k, φ) for each k ∈ N.

We then establish a vector contraction inequality, which is a modified version of Corollary 4 in [20] and Lemma 5 in [21].Note that the empirical Rademacher complexity of `locF can be written as:

Rn`locF (r) =

1

nEσ sup

φ,θ

n∑i=1

σi`φ,θ(xi) =1

nEσ1:n−1

Eσn supφ,θ

n−1∑i=1

σi`φ,θ(xi) + σn`φ,θ(xn), (42)

where the supremum is taken over the parameter space{

(φ, θ) : φ ∈ Φ, θ ∈ Θ, P `2φ,θ ≤ r}

.

Let Un−1(φ, θ) =∑n−1i=1 σi`φ,θ(xi) for each (φ, θ). We now assume without loss of generality that the supremum can be

attained and let

φ1, θ1 = arg supφ,θ

(Un−1(φ, θ) + `φ,θ(xn)

),

φ2, θ2 = arg supφ,θ

(Un−1(φ, θ)− `φ,θ(xn)

),

since otherwise we can consider (φ1, θ1) and (φ2, θ2) that are ε-close to the suprema for any ε > 0 and conclude the sameresult. Then we can deduce from Eq. 41 that

Eσn supφ,θ

n−1∑i=1

σi`φ,θ(xi) + σn`φ,θ(xn)

=1

2

(Un−1(φ1, θ1) + `φ1,θ1(xn) + Un−1(φ2, θ2)− `φ2,θ2(xn)

)=

1

2

(Un−1(φ1, θ1) + Un−1(φ2, θ2) + (`φ1,θ1(xn)− `φ2,θ2(xn))

)≤ 1

2

(Un−1(φ1, θ1) + Un−1(φ2, θ2)

)+

1

2

(Stab(k)‖Qθ1(xn)−Qθ2(xn)‖2 + Sens(k)‖φ1 − φ2‖2

)≤ 1

2

(Un−1(φ1, θ1) + Un−1(φ2, θ2)

)+

1

2Stab(k)‖Qθ1(xn)−Qθ2(xn)‖F + Sens(k)BΦ,

where BΦ = 12 supφ1,φ2∈Φ ‖φ1 − φ2‖2.

For each x ∈ X , θ ∈ Θ and 1 ≤ j, k ≤ d, let Qj,kθ (x) be the j, k-th entry of the matrix Qθ(x). The the Khintchine-Kahaneinequality (see e.g. [20]) gives us that

Eσn supφ,θ

n∑i=1

σi`φ,θ(xi) ≤1

2(Un−1(φ1, θ1) + Un−1(φ2, θ2)) + Sens(k)BΦ (43)

+1

2Stab(k)

√2Eεn

∣∣∣∣∑j,k

εj,kn

(Qj,kθ1 (xn)−Qj,kθ2 (xn)

) ∣∣∣∣, (44)

where εn = (εj,kn )nj,k=1 are independent Rademacher variables. Hence, if we denote by s(εn) the sign of

Page 19: Understanding Deep Learning with Reasoning Layer

990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044

Understanding Deep Learning with Reasoning Layer∑j,k ε

j,kn

(Qj,kθ1 (xn)−Qj,kθ2 (xn)

)and by Q∗j,k(x) be the j, k-th entry of the matrix Q∗(x), then we can obtain that

Eσn supφ,θ

n∑i=1

σi`φ,θ(xi)

≤ Eεn1

2

[(Un−1(φ1, θ1) + Stab(k)

√2s(εn)

∑j,k

εj,kn Qj,kθ1 (xn)

)

+

(Un−1(φ2, θ2)− Stab(k)

√2s(εn)

∑j,k

εj,kn Qj,kθ2 (xn)

)]+ Sens(k)BΦ

= Eεn1

2

[(Un−1(φ1, θ1) + Stab(k)

√2s(εn)

∑j,k

εj,kn

(Qj,kθ1 (xn)−Q∗j,k(xn)

))

+

(Un−1(φ2, θ2)− Stab(k)

√2s(εn)

∑j,k

εj,kn

(Qj,kθ2 (xn)−Q∗j,k(xn)

))]+ Sens(k)BΦ.

Then by taking the supremum over (φ, θ) and using the fact that σn is an independent Rademacher variable, we can deducethat

Eσn supφ,θ

n∑i=1

σi`φ,θ(xi)

≤ Eεn1

2

[supφ,θ

(Un−1(φ, θ) + Stab(k)

√2s(εn)

∑j,k

εj,kn

(Qj,kθ (xn)−Q∗j,k(xn)

))

+ supφ,θ

(Un−1(φ, θ)− Stab(k)

√2s(εn)

∑j,k

εj,kn

(Qj,kθ (xn)−Q∗j,k(xn)

))]+ Sens(k)BΦ

= EεnEσn[

supφ,θ

(Un−1(φ, θ) + Stab(k)

√2σn

∑j,k

εj,kn

(Qj,kθ (xn)−Q∗j,k(xn)

))]+ Sens(k)BΦ

= Eεn[

supφ,θ

(Un−1(φ, θ) + Stab(k)

√2∑j,k

εj,kn

(Qj,kθ (xn)−Q∗j,k(xn)

))]+ Sens(k)BΦ,

where we have used the fact that∑j,k ε

j,kn

(Qj,kθ (xn)−Q∗j,k(xn)

)is a symmetric random variable in the last line.

By proceeding in the same way for all other σn−1, · · · , σ1, we can obtain the following vector-contraction inequality:

Eσ supφ,θ

n∑i=1

σi`φ,θ(xi) ≤√

2Stab(k)Eε1:n[supθ

n∑i=1

∑j,k

εj,ki

(Qj,kθ (xn)−Q∗j,k(xn)

)]+ nSens(k)BΦ.

(45)

Page 20: Understanding Deep Learning with Reasoning Layer

1045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099

Understanding Deep Learning with Reasoning Layer

The first term on the right-hand side can be bounded by using the Cauchy-Schwarz inequality as follows:

Eε1:n

supθ

n∑i=1

∑j,k

εj,ki

(Qj,kθ (xn)−Q∗j,k(xn)

)= Eσ1:n

Eε1:n

supθ

n∑i=1

σi∑j,k

εj,ki

(Qj,kθ (xn)−Q∗j,k(xn)

)≤ Eσ1:n

Eε1:n

supθ

n∑i=1

σi

√∑j,k

(εj,ki )2

√∑j,k

|Qj,kθ (xn)−Q∗j,k(xn)|2

= Eσ1:n

Eε1:n

[supθ

n∑i=1

σid‖Qθ(xn)−Q∗(xn)‖F

]

= dEσ1:n

[supθ

n∑i=1

σi‖Qθ(xn)−Q∗(xn)‖F

].

(46)

Therefore, bounding the Rademacher complexity of `locF (r) reduces to bounding the Rademacher complexity of the spaceof functions ‖Qθ − Q∗‖F . Recall that the supremum is taken over the parameter space where (φ, θ) ∈ Φ × Θ satisfiesP`2φ,θ ≤ r. Note that Lemma A.2 implies that,

P‖Qθ −Q∗‖2F ≤ rq := σ−2b L4

(√ε+M · Cvg(k, φ)

)2. (47)

Hence, by defining the following function space:

`locQ (rq) :={‖Qθ −Q∗‖F : θ ∈ Θ, P‖Qθ −Q∗‖2F ≤ rq

}, (48)

we can conclude the desired relationship between Rn`locF (r) and Rn`locQ (rq) from the inequalities Eq. 45 and Eq. 46.

With Theorem F.2 in hand, we see that, for each r > 0, in order to obtain the upper bounds of Rn`locF (r) in Theorem F.1, itsuffices to estimate Rn`locQ (rq), i.e., the Rademacher complexity of the function space `locQ (rq).

The following theorem summarizes the estimates for the empirical and expected Rademacher complexity of the local class`locQ , which will be established in Propositions F.1 and F.2, respectively.

Recall that, for any given ε > 0, a class of functions F and pseudometric ‖ · ‖, the covering numberN (ε,F , ‖ · ‖) is definedas the cardinality of the smallest subset F of F for which every element of F is within the ε-neighbourhood of some elementof F with respect to the pseudometric ‖ · ‖.Theorem F.3. Assume the problem setting in Sec 2. Let r > 0, rq = σ−2

b L4(√r + MCvg(k))2 and `locQ (rq) = {‖Qθ −

Q∗‖F : θ ∈ Θ, P‖Qθ −Q∗‖2F ≤ rq}. Then for all t > 0, we have with probability at least 1− e−t that

Rn`locQ (rq) ≤ n−

12

[(C1(n)(

√r +MCvg(k))2 + C2(n, t, k, r)

) 12

+ 4

], (49)

where

C1(n) = 216σ−2b L4 logN

(n−

12 , `Q, L2(Pn)

),

C2(n, t, k, r) =

(768B2

Qt

n+ 720BQERn`locQ (rq)

)logN

(n−

12 , `Q, L2(Pn)

),

and BQ = 2L√d.

Page 21: Understanding Deep Learning with Reasoning Layer

1100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154

Understanding Deep Learning with Reasoning Layer

Moreover, for all t > 0, we have that

ERn`locQ (rq) ≤ n−12

[(C1(n)(

√r +MCvg(k))2 + C2(n, t)

) 12

+ C3(n, t) + 4

], (50)

where

C1(n) = 216σ−2b L4 logNQ,

C2(n, t) =

(1 + 3BQe

−t√logNQ +45√nBQ logNQ

)2880√nBQ logNQ + t

768B2Q

nlogNQ,

C3(n, t) = 12BQe−t√logNQ +

360√nBQ logNQ

and NQ = N (n−12 , `Q, L∞).

We first establish the estimate for the empirical Rademacher complexity Rn`locQ (rq), i.e., Eq. 49 in Theorem F.3.

Proposition F.1. Assume the problem setting in Sec 2. Let BQ = sup(θ,x)∈Θ×X ‖Qθ(x)−Q∗(x)‖F , and for each r > 0

let rq and `locQ (rq) be defined as in Theorem F.2. Then we have that

Rn`locQ (rq) ≤ 4√

n

(1 + 3BQ

√logN

(1√n, `locQ (rq), L2(Pn)

)). (51)

Moreover, for all t > 0, it holds with probability at least 1− e−t that

Rn`locQ (rq) ≤ 4√

n

(1 + 3C(rq, t)

√logN

(1√n, `locQ (rq), L2(Pn)

)), (52)

with the constant C(rq, t) =( 3rq

2 +16B2

Qt

3n + 5BQERn`locQ (rq))1/2

.

Proof. The classical Dudley’s entropy integral bound for the empirical Rademacher complexity gives us that

Rn`locQ (rq) ≤ inf

α>0

(4α+

12√n

∫ ∞α

√logN (ε, `locQ (rq), L2(Pn)) dε

). (53)

Observe that all functions in `locQ (rq) take value in [0, BQ], which implies for all ε ≥ BQ that, N (ε, `locQ (rq), L2(Pn)) ≤N (ε, `locQ (rq), L∞(Pn)) = 1 and consequently the integrand in Eq. 53 vanishes on [BQ,∞). Hence we have that

Rn`locQ (rq) ≤ inf

α>0

(4α+

12√n

∫ BQ

α

√logN (ε, `locQ (rq), L2(Pn)) dε

)

≤ 4√n

+12√n

∫ BQ

1√n

√logN (ε, `locQ (rq), L2(Pn)) dε

≤ 4√n

+12√nBQ

√logN

(1√n, `locQ (rq), L2(Pn)

),

where we used the fact thatN (ε, `locQ (rq), L2(Pn)) is decreasing in terms of ε for the last inequality. This proves the estimateEq. 51.

In order to establish the estimate Eq. 52, we shall bound the empirical error Pn‖Qθ −Q∗‖2F with high probability. Let usconsider the class of functions `locQ2(rq) = {‖Qθ −Q∗‖2F : θ ∈ Θ, P‖Qθ −Q∗‖2F ≤ rq}, whose element takes values in[0, B2

Q]. Moreover, we see it holds for all ‖Qθ−Q∗‖2F ∈ `locQ2(rq) that P‖Qθ−Q∗‖4F ≤ B2QP‖Qθ−Q∗‖2F ≤ B2

Qrq . Hence,by applying Theorem 2.1 in [15] (with F = `locQ2(rq), a = 0, b = B2

Q, α = 1/4 and r = B2Qrq) and the Cauchy-Schwarz

Page 22: Understanding Deep Learning with Reasoning Layer

1155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209

Understanding Deep Learning with Reasoning Layer

inequality, we can deduce that, for each t > 0, it holds with probability at least 1− e−t that

Pn‖Qθ −Q∗‖2F ≤ P‖Qθ −Q∗‖2F +5

2ERn`locQ2(rq) +

√2B2

Qrqt

n+B2

Q

13t

3n

≤ rq +5

2ERn`locQ2(rq) +

rq2

+B2Qt

n+B2

Q

13t

3n

≤ 3rq2

+ 5BQERn`locQ (rq) +16B2

Qt

3n.

Consequently, we see it holds with probability at least 1− e−t that, N (ε, `locQ (rq), L2(Pn)) = 1 for all ε ≥ C(rq, t), withthe constant C(rq, t) defined as in the statement of Proposition F.1. Substituting this fact into the integral bound Eq. 53 andfollowing the same argument as above, we can conclude Eq. 52 with probability at least 1− e−t.

Now we proceed to prove the estimate of the expected Rademacher complexity ERn`locQ (rq), i.e., Eq. 50 in Theorem F.3.

Proposition F.2. Assume the same setting as in Proposition F.1. Then it holds for any r, t > 0 that

ERn`locQ (rq) ≤ n−12

[(C1(n, t)(

√r +MCvg(k))2 + C2(n, t)

) 12

+ C3(n, t) + 4

], (54)

where C1(n, t), C2(n, t) and C3(n, t) the constants defined as in Eq. 57, Eq. 58 and Eq. 59, respectively.

Proof. Let r, t > 0 be fixed throughout this proof. Since it holds for all ε > 0 and n ∈ N that N (ε, `locQ (rq), L2(Pn)) ≤N (ε, `Q, L∞), we can deduce from Proposition F.1 that

ERn`locQ (rq) ≤ 4√n

(1 + 3

[C(rq, t)(1− e−t) +BQe

−t]√logN(

1√n, `Q, L∞

)), (55)

with the constants BQ and C(rq, t) defined as in the statement of Proposition F.1.

The above estimate gives an implicit upper bound of ERn`locQ (rq) since C(rq, t) also involves ERn`locQ (rq). Now we shallintroduce the notationNn

Q = N ( 1√n, `Q, L∞) and derive an explicit upper bound of ERn`locQ (rq). By rearranging the terms

in Eq. 55 and using the definition of C(rq, t), we can obtain that

√n

4ERn`locQ (rq)− 1− 3BQe

−t√

logNnQ

≤ 3(1− e−t)

√(3rq2

+16B2

Qt

3n+ 5BQERn`locQ (rq)

)logNn

Q.

(56)

We shall assume without loss of generality that ERn`locQ (rq) ≥ 4√n

(1 + 3BQe

−t√

logNnQ

), since otherwise we have a

trivial estimate that ERn`locQ (rq) ≤ 4n−12A1, with A1 = 1 + 3BQe

−t√

logNnQ. Then by squaring both sides of Eq. 56

and rearranging the terms, we get that

n

16(ERn`locQ (rq))

2 −(√

n

2A1 + 45(1− e−t)2BQ logNn

Q

)ERn`locQ (rq)

+A21 − 9(1− e−t)2A2 logNn

Q ≤ 0,

Page 23: Understanding Deep Learning with Reasoning Layer

1210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264

Understanding Deep Learning with Reasoning Layer

with the constant A2 =3rq2 +

16B2Qt

3n . This implies that

ERn`locQ (rq) ≤8

n

[√nA1

2+ 45(1− e−t)2BQ logNn

Q +

([√nA1

2+ 45(1− e−t)2BQ logNn

Q

]2− n

4

[A2

1 − 9(1− e−t)2A2 logNnQ

]) 12]

= n−12

[4A1 +

360√n

(1− e−t)2BQ logNnQ +

([4A1 +

360√n

(1− e−t)2BQ logNnQ

]2− 16

[A2

1 − 9(1− e−t)2A2 logNnQ

]) 12].

Hence, for each t > 0, by introducing the following constants

C1(n, t) = 216(1− e−t)2σ−2b L4 logNn

Q, (57)

C2(n, t) =[4A1 +

360√n

(1− e−t)2BQ logNnQ

]2 − 16A21 + t(1− e−t)2

768B2Q

nlogNn

Q

=

(1 + 3BQe

−t√

logNnQ +

45√n

(1− e−t)2BQ logNnQ

)2880√n

(1− e−t)2BQ logNnQ

+ t(1− e−t)2768B2

Q

nlogNn

Q, (58)

C3(n, t) = 12BQe−t√

logNnQ +

360√n

(1− e−t)2BQ logNnQ, (59)

with BQ = sup(θ,x)∈Θ×X ‖Qθ(x)−Q∗(x)‖F ≤ 2√dL and Nn

Q = N ( 1√n, `Q, L∞), we can deduce that

ERn`locQ (rq) ≤ n−12

[(C1(n, t)(

√r +MCvg(k))2 + C2(n, t)

) 12

+ C3(n, t) + 4

].

Page 24: Understanding Deep Learning with Reasoning Layer

1265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319

Understanding Deep Learning with Reasoning Layer

G. Poof of Algorithm properties of RNNWe denote by RNNkφ a recurrent neural network that has k unrolled RNN cells and view it as a neural algorithm. It has beenproposed in [18] to use RNN to learn an optimization algorithm where the update steps in each iteration are given by theoperations in an RNN cell

yk+1 ← RNNcell (Q, b,yk) := V σ(WLσ

(WL−1 · · ·W 2σ

(W 1

1 yk +W 12 gk

))). (60)

In the above equation, we take a specific example where the RNNcell is a multi-layer perception (MLP) with activationsσ = RELU that takes the current iterate yk and the gradient gk = Qyk + b as inputs.

(I) Stable Region. First, we show that when the parameters satisfy cφ := supQ ‖V ‖2‖W 11 + W 1

2Q‖2∏Ll=2 ‖W l‖2 < 1,

the operations in RNNcell are strictly contractive, i.e., ‖yk+1 − yk‖2 ≤ cφ‖yk − yk−1‖2.

Proof. By definition,

‖yk+1 − yk‖2 = ‖V σ(WLσ

(WL−1 · · ·W 2σ

(W 1

1 yk +W 12 gk

)))− V σ

(WLσ

(WL−1 · · ·W 2σ

(W 1

1 yk−1 +W 12 gk−1

)))‖2

≤ ‖V ‖2‖σ(WLσ

(WL−1 · · ·W 2σ

(W 1

1 yk +W 12 gk

)))− σ

(WLσ

(WL−1 · · ·W 2σ

(W 1

1 yk−1 +W 12 gk−1

)))‖2

Since the activation function σ = RELU satisfies the inequality that ‖σ(x)− σ(x′)‖2 ≤ ‖x− x′‖2 for any x,x′, we have

‖yk+1 − yk‖2 ≤ ‖V ‖2‖WLσ(WL−1 · · ·W 2σ

(W 1

1 yk +W 12 gk

))−WLσ

(WL−1 · · ·W 2σ

(W 1

1 yk−1 +W 12 gk−1

))‖2.

Similarly, we can obtain

‖yk+1 − yk‖2≤ ‖V ‖2‖WL‖2 · · · ‖W 2‖2‖

(W 1

1 yk +W 12 gk

)−(W 1

1 yk−1 +W 12 gk−1

)‖2

= ‖V ‖2‖WL‖2 · · · ‖W 2‖2‖(W 11 +QW 1

2 )(yk − yk−1)‖2≤ ‖V ‖2‖WL‖2 · · · ‖W 2‖2‖W 1

1 +QW 12 ‖2‖yk − yk−1‖2

≤ cφ‖yk − yk−1‖2.

Therefore, if cφ < 1, then the operation is strictly contractive.

(II) Stability. We shall show the neural algorithm RNNkφ has a stability constant Stab(k, φ) = O(1− ckφ) (see the definitionof stability in Sec 3).

Proof. Let us consider two quadratic problems induced by (Q, b) and (Q′, b′), and denote the corresponding outputs ofRNNkφ as yk = RNNkφ(Q, b) and y′k = RNNkφ(Q′, b′).

Denote cQφ = ‖V ‖2‖W 11 + W 1

2Q‖2∏Ll=2 ‖W l‖2, cQ

φ = ‖V ‖2‖W 11 + W 1

2Q′‖2∏Ll=2 ‖W l‖2, and cφ :=

‖V ‖2‖W 12 ‖2

∏Ll=2 ‖W l‖2. First, we see that

‖yk‖2 ≤ cQφ ‖yk−1‖2 + cφ‖b‖2 ≤ (cQφ )k‖y0‖2 + cφ‖b‖2k∑i=1

(cQφ )i−1

=cφ‖b‖2(1− (cQφ )k)

1− cQφ≤ cφ‖b‖2

1− cQφ.

(61)

Page 25: Understanding Deep Learning with Reasoning Layer

1320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374

Understanding Deep Learning with Reasoning Layer

Similar conclusion holds for y′k. Then, by following a similar argument as that for the proof of the stable region, we candeduce from y0 = y′0 that

‖yk − y′k‖2≤ ‖V ‖2‖WL‖2 · · · ‖W 2‖2‖(W 1

1 +W 21Q)yk−1 − (W 1

1 +W 21Q′)y′k−1 +W 2

1 (b− b′)‖2≤ ‖V ‖2‖WL‖2 · · · ‖W 2‖2(‖W 1

1 +W 21Q‖2‖yk−1 − y′k−1‖2 + ‖Q−Q′‖2‖W 2

1 ‖2‖y′k−1‖2+ ‖W 2

1 ‖2‖(b− b′)‖2)

≤ cQφ ‖yk−1 − y′k−1‖2 + cφ‖Q−Q′‖2cφ‖b′‖21− cQ′φ

+ cφ‖b− b′‖2

≤ (cQφ )k‖y0 − y′0‖2 +

(c2φ‖b′‖21− cQ′φ

‖Q−Q′‖2 + cφ‖b− b′‖2

)k∑i=1

(cQφ )i−1

=c2φ‖b′‖21− cQ′φ

1− (cQφ )k

1− cQφ‖Q−Q′‖2 + cφ

1− (cQφ )k

1− cQφ‖b− b′‖2.

Therefore, the stability constant is of the magnitude O(1− ckφ).

(III) Sensitivity. We now proceed to analyze the sensitivity of the neural algorithm RNNkφ as defined in Sec 3. Note thatthe strong non-linearity in the RNN cell and the high-dimensionality of the parameter space significantly complicate theanalysis of the Lipschitz dependence of RNNkφ with respect to its parameter φ = {W 1

1 ,W11 ,W

2, . . . ,WL, V }. To simplifyour presentation, we shall assume the parameter φ are constrained in a compact subset Φ of the stable region, and showthe neural algorithm RNNkφ has a sensitivity Sens(k) = O(1− (infφ∈Φ cφ)k). A rigorous sensitivity analysis of RNN withgeneral weights is out of the scope of this paper.

Proof. Let the range of parameters Φ is a compact subset of the stable region, such that for all φ ∈ Φ, cφ :=

supQ ‖V ‖2‖W 11 + W 1

2Q‖2∏Ll=2 ‖W l‖2 ≤ c0 < 1 for some constant c0. Let φ, φ′ ∈ Φ be two given sets of param-

eters. For each k ∈ N, we denote yk = RNNkφ(Q, b) and y′k = RNNkφ′(Q, b) the outputs corresponding to the parameters φand φ′, respectively. Then we have that

‖yk − y′k‖2 = ‖RNNcellφ(Q, b,yk−1)− RNNcellφ′(Q, b,y′k−1)‖2

≤ ‖RNNcellφ(Q, b,y′k−1)− RNNcellφ′(Q, b,y′k−1)‖2+ ‖RNNcellφ(Q, b,yk−1)− RNNcellφ(Q, b,y′k−1)‖2≤ ‖RNNcellφ(Q, b,y′k−1)− RNNcellφ′(Q, b,y′k−1)‖2 + cφ‖yk−1 − y′k−1‖2

If there exists a constant K, independent of k, φ, φ′, such that

‖RNNcellφ(Q, b,y′k−1)− RNNcellφ′(Q, b,y′k−1)‖2 ≤ K‖φ− φ′‖2, (62)

then we can obtain from y0 = y′0 that

‖yk − y′k‖2 ≤ v‖φ− φ′‖2 + cφ‖yk−1 − y′k−1‖2

≤ K‖φ− φ′‖2k∑i=1

ci−1φ =

1− ckφ1− cφ

K‖φ− φ′‖2.

The fact that cφ ≤ c0 < 1 for some constant c0 implies that the magnitude of sensitivity is O(1− (infφ∈Φ cφ)k).

Now it remains to establish the estimate Eq. 62. For each k ∈ N, φ = {W 11 ,W

11 ,W

2, . . . ,WL, V } and l = 2, · · · , L, weintroduce the notation

f lφ := W lσ(W l−1 · · ·W 2σ

(W 1

1 yk +W 12 gk

)), (63)

Page 26: Understanding Deep Learning with Reasoning Layer

1375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429

Understanding Deep Learning with Reasoning Layer

with f1φ = W 1

1 yk +W 12 gk. Then we have for each l = 1, · · · , L that

‖f lφ‖2 ≤l∏

j=2

‖W j‖2(‖W 1

1 +W 12Q‖2‖yk‖2 + ‖W 1

2 ‖2‖b‖2)

= cl‖yk‖2 + cl‖b‖2, (64)

with the constants cl :=(∏l

j=2 ‖W j‖2)‖W 1

1 + W 12Q‖2, cl :=

(∏lj=2 ‖W j‖2

)‖W 1

2 ‖2 for all l = 1, . . . , L. Then byinduction, we can see that

‖fLφ − fLφ′‖2 = ‖WLσ(fL−1φ )−W ′Lσ(fL−1

φ′ )‖2≤ ‖WL −W ′L‖2‖fL−1

φ′ ‖2 + ‖WL‖2‖fL−1φ − fL−1

φ′ ‖2

≤ ‖WL −W ′L‖2‖fL−1φ′ ‖2 + ‖WL‖2

(‖WL−1 −W ′L−1‖2‖fL−2

φ′ ‖2

+ ‖WL−1‖2‖fL−2φ − fL−2

φ′ ‖2)

≤L∑l=2

( L∏j=l+1

‖W j‖2)‖W l −W ′l‖2‖f l−1

φ′ ‖2 +

( L∏l=2

‖W l‖2)‖f1φ − f1

φ′‖2.

Thus we have that

‖RNNcellφ(Q, b,yk)− RNNcellφ′(Q, b,yk)‖2 = ‖V σ(fLφ )− V ′σ(fLφ′)‖2≤ ‖V − V ′‖2‖fLφ′‖2 + ‖V ‖2‖fLφ − fLφ′‖2

≤ ‖V − V ′‖2‖fLφ′‖2 + ‖V ‖2[ L∑l=2

( L∏j=l+1

‖W j‖2)‖W l −W ′l‖2‖f l−1

φ′ ‖2

+

( L∏l=2

‖W l‖2)‖f1φ − f1

φ′‖2].

Furthermore, we see that

‖f1φ − f1

φ′‖2 = ‖(W 11 +W 1

2Q)yk +W 12 b− (W ′11 +W ′12 Q)yk +W ′12 b‖2

≤ ‖W 11 −W ′11 + (W 1

2 −W ′12 )Q‖2‖yk‖2 + ‖W 12 −W ′12 ‖2‖b‖2

≤ ‖W 11 −W ′11 ‖‖yk‖2 + ‖W 1

2 −W ′12 ‖(‖Q‖2‖yk‖2 + ‖b‖2),

from which we can conclude that

‖RNNcellφ(Q, b,yk)− RNNcellφ′(Q, b,yk)‖2

≤ ‖fLφ′‖2‖V − V ′‖2 +

L∑l=2

[‖V ‖2

( L∏j=l+1

‖W j‖2)‖f l−1φ′ ‖2

]‖W l −W ′l‖2

+ ‖V ‖2( L∏l=2

‖W l‖2)[‖W 1

1 −W ′11 ‖‖yk‖2 + ‖W 12 −W ′12 ‖(‖Q‖2‖yk‖2 + ‖b‖2)

].

Note that we have assumed that the set of parameters Φ is a compact subset of the stable region and (Q, b) ∈ Sd×dµ,L × B arebounded, which imply that for all φ, φ′ ∈ Φ, the corresponding outputs (yk)k∈N and (y′k)k∈N are uniformly bound, andhence ‖f lφ′‖2 is bounded for all k and l = 1, . . . , L (see Eq. 64). Consequently, we see there exists a constant K such thatEq. 62 is satisfied. This finishes the proof of the desired sensitivity result.

(IV) Convergence. For the convergence of RNNkφ, we can only give the best case guarantee. It is easy to see that with thefollowing choice of φ, RNNkφ can represent GDks :

V = [I,−I], W 11 = [I;−I]>, W 2

1 = [−sI; sI]>, W l = I for l = 2, · · · , L. (65)

Therefore, for the best case, RNNkφ can converge at least as fast as GDks .

Page 27: Understanding Deep Learning with Reasoning Layer

1430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484

Understanding Deep Learning with Reasoning Layer

H. Experiment DetailsHere we state the configuration details of the experiments.

• Convexity and smoothness. They are set to be µ = 0.1 and L = 1, respectively.

• Dataset. 10000 pairs of (x, b) are generated in the following way: 10000 many x are uniformly sampled from[−5, 5]10 × U5×5, where U5×5 denotes the space of all 5 × 5 unitary matrices. Each input x actually is a tuplex = (zx, Ux) where zx ∈ [−5, 5]10 and Ux is unitary. 10000 many b are uniformly sampled from [−5, 5]5. These10000 pairs are viewed as the whole dataset.

• Training set Sn. During training, n samples are randomly drawn from these 10000 data points as the training set. Thelabels of these training samples are given by y = Opt(Q∗(x), b).

• More details on Q∗(x). As mentioned before, each x is a tuple x = (zx, Ux). Then we implement Q∗(x) =Uxdiag([g∗(zx), µ, L])U>x , where g∗ is a 2-layer dense neural network with hidden dimension 3, output dimension3, and with randomly fixed parameters. Note that in the final layer of g∗, there is a sigmoid-activation that scales theoutput to the range [0, 1] and then the range is further re-scaled to [µ,L]. Finally, g∗(zx) is concatenated with [µ,L]to form a 5-dimensional vector with smallest and largest value to be µ and L respectively. This vector represents theeigenvalues of Q∗(x).

• Architecture of Qθ. Qθ has the same form as Q∗(x), except that the network g∗ in Q∗ becomes gθ in Qθ. That is,Qθ(x) = Uxdiag([gθ(zx), µ, L])U>x . Here gθ is also a 2-layer dense neural network with output dimension 3, butthe hidden dimension can vary. In the reported results, when we say hidden dimension=0, it means gθ is a one-layernetwork.

For the experiments that compare RNNkφ with GDkφ and NAGkφ, they are conducted under the ‘learning to learn’ scenario, withthe following modifications compared to the above setting.

• Dataset. Instead of sampling (x, b), here we directly sample the problem pairs (Q, b). Similarly, 10000 pairs of (Q, b)are sampled uniformly from S10×10

µ,L × [−5, 5]10.

• Architecture of RNNkφ. For each cell in RNNkφ, it is a 4-layer dense neural network with hidden dimension 20-20-20.

For all experiments, each model has been trained by both ADAM and SGD with learning rate searched over [1e-2,5e-3,1e-3,5e-4,1e-4], and only the best result is reported. Furthermore, error bars are produced by 20 independent instantiations ofthe experiments. The experiments are mainly run parallelly (since we need to search the best learning rate) on clusters whichhave 416 nodes where on each node there are 24 Xeon 6226 CPU @ 2.70GHz with 192 GB RAM and 1x512 GB SSD.