Incorporate Jonathan's correction to sliding-window decoding sections

This commit is contained in:
2026-05-04 17:35:33 +02:00
parent 7bf1b2f8d7
commit a977860ddb
2 changed files with 77 additions and 75 deletions

View File

@@ -2,31 +2,30 @@
\chapter{Decoding under Detector Error Models} \chapter{Decoding under Detector Error Models}
\label{ch:Decoding} \label{ch:Decoding}
In \Cref{ch:Fundamentals} we introduced the fundamentals of classical In \Cref{ch:Fundamentals}, we introduced the fundamentals of classical
error correction, before moving on to quantum information science and error correction, before moving on to quantum information science and
finally combining the two in \acf{qec}. finally combining the two in \acf{qec}.
In \Cref{ch:Fault tolerance} we then turned to fault-tolerance, with In \Cref{ch:Fault tolerance}, we then turned to fault-tolerance, with
a focus on a specific way of implementing it, called \acfp{dem}. a focus on a specific way of implementing it, called \acfp{dem}.
In this chapter, we move on from the fundamental concepts and examine In this chapter, we move on from the fundamental concepts and examine
how to apply them in practice. how to apply them in practice.
Specifically, we concern ourselves with the practical aspects of decoding Specifically, we consider the practical aspects of decoding under \acp{dem}.
under \acp{dem}.
We investigate decoding \acf{qldpc} codes under \acp{dem} in particular. In particular, we investigate decoding \acf{qldpc} codes under \acp{dem}.
We focus on \ac{qldpc} codes, as they have emerged as leading We focus on \ac{qldpc} codes, as they have emerged as leading
candidates for practical quantum error correction, offering candidates for practical quantum error correction, offering
comparable thresholds with substantially improved encoding rates comparable thresholds with substantially improved encoding rates
\cite[Sec.~1]{bravyi_high-threshold_2024}. \cite[Sec.~1]{bravyi_high-threshold_2024}.
Because of this, the decoding algorithms we consider will all be Because of this, the decoding algorithms we consider will all be
related to \acf{bp} in some way. based on \acf{bp}.
Our aim is to build a fault-tolerant \ac{qec} system that works well Our aim is to build a fault-tolerant \ac{qec} system that works well
even in the presence of circuit-level noise. even in the presence of circuit-level noise.
We must overcome two main challenges to achieve this. We must overcome two main challenges to achieve this.
First, recall the problems related to degeneracy, which is inherent First, recall the problems related to degeneracy, which is inherent
to quantum codes. to quantum codes.
Because multiple minimum-weight codewords exist, the \ac{bp} Because multiple minimum-weight solutions to the decoding problem may
algorithm becomes uncertain of the direction to proceed in. exist, the \ac{bp} algorithm becomes uncertain of the direction to proceed in.
Additionally, the commutativity conditions of the stabilizers Additionally, the commutativity conditions of the stabilizers
necessitate the existence of short cycles. necessitate the existence of short cycles.
Together, these two aspects lead to substantial convergence problems Together, these two aspects lead to substantial convergence problems
@@ -40,28 +39,28 @@ We also perform multiple rounds of syndrome measurements,
exacerbating the problem. exacerbating the problem.
This leads to a massively increased computational complexity and This leads to a massively increased computational complexity and
latency of the decoding process. latency of the decoding process.
In our experiments using the $\llbracket 144,12,12 \rrbracket$ For example, in our experiments using the $\llbracket 144,12,12
\acf{bb} code with $12$ syndrome measurement rounds, for example, the \rrbracket$ \acf{bb} code with $12$ syndrome measurement rounds, the
number of \acp{vn} grew from $144$ to $9504$, and the number of \acp{vn} grew from $144$ to $9504$, and the number of
number of \acfp{cn} grew from $72$ to $1008$. \acfp{cn} grew from $72$ to $1008$.
The first problem is not inherent to \acp{dem} or fault-tolerance, The first problem is not inherent to \acp{dem} or fault-tolerance,
but rather quantum codes in general. but rather quantum codes in general.
Many different approaches to solving it exist, usually centered Many different approaches to solving it exist, usually centered
around somehow modifying \ac{bp}. around modifying \ac{bp}.
The most popular approach is combining a few initial The most popular approach is combining a few initial iterations of
iterations of \ac{bp} with a second decoding algorithm, \ac{osd} \ac{bp} with a second decoding algorithm, namely \ac{osd}
\cite{roffe_decoding_2020}. \cite{roffe_decoding_2020}.
Other approaches exist, such as \ac{aed} Other approaches exist, such as \ac{aed}
\cite{koutsioumpas_automorphism_2025}, where multiple variations of \cite{koutsioumpas_automorphism_2025}, where multiple variations of
the code are decoded simultaneously to increase the chances of convergence. the syndrome, based on graph and code symmetries, are decoded
simultaneously to increase the chances of convergence.
Here, we will focus on the \acf{bpgd} algorithm Here, we will focus on the \acf{bpgd} algorithm
\cite{yao_belief_2024} we already introduced in \Cref{ch:Fundamentals}, \cite{yao_belief_2024} introduced in \Cref{ch:Fundamentals}.
for reasons that will become clear later in the chapter.
The second problem is inherent to decoding using \acp{dem}. The second problem is inherent to decoding using \acp{dem}.
This is an area that has received less attention. This is an area that has so far received less attention in the literature.
As we saw in \Cref{sec:Quantum Error Correction}, for \ac{qec}, As discerned in \Cref{sec:Quantum Error Correction}, for \ac{qec},
latency is the main constraint, not raw computational complexity. latency is the main constraint, not raw computational complexity.
The main way this is addressed in the literature is \emph{sliding The main way this is addressed in the literature is \emph{sliding
window decoding}, which attempts to divide the overall decoding window decoding}, which attempts to divide the overall decoding
@@ -70,7 +69,7 @@ problem into many smaller ones that can be solved more efficiently.
% TODO: This could potentially be a bit more text (e.g., go into % TODO: This could potentially be a bit more text (e.g., go into
% SC-LDPC like structure that serves as the inspiration for the % SC-LDPC like structure that serves as the inspiration for the
% warm-start decoding. Or just go into warm-start decoding) % warm-start decoding. Or just go into warm-start decoding)
Our own work will focus mostly on the the solution of the second In this thesis, we will focus mostly on the the solution of the second
problem using sliding-window decoding. problem using sliding-window decoding.
We will start by briefly reviewing the existing work related to We will start by briefly reviewing the existing work related to
sliding-window decoding, sliding-window decoding,
@@ -200,7 +199,7 @@ Each of these windows is then decoded separately.
% Some general notes % Some general notes
\Cref{fig:literature} gives an overview over the existing body of work \Cref{fig:literature} gives an overview over the existing works
related to sliding-window decoding. related to sliding-window decoding.
The papers \cite{huang_improved_2023} and \cite{huang_increasing_2024} are The papers \cite{huang_improved_2023} and \cite{huang_increasing_2024} are
lumped together, as they share the same content; lumped together, as they share the same content;
@@ -217,9 +216,9 @@ software freely available online%
\footnote{ \footnote{
\url{https://github.com/gongaa/SlidingWindowDecoder} \url{https://github.com/gongaa/SlidingWindowDecoder}
}. }.
A final thing to note is that \cite{dennis_topological_2002} never Finally, note that \cite{dennis_topological_2002} never explicitly
explicitly mentions sliding windows; the authors call their scheme mentions sliding windows; the authors call their scheme ``overlapping
``overlapping recovery''. recovery''.
% Topological vs QLDPC % Topological vs QLDPC
@@ -244,7 +243,7 @@ Finally, \cite{gong_toward_2024} explores \ac{bb} codes.
% Sequential vs parallel % Sequential vs parallel
After having divided the whole circuit into separate windows, the question After having divided the whole circuit into separate windows, the question
arises of how exactly to realize the decoding. arises of how to make use of the window-like structure for decoding.
There are two main approaches, with differing mechanisms of reducing There are two main approaches, with differing mechanisms of reducing
the latency. the latency.
Some papers decode the sliding windows in a parallel fashion. Some papers decode the sliding windows in a parallel fashion.
@@ -252,7 +251,8 @@ The benefit in this case is
is that classical hardware can be utilized more effectively. is that classical hardware can be utilized more effectively.
Others choose a sequential approach. Others choose a sequential approach.
Here, decoding can start earlier, as there is no need to wait for the Here, decoding can start earlier, as there is no need to wait for the
syndrome measurements of all windows before beginning with the decoding. syndrome measurements of subsequent windows before beginning with the
decoding of earlier windows.
With the exception of \cite{dennis_topological_2002}, literature With the exception of \cite{dennis_topological_2002}, literature
treating topological codes has mostly focused on parallel decoding treating topological codes has mostly focused on parallel decoding
while literature treating \ac{qldpc} codes has wholly considered while literature treating \ac{qldpc} codes has wholly considered
@@ -261,7 +261,7 @@ sequential decoding.
% Deep-dive into QLDPC methods % Deep-dive into QLDPC methods
For this work, the publications treating \ac{qldpc} codes are For this work, the publications treating \ac{qldpc} codes are
especially interesting. particularly interesting.
The experimental conditions for these are summarized in The experimental conditions for these are summarized in
\Cref{table:experimental_conditions}. \Cref{table:experimental_conditions}.
As we noted above, \ac{hgp} and \ac{lp} codes are considered in As we noted above, \ac{hgp} and \ac{lp} codes are considered in
@@ -286,12 +286,12 @@ explicitly work with the \ac{dem} formalism.
sliding-window decoding for \ac{qldpc} codes.} sliding-window decoding for \ac{qldpc} codes.}
\vspace*{3mm} \vspace*{3mm}
\label{table:experimental_conditions} \label{table:experimental_conditions}
\begin{tabular}{l|ccc} \begin{tabular}{lccc}\toprule
% tex-fmt: off % tex-fmt: off
Publication & Code & Noise Model & Decoder \\ \hline Publication & Code & Noise Model & Decoder \\ \midrule
\hspace{-2.5mm}\cite{huang_improved_2023},\cite{huang_increasing_2024} & \acs{hgp}, \acs{lp} & Phenomenological noise & \acs{bp} + \acs{osd} \\ \hspace{-2.5mm}\cite{huang_improved_2023},\cite{huang_increasing_2024} & \acs{hgp}, \acs{lp} & Phenomenological noise & \acs{bp} + \acs{osd} \\
\hspace{-2.5mm}\cite{gong_toward_2024} & \acs{bb} & Circuit-level noise & \acs{bp} + \acs{gdg} \\ \hspace{-2.5mm}\cite{gong_toward_2024} & \acs{bb} & Circuit-level noise & \acs{bp} + \acs{gdg} \\
\hspace{-2.5mm}\cite{kang_quits_2025} & \acs{hgp}, \acs{lp}, \acs{bpc} & Circuit-level noise & \acs{bp} + \ac{osd} \hspace{-2.5mm}\cite{kang_quits_2025} & \acs{hgp}, \acs{lp}, \acs{bpc} & Circuit-level noise & \acs{bp} + \acs{osd} \\ \bottomrule
% tex-fmt: on % tex-fmt: on
\end{tabular} \end{tabular}
\end{table} \end{table}
@@ -382,7 +382,7 @@ explicitly work with the \ac{dem} formalism.
\subsection{Window Splitting and Sequential Sliding-Window Decoding} \subsection{Window Splitting and Sequential Sliding-Window Decoding}
\label{subsec:Window Splitting and Sequential Sliding-Window Decoding} \label{subsec:Window Splitting and Sequential Sliding-Window Decoding}
In this section, we will examine the methodology by which a detector In this section, we examine the methodology by which a detector
error matrix is divided into overlapping windows. error matrix is divided into overlapping windows.
The algorithm detailed here follows \cite{kang_quits_2025}, which The algorithm detailed here follows \cite{kang_quits_2025}, which
is in turn based on \cite{huang_increasing_2024}. is in turn based on \cite{huang_increasing_2024}.
@@ -411,11 +411,10 @@ After decoding a window, there is a subset of \acp{cn} that
no longer contribute to decoding, since none of their no longer contribute to decoding, since none of their
neighboring \acp{vn} appear in subsequent windows. neighboring \acp{vn} appear in subsequent windows.
We call the set of \acp{vn} connected to those \acp{cn} the We call the set of \acp{vn} connected to those \acp{cn} the
\emph{commit region} and we wish to commit them before moving to the \emph{commit region} and we commit them before moving to the
next window, i.e., fix the values we estimate for the corresponding bits. next window, i.e., fix the values we estimate for the corresponding bits.
As mentioned above, the benefit of this sequential sliding-window The benefit of this sequential sliding-window decoding approach is
decoding approach that the decoding process can begin as soon as the syndrome
is that the decoding process can begin as soon as the syndrome
measurements for the first window are complete. measurements for the first window are complete.
% W and F and why we look at rows, not columns % W and F and why we look at rows, not columns
@@ -425,15 +424,15 @@ The \emph{window size} $W \in \mathbb{N}$ represents the number of
syndrome extraction rounds lumped into one window, while syndrome extraction rounds lumped into one window, while
the \emph{step size} $F \in \mathbb{N}$ represents the number of the \emph{step size} $F \in \mathbb{N}$ represents the number of
syndrome extraction rounds skipped before starting the next window. syndrome extraction rounds skipped before starting the next window.
$W$ controls the size of the windows while $F$ controls the overlap The parameter $W$ controls the size of the windows while $F$ controls
between them. the overlap between them.
As illustrated in \Cref{fig:windowing_pcm}, $W$ and $F$ control the As illustrated in \Cref{fig:windowing_pcm}, $W$ and $F$ control the
window dimensions and locations by defining the related \acp{cn}, window dimensions and locations by defining the related \acp{cn},
not the \acp{vn}. not the \acp{vn}.
This is because while the number of overall \acp{cn} is only affected This is because the number of overall \acp{cn} is only affected
by the choice of the underlying code and the number of syndrome by the choice of the underlying code and the number of syndrome
measurement rounds, the number of \acp{vn} depends on the noise model measurement rounds, while the number of \acp{vn} depends on the noise
and is difficult to predict beforehand. model and is difficult to predict beforehand.
\begin{figure}[t] \begin{figure}[t]
\centering \centering
@@ -469,18 +468,16 @@ and is difficult to predict beforehand.
matrix generated from the $\llbracket 72, 6, 6 \rrbracket$ matrix generated from the $\llbracket 72, 6, 6 \rrbracket$
BB code under circuit-level noise. BB code under circuit-level noise.
The block-diagonal structure reflects the time-like locality The block-diagonal structure reflects the time-like locality
of the syndrome extraction circuit., with each block of the syndrome extraction circuit, with each block
corresponding to one syndrome measurement round. corresponding to one syndrome measurement round.
Two consecutive windows are highlighted: the window size $W$ Two consecutive windows are highlighted: the window size $W
controls the number of syndrome rounds included in each \in \mathbb{N}$ controls the number of syndrome rounds
window, while the step size $F$ controls how many rounds included in each window, while the step size $F \in
separate the start of one window from the next. \mathbb{N}$ controls how many rounds separate the start of
one window from the next.
The bracketed region indicates the commit The bracketed region indicates the commit
region of the first window, i.e., the \acp{vn} that are committed region of the first window, i.e., the \acp{vn} that are committed
before moving to the second window. before moving to the decoding of the second window.
% Visualization of the windowing process on a detector
% error matrix generated from the $\llbracket 72, 6, 6
% \rrbracket$ BB code.
} }
\label{fig:windowing_pcm} \label{fig:windowing_pcm}
\end{figure} \end{figure}
@@ -493,9 +490,9 @@ We use the variables $n,m \in \mathbb{N}$ to describe the number of
We index the \acp{vn} using the variable $i \in \mathcal{I} := We index the \acp{vn} using the variable $i \in \mathcal{I} :=
[0:n-1]$ and the \acp{cn} using the variable $j \in \mathcal{J} := [ 0 : m-1]$. [0:n-1]$ and the \acp{cn} using the variable $j \in \mathcal{J} := [ 0 : m-1]$.
Finally, we call $\mathcal{N}_\text{V}(i) = \left\{ j\in \mathcal{J}: Finally, we call $\mathcal{N}_\text{V}(i) = \left\{ j\in \mathcal{J}:
\bm{H}_{j,i} = 1 \right\}$ and $\mathcal{N}_\text{C}(j) := \left\{ i H_{j,i} = 1 \right\}$ and $\mathcal{N}_\text{C}(j) := \left\{ i
\in \mathcal{I} : \bm{H}_{j,i} = 1 \right\}$ the neighborhoods of the \in \mathcal{I} : H_{j,i} = 1 \right\}$ the neighborhoods of the
corresponding nodes. respective nodes.
In this case, we take $\bm{H} \in \mathbb{F}_2^{m\times n}$ to be the In this case, we take $\bm{H} \in \mathbb{F}_2^{m\times n}$ to be the
check matrix of the underlying code, from which the \ac{dem} was generated. check matrix of the underlying code, from which the \ac{dem} was generated.
We use $m_\text{DEM}, \mathcal{I}_\text{DEM}$, and $\mathcal{J}_\text{DEM}$ We use $m_\text{DEM}, \mathcal{I}_\text{DEM}$, and $\mathcal{J}_\text{DEM}$
@@ -503,17 +500,17 @@ to refer to the respective values defined from the detector error matrix.
% How we get the corresponding rows % How we get the corresponding rows
We begin by describing the sets of \acp{cn} relevant to each window. First, we describe the sets of \acp{cn} relevant to each window.
For indexing, we use the variable $\ell \in [0:n_\text{win} - 1]$, For indexing, we use the variable $\ell \in [0:n_\text{win} - 1]$,
where $n_\text{win} \in \mathbb{N}$ is the number of windows. where $n_\text{win} \in \mathbb{N}$ is the number of windows.
Because we defined the step size $F$ as the number of syndrome Since we define the step size $F$ as the number of syndrome
extraction rounds to skip, the first \ac{cn} of window $\ell$ should have index extraction rounds to skip, the first \ac{cn} of window $\ell$ has index
$\ell F m$. $\ell F m$.
Similarly, because of the way we defined the window size $W$, the Similarly, due to the definition of the window size $W$, the
number of \acp{cn} should be $Wm$ for all but the last window. number of \acp{cn} per window is $Wm$ for all but the last window.
The number of \acp{cn} in the last window may differ if there are The number of \acp{cn} in the last window may differ if there are
not enough \acp{cn} left to completely fill it. not enough \acp{cn} left to completely fill it.
We thus define Thus, we define
\begin{align*} \begin{align*}
\mathcal{J}_\text{win}^{(\ell)} &:= \left\{ j\in \mathcal{J}_\text{DEM}:~ \mathcal{J}_\text{win}^{(\ell)} &:= \left\{ j\in \mathcal{J}_\text{DEM}:~
\ell F m \le j < \min \left\{m_\text{DEM}, (\ell F + W) m \right\} \ell F m \le j < \min \left\{m_\text{DEM}, (\ell F + W) m \right\}
@@ -522,13 +519,13 @@ We thus define
\mathcal{J}_\text{commit}^{(\ell)} &:= \left\{ j\in \mathcal{J}_\text{DEM}:~ \mathcal{J}_\text{commit}^{(\ell)} &:= \left\{ j\in \mathcal{J}_\text{DEM}:~
\ell F m \le j < \min \left\{m_\text{DEM}, (\ell + 1) F m \right\} \ell F m \le j < \min \left\{m_\text{DEM}, (\ell + 1) F m \right\}
\right\} \right\}
.% ,%
\end{align*} \end{align*}
$\mathcal{J}_\text{win}^{(\ell)}$ is the set of all \acp{cn} in the where $\mathcal{J}_\text{win}^{(\ell)}$ is the set of all \acp{cn} in the
window while $\mathcal{J}_\text{commit}^{(\ell)}$ is the set of \acp{cn} window and $\mathcal{J}_\text{commit}^{(\ell)}$ is the set of \acp{cn}
that do not contribute to the next window and whose neighboring that do not contribute to the next window and whose neighboring
\acp{vn} will thus be committed. \acp{vn} will thus be committed.
We can additionally define the set of \acp{cn} that are shared between windows Additionally, we can define the set of \acp{cn} that are shared between windows
$\ell$ and $\ell + 1$ as $\mathcal{J}_\text{overlap}^{(\ell)} := $\ell$ and $\ell + 1$ as $\mathcal{J}_\text{overlap}^{(\ell)} :=
\mathcal{J}_\text{win}^{(\ell)}\setminus \mathcal{J}_\text{commit}^{(\ell)}$. \mathcal{J}_\text{win}^{(\ell)}\setminus \mathcal{J}_\text{commit}^{(\ell)}$.
@@ -537,8 +534,9 @@ $\ell$ and $\ell + 1$ as $\mathcal{J}_\text{overlap}^{(\ell)} :=
We can now turn our attention to defining the sets of \acp{vn} relevant We can now turn our attention to defining the sets of \acp{vn} relevant
to each window. to each window.
We first introduce a helper function $i_\text{max} : We first introduce a helper function $i_\text{max} :
\mathcal{P}(\mathbb{N}) \to \mathbb{N}$, which takes a set of \mathcal{P}(\mathbb{N}) \to \mathbb{N}$, which takes a set
\ac{cn} indices and returns the largest neighboring \ac{vn} index. $\mathcal{S} \in \mathcal{P}(\mathbb{N})$ of \ac{cn} indices and
returns the largest neighboring \ac{vn} index.
We define We define
\begin{align*} \begin{align*}
i_\text{max}\left( \mathcal{S} \right) := \max \left\{ i\in i_\text{max}\left( \mathcal{S} \right) := \max \left\{ i\in
@@ -552,13 +550,13 @@ where we set $i_\text{max} (\emptyset) = -1$ by convention%
and $\mathcal{I}_\text{win}^{(\ell)}$ appropriately. and $\mathcal{I}_\text{win}^{(\ell)}$ appropriately.
}% }%
. .
The commit region of window $\ell$ should include all of the \acp{vn} The commit region of window $\ell$ includes all of the \acp{vn}
neighboring any of the \acp{cn} in $\mathcal{J}_\text{commit}^{(\ell)}$. neighboring any of the \acp{cn} in $\mathcal{J}_\text{commit}^{(\ell)}$.
Consequently, the maximum index of the \acp{vn} we consider should be Consequently, the maximum index of the \acp{vn} we consider is
$i_\text{max}(\mathcal{J}_\text{commit}^{(\ell)})$. $i_\text{max}(\mathcal{J}_\text{commit}^{(\ell)})$.
Additionally, the set of \acp{vn} committed in the next window should Additionally, the set of \acp{vn} committed in the next window should
start immediately afterwards. contain the next largest index.
We thus define Thus we define
\begin{align*} \begin{align*}
\mathcal{I}_\text{commit}^{(\ell)} \mathcal{I}_\text{commit}^{(\ell)}
&:= \left\{i \in \mathcal{I}_\text{DEM} :~ &:= \left\{i \in \mathcal{I}_\text{DEM} :~
@@ -680,7 +678,7 @@ and after decoding all windows we will therefore have committed all \acp{vn}.
% Syndrome update % Syndrome update
\Cref{fig:vis_rep} illustrates the meaning of the various sets of nodes. \Cref{fig:vis_rep} illustrates the the various sets of nodes.
We can also see a subtlety we must handle carefully when We can also see a subtlety we must handle carefully when
moving on to decode the next window. moving on to decode the next window.
While the \acp{vn} in $\mathcal{J}_\text{commit}^{(\ell)}$ have no While the \acp{vn} in $\mathcal{J}_\text{commit}^{(\ell)}$ have no
@@ -690,9 +688,12 @@ This is the case because these \acp{vn} have neighboring \acp{cn} in
the next window. the next window.
The part of the detector error matrix $\bm{H}_\text{DEM}$ describing The part of the detector error matrix $\bm{H}_\text{DEM}$ describing
these connections is these connections is
$\bm{H}_\text{overlap}^{(\ell)} = \begin{align*}
\left(\bm{H}_\text{DEM}\right)_{\mathcal{J}_\text{overlap}^{(\ell)}, \bm{H}_\text{overlap}^{(\ell)} :=
\mathcal{I}_\text{commit}^{(\ell)}}$. \left(\bm{H}_\text{DEM}\right)_{\mathcal{J}_\text{overlap}^{(\ell)},
\mathcal{I}_\text{commit}^{(\ell)}}
.%
\end{align*}
We have to account for this fact by updating the syndrome $\bm{s}$ We have to account for this fact by updating the syndrome $\bm{s}$
based on the committed bit values. based on the committed bit values.
Specifically, if $\hat{\bm{e}}_\text{commit}^{(\ell)}$ describes the error Specifically, if $\hat{\bm{e}}_\text{commit}^{(\ell)}$ describes the error

View File

@@ -29,6 +29,7 @@
\usepackage{colortbl} \usepackage{colortbl}
\usepackage{cleveref} \usepackage{cleveref}
\usepackage{lipsum} \usepackage{lipsum}
\usepackage{booktabs}
\usetikzlibrary{calc, positioning, arrows, fit} \usetikzlibrary{calc, positioning, arrows, fit}
\usetikzlibrary{external} \usetikzlibrary{external}