Needles in a haystack
Building on Models: Experiences from a Decade with the Microcircuit Model
KHK • Aachen • 3 April 2024
How machine learning falls short of learning mechanistic models, and what we can do about it
Alexandre René
Computational Network Science group (RWTH)
rene@cs.rwth-aachen.de
Concept vs Task oriented workflows
Usual scientific workflow
Anecdotal
observations
Usual scientific workflow
Usual mL workflow
Conceive theory
Conceive experiment
Accumulate data
Compare
Make prediction
New experiment?
Conceive task
experiment
Select architecture
Learn theory
Train model
Make prediction
Compare
New task?
Assumptions
Symmetry
Conservation
Exchangeability
Assumptions
Symmetry
Color invariance
Exchangeability
Anecdotal
observations









Anecdotal
observations
Validate/falsify
Validate/falsify
Accumulate data
(training data)
Accumulate more data
(test data)
Concept vs Task oriented workflows
Needles in a haystack



Optimize model
Falsification analysis




Part 1:
Learning with
domain-motivated constraints
domain-motivated constraints
Mesocircuit model


Inference constrained by a dynamical system
(René et al, Neural Comp, 2020)
- Treat the dynamical system as a very complicated recurrent neural network (RNN).
- Optimize parameters with backpropagation through time (BPTT).
Train output
Mesoscopic model
Fit dynamics
(Schwalger, Deger & Gerstner, 2017)
(René et al, Neural Comp, 2020)
- Treat the dynamical system as a very complicated recurrent neural network ( ).
- Optimize parameters with backpropagation through time .
What we gain compared to a standard RNN:
- Fewer parameters ( )
- Fewer redundancies between parameters
- Robust training
- Out-of-the-box generalization
So why don’t more people do this ?
- Specifying the system is really hard.
Inference constrained by a dynamical system
RNN
(BPTT)
\(\color{#3cb100} Θ\)
\(\color{#3cb100} Θ\)
…
Treat the mesoGIF model as an and learn with
backpropagation through time
RNN
(BPTT)
https://sinn-full.readthedocs.io/

Must implement entire model symbolically
Caveat:
Toolbox for making differentiable models
Complex constraints → Non-convex optimization
Fit dynamics
Mesoscopic model
Many distinct Θ produce output consistent with data
Even worse case: dozens of plausible, distinct candidate models
Part 2:
Comparing candidate models
Small 2 neuron circuit


Needles in a haystack


Optimize model
Falsification analysis




Domain constraints
Still many plausible candidate models
Distinguishing candidate models
of the lobster pyloric circuit
Four candidate models for LP
(René & Longtin, in preparation)
expected risk (\(R\))
Model: Prinz et al, Similar network activity from disparate circuit parameters, 2004
What we were doing before
Is this difference meaningful ?
“Observed” data
Model
Distinguishing candidate models
(René & Longtin, in preparation)
expected risk (\(R\))
Is this difference meaningful ?
This is a model selection problem
| 512 | 2×10⁻⁵ | -5×10⁻⁴ | 5×10⁻³ |
| 4096 | 2×10⁻⁵ | -5×10⁻⁴ | 5×10⁻³ |
| 32768 | 2×10⁻⁵ | -5×10⁻⁴ | 5×10⁻³ |
| 512 | -0.72 | -0.74 | 5.64 |
| 4096 | 0.64 | -0.41 | 14.49 |
| 32768 | -3.02 | 10.33 | 40.41 |
| 512 | 4×10⁻¹¹ | 5×10⁻¹¹ | 4×10⁻¹¹ |
| 4096 | 4×10⁻¹⁰ | 4×10⁻¹⁰ | 4×10⁻¹⁰ |
| 32768 | 1×10⁻⁹ | 1×10⁻⁹ | 1×10⁻⁹ |
| 512 | 0 | 0 | 0 |
| 4096 | 0 | 0 | 0 |
| 32768 | 0 | 0 | 0 |
Expected risk
Probability ratios
\( \log_{10} \left(\displaystyle \frac{\mathbb{P}(\text{model } A)}{\mathbb{P}(\text{model } B)}\right)\)
Likelihood ratio
Bayes factor
Bayesian expected risk
Noise strength →
Dataset size ↴
\(\bf 2^{-12}\)
\(\bf 2^{-16}\)
\(\bf 2^{-20}\)
↓ Inconsistent values
→↓ Unreliable scale
↓ Inconsistent values
→ Unreliable scale
Prior-dependent
Data hungry
↓ Inconsistent values
→ Unreliable scale
Prior-dependent
Data hungry
↓ Convergences with size
Arbitrary scale
Distinguishing candidate models
expected risk (\(R\))
Is this difference meaningful ?
This is a model selection problem
…but the usual methods either
- have no notion of scale
- don’t converge as #samples increases
- make strong but unreliable selections
(expected risk)
(likelihood, Bayes)
(likelihood)
We need
- a way to quantify the strength of evidence
- which converges as #samples increases
- Reproducibility
- Generalizability
- Robustness against modelling errors
Distinguishing candidate models
expected risk (\(R\))
Is this difference meaningful ?
This is a model selection problem
We need
- a way to quantify the strength of evidence
- which converges as #samples increases
- Reproducibility
- Generalizability
- Robustness against modelling errors
Ternary criterion
(three options)
Reported
strong evidence
\(\Rightarrow\)
Reported
weak evidence
\(\Rightarrow\)
Model selection outcome is robust
Inconsequential
(no model selected)
Distinguishing candidate models
We need
- a way to quantify the strength of evidence
- which converges as #samples increases
Observation:
Expected risk measures only aleatoric uncertainty.
(In-class errors)
Realization:
Neglecting epistemic uncertainty is what causes the likelihood to be overconfident.
(out-of-class / modelling errors)
Idea:
Epistemic uncertainty can quantify the strength of evidence
| 512 | 2×10⁻⁵ | -5×10⁻⁴ | 5×10⁻³ |
| 4096 | 2×10⁻⁵ | -5×10⁻⁴ | 5×10⁻³ |
| 32768 | 2×10⁻⁵ | -5×10⁻⁴ | 5×10⁻³ |
| 512 | -0.72 | -0.74 | 5.64 |
| 4096 | 0.64 | -0.41 | 14.49 |
| 32768 | -3.02 | 10.33 | 40.41 |
- Robustness against modelling errors
- Generalizability
- Reproducibility
Expected risk
Likelihood ratio
Dataset size ↴
\(\bf 2^{-12}\)
\(\bf 2^{-16}\)
\(\bf 2^{-20}\)
(Hüllermeier & Wagerman, 2021)
(Kiureghian & Ditlevsen, 2009)
↓ Inconsistent values
→↓ Unreliable scale
↓ Convergences with size
Arbitrary scale
(René & Longtin, in preparation)
Estimating epistemic (out-of-class) error
by comparing data and theory distributions
Evaluate two percent-point functions \(q\) (PPF, aka quantile function, aka inverse CDF).
- The mixed PPF evaluates the model loss on the true samples.
- The synthetic PPF evaluates the model loss on simulated model samples.
The difference between the two PPFs we call the empirical model discrepancy: \(δ^{\mathrm{EMD}}\).
The “real” PPF should be somewhere between these curves.
We sample PPFs such that their variance is proportional to \(δ^{\mathrm{EMD}}\).
Each PPF
Distribution of PPFs ⇒ Distribution of expected risks \(R\)
⇒ Different expected risk \(R\)
(René & Longtin, in preparation)
Epistemic uncertainty as distribution of expected risk
PPF samples
expected risk (\(R\))
quantile
\(Φ\)
Reported
strong evidence
\(\Rightarrow\)
Reported
weak evidence
\(\Rightarrow\)
Model selection outcome is robust
Inconsequential
(no model selected)
(René & Longtin, in preparation)
Epistemic uncertainty as distribution of expected risk
We interpret \(R\)-distributions as follows:
- Aleatoric uncertainty ⇒ location
- Epistemic uncertainty ⇒ scale
PPF samples
expected risk distribution (\(R\))
Reported
strong evidence
\(\Rightarrow\)
Reported
weak evidence
\(\Rightarrow\)
Model selection outcome is robust
Inconsequential
(no model selected)
quantile
\(Φ\)
Probability ratios – \(\displaystyle \frac{\mathbb{P}(\text{model } A)}{\mathbb{P}(\text{model } B)}\)
EMD-criterion is more consistent
then previously shown criteria
(René & Longtin, in preparation)
| 512 | -0.09 | 0.06 | 0.44 |
| 4096 | -0.04 | 0.10 | 0.62 |
| 32768 | 0.02 | -0.05 | 0.32 |
| 512 | 2×10⁻⁵ | -5×10⁻⁴ | 5×10⁻³ |
| 4096 | 2×10⁻⁵ | -5×10⁻⁴ | 5×10⁻³ |
| 32768 | 2×10⁻⁵ | -5×10⁻⁴ | 5×10⁻³ |
| 512 | -0.72 | -0.74 | 5.64 |
| 4096 | 0.64 | -0.41 | 14.49 |
| 32768 | -3.02 | 10.33 | 40.41 |
| 512 | 4×10⁻¹¹ | 4×10⁻¹¹ | 4×10⁻¹¹ |
| 4096 | 4×10⁻¹⁰ |
4×10⁻¹⁰ |
4×10⁻¹⁰ |
| 32768 | 1×10⁻⁹ |
1×10⁻⁹ |
1×10⁻⁹ |
| 0 |
0 |
0 |
|
| 0 |
0 |
0 |
|
| 0 |
0 |
0 |
Expected risk
Likelihood ratio
Bayes factor
Bayesian expected risk
Noise strength →
Dataset size ↴
↓ Inconsistent values
→↓ Unreliable scale
↓ Inconsistent values
→ Unreliable scale
Prior-dependent
Data hungry
↓ Inconsistent values
→ Unreliable scale
Prior-dependent
Data hungry
\(\bf 2^{-12}\)
\(\bf 2^{-16}\)
\(\bf 2^{-20}\)
EMD criterion
↓ Convergences with size
Arbitrary scale
↓ Convergences with size
Scale adjusted by epistemic uncertainty
EMD-falsification available in a Python toolbox
(René & Longtin, in preparation)
from emd_falsify import Bemd, make_empirical_risk
synth_ppfA = make_empirical_risk(lossA(modelA.generate(Lsynth)))
synth_ppfB = make_empirical_risk(lossB(modelB.generate(Lsynth)))
mixed_ppfA = make_empirical_risk(lossA(data))
mixed_ppfB = make_empirical_risk(lossB(data))
Bemd(mixed_ppfA, mixed_ppfB, synth_ppfA, synth_ppfB, c=c)
Summary


Optimize model
Falsification analysis




Domain constraints
Aleatoric uncertainty
≠
Epistemic uncertainty
Collaborators

Neurophysics group (Ottawa)
Machine learning in science group (Tübingen)
Institute for Advanced Simulation (IAS-6), Computational and Systems Neuroscience (Jülich)
Computational Network Science group (Aachen)
- Claudia Merger
- Sandra Nestler
- Prof. Moritz Helias
- Peter Bouss
- Kirsten Fischer
- Prof. André Longtin
- Prof. Jakob Macke
- Prof. Michael Schaub
- Bastian Epping
- Josef Hoppe
Resources

Model falsification paper
(pre-pre-print)

Model falsification toolbox
(emd-falsify on PyPI)

Mesoscopic inference
(René et al., 2020,
Neural Comp.)

Pyloric circuit simulator
(Python+JAX, GitHub)

Model inference toolbox
(Python+Theano, GitHub)
EXTRAS
(René et al, Neural Comp, 2020)
Inference constrained by a dynamical system
EXTRA: Recovery of effective parameters for out-of-class (heterogeneous populations)
Empirical CDF and PPF
Aleatoric sources of variability
Distribution of the per-sample loss
Bootstrap estimate for the uncertainty of the expected risk
Two models of blackbody radiation

Radiance
Wavelength (μm)
Wavelength (μm)
Rayleigh-Jeans model
Planck model
No measurement is perfect, so we also simulate noise:
(René & Longtin, in preparation)
(René & Longtin, in preparation)
Epistemic uncertainty as distribution of expected risk
Each PPF
Distribution of PPF ⇒ Distribution of expected risks \(R\)
⇒ Different expected risk \(R\)
- Aleatoric error ⇒ position
- Epistemic error ⇒ spread


Reduce noise
(René & Longtin, in preparation)
EXTRA: Calibrating the stochastic quantile process

Inferring the mesoGIF model with
backpropagation through time (BPTT)
- Models can have dozens of parameters
- Parameter sweeps would be prohibitive
- BPTT is typically used to train RNNs
- Models can be viewed as complicated RNNs
Baye's theorem
+ Markov property
\({\color{#ff4e37} u(t_{k-1})} + Δt \cdot\! \left.\frac{d {\color{#ff4e37} u}}{dt}\right\rvert_{{\color{#d39f4d} Θ}, {\color{#56ff00} I}}\)
\({\color{#56ff00} Θ}\)
\(\mathcal{M}\)
\({\color{#ff4e37} u(t)}\)
\({\color{#d39f4d} I(t)}\)
Model; \(\left.\frac{d {\color{#ff4e37} u}}{dt}\right\rvert_{{\color{#56ff00} Θ}, {\color{#d39f4d} I}}\)
Model parameters
Observations
Inputs
BPTT looks for:
Parameters of the mesoscopic model
René et al. (2020)
| Parameter | No. components | Description |
|---|---|---|
| connection probability | ||
| connection weight | ||
| transmission delay | ||
| no. of neurons in pop | ||
| membrane resistance | ||
| membrane resting potential | ||
| membrane time constant | ||
| absolute refractory period | ||
| non-adapting threshold | ||
| reset potential | ||
| escape rate at threshold | ||
| noise level | ||
| synaptic time constant | ||
| adaptation strength | ||
| adaptation time constant |
models the average population activity
models spiking of each individual neurons
mesoGIF:
GIF:
(Schwalger et al., 2017)
(Gerstner et al., 2014)
GIF:
mesoGIF:
Homogeneous
| Parameter | No. components | Description |
|---|---|---|
| connection probability | ||
| connection weight | ||
| transmission delay | ||
| no. of neurons in pop | ||
| membrane resistance | ||
| membrane resting potential | ||
| membrane time constant | ||
| absolute refractory period | ||
| non-adapting threshold | ||
| reset potential | ||
| escape rate at threshold | ||
| noise level | ||
| synaptic time constant | ||
| adaptation strength | ||
| adaptation time constant |
models the average population activity
models spiking of each individual neurons
mesoGIF:
GIF:
(Schwalger et al., 2017)
(Gerstner et al., 2014)
mesoGIF:
Homogeneous
\(\color{#3cb100} Θ\)
Parameters of the mesoscopic model
Inferring the mesoGIF model
2 populations,
14 parameters to infer
Train
Test
Input
Output – true
Optimizer
iterations
Input
Output – pop E – model vs true
Not shown:
Also demonstrated with 4 populations,
36 parameters
( )
Pop. E
Pop. I
René et al. (Neural Computation, 2020)
Results for the mesoGIF model
Inference finds effective parameters which compensate for incorrect model assumptions
René et al. (Neural Computation, 2020)
Heterogeneous parameters
GIF (true model)
mesoGIF (homogeneous model) –
Theoretical params
mesoGIF (homogeneous model) –
Inferred params
MCMC sampling with the mesoGIF model
A differentiable likelihood can also be used for MCMC sampling
→credible intervals (Bayesian error bars) on the parameters
(Marginals from the 14-D distribution)
René et al. (Neural Computation, 2020)
Needles in a Haystack – Anniversary of Potjans-Diesmann model – Aachen 2024
By Alexandre René
Needles in a Haystack – Anniversary of Potjans-Diesmann model – Aachen 2024
- 39