# Android dialogue system for customer service using prompt-based topic
control and compliments generation

Tamotsu Miyama1 and Shogo Okada1 11 Japan Advanced Institute of Science and
Technology, tamotsu.miyama<EMAIL_ADDRESS>
###### Abstract

This paper describes a dialogue system developed for the Dialogue Robot
Competition 2023 that achieves topic control for trip planning by inserting
text into prompts using the ChatGPT-API. We built a system that is capable of
generating compliments for the user based on recognition of the user’s
appearance and creating travel plans by extracting the knowledge about the
user’s preference from the history of the user’s utterances. Complements and
planning based on preference are the elements required to maintain the quality
of customer service. A preliminary round was held at a travel agency’s actual
store, where real customers experienced and evaluated the system. This system
was evaluated first in the preliminary round and participated in the final
round. The results of the preliminary round showed the effectiveness of the
proposed system.

##  I INTRODUCTION

This paper describes the dialogue system we developed for the Dialogue Robot
Competition 2023 [1][2]: the advent of generative AI such as ChatGPT has
dramatically improved the performance of response generation of dialogue
systems [3]. In addition of appropriate dialogue ability, hospitality is
required in customer service such as travel agencies, and dialogue systems for
customer service are expected to response with hospitality [4]. Furthermore,
from the aspect of social implementation of robotic dialogue systems, it is
important to conduct demonstration tests in actual fields and extract issues.
In this context, it is necessary to construct a dialogue system with various
elements of hospitality service, and to evaluate users.

There are three key points in the development of the proposed dialogue system.
(1) Topic control for trip planning was achieved by using ChatGPT for dialog
control and inserting text in the prompts. (2) Customer service requires
various elements such as language, facial expressions, listening, and attitude
[4], as well as the use of compliments to establish a personal relationship
with the customer [5]. Therefore, this system was designed to identify the
user’s external characteristics and issue compliments. (3) In order to propose
travel plans that match the user’s preferences, we implemented a function to
create a travel plan using the user’s past utterances. In the preliminary
round, experiments and evaluations were conducted with customers who actually
visited the travel agency’s stores. We placed first out of 19 teams entered
(12 teams participated) and were selected to participate in the final round.

##  II Proposed System

Figure 1: dialogue flow

###  II-A Controlling topics with ChatGPT prompts

The generative AIs used were GPT-3.5-trubo and GPT4. Since the goal task is to
create a travel plan, insert fixed text in the prompt to direct the topic
toward that task.

###  II-B Dialogue Flow

The dialogue flow is shown in Figure 1. Basically, the customer’s requests are
elicited by asking questions, and then tourist destinations are determined one
by one. The customer’s requirements for the travel plan are then confirmed,
and a travel plan that meets the customer’s requirements is then discussed.

The system asked the customer questions about their experience visiting Kyoto,
enjoyment of the trip, and desired activities, and the system referred the
answers to the ChatGPT to determine Sightseeing Spot 1. The system asked the
customer questions about what they wanted to eat, their preferred areas,
hobbies, etc., and the answers were queried on ChatGPT to determine
Sightseeing Spot 2. In determining the sightseeing spots, the existence of
data was checked by referring to the Sightseeing Spot API. In addition, the
summary description of the sightseeing spot being uttered was created by
having ChatGPT summarize the introduction in the sightseeing spot API. In the
process of creating a travel plan, we asked the customer about the place of
departure and means of transportation and used the answers to create a travel
plan to visit the two sightseeing spots via ChatGPT.

###  II-C Function to complement a user’s physical appearance

Figure 2: Overall Configuration. FaMo and UppM denote facial expression
generation and mouth shape generation and upper body position generation

A dialogue system designed for customer service requires various elements such
as language, facial expressions, gestures, and listening, among which this
system focuses on words of praise.

The specific words of praise for each user are automatically determined based
on the user’s appearance recognition as follows. During the dialogue, images
of the user’s upper body was captured with a camera, and the user’s appearance
characteristics were extracted from this image.

The color of clothing, the shade of clothing are recognized from the image
capturing user’s appearance, by using CLIP model, which is a pre-trained image
classification model developed by OpenAI. In addition to the appearance
information, Gender type, age, glasses, and beauty quotient are estimated
using Face++.

A maximum of two compliments were generated based on the estimated five
characteristics: clothing color, clothing shade, eyeglasses, beauty, and
personality. Specifically, ”Your chic clothes look great on you!” You are such
a sweet person!” and other comments.

###  II-D Control using user’s past speech

ChatGPT was also used to determine sightseeing spots and to create travel
plans. In addition, ChatGPT was queried using the user’s past speech
information for these decisions and creation. For example, in the case of
creating a travel plan, the user was asked about companions, interests, and
activities in the first half of the dialogue flow, and the user’s responses
were included in the prompts and queried to ChatGPT to create a travel plan.

###  II-E Overall Configuration

The overall system configuration is shown in Figure 2.

##  III User Evaluation and Preliminary Results

Figure 3: User Evaluation and Preliminary Results. Suf, Nat, App, Lik, Sat,
R-re, Inf, Re-i, Rev, Pla, and Fea denote Sufficiency of information,
Naturalness, Appropriateness, Likability, Satisfaction, Robot reliability,
Information reference, Reliability of information, Degree of revisit, Plan
creation, and Feasibility of plan.

The evaluation items are largely divided into two categories: satisfaction
evaluation of the experiencer and evaluation of the plan. The satisfaction
evaluation consists of 9 items (7 on each recoded scale): sufficiency of
information, naturalness of dialogue, appropriateness of dialogue,
friendliness of response, satisfaction with dialogue, trustworthiness of the
robot, informational reference, reliability of information, and degree of
desire to return, all of which were rated No. 1. The plan evaluation item,
which asks whether a plan to visit two sightseeing spots can be created
(Yes/No) and whether it is feasible (Yes/No), was also rated No. 1. Figure 3
shows the satisfaction rating and the plan evaluation on a plan diagram.
Therefore, of course, the overall evaluation was also the first place in the
preliminary round. This means that our dialogue system was the highest rated
in the evaluation by real customers in the actual shops. In addition, the high
evaluation of the reliability of information in the satisfaction ratings
suggests that control using the user’s past speech contributed significantly
to improving the user’s reliability.

##  IV CONCLUSION

I described our dialogue robot developed for the Dialogue Robot Competition
2023. Our dialogue system used ChatGPT to control the dialogue and topics by
embedding text in the prompts as appropriate. We also implemented a function
to praise the user’s physical appearance and a function to create a travel
plan using the user’s previous utterances. As a result of the preliminary
round evaluation, the system was ranked first in both satisfaction rating and
plan rating.

## ACKNOWLEDGMENT

We deeply appreciate the organizers of the Dialogue Robot Competition 2023.

## References

  * [1] Takashi Minato, Ryuichiro Higashinaka, Kurima Sakai, Tomo Funayama, Hiromitsu Nishizaki, Takayuki Nagai, ”Overview of Dialogue Robot Competition 2023,” Proceedings of the Dialogue Robot Competition 2023, 12/2013.
  * [2] Takashi Minato, Ryuichiro Higashinaka, Kurima Sakai, Tomo Funayama, Hiromitsu Nishizaki, and Takayuki Nagai, ”Design of a competition specifically for spoken dialogue with a humanoid robot”, Advanced Robotics, vol.37, no.21, pp.1349-1363, 2023.
  * [3] Yubing Gao, Wei Tong, Edmond Q. Wu, Wei Chen, Guang Yu Zhu, and Fei-Yue Wang, “Chat With ChatGPT on Interactive Engines for Intelligent Driving,” IEEE TRANSACTIONS ON INTELLIGENT VEHICLES, VOL. 8, NO. 3, MARCH 2023, pp.2034–2036
  * [4] Galen R. Collins, “Improving human–robot interactions in hospitality settings,” International Hospitality Review International Hospitality Review Vol. 34 No. 1, 2020 pp.61-79
  * [5] Motoki IWASHITA, Daisuke KATAGAMI, “Psychological Effects of Compliment Expressions by Communication Robots on Humans,” In Proceedings of the 2020 International Joint Conference on Neural Networks (IJCNN ‘20). IEEE, pp.1–8


Type | Designation | Number | Name | Date(mjd) |  $r_{h}$(au) |  CO/H2O | $\sigma_{\textrm{CO/H2O}}$ | Composition Source |  $r$(km) |  $\sigma_{r}$(km) | Radius Source
---|---|---|---|---|---|---|---|---|---|---|---
P |  | 1 | Halley | 46495.0 | 0.79 | 0.110 | 0.0160 | Harrington Pinto et al. (2022) | 5.50 | 0.53 | Lamy et al. (2004)
P |  | 2 | Encke | 57834.3 | 0.48 | 0.004 | 0.0004 | Roth et al. (2018) | 2.43 | 0.06 | Boehnhardt et al. (2008)
P |  | 8 | Tuttle | 54487.7 | 1.05 | 0.004 | 0.0008 | Dello Russo et al. (2016) | 2.25 | 0.50 | Harmon et al. (2008)
P |  | 9 | Tempel 1 | 53547.5 | 1.52 | 0.043 | 0.0100 | Dello Russo et al. (2016) | 2.83 | 0.10 | Thomas et al. (2013a)
P |  | 17 | Holmes | 54401.5 | 2.46 | 0.088 | 0.0270 | Lippi et al. (2021) | 2.40 | 0.53 | Bauer et al. (2017)
P |  | 21 | Giacobini-Zinner | 51455.7 | 1.12 | 0.022 | 0.0150 | Dello Russo et al. (2016) | 1.82 | 0.05 | Pittichová et al. (2008)
P |  | 29 | Schwassmann-Wachmann 1 | 55153.5 | 6.18 | 4.645 | 1.0187 | Ootsubo et al. (2012) | 23.00 | 6.50 | Bauer et al. (2017)
P |  | 45 | Honda-Mrkos-Pajdusakova | 57761.0 | 0.56 | 0.005 | 0.0010 | Harrington Pinto et al. (2022) | 0.62 | 0.03 | Lejoly et al. (2022)
P |  | 67 | Churyumov-Gerasimenko | 57152.0 | 1.66 | 0.031 | 0.0090 | Rubin et al. (2019) | 1.65 | 0.01 | Jorda et al. (2016)
P |  | 103 | Hartley 2 | 55498.0 | 1.13 | 0.003 | 0.0015 | Dello Russo et al. (2016) | 0.58 | 0.02 | Thomas et al. (2013b)
C | 1995 O1 |  | Hale-Bopp | 50594.6 | 1.14 | 0.262 | 0.0070 | Dello Russo et al. (2016) | 30.00 | 10.00 | Lamy et al. (2004)
C | 2006 W3 |  | Christensen | 54909.9 | 3.40 | 2.296 | 0.4648 | Ootsubo et al. (2012) | 21.88 | 4.20 | Bauer et al. (2017)
C | 2007 N3 |  | Lulin | 54870.9 | 1.31 | 0.022 | 0.0009 | Dello Russo et al. (2016) | 6.10 | 0.25 | Bauer et al. (2017)
C | 2008 Q3 |  | Garradd | 55018.0 | 1.81 | 0.243 | 0.0494 | Ootsubo et al. (2012) | 3.35 | 0.50 | Bauer et al. (2017)
C | 2009 P1 |  | Garradd | 55943.5 | 1.71 | 0.084 | 0.0750 | See appendix D | 9.60 | 4.00 |  Boissier et al. (2013) & Bauer et al. (2017)
C | 2010 G2 |  | Hill | 55935.5 | 2.50 | 0.910 | 0.2300 | Dello Russo et al. (2016) | 4.01 | 1.04 | Bauer et al. (2017)
C | 2020 F3 |  | NEOWISE | 59047.3 | 0.80 | 0.032 | 0.0120 | Biver et al. (2022b) | 2.50 | 0.22 | J. Bauer (unpubl. data)
Table 9:  The CO/H2O abundance ratio and nucleus radius for each comet used in
our analysis. This table is a subset of the full composition - size dataset
(which is sampled in table 6) but is presented here for convenience.


# Nougat: Neural Optical Understanding for Academic Documents

Lukas Blecher &Guillem Cucurull &Thomas Scialom &Robert Stojnic Meta AI
Correspondence to<EMAIL_ADDRESS>
(January 2023)

###### Abstract

Scientific knowledge is predominantly stored in books and scientific journals,
often in the form of PDFs. However, the PDF format leads to a loss of semantic
information, particularly for mathematical expressions. We propose Nougat
(Neural Optical Understanding for Academic Documents), a Visual Transformer
model that performs an _Optical Character Recognition_ (OCR) task for
processing scientific documents into a markup language, and demonstrate the
effectiveness of our model on a new dataset of scientific documents. The
proposed approach offers a promising solution to enhance the accessibility of
scientific knowledge in the digital age, by bridging the gap between human-
readable documents and machine-readable text. We release the models and code
to accelerate future work on scientific text recognition.

##  1 Introduction

The majority of scientific knowledge is stored in books or published in
scientific journals, most commonly in the Portable Document Format (PDF). Next
to HTML, PDFs are the second most prominent data format on the internet,
making up 2.4% of common crawl [1]. However, the information stored in these
files is very difficult to extract into any other formats. This is especially
true for highly specialized documents, such as scientific research papers,
where the semantic information of mathematical expressions is lost.
Existing Optical Character Recognition (OCR) engines, such as Tesseract OCR
[2], excel at detecting and classifying individual characters and words in an
image, but fail to understand the relationship between them due to their line-
by-line approach. This means that they treat superscripts and subscripts in
the same way as the surrounding text, which is a significant drawback for
mathematical expressions. In mathematical notations like fractions, exponents,
and matrices, relative positions of characters are crucial.
Converting academic research papers into machine-readable text also enables
accessibility and searchability of science as a whole. The information of
millions of academic papers can not be fully accessed because they are locked
behind an unreadable format. Existing corpora, such as the S2ORC dataset [3],
capture the text of 12M111The paper reports 8.1M papers but the authors
recently updated the numbers on the GitHub page
https://github.com/allenai/s2orc papers using GROBID [4], but are missing
meaningful representations of the mathematical equations.

To this end, we introduce Nougat, a transformer based model that can convert
images of document pages to formatted markup text.
The primary contributions in this paper are

  * •

Release of a pre-trained model capable of converting a PDF to a lightweight
markup language. We release the code and the model on
GitHub222https://github.com/facebookresearch/nougat

  * •

We introduce a pipeline to create dataset for pairing PDFs to source code

  * •

Our method is only dependent on the image of a page, allowing access to
scanned papers and books

##  2 Related Work

Optical Character Recognition (OCR) is an extensively researched field in
computer vision for a variety applications, such as document digitalization
[5, 2], handwriting recognition and scene text recognition [6, 7, 8].
More concretely, recognizing mathematical expressions is a heavily researched
subtopic. Grammar based methods [9, 10, 11] for handwritten mathematical
expressions were improved upon by different encoder-decoder models. The fully
convolutional model [12] was succeeded by various RNN decoder models [13, 14,
15, 16, 17], both for handwritten and printed formulas. Recently, the decoder
[18, 19] as well as the encoder [20] were replaced with the Transformer [21]
architecture.

Visual Document Understanding (VDU) is another related topic of deep learning
research and focuses on extracting relevant information of a variety of
document types. Previous works depend on pre-trained models that learn to
extract information by jointly modeling text and layout information using the
Transformer architecture. The LayoutLM model family [22, 23, 24] uses masked
layout prediction task to capture the spatial relationships between different
document elements.

Open source solutions with a related goal as ours include GROBID [4], which
parses digital-born scientific documents to XML with a focus on the
bibliographic data and `pdf2htmlEX` [25], that converts digital-born PDFs to
HTML while preserving the layout and appearance of the document. However, both
solutions can not recover the semantic information of mathematical
expressions.

##  3 Model

Previous VDU methods either rely on OCR text from a third party tool [22, 23,
26] or focus on document types such as receipts, invoices or form-like
documents [27]. Recent studies [28, 29] show that an external OCR engine is
not necessarily needed to achieve competitive results in VDU.

The architecture is a encoder-decoder transformer [21] architecture, that
allows for an end-to-end training procedure. We build on the Donut [28]
architecture. The model does not require any OCR related inputs or modules.
The text is recognized implicitly by the network. See Fig. 1 for an overview
of the approach.

Encoder The visual encoder receives a document image
$\mathbf{x}\in\mathbb{R}^{3\times H_{0}\times W_{0}}$, crops the margins and
resizes the image to fit in a fixed rectangle of size $(H,\,W)$. If the image
is smaller than the rectangle, additional padding is added to ensure each
image has the same dimensionality. We use a Swin Transformer [30], a
hierarchical vision transformer [31] that splits the image into non-
overlapping windows of fixed size and applies a series of self-attention
layers to aggregate information across these windows. The model output a
sequence of the embedded patches $\mathbf{z}\in\mathbb{R}^{d\times N}$ where
$d$ is the latent dimension and $N$ is the number of patches.

Decoder The encoded image $\mathbf{z}$ is decoded into a sequence of tokens
using a transformer decoder architecture with cross-attention. The tokens are
generated in an auto-regressive manner, using self-attention and cross-
attention to attend to different parts of the input sequence and encoder
output respectively. Finally, the output is projected to the size of the
vocabulary $v$, yielding the logits $\boldsymbol{\ell}\in\mathbb{R}^{v}$.
Following Kim et al. [28], we use the implementation of the mBART [32]
decoder. We use the same tokenizer as Taylor et al. [33] because their model
is also specialized in the scientific text domain.

Figure 1:  Our simple end-to-end architecture followin Donut [28]. The Swin
Transformer encoder takes a document image and converts it into latent
embeddings, which are subsequently converted to a sequence of tokens in a
auto-regressive manner

###  3.1 Setup

We render the document images at a resolution of 96 DPI. Due to the
restrictive possible input dimensions of the Swin Transformer we choose the
input size $(H,\,W)=(896,\,672)$. The aspect ratio is in between the US letter
and Din A4 format $\frac{22}{17}<\frac{4}{3}<\sqrt{2}$. The document images
are resized and then padded to achieve the desired input size. This input size
allows us to use the Swin base model architecture [30]. We initialize the
model with the pre-trained weights.
The Transformer decoder has a maximal sequence length of $S=4096$. This
relatively large sizing is due to the fact that the text of academic research
papers can be dense and the syntax for tables in particular is token
intensive. The BART decoder is a decoder-only transformer with 10 layers. The
entire architecture has a total of 350M parameters.
We also test experiment with a smaller model (250M parameters) with a slightly
smaller sequence length of $S=3584$ and only 4 decoder layers, where we start
from the pre-trained base model.
During inference the text is generated using greedy decoding.
Training We use an AdamW optimizer [34] to train for 3 epochs with an
effective batch size of 192. Due to training instabilities, we choose a
learning rate of $\mathrm{lr}_{\rm init}=5\cdot 10^{-5}$ which is reduced by a
factor of $0.9996$ every 15 updates until it reaches $\mathrm{lr}_{\rm
end}=7.5\cdot 10^{-6}$.

###  3.2 Data Augmentation

In image recognition tasks, it is often beneficial to use data augmentation to
improve generalization. Since we are only using digital-born academic research
papers, we need to employ a number of transformations to simulate the
imperfections and variability of scanned documents. These transformations
include erosion, dilation, gaussian noise, gaussian blur, bitmap conversion,
image compression, grid distortion and elastic transform [35]. Each has a
fixed probability of being applied to a given image. The transformations are
implemented in the _Albumentations_ [36] library. For an overview of the
effect of each transformation, see Fig. 2.
During training time, we also add perturbations to the ground truth text by
randomly replacing tokens. We found this to reduce the collapse into a
repeating loop significantly. For more details, see Section 5.4.

Figure 2: List of the different image augmentation methods used during
training on an example snippet form a sample document.

##  4 Datasets

To the best of our knowledge there is no paired dataset of PDF pages and
corresponding source code out there, so we created our own from the open
access articles on arXiv.333https://arxiv.org/ For layout diversity we also
include a subset of the _PubMed Central_ 444https://www.ncbi.nlm.nih.gov/pmc/
(PMC) open access non-commercial dataset. During the pretraining, a portion of
the _Industry Documents Library_ 555https://www.industrydocuments.ucsf.edu/
(IDL) is included. See Table A.1 for the dataset composition.

arXiv We collected the source code and compiled PDFs from 1,748,201 articles
released on arXiv. To ensure consistent formatting, we first process the
source files using _LaTeXML_ 666http://dlmf.nist.gov/LaTeXML/ and convert them
into HTML5 files. This step was important as it standardized and removed
ambiguity from the LaTeX source code, especially in mathematical expressions.
The conversion process included replacing user-defined macros, standardizing
whitespace, adding optional brackets, normalizing tables, and replacing
references and citations with their correct numbers.

We then parse the HTML files and convert them into a lightweight markup
language that supports various elements such as headings, bold and italic
text, algorithms, LaTeX inline and display math and LaTeX tables. This way, we
ensure that the source code is properly formatted and ready for further
processing.
The process is visualized in Fig. 3.

Figure 3: Data processing. The source file is converted into HTML which is
then converted to Markdown. a) The LaTeX source provided by the authors. b)
The HTML file computed form the LaTeX source using LaTeXML. c) The Markdown
file parsed from the HTML file. d) The PDF file provided by the authors

PMC We also processed articles from PMC, where XML files with semantic
information are available in addition to the PDF file. We parse these files
into the same markup language format as the arXiv articles. We chose to use
far fewer articles from PMC because the XML files are not always as rich in
semantic information. Often times equations and tables are stored as images
and these cases are not trivial to detect, which leads to our decision to
limit the use of PMC articles to the pre-training phase.

The XML files are parsed into the same markup language as described above.

IDL The IDL is a collection of documents produced by industries that have an
impact on public health and is maintained by the University of California, San
Francisco Library. Biten et al. [37] provide high quality OCR text for PDFs
from the IDL dataset. This does not include text formatting and is only used
for pre-training to teach the model basic OCR of scanned documents.

###  4.1 Splitting the pages

We split the markdown files according to the page breaks in the PDF file and
rasterize each page as an image to create the final paired dataset. During the
compilation, the LaTeX compiler determines the page breaks of the PDF file
automatically. Since we are not recompiling the LaTeX sources for each paper,
we must heuristically split the source file into parts, which correspond to
different pages. To achieve that we are using the embedded text on the PDF
page and match it to source text.
However, figures and tables in the PDF may not correspond to their position in
the source code. To address this issue, we remove these elements in a pre-
processing step using `pdffigures2` [38]. The recognized captions are are then
compared to the captions in the XML file and matched based on their
Levenshtein distance [39]. Once the source document has been split into
individual pages, the removed figures and tables are reinserted at the end of
each page.
For a better matching we also replaced unicode characters in the PDF text with
corresponding LaTeX commands using the pylatexenc-
library777https://github.com/phfaist/pylatexenc.

Bag of Words matching First we extract the text lines from the PDF using
MuPDF888https://mupdf.com/ and preprocess them to remove page numbers and
potential headers/footers. We then use a _Bag of Words_ model [40] with TF-IDF
vectorizer and a linear Support Vector Machine classifier. The model is fitted
to the PDF lines with the page number as label. Next we split the LaTeX source
into paragraphs and predict the page number for each of them.

Ideally, the predictions will form a stair case function but in practice the
signal will be noisy. To find the best boundary points we employ a similar
logic as decision trees and minimize a measure based on the _Gini_ impurity

$G_{[a,\>\\!b]}(i)=(b-a)\cdot\left(1-p_{[a,\>\\!b]}^{2}(i)-p_{[a,\>\\!b]}^{2}(i+1)\right),$

where $p_{[a,\>\\!b]}(i)$ is the probability of choosing an element with the
predicted page number $i$ in the interval $[a,\,b]$ that describes which
paragraphs (elements) were considered for the split.
The best splitting position $t$ in the interval $[a,\,b]$ is then

${\hat{t}}_{i}=\operatorname*{\arg\,\min}_{t}\left(G_{[a,\>\\!t]}(i)+G_{[t,\>\\!b]}(i)\right).$

The search process starts with all paragraphs and for each subsequent page
break, the lower bound of the search interval is set to the previous split
position. See Fig. 4 for a visualization of an example page.

Figure 4: Example for splitting the paragraphs in the source code into
different pages. The points in blue denote the page index predicted by the
SVM.

Fuzzy matching After this first coarse document splitting we try to find the
exact position within the paragraph. This is done by comparing the source text
within the neighborhood of the predicted splitting position to the last
sentences of the previous page of the embedded PDF text, and the first
sentences of the next page using the `fuzzysearch`
library999https://github.com/taleinat/fuzzysearch. If the two dividing points
are at the same location in the source text, the page break is considered
“accurate” and receives a score of 1. On the other hand, if the splitting
positions differ, the one with the smallest normalized Levenshtein distance is
selected and given a score of 1 minus the distance. To be included in the
dataset, a PDF page must have an average score of at least 0.9 for both page
breaks. This results in an acceptance rate of about $47\%$ of all pages.

###  4.2 Ground truth artifacts

Because the dataset was pre-processed by LaTeXML, the markup version of the
source code can contain artifacts and commands from unsupported packages. The
HTML file may contain subsection titles with numbering even though they are
not numbered in the PDF. There may also be instances where figures or tables
are missing from the ground truth due to processing errors.

In addition, the splitting algorithm of the source code will in some cases
include text from the previous page or cut off words from the end. This is
especially true for “invisible” characters used for formatting, like italic,
bold text or section header.

For PMC papers the inline math is written as Unicode or italic text, while
display math equations or tables are often included in image format and will
therefore be ignored.

Each of these issues reduces the overall data quality. However, the large
number of training samples compensates for these small errors.

##  5 Results & Evaluation

Figure 5: Example of a page with many mathematical equations taken from [41].
Left: Image of a page in the document, Right: Model output converted to LaTeX
and rendered to back into a PDF. Examples of scanned documents can be found in
the appendix B.

In this section we discuss the results and performance of the model. For an
example see Fig. 5 or go to Sec. B. The model focuses only on the important
content relevant features of the page. The box around the equations is
skipped.

###  5.1 Metrics

We report the following metrics on our test set.

Edit distance The edit distance, or Levenshtein distance [39], measures the
number of character manipulations (insertions, deletions, substitutions) it
takes to get from one string to another. In this work we consider the
normalized edit distance, where we divide by the total number of characters.

BLEU The BLEU [42] metric was originally introduced for measuring the quality
of text that has been machine-translated from one language to another. The
metric computes a score based on the number of matching n-grams between the
candidate and reference sentence.

METEOR Another machine-translating metric with a focus on recall instead of
precision, introduced in [43].

F-measure We also compute the F1-score and report the precision and recall.

###  5.2 Text modalities

In a scientific research article, there are three distinct types of text: 1)
plain text, which comprises the majority of the document, 2) mathematical
expressions, and 3) tables. It is important to separately examine each of
these components during the evaluation process. This is necessary because in
LaTeX, there are multiple ways to express the same mathematical expression.
While some variability has been eliminated during the LaTeXML pre-processing
step, there still is a significant amount of ambiguity present, like ordering
of subscript and superscript, equivalent commands with different notation
(`stackrel`, `atop`, `substack` or `frac`, `over`), situationally
interchangeable commands (`bm`, `mathbf`, `boldsymbol`, `bf` or `\left(`,
`\big(`, etc.), whitespace commands, additional layers of brackets, and more.
As a consequence, there can be a discrepancy between prediction and ground
truth, even if the rendered formulas appear identical.
In addition, it is not always possible to determine, where a inline math
environment ends and text begins, when writing numbers and punctuation
(Example: `$\mathrm{H}_{0}$1,` vs. `H$_{0}1,$` $\to$ $\mathrm{H}_{0}$1, vs.
H${}_{0}1,$). This ambiguity reduces both math and plain text scores.
The expected score for mathematical expressions is lower than for plain text.

###  5.3 Comparison

We present our results in Table 1. As expected, the mathematical expressions
have the worst agreement with the ground truth. For the plain text, most
discrepancies come from formatting ambiguities and missing text due to inline
math, as described above. The output format of GROBID is an XML file, which we
convert into a compatible markup language, similar to the PMC or arXiv files.
To some extent, GROBID provides support for formulas in its output, but it
identifies and stores them as the Unicode representations embedded in the PDF.
We replace each Unicode symbol with its corresponding LaTeX command to
increase the similarity. Additionally, GROBID mislabels small inline
expressions as text. For identified formulas, GROBID stores the bounding box
coordinates. We modify the program by sending the snippet to the external
formula recognition software LaTeX-OCR [20]. This way we can also get a signal
for math modality. The reported results in this section are quite poor,
primarily due to the amount of missed formulas by GROBID and the equation
prediction accuracy is affected by the quality of the bounding boxes. The
performance of the embedded PDF text alone is better than GROBID, which is due
to formatting differences for the title page or reference section.
Both Nougat small and base are able to outperform the other approach and
achieve high scores in all metrics. We note that the performance of the
smaller model is on par with the larger base model.

Method | Modality | Edit distance $\downarrow$ | BLEU $\uparrow$ | METEOR $\uparrow$ | Precision $\uparrow$ | Recall $\uparrow$ | F1 $\uparrow$
---|---|---|---|---|---|---|---
PDF | All | 0.255 | 65.8 | 82.1 | 77.1 | 81.4 | 79.2
GROBID | All | 0.312 | 55.6 | 71.9 | 74.0 | 72.1 | 73.0
| Tables | 0.626 | 25.1 | 64.5 | 61.4 | 80.7 | 69.7
\+ LaTeX OCR | Plain text | 0.363 | 57.4 | 69.2 | 82.1 | 70.5 | 75.9
| Math | 0.727 | 0.3 | 5.0 | 11.0 | 8.6 | 9.7
Nougat small (250M∗) | All | 0.073 | 88.9 | 92.8 | 93.6 | 92.2 | 92.9
Tables | 0.220 | 68.5 | 78.6 | 75.0 | 79.8 | 77.3
Plain text | 0.058 | 91.0 | 94.3 | 96.1 | 95.3 | 95.7
Math | 0.117 | 56.0 | 74.7 | 77.1 | 76.8 | 76.9
Nougat base (350M∗) | All | 0.071 | 89.1 | 93.0 | 93.5 | 92.8 | 93.1
Tables | 0.211 | 69.7 | 79.1 | 75.4 | 80.7 | 78.0
Plain text | 0.058 | 91.2 | 94.6 | 96.2 | 95.3 | 95.7
Math | 0.128 | 56.9 | 75.4 | 76.5 | 76.6 | 76.5
Table 1: Results on arXiv test set. PDF is the text embedded in the PDF file.
The modality “All” refers to the output text without any splitting. ∗Number of
parameters.

###  5.4 Repetitions during inference

Figure 6: Examples for repetition detection on logits. Top: Sample with
repetition, Bottom: Sample without repetition. Left: Highest logit score for
each token in the sequence $\ell(x)$, Center: Sliding window variance of the
logits $\operatorname{VarWin}_{B}[\ell](x)$, Right: Variance of variance from
the position to the end $\operatorname{VarEnd}_{B}[\ell](x)$

We notice that the model degenerates into repeating the same sentence over and
over again. The model can not recover from this state by itself. In its
simplest form, the last sentence or paragraph is repeated over and over again.
We observed this behavior in $1.5\%$ of pages in the test set, but the
frequency increases for out-of-domain documents. Getting stuck in a repetitive
loop is a known problem with Transformer-based models, when sampled with
greedy decoding [44].
It can also happen that the model alternates between two sentences but
sometimes changes some words, so a strict repetition detection will not
suffice. Even harder to detect are predictions where the model counts its own
repetitions, which sometimes happens in the references section.
In general we notice this kind behavior after a mistake by the model. The
model is not able to recover from the collapse.

Anti-repetition augmentation Because of that we introduce a random
perturbation during training. This helps the model to learn how to handle a
wrongly predicted token. For each training example, there is a fixed
probability that a random token will be replaced by any other randomly chosen
token. This process continues until the newly sampled number is greater than a
specified threshold (in this case, 10%). We did not observe a decrease in
performance with this approach, but we did notice a significant reduction in
repetitions. Particularly for out-of-domain documents, where we saw a 32%
decline in failed page conversions.

Repetition detection Since we are generating a maximum of $4096$ tokens the
model will stop at some point, however it is very inefficient and resource
intensive to wait for a “end of sentence” token, when none will come. To
detect the repetition during inference time we look at the largest logit value
$\ell_{i}=\max\boldsymbol{\ell}_{i}$ of the ith token. We found that the
logits after a collapse can be separated using the following heuristic. First
calculate the variance of the logits for a sliding window of size $B=15$

$\operatorname{VarWin}_{B}[\boldsymbol{\ell}](x)=\frac{1}{B}\sum_{i=x}^{x+B}\left(\ell_{i}-\frac{1}{B}\sum_{j=x}^{x+B}\ell_{j}\right)^{2}.$

Here $\ell$ is the signal of logits and $x$ the index. Using this new signal
we compute variances again but this time from the point $x$ to the end of the
sequence

$\operatorname{VarEnd}_{B}[\boldsymbol{\ell}](x)=\frac{1}{S-x}\sum_{i=x}^{S}\left(\operatorname{VarWin}_{B}[\boldsymbol{\ell}](i)-\frac{1}{S-x}\sum_{j=x}^{S}\operatorname{VarWin}_{B}[\boldsymbol{\ell}](i)\right)^{2}.$

If this signal drops below a certain threshold (we choose 6.75) and stays
below for the remainder of the sequence, we classify the sequence to have
repetitions.

During inference time, it is obviously not possible to compute the to the end
of the sequence if our goal is to stop generation at an earlier point in time.
So here we work with a subset of the last 200 tokens and a half the threshold.
After the generation is finished, the procedure as described above is repeated
for the full sequence.

###  5.5 Limitations & Future work

Utility The utility of the model is limited by a number of factors. First, the
problem with repetitions outlined in section 5.4. The model is trained on
research papers, which means it works particularly well on documents with a
similar structure. However, it can still accurately convert other types of
documents.
Nearly every dataset sample is in English. Initial tests on a small sample
suggest that the model’s performance with other Latin-based languages is
satisfactory, although any special characters from these languages will be
replaced with the closest equivalent from the Latin alphabet. Non-Latin script
languages result in instant repetitions.
Generation Speed On a machine with a NVIDIA A10G graphics card with 24GB VRAM
we can process 6 pages in parallel. The generation speed depends heavily on
the amount of text on any given page. With an average number of tokens of
$\approx 1400$ we get an mean generation time of 19.5s per batch for the base
model without any inference optimization. Compared to classical approaches
(GROBID 10.6 PDF/s [4]) this is very slow, but it is not limited to digital-
born PDFs and can correctly parse mathematical expressions.
Future work The model is trained on one page at a time without knowledge about
other pages in the document. This results in inconsistencies across the
document. Most notably in the bibliography where the model was trained on
different styles or section titles where sometimes numbers are skipped or
hallucinated. Though handling each page separately significantly improves
parallelization and scalability, it may diminish the quality of the merged
document text.
The primary challenge to solve is the tendency for the model to collapse into
a repeating loop, which is left for future work.

##  6 Conclusion

In this work, we present Nougat, an end-to-end trainable encoder-decoder
transformer based model for converting document pages to markup. We apply
recent advances in visual document understanding to a novel OCR task. Distinct
from related approaches, our method does not rely on OCR or embedded text
representations, instead relying solely on the rasterized document page.
Moreover, we have illustrated an automatic and unsupervised dataset generation
process that we used to successfully train the model for scientific document
to markup conversion. Overall, our approach has shown great potential for not
only extracting text from digital-born PDFs but also for converting scanned
papers and textbooks. We hope this work can be a starting point for future
research in related domains.
All the code for model evaluation, training and dataset generation can be
accessed at https://github.com/facebookresearch/nougat.

##  7 Acknowledgments

Thanks to Ross Taylor, Marcin Kardas, Iliyan Zarov, Kevin Stone, Jian Xiang
Kuan, Andrew Poulton and Hugo Touvron for their valuable discussions and
feedback.
Thanks to Faisal Azhar for the support throughout the project.

## References

  * Sebastian Spiegler [2013] Sebastian Spiegler.  Statistics of the Common Crawl Corpus 2012, June 2013.  URL https://docs.google.com/file/d/1_9698uglerxB9nAglvaHkEgU-iZNm1TvVGuCW7245-WGvZq47teNpb_uL5N9.
  * Smith [2007] R. Smith.  An Overview of the Tesseract OCR Engine.  In _Ninth International Conference on Document Analysis and Recognition (ICDAR 2007) Vol 2_ , pages 629–633, Curitiba, Parana, Brazil, September 2007. IEEE.  ISBN 978-0-7695-2822-9.  doi: 10.1109/ICDAR.2007.4376991.  URL http://ieeexplore.ieee.org/document/4376991/.  ISSN: 1520-5363.
  * Lo et al. [2020] Kyle Lo, Lucy Lu Wang, Mark Neumann, Rodney Kinney, and Daniel Weld.  S2ORC: The Semantic Scholar Open Research Corpus.  In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 4969–4983, Online, July 2020. Association for Computational Linguistics.  doi: 10.18653/v1/2020.acl-main.447.  URL https://aclanthology.org/2020.acl-main.447.
  * Lopez [2023] Patrice Lopez.  GROBID, February 2023.  URL https://github.com/kermitt2/grobid.  original-date: 2012-09-13T15:48:54Z.
  * Moysset et al. [2017] Bastien Moysset, Christopher Kermorvant, and Christian Wolf.  Full-Page Text Recognition: Learning Where to Start and When to Stop, April 2017.  URL http://arxiv.org/abs/1704.08628.  arXiv:1704.08628 [cs].
  * Bautista and Atienza [2022] Darwin Bautista and Rowel Atienza.  Scene Text Recognition with Permuted Autoregressive Sequence Models, July 2022.  URL http://arxiv.org/abs/2207.06966.  arXiv:2207.06966 [cs] version: 1.
  * Li et al. [2022] Minghao Li, Tengchao Lv, Jingye Chen, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang, Zhoujun Li, and Furu Wei.  TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models, September 2022.  URL http://arxiv.org/abs/2109.10282.  arXiv:2109.10282 [cs].
  * Diaz et al. [2021] Daniel Hernandez Diaz, Siyang Qin, Reeve Ingle, Yasuhisa Fujii, and Alessandro Bissacco.  Rethinking Text Line Recognition Models, April 2021.  URL http://arxiv.org/abs/2104.07787.  arXiv:2104.07787 [cs].
  * MacLean and Labahn [2013] Scott MacLean and George Labahn.  A new approach for recognizing handwritten mathematics using relational grammars and fuzzy sets.  _International Journal on Document Analysis and Recognition (IJDAR)_ , 16(2):139–163, June 2013.  ISSN 1433-2825.  doi: 10.1007/s10032-012-0184-x.  URL https://doi.org/10.1007/s10032-012-0184-x.
  * Awal et al. [2014] Ahmad-Montaser Awal, Harold Mouchre, and Christian Viard-Gaudin.  A global learning approach for an online handwritten mathematical expression recognition system.  _Pattern Recognition Letters_ , 35(C):68–77, January 2014.  ISSN 0167-8655.
  * Álvaro et al. [2014] Francisco Álvaro, Joan-Andreu Sánchez, and José-Miguel Benedí.  Recognition of on-line handwritten mathematical expressions using 2D stochastic context-free grammars and hidden Markov models.  _Pattern Recognition Letters_ , 35:58–67, January 2014\.  ISSN 0167-8655.  doi: 10.1016/j.patrec.2012.09.023.  URL https://www.sciencedirect.com/science/article/pii/S016786551200308X.
  * Yan et al. [2020] Zuoyu Yan, Xiaode Zhang, Liangcai Gao, Ke Yuan, and Zhi Tang.  ConvMath: A Convolutional Sequence Network for Mathematical Expression Recognition, December 2020.  URL http://arxiv.org/abs/2012.12619.  arXiv:2012.12619 [cs].
  * Deng et al. [2016] Yuntian Deng, Anssi Kanervisto, Jeffrey Ling, and Alexander M. Rush.  Image-to-Markup Generation with Coarse-to-Fine Attention, September 2016.  URL http://arxiv.org/abs/1609.04938.  arXiv:1609.04938 [cs] version: 1.
  * Le and Nakagawa [2017] Anh Duc Le and Masaki Nakagawa.  Training an End-to-End System for Handwritten Mathematical Expression Recognition by Generated Patterns.  In _2017 14th IAPR International Conference on Document Analysis and Recognition (ICDAR)_ , volume 01, pages 1056–1061, November 2017.  doi: 10.1109/ICDAR.2017.175.  ISSN: 2379-2140.
  * Singh [2018] Sumeet S. Singh.  Teaching Machines to Code: Neural Markup Generation with Visual Attention, June 2018.  URL http://arxiv.org/abs/1802.05415.  arXiv:1802.05415 [cs].
  * Zhang et al. [2018] Jianshu Zhang, Jun Du, and Lirong Dai.  Multi-Scale Attention with Dense Encoder for Handwritten Mathematical Expression Recognition, January 2018.  URL http://arxiv.org/abs/1801.03530.  arXiv:1801.03530 [cs].
  * Wang and Liu [2019] Zelun Wang and Jyh-Charn Liu.  Translating Math Formula Images to LaTeX Sequences Using Deep Neural Networks with Sequence-level Training, September 2019.  URL http://arxiv.org/abs/1908.11415.  arXiv:1908.11415 [cs, stat].
  * Zhao et al. [2021] Wenqi Zhao, Liangcai Gao, Zuoyu Yan, Shuai Peng, Lin Du, and Ziyin Zhang.  Handwritten Mathematical Expression Recognition with Bidirectionally Trained Transformer, May 2021.  URL http://arxiv.org/abs/2105.02412.  arXiv:2105.02412 [cs].
  * Mahdavi et al. [2019] Mahshad Mahdavi, Richard Zanibbi, Harold Mouchere, Christian Viard-Gaudin, and Utpal Garain.  ICDAR 2019 CROHME + TFD: Competition on Recognition of Handwritten Mathematical Expressions and Typeset Formula Detection.  In _2019 International Conference on Document Analysis and Recognition (ICDAR)_ , pages 1533–1538, Sydney, Australia, September 2019\. IEEE.  ISBN 978-1-72813-014-9.  doi: 10.1109/ICDAR.2019.00247.  URL https://ieeexplore.ieee.org/document/8978036/.
  * Blecher [2023] Lukas Blecher.  pix2tex - LaTeX OCR, February 2023.  URL https://github.com/lukas-blecher/LaTeX-OCR.  original-date: 2020-12-11T16:35:13Z.
  * Vaswani et al. [2017] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin.  Attention Is All You Need, December 2017.  URL http://arxiv.org/abs/1706.03762.  arXiv:1706.03762 [cs].
  * Xu et al. [2020] Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, and Ming Zhou.  LayoutLM: Pre-training of Text and Layout for Document Image Understanding.  In _Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining_, pages 1192–1200, August 2020.  doi: 10.1145/3394486.3403172.  URL http://arxiv.org/abs/1912.13318.  arXiv:1912.13318 [cs].
  * Xu et al. [2022] Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, and Lidong Zhou.  LayoutLMv2: Multi-modal Pre-training for Visually-Rich Document Understanding, January 2022.  URL http://arxiv.org/abs/2012.14740.  arXiv:2012.14740 [cs].
  * Huang et al. [2022] Yupan Huang, Tengchao Lv, Lei Cui, Yutong Lu, and Furu Wei.  LayoutLMv3: Pre-training for Document AI with Unified Text and Image Masking, July 2022.  URL http://arxiv.org/abs/2204.08387.  arXiv:2204.08387 [cs].
  * Lu Wang and Wanmin Liu [2013] Lu Wang and Wanmin Liu.  Online publishing via pdf2htmlEX, 2013.  URL https://www.tug.org/TUGboat/tb34-3/tb108wang.pdf.
  * Appalaraju et al. [2021] Srikar Appalaraju, Bhavan Jasani, Bhargava Urala Kota, Yusheng Xie, and R. Manmatha.  DocFormer: End-to-End Transformer for Document Understanding, September 2021.  URL http://arxiv.org/abs/2106.11539.  arXiv:2106.11539 [cs].
  * Majumder et al. [2020] Bodhisattwa Prasad Majumder, Navneet Potti, Sandeep Tata, James Bradley Wendt, Qi Zhao, and Marc Najork.  Representation Learning for Information Extraction from Form-like Documents.  In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 6495–6504, Online, July 2020. Association for Computational Linguistics.  doi: 10.18653/v1/2020.acl-main.580.  URL https://aclanthology.org/2020.acl-main.580.
  * Kim et al. [2022] Geewook Kim, Teakgyu Hong, Moonbin Yim, Jeongyeon Nam, Jinyoung Park, Jinyeong Yim, Wonseok Hwang, Sangdoo Yun, Dongyoon Han, and Seunghyun Park.  OCR-free Document Understanding Transformer, October 2022.  URL http://arxiv.org/abs/2111.15664.  arXiv:2111.15664 [cs].
  * Davis et al. [2022] Brian Davis, Bryan Morse, Bryan Price, Chris Tensmeyer, Curtis Wigington, and Vlad Morariu.  End-to-end Document Recognition and Understanding with Dessurt, June 2022.  URL http://arxiv.org/abs/2203.16618.  arXiv:2203.16618 [cs].
  * Liu et al. [2021] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo.  Swin Transformer: Hierarchical Vision Transformer using Shifted Windows, August 2021.  URL http://arxiv.org/abs/2103.14030.  arXiv:2103.14030 [cs].
  * Dosovitskiy et al. [2021] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby.  An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale, June 2021.  URL http://arxiv.org/abs/2010.11929.  arXiv:2010.11929 [cs].
  * Lewis et al. [2019] Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer.  BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension, October 2019.  URL http://arxiv.org/abs/1910.13461.  arXiv:1910.13461 [cs, stat].
  * Taylor et al. [2022] Ross Taylor, Marcin Kardas, Guillem Cucurull, Thomas Scialom, Anthony Hartshorn, Elvis Saravia, Andrew Poulton, Viktor Kerkez, and Robert Stojnic.  Galactica: A Large Language Model for Science, November 2022\.  URL http://arxiv.org/abs/2211.09085.  arXiv:2211.09085 [cs, stat].
  * Loshchilov and Hutter [2019] Ilya Loshchilov and Frank Hutter.  Decoupled Weight Decay Regularization, January 2019.  URL http://arxiv.org/abs/1711.05101.  arXiv:1711.05101 [cs, math] version: 3.
  * Simard et al. [2003] P.Y. Simard, D. Steinkraus, and J.C. Platt.  Best practices for convolutional neural networks applied to visual document analysis.  In _Seventh International Conference on Document Analysis and Recognition, 2003. Proceedings._ , volume 1, pages 958–963, Edinburgh, UK, 2003. IEEE Comput. Soc.  ISBN 978-0-7695-1960-9.  doi: 10.1109/ICDAR.2003.1227801.  URL http://ieeexplore.ieee.org/document/1227801/.
  * Buslaev et al. [2020] Alexander Buslaev, Vladimir I. Iglovikov, Eugene Khvedchenya, Alex Parinov, Mikhail Druzhinin, and Alexandr A. Kalinin.  Albumentations: Fast and Flexible Image Augmentations.  _Information_ , 11(2):125, February 2020.  ISSN 2078-2489.  doi: 10.3390/info11020125.  URL https://www.mdpi.com/2078-2489/11/2/125.
  * Biten et al. [2022] Ali Furkan Biten, Rubèn Tito, Lluis Gomez, Ernest Valveny, and Dimosthenis Karatzas.  OCR-IDL: OCR Annotations for Industry Document Library Dataset, February 2022.  URL http://arxiv.org/abs/2202.12985.  arXiv:2202.12985 [cs].
  * Clark and Divvala [2016] Christopher Clark and Santosh Divvala.  PDFFigures 2.0: Mining Figures from Research Papers.  In _Proceedings of the 16th ACM/IEEE-CS on Joint Conference on Digital Libraries_ , pages 143–152, Newark New Jersey USA, June 2016. ACM.  ISBN 978-1-4503-4229-2.  doi: 10.1145/2910896.2910904.  URL https://dl.acm.org/doi/10.1145/2910896.2910904.
  * Levenshtein [1965] V. Levenshtein.  Binary codes capable of correcting deletions, insertions, and reversals.  _Soviet physics. Doklady_ , 1965.  URL https://www.semanticscholar.org/paper/Binary-codes-capable-of-correcting-deletions%2C-and-Levenshtein/b2f8876482c97e804bb50a5e2433881ae31d0cdd.
  * Harris [1954] Zellig S. Harris.  Distributional Structure.  _WORD_ , 10(2-3):146–162, 1954.  doi: 10.1080/00437956.1954.11659520.  URL https://doi.org/10.1080/00437956.1954.11659520.  Publisher: Routledge _eprint: https://doi.org/10.1080/00437956.1954.11659520.
  * Sorscher et al. [2022] Ben Sorscher, Robert Geirhos, Shashank Shekhar, Surya Ganguli, and Ari S. Morcos.  Beyond neural scaling laws: beating power law scaling via data pruning, November 2022.  URL http://arxiv.org/abs/2206.14486.  arXiv:2206.14486 [cs, stat].
  * Papineni et al. [2002] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu.  Bleu: a Method for Automatic Evaluation of Machine Translation.  In _Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics_ , pages 311–318, Philadelphia, Pennsylvania, USA, July 2002. Association for Computational Linguistics.  doi: 10.3115/1073083.1073135.  URL https://aclanthology.org/P02-1040.
  * Banerjee and Lavie [2005] Satanjeev Banerjee and Alon Lavie.  METEOR: An Automatic Metric for MT Evaluation with Improved Correlation with Human Judgments.  In _Proceedings of the ACL Workshop on Intrinsic and Extrinsic Evaluation Measures for Machine Translation and/or Summarization_ , pages 65–72, Ann Arbor, Michigan, June 2005. Association for Computational Linguistics.  URL https://aclanthology.org/W05-0909.
  * Holtzman et al. [2020] Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi.  The Curious Case of Neural Text Degeneration, February 2020\.  URL http://arxiv.org/abs/1904.09751.  arXiv:1904.09751 [cs].
  * March and Wolff [1917] Herman W. (Herman William) March and Henry C. (Henry Charles) Wolff.  _Calculus_.  New York : McGraw-Hill, 1917.  URL http://archive.org/details/calculus00marciala.
  * noa [1970] Kinetics and Thermodynamics in High-Temperature Gases, January 1970.  URL https://ntrs.nasa.gov/citations/19700022795.  NTRS Report/Patent Number: N70-32106-116 NTRS Document ID: 19700022795 NTRS Research Center: Glenn Research Center (GRC).
  * Fan et al. [2018] Angela Fan, Mike Lewis, and Yann Dauphin.  Hierarchical Neural Story Generation.  In _Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , pages 889–898, Melbourne, Australia, July 2018. Association for Computational Linguistics.  doi: 10.18653/v1/P18-1082.  URL https://aclanthology.org/P18-1082.
  * Shah et al. [2019] Meet Shah, Xinlei Chen, Marcus Rohrbach, and Devi Parikh.  Cycle-Consistency for Robust Visual Question Answering, February 2019.  URL http://arxiv.org/abs/1902.05660.  arXiv:1902.05660 [cs].

##  Appendix A Dataset

Name | Number of Pages
---|---
arXiv | 7,511,745
PMC | 536,319
IDL | 446,777
Total | 8,204,754
Table A.1: Dataset composition

The most important data source is arXiv, making up $>91.5\%$ of the corpus. On
arXiv most research documents are paired with the LaTeX source code provided
by the authors. The LaTeX source offers more information and is left
unprocessed, unlike the XML format from PMC where equations and tables are
frequently substituted with images. This allows us to select exactly which
information we need to build the dataset.

##  Appendix B Examples

In this section we converted some pages from old text books using the Nougat
base model. The text books from the _Internet Archive_
101010https://archive.org/ and _Project Gutenberg_
111111https://www.gutenberg.org/ and are in public domain.
The performance for these scanned pages is noticeable worse than for digital-
born documents. However, the model does generate sensible text for each page
with few errors. For example see the first row of Fig. B.1. Here the model
mistakes the almost illegible exponent $n$ for $\ast$. In the second row of
the same figure the model falls into a repetitive loop after predicting
another comma instead of a dot. Similar problems can be seen in Fig. B.2.
In Fig. B.3 we present pages, scanned with a mobile device, from a printed
master thesis and the Nougat output. The model is robust to the artifacts that
arise when hand-scanning a document.
Explore the examples in this section on the project page:
https://facebookresearch.github.io/nougat.

Figure B.1: Example of an old calculus text book [45].

Figure B.2: A selection of pages from a NASA conference from 1970 [46].

Figure B.3: Scan of a modern thesis with a mobile device camera, with
permission from the author.

Figure B.4: Pages with tables. Upper: Fan et al. [47] page 6, Lower: Shah et
al. [48] page 6


# Stochastic and deterministic SIS patch model

T. Yeo Aix Marseille Univ, CNRS, Centrale Marseille, I2M, Marseille, France;
<EMAIL_ADDRESS>Félix Houphouët Boigny, Abidjan-Côte d’Ivoire;
<EMAIL_ADDRESS>
###### Abstract

Here, we consider a SIS epidemic model where the individuals are distributed
on several distinct patches. We construct a stochastic model and then prove
that it converges to a deterministic model as the total population size tends
to infinity. Furthermore we show the existence and the global stability of a
unique endemic equilibrium provided that the migration rates of susceptible
and infectious individuals are equal. Finally we compare the equilibra with
those of the homogeneous model, and with those of isolated patches.

Keywords: epidemic patch model . law of large numbers . endemic equilibrium

##  0 Introduction

Early epidemic models were formulated assuming that individuals in the
population mix homogeneously [2, 5, 9, 16, 25]. In this consideration, all
pairs of individuals in the population have the same probability of coming
into contact with each other. But, it is well known that in a large population
several groups can be formed due to heterogeneity arising, for example, from
social and economic factors. Some people may live in cities while others may
live in rural areas. Consequently, demographic and disease parameters may vary
for each group, and then the persistence and extinction of infectious diseases
in those communities can be different. Furthermore, people may travel between
the groups, which leads to the spread of the disease between groups. Then it
is clear that spatial heterogeneity, habitat connectivity and rates of
movement of individuals play an important role in the outbreak of an
infectious disease. Those considerations have lead to the development of
epidemic models that take into account the structure of the population. For
this reason, several authors studied heterogeneous epidemic models, by
structuring the spatial environment into patches. Fulford et al. [13]
developed a Susceptible-Exposed-Infectious (SEI) metapopulation model for the
spread of an infectious agent by migration. Salmani $\&$ Van den Driessche
[19] considered a SEIRS deterministic model in which travel rates were assumed
to depend on the disease status. Disease spread in metapopulation models
involving discrete patches has been also investigated by Arino et al. [3],
Arino $\&$ Van den Driessche [4], Jin $\&$ Wang [15], Wang $\&$ Mulone [23],
Wang $\&$ Zho [24]. Arino $\&$ Van den Driessche developed a general framework
for movement of susceptible, exposed, infectious, and recovered individuals
(SEIRS model) and define a mobility matrix, an irreducible matrix that defines
the spatial arrangement of patches and rates of movement between patches. Wang
and colleagues studied uniform persistence and global stability of disease-
free and endemic equilibria in Susceptible-Infectious-Susceptible (SIS)
metapopulation models. In a similar setting, Allen et al. [1] showed for a SIS
deterministic patch model that, while the population is at an endemic level
and if infectious individuals travel between the patches but the rate of
travel for susceptible individuals approaches zero, then, the endemic
equilibrium approaches a disease–free equilibrium.
Deterministic patch models describe the spread of disease under the
assumptions of mass action, relying on the law of large numbers. But the most
natural way to describe the spread of disease is stochastic. The probabilistic
point of view is recent. Let us mention some authors which treated stochastic
epidemic models. In 2007, McCormack $\&$ Allen [17] studied a SIR and a SIS
epidemic model. In this setting both models are deterministic and stochastic.
They showed that travel between patches can lead to either disease persistence
or extinction in all patches. Considering stochastic model, Clancy [10]
proposed a SIR model, and then showed that movement of infectious individuals
can decrease the spread of the disease. In the same considerations, Sani et
al. [20] introduced a multi-group SIR model for the spread of AIDS. In this
study, the authors used Markov process to describe the model. Using an
approximating system of the ODEs, they analysed the equilibrium behaviour of
the stochastic model. Finally, let’s mention that stochastic epidemics in a
homogeneous community has been studied recently by Britton $\&$ Pardoux [9].

The rest of the paper is organised as follows. In section 1 we introduce a
stochastic model on a finite number of patches. Section 2 is devoted to the
law of large numbers. In section 3 we show that the limit deterministic model
has an unique endemic equilibrium (EE) which is gloably asymptotically stable.
Finally we compare this endemic equilibrium with the one of the homogeneous
model in the section 4.

##  1 The model

Consider a population consisting of N individuals, where each individual is
located at one of $j$ geographically distinct patches. Sites (or vertices)
represent human communities in which the disease can diffuse and grow. The
edges represent links between communities (see figure 1 below). Individuals in
that population can be classified according to their ability to transmit the
disease to others. Susceptible individuals are those who do not have the
disease and who can become infected. Infectious individuals are those who are
infected by the disease and can transmit it to susceptible individuals. In
this work, attention is given to the SIS model, but the same approach can be
developed in the case of the SIRS model and of the SIR model with demography.
For any patch $j$, the transmission of the disease depends on three factors:
the rate of contacts, the probability that a contact is made with a
susceptible individual, and the probability that a contact between an
infectious and a susceptible individual leads to a successful transmission
(see e.g [8, 9]). $\mathrm{S}_{j}(t)$ (resp. $\mathrm{I}_{j}(t)$ ) denotes the
number of susceptible (resp. infectious) individuals in patch $j$ at time $t.$
We formulate a random Markov epidemic model as a Poisson process driven
stochastic differential equation (SDE). In what follows the
$\mathrm{P}_{\\!\\!j}$ are mutually independent standard Poisson processes.
Infections, healings and migrations of individuals happen according to Poisson
processes. In this model

  1. $\bullet$

infections are local;

  2. $\bullet$

when an infectious individual cures, he immediately becomes susceptible again;

  3. $\bullet$

each infectious individual meets other individuals at some rate $\alpha_{j}$.
The encounter results in a new infection with probability $p_{j}$ if the
patner of the encounter is susceptible, which happens with probability
$\displaystyle\dfrac{\mathrm{S}_{j}(t)}{\mathrm{S}_{j}(t)+\mathrm{I}_{j}(t)}$,
since we assume that individuals in each patch mix homogeneously. Letting
$\lambda_{j}=\alpha_{j}p_{j}$ and summing over the infectious individuals at
time $t$ gives the rate
$\displaystyle\lambda_{j}\dfrac{\mathrm{S}_{j}(t)}{\mathrm{S}_{j}(t)+\mathrm{I}_{j}(t)}\mathrm{I}_{j}(t)$
at time $t$. Then
$\displaystyle\mathrm{P}_{\\!\\!j}^{inf}\left(\int_{0}^{t}\lambda_{j}\dfrac{\mathrm{S}_{j}(r)\mathrm{I}_{j}(r)}{\mathrm{S}_{j}(r)+\mathrm{I}_{j}(r)}dr\right)$
counts the number of transitions of type $\mathrm{S}\longrightarrow\mathrm{I}$
on the patch $j$ between time $0$ and time $t$;

  4. $\bullet$

recovery of an infectious happens at rate $\gamma_{j}$, so
$\displaystyle\mathrm{P}_{\\!\\!j}^{rec}\left(\int_{0}^{t}\gamma_{j}\mathrm{I}_{j}(r)dr\right)$
counts the number of transitions of type $\mathrm{I}\longrightarrow\mathrm{S}$
on the patch $j$ between time $0$ and time $t$.

  5. $\bullet$

The term
$\displaystyle\mathrm{P}_{\\!\\!S,j,k}^{mig}\left(\int_{0}^{t}\nu_{S}a_{jk}\mathrm{S}_{j}(r)dr\right)$
counts the number of migrations of susceptible individuals from patch $j$ to
$k$, if we assume that each susceptible migrates from $j$ to $k$ at rate
$\nu_{S}a_{jk}$, and similarly for the compartment $\mathrm{I}$.

Here, $\nu_{S}$ and $\nu_{I}$ are the diffusion coefficients for susceptible
and infectious individuals, respectively. $a_{ij}$ represents the degree of
movement from patch $i$ into patch $j$.

$\bullet$ infectious individuals

$\bullet$ susceptible individuals

Figure 1: Metapopulation

Then the propagation of the illness can be modeled by the following system of
stochastic differential equations

(1.1) $\left\\{\begin{aligned} \vskip 12.0pt plus 4.0pt minus
4.0pt\mathrm{S}_{j}(t)&=\mathrm{S}_{j}(0)-\mathrm{P}_{\\!\\!j}^{inf}\left(\int_{0}^{t}\lambda_{j}\dfrac{\mathrm{S}_{j}(r)\mathrm{I}_{j}(r)}{\mathrm{S}_{j}(r)+\mathrm{I}_{j}(r)}dr\right)+\mathrm{P}_{\\!\\!j}^{rec}\left(\int_{0}^{t}\gamma_{j}\mathrm{I}_{j}(r)dr\right)\\\
&-\sum_{\underset{k\neq
j}{k=1}}^{\ell}\mathrm{P}_{\\!\\!S,j,k}^{mig}\left(\int_{0}^{t}\nu_{S}a_{jk}\mathrm{S}_{j}(r)dr\right)+\sum_{\underset{k\neq
j}{k=1}}^{\ell}\mathrm{P}_{\\!\\!S,k,j}^{mig}\left(\int_{0}^{t}\nu_{S}a_{kj}\mathrm{S}_{k}(r)dr\right)\\\\[5.69054pt]
\mathrm{I}_{j}(t)&=\mathrm{I}_{j}(0)+\mathrm{P}_{\\!\\!j}^{inf}\left(\int_{0}^{t}\lambda_{j}\dfrac{\mathrm{S}_{j}(r)\mathrm{I}_{j}(r)}{\mathrm{S}_{j}(r)+\mathrm{I}_{j}(r)}dr\right)-\mathrm{P}_{\\!\\!j}^{rec}\left(\int_{0}^{t}\gamma_{j}\mathrm{I}_{j}(r)dr\right)\\\
&-\sum_{\underset{k\neq
j}{k=1}}^{\ell}\mathrm{P}_{\\!\\!I,j,k}^{mig}\left(\int_{0}^{t}\nu_{I}a_{jk}\mathrm{I}_{j}(r)dr\right)+\sum_{\underset{k\neq
j}{k=1}}^{\ell}\mathrm{P}_{\\!\\!I,k,j}^{mig}\left(\int_{0}^{t}\nu_{I}a_{kj}\mathrm{I}_{k}(r)dr\right)\\\
t&\in[0,T],\;\;\;j=1,\cdots,\ell.\end{aligned}\right.$

In the next section we show that this stochastic model converges to a
deterministic epidemic patch model as the total size of population tends to
infinity.

##  2 Law of large numbers

We introduce the martingales $\mathrm{M}_{j}(t)=\mathrm{P}_{\\!\\!j}(t)-t$ and
we look instead at the renormalized model by dividing the size of the
population in each compartment by $\mathrm{N}$. Hence by setting

$\mathrm{S}_{j}^{\mathrm{N}}(t)=\dfrac{\mathrm{S}_{j}(t)}{\mathrm{N}}$,
$\mathrm{I}_{j}^{\mathrm{N}}(t)=\dfrac{\mathrm{I}_{j}(t)}{\mathrm{N}}$,
$\displaystyle\mathrm{S}^{\mathrm{N}}(t)=\left(\begin{array}[]{cl}\mathrm{S}_{1}^{\mathrm{N}}(t)\\\
\vdots\\\ \mathrm{S}_{\ell}^{\mathrm{N}}(t)\end{array}\right)$,
$\mathrm{I}^{\mathrm{N}}(t)=\left(\begin{array}[]{cl}\mathrm{I}_{1}^{\mathrm{N}}(t)\\\
\vdots\\\ \mathrm{I}_{\ell}^{\mathrm{N}}(t)\end{array}\right)$, and
$\displaystyle\mathcal{Z}^{\mathrm{N}}(t)=\left(\begin{array}[]{cl}\mathrm{S}^{\mathrm{N}}(t)\\\
\mathrm{I}^{\mathrm{N}}(t)\end{array}\right),$ then the stochastic model takes
the aggregated form

(2.1) $\displaystyle\mathcal{Z}^{\mathrm{N}}(t)$ $\displaystyle=$
$\displaystyle\mathcal{Z}^{\mathrm{N}}(0)+\int_{0}^{t}b\big{(}r,\mathcal{Z}^{\mathrm{N}}(r)\big{)}dr+\sum_{j=1}^{k}\frac{h_{j}}{\mathrm{N}}\mathrm{M}_{j}\Bigg{(}\mathrm{N}\int_{0}^{t}\beta_{j}\big{(}\mathcal{Z}^{\mathrm{N}}(r)\big{)}dr\Bigg{)},$

where $k$ is the total number of $\mathrm{P}_{\\!\\!j}$’s in the system, and

(2.2) $\displaystyle
b\big{(}r,\mathcal{Z}^{\mathrm{N}}(r)\big{)}=\sum_{j=1}^{k}h_{j}\beta_{j}\big{(}\mathcal{Z}^{\mathrm{N}}(r)\big{)};$

the vectors $h_{j}\in\\{-1,0,1\\}^{2\ell}$ denote the respective jump
directions with jump rates $\beta_{j}$ . The rates

$\displaystyle\beta_{.}\big{(}\mathcal{Z}^{\mathrm{N}}(t)\big{)}\\!\\!\\!$
$\displaystyle\in$
$\displaystyle\\!\\!\\!\Big{\\{}\;\dfrac{\lambda_{j}\mathrm{S}_{j}^{\mathrm{N}}(t)\mathrm{I}_{j}^{\mathrm{N}}(t)}{\mathrm{S}_{j}^{\mathrm{N}}(t)+\mathrm{I}_{j}^{\mathrm{N}}(t)},\;\gamma_{j}\mathrm{I}_{j}^{\mathrm{N}}(t),\;\nu_{S}\,a_{ij}\mathrm{S}_{j}^{\mathrm{N}}(t),$
$\displaystyle\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\nu_{I}\,a_{ij}\mathrm{I}_{j}^{\mathrm{N}}(t),\;i,j\in\\{1,\cdots,\ell\\}\;\Big{\\}}.$

Concerning the initial condition, we assume that
$\mathcal{Z}^{\mathrm{N}}(0)=z_{\mathrm{N}}=[\mathrm{N}x]/\mathrm{N}$, for
some $x\in[0,1]^{\ell}$, where $[\mathrm{N}x]$ is a vector of integers.

We set
$\displaystyle\mathcal{F}_{t}^{\mathrm{N}}=\sigma\\{\;\mathcal{Z}_{j}^{\mathrm{N}}(r),\;0\leq
r\leq t,\;j=1,\cdots,\ell\;\\}$ and we shall assume that the process
$\\{\mathcal{Z}^{\mathrm{N}}(t),t\geq 0\\}$ is defined on the filtered
probability space
$\displaystyle\big{(}\Omega,\mathcal{F},\mathcal{F}_{t}^{\mathrm{N}},\mathbb{P}\big{)}$.
In what follows, $\|u\|$ denotes the $L^{1}$ norm of an $\ell$–dimensional
vector u. More precisely, $\displaystyle\|u\|=\sum_{j=1}^{\ell}|u_{j}|$. We
shall say that a vector $u$ is nonnegative (resp. positive) if all its
elements are nonnegative (resp. positive), in with case we will write $u\geq
0$ (resp. $u>0$). The following theorem shows that the solution of the
stochastic model $(\ref{fag})$ converges a.s. locally uniformly in $t$ to the
solution of a deterministic model, as the total population size $\mathrm{N}$
tends to infinity.

###### Theorem 2.1

$\bf{[Law\ of\ Large\ Numbers]}$
Let $\mathcal{Z}^{\mathrm{N}}$ denote the solution of the SDEs (2.1) and $z$
the unique solution of the system of ordinary differential equations
$\dfrac{dz}{dt}(t)=b(t,z(t))$, $z(0)=x$.
Let us fix an arbitrary $T>0$. Then $\displaystyle\underset{0\leq t\leq
T}{\sup}\Big{\|}\mathcal{Z}^{\mathrm{N}}(t)-z(t)\Big{\|}\longrightarrow
0\;\text{a.s.},\;as\;\;\mathrm{N}\rightarrow+\infty.$

Note that the solution
$z(t)=\big{(}\mathbf{S}_{1}(t),\mathbf{I}_{1}(t),\mathbf{S}_{2}(t),\mathbf{I}_{2}(t),\cdots,\mathbf{S}_{\ell}(t),\mathbf{I}_{\ell}(t)\big{)}^{\\!\mathtt{T}}$
of the deterministic model satisfy

(2.4) $\left\\{\begin{aligned}
\frac{d\,\mathbf{S}_{j}}{dt}(t)&\\!=\\!-\lambda_{j}\dfrac{\mathbf{S}_{j}(t)\mathbf{I}_{j}(t)}{\mathbf{S}_{j}(t)+\mathbf{I}_{j}(t)}+\gamma_{j}\,\mathbf{I}_{j}(t)+\nu_{S}\sum_{\underset{k\neq
j}{k=1}}^{\ell}\Big{(}a_{kj}\,\mathbf{S}_{k}(t)-a_{jk}\,\mathbf{S}_{j}(t)\Big{)}\\\
\frac{d\,\mathbf{I}_{j}}{dt}(t)&\\!=\\!\lambda_{j}\dfrac{\mathbf{S}_{j}(t)\mathbf{I}_{j}(t)}{\mathbf{S}_{j}(t)+\mathbf{I}_{j}(t)}-\gamma_{j}\,\mathbf{I}_{j}(t)+\nu_{I}\sum_{\underset{k\neq
j}{k=1}}^{\ell}\Big{(}a_{kj}\,\mathbf{I}_{k}(t)-a_{jk}\,\mathbf{I}_{j}(t)\Big{)}\\\
\mathbf{S}_{j}(0)&\geq 0,\;\mathbf{I}_{j}(0)\geq 0\\\
j&=1,\cdots,\ell.\end{aligned}\right.$

$\mathbf{S}_{j}(t)$ (resp. $\mathbf{I}_{j}(t)$ ) is the proportion of the
total susceptible (resp. infectious) population which is localized on the site
$j$ at time $t$.

2.1 ensures that, as the population size $\mathrm{N}$ becomes large, the
proportion of susceptible and infectious individuals at each patch is well
approximated, on any bounded intervall $[0,T]$ by the solution of the ODEs
(2.4), provided the scaled process starts close to an initial value of the
ODEs.

2.1 is a special case of Theorem 2.2.7 of Britton $\&$ Pardoux [9], where the
proof written for the homogeneous model covers our situation as well. One of
the earliest references on this convergence result is Ethier $\&$ Kurtz [12]
(chapter 11, Theorem 2.1). Thus, we do not give details and refer the reader
to those papers for a complete proof. We briefly sketch the idea of the proof.
First note that $0\leq\mathcal{Z}^{\mathrm{N}}(t)\leq 1$, for all $t\in[0,T]$.
By using the law of large numbers for Poisson processes and the second Dini
Theorem, it follows that

$\underset{0\leq t\leq
T}{\sup}{\Big{\rvert}\sum_{j=1}^{\ell}\dfrac{h_{j}}{\mathrm{N}}\mathrm{M}_{j}\left(\mathrm{N}\int_{0}^{t}\beta_{j}(\mathcal{Z}^{\mathrm{N}}(r))dr\right)\Big{\rvert}}\overset{a.s.}{\longrightarrow}0.$

Next, it is not hard to see that $b(t,z)$ is a globally Lipchitz function of
$z$, locally uniformly in $t$. From this fact, it follows that, for all
$t\in[0,T]$,

$\displaystyle\Big{\|}\mathcal{Z}^{\mathrm{N}}(t)-z(t)\Big{\|}$
$\displaystyle\leq$
$\displaystyle\Big{\|}z_{\mathrm{N}}-x\Big{\|}+\Big{\rVert}\sum_{j=1}^{\ell}\dfrac{h_{j}}{\mathrm{N}}\mathrm{M}_{j}\left(\mathrm{N}\int_{0}^{t}\beta_{j}(\mathcal{Z}^{\mathrm{N}}(r))dr\right)\Big{\rVert}$
$\displaystyle+$ $\displaystyle
C\\!\\!\int_{0}^{t}\Big{\|}\mathcal{Z}^{\mathrm{N}}(r)-z(r)\Big{\|}dr,$

where $C$ is the Lipschitz constant of $b$. Finally, the result follows from
Gronwall’s Lemma and the fact that the two first terms in the right-hand side
of (2) tend to zero as $\mathrm{N}\to\infty$.

In the following section, we study the equilibra of this system of ODEs.

##  3 Equilibra of the ODEs and their stability

In this section, we consider properties of the disease free equilibrium (DFE)
and the endemic equilibrium (EE), including its existence, uniqueness and
stability. Throughout this section, we assume that the connectivity matrix
$\mathbb{A}=\big{(}a_{ij}\big{)}_{\underset{1\leq j\leq\ell}{1\leq
i\leq\ell}}$ is irreducible and symmetric. This irreducibility assumption
implies that the patches cannot be separated into two disjoint subsets such
that there is no migration of individuals from one subset to the other. That
is, for any $j,k\in\\{1,\cdots,\ell\\}$, $j\neq k$, there exists $s\geq 2$, a
sequence $j_{1},j_{2},\cdots,j_{s}\in\\{1,\cdots,\ell\\}$ such that $j_{1}=j$,
$j_{s}=k$ and $a_{j_{i}j_{i+1}}\neq 0$, $\forall i\in\\{1,\cdots,s-1\\}$. We
shall say that a matrix $M=\big{(}m_{ij}\big{)}_{\underset{1\leq
j\leq\ell}{1\leq i\leq\ell}}$ is nonnegative (resp. positive) if all its
elements are nonnegative (resp. positive), in with case we will write $M\geq
0$ (resp. $M>0$). In what follows, we set
$\mathbf{N}_{j}(t)=\mathbf{S}_{j}(t)+\mathbf{I}_{j}(t)$.

Let us mention that the system of ODEs (2.4) obtained in 2.1 has been studied
by Allen et al. [1], where the authors studied the asymptotic profiles of the
steady states. First, using the irreducibility of the connectivity matrix,
they show

######  Lemma 3.1 (Allen [1] )

$\bf{[Existence\ and\ uniqueness\ of\ the\ DFE]}$
The system (2.4) has a unique disease-free equilibrium which is given by

$\hat{z}:=\Big{(}\hat{\mathbf{S}}_{1},\hat{\mathbf{I}}_{1},\hat{\mathbf{S}}_{2},\hat{\mathbf{I}}_{2},\cdots,\hat{\mathbf{S}}_{\ell},\hat{\mathbf{I}}_{\ell}\Big{)}=\Big{(}\dfrac{1}{\ell},0,\dfrac{1}{\ell},0,\cdots,\dfrac{1}{\ell},0\Big{)}.$

The DFE always exists, an important question is whether an outbreak of the
disease can occur when the population initially contains a small number of
infected individuals. This question may be addressed using stability analysis
of the DFE. In fact if $\mathcal{R}_{0}$, the basic reproduction number (the
expected number of secondary cases produced, in a completely susceptible
population, by a typical infective individual) is less than 1, the DFE is
globally asymptotically stable. That is, the trajectory of the ODEs which
starts close to the DFE will be attracted towards the DFE. That is the content
of the next lemma. Before, we use the next-generation matrix approach of Van
den Driessche $\&$ Watmough [11] to compute $\mathcal{R}_{0}$. Define the
matrices

$\mathrm{A}=\text{diag}(\gamma_{j})_{1\leq
j\leq\ell},\;\;\;\mathrm{F}=\text{diag}(\lambda_{j})_{1\leq
j\leq\ell}\;\text{and}\;\;\mathrm{D}=(d_{ij})_{1\leq i,\,j\leq\ell}$

with $\displaystyle
d_{ij}=\left\\{\begin{array}[]{lr}\displaystyle-\sum_{\underset{k\neq
i}{k=1}}^{\ell}a_{ik}&\;\;\text{if}\;\;\;i=j,\\\
\;\;\;\;a_{ij}&\;\;\text{if}\;\;\;i\neq j.\end{array}\right.$

A direct application of the result of the above reference yields the following
Proposition.

###### Proposition 3.1

The basic reproduction number for (2.4) is the spectral radius of the next-
generation matrix:

$\mathcal{R}_{0}=\rho(-\mathrm{F}\mathrm{V}^{-1}),$

where $\mathrm{V}=\nu_{I}\mathrm{D}-\mathrm{A}$.

We have also the

######  Lemma 3.2 (Allen et al. [1] )

$\bf{[Stability\ of\ the\ DFE]}$
If $\mathcal{R}_{0}<1$, then the disease-free equilibrium $\hat{z}$ is
globally asymptotically stable, that is

$z(t)\longrightarrow\hat{z},\;\;\text{ as}\;\;t\to\infty.$

We will show at the end of this section that, under a specific condition, the
disease-free equilibrium is globally asymptotically stable if
$\mathcal{R}_{0}=1$. The existence and uniqueness of the EE for (2.4) is shown
in [1] under the assumption that $\mathcal{R}_{0}>1$. In that work, the
authors were not able to prove the stability of the EE, but conjectured that
this EE attracts all solutions whose initial conditions have a nonzero
proportion of infectious (and numerical simulations suggest that this is
indeed the case). Here, we employ the approach in Bichara et al. [7] to prove
the globally stability of the EE, under the assumption that infectious and
susceptible individuals have the same diffusion rate $\nu_{S}=\nu_{I}:=\nu$.
Assuming that $\nu_{S}=\nu_{I}:=\nu$, then the sytem given by (2.4) is
equivalent to

(3.1) $\left\\{\begin{aligned}
\frac{d\,\mathbf{N}_{j}(t)}{dt}&=\nu\sum_{\underset{k\neq
j}{k=1}}^{\ell}\Big{(}a_{kj}\mathbf{N}_{k}(t)-a_{jk}\mathbf{N}_{j}(t)\Big{)}\\\
\frac{d\,\mathbf{I}_{j}(t)}{dt}&=\lambda_{j}\Big{(}1-\frac{\mathbf{I}_{j}(t)}{\mathbf{N}_{j}(t)}\Big{)}\mathbf{I}_{j}(t)-\gamma_{j}\,\mathbf{I}_{j}(t)+\nu\sum_{\underset{k\neq
j}{k=1}}^{\ell}\Big{(}a_{kj}\mathbf{I}_{k}(t)-a_{jk}\mathbf{I}_{j}(t)\Big{)}\\\
j&=1,\cdots,\ell,\end{aligned}\right.$

which can be written in the form

(3.2) $\left\\{\begin{aligned}
\frac{d\,\mathbf{N}(t)}{dt}&=\nu\mathrm{D}\mathbf{N}(t)\\\
\dfrac{d\,\mathbf{I}(t)}{dt}&=\nu\mathrm{D}\,\mathbf{I}(t)-\mathrm{A}\,\mathbf{I}(t)+\Big{(}\mathbb{I}_{\ell}-\text{diag}(\mathbf{N}_{j}^{-1}(t))\text{diag}(\mathbf{I}(t))\Big{)}\mathrm{F}\,\mathbf{I}(t),\end{aligned}\right.$

where $\mathbf{N}=(\mathbf{N}_{1},\cdots,\mathbf{N}_{\ell})^{\mathtt{T}}$,
$\mathbf{I}=(\mathbf{I}_{1},\cdots,\mathbf{I}_{\ell})^{\mathtt{T}}$ and
$\mathbb{I}_{\ell}$ is the identity matrix with dimension $\ell\times\ell.$
Note that
$\Big{(}\mathbb{I}_{\ell}-\text{diag}(\mathbf{N}_{j}^{-1}(t))\text{diag}(\mathbf{I}(t))\Big{)}\mathrm{F}\,\mathbf{I}(t)$
is the vector of new infections, $\nu\mathrm{D}\mathbf{I}(t)$ is the vector of
migrations of infectious individuals and $\mathrm{A}\mathbf{I}(t)$ is the
vector of transitions of individuals from the compartment $\mathbf{I}$ to the
compartment $\mathbf{S}$.

###### Lemma 3.3

The system
$\displaystyle\frac{d\,\mathbf{N}(t)}{dt}=\nu\mathrm{D}\mathbf{N}(t)$ has a
unique global asymptotically stable equilibrium.

Proof :  Let $Q$ be the matrix such that $q_{ij}=a_{ji}$ for $i\neq j$ and
$\displaystyle q_{jj}=-\sum_{k=1}^{\ell}a_{kj}.$ Hence the system
$\displaystyle\frac{d\,\mathbf{N}(t)}{dt}=\nu D\mathbf{N}(t)$ is equivalent to
$\displaystyle\frac{d\,\mathbf{N}^{\mathtt{T}}(t)}{dt}=\nu\mathbf{N}^{\mathtt{T}}(t)Q$.
Notice that $Q$ is the infinitesimal generator of an irreducible Markov
process with state space
$\big{\\{}\;\dfrac{n}{\ell},n=0,1,\cdots,\ell\;\big{\\}}^{\ell}.$ By using
Theorem 5.1 of Pardoux [18], it follows that there exists a unique strictly
positive equilibrium $\mathbf{N}^{*}$ which solves the equation
$(\mathbf{N}^{*})^{\\!\mathtt{T}}Q=0$. Since the state space is finite, the
Markov process associed to the infinitesimal generator $Q$ is reccurent, and
then the global asymptotic stability of $\mathbf{N}^{*}$ is garanteed by the
Theorem 6.5 of the above reference.

$\square$

Next we treat the existence and stablity of the endemic equilibrium for the
system given by (3.2). Notice that (3.2) is of triangular form, and hence the
theory of asymptotically autonomous systems for triangular systems (Vidyasagar
[22] ) guarantees that the asymptotic stability of its equilibrium is
equivalent to that of the system

$\dfrac{d\,\mathbf{I}(t)}{dt}=\nu\mathrm{D}\,\mathbf{I}(t)-\mathrm{A}\,\mathbf{I}(t)+\Big{(}\mathbb{I}_{\ell}-\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathbf{I}(t))\Big{)}\mathrm{F}\,\mathbf{I}(t),$

where $(\mathbf{N}_{1}^{*},\cdots,\mathbf{N}_{\ell}^{*})$ is the unique
asymptotically stable equilibrium defined in 3.3. The Jacobian matrices of
$\Big{(}\mathbb{I}_{\ell}-\text{diag}(\mathbf{N}_{j}^{-1}(t))\text{diag}(\mathbf{I}(t))\Big{)}\mathrm{F}\,\mathbf{I}(t)$
and $\nu\mathrm{D}\,\mathbf{I}(t)-\mathrm{A}\,\mathbf{I}(t)$, respectively, at
the disease free equilibrium are $\mathrm{F}$ and $\mathrm{V}$. For the
convenience of the reader, we recall the following result.

######  Theorem 3.1 (Vidyasagar[22], Theorem 3.1 and 3.4)

Let $f$ and $g$ be two functions of class $\mathcal{C}^{1}$. Consider the
following system

(3.3) $\left\\{\begin{aligned} \dot{x}&=f(x)\\\ \dot{y}&=g(x,y)\hskip
85.35826ptx\in\mathbb{R}^{n},y\in\mathbb{R}^{m}\\\ &\text{with an equilibrium
point }\,(x^{*},y^{*}),\;\;\text{i.e.}\,,\\\
&f(x^{*})=0\;\text{and}\;g(x^{*},y^{*})=0.\end{aligned}\right.$

If $x^{*}$ is globally asymptotically stable (GAS) in $\mathbb{R}^{n}$ for the
system $\dot{x}=f(x)$, and if $y^{*}$ is GAS in $\mathbb{R}^{m}$ for the
system $\dot{y}=g(x^{*},y)$, then $(x^{*},y^{*})$ is locally asymptotically
stable for (3.3). Moreover, if all the trajectories of (3.3) are forward
bounded, then $(x^{*},y^{*})$ is GAS for (3.3).

We shall need below the

######  Theorem 3.2 (Hirsch [14], Theorem 6.1)

Let F be a $\mathcal{C}^{1}$ vector field in $\mathbb{R}^{q}$, whose flow
$\phi$ preserves $\mathbb{R}^{q}_{+}$ for $t\geq 0$ and is strongly monotone
in $\mathbb{R}^{q}_{+}$. Assume that the origin is an equilibrium and that all
trajectories in $\mathbb{R}^{q}_{+}$ are bounded. If the matrix-valued map
$\mathcal{D}F:\mathbb{R}^{q}\longrightarrow\mathbb{R}^{q}\times\mathbb{R}^{q}$
is strictly decreasing, in the sense that

$\text{if}\;\;x<y\;\;\text{then}\;\;\mathcal{D}F(x)>\mathcal{D}F(y),$

then either all trajectories in $\mathbb{R}^{q}_{+}\backslash\\{0\\}$ tend to
the origin, or there is a unique equilibrium $p^{*}$, ($p^{*}\gg 0$) in the
interior of $\mathbb{R}^{q}_{+}$ and all trajectories in
$\mathbb{R}^{q}_{+}\backslash\\{0\\}$ tend to $p^{*}$.

Now, we are in a position to prove the main result of this section.

###### Theorem 3.3

$\bf{[Existence\ and\ stability\ of\ the\ EE]}$
Assume that $\nu_{I}=\nu_{S}:=\nu$ and $\mathcal{R}_{0}>1$. Then the system
(2.4) has a unique endemic equilibrium
$z^{*}=\Big{(}\mathbf{S}_{1}^{*},\mathbf{I}_{1}^{*},\mathbf{S}_{2}^{*},\mathbf{I}_{2}^{*}\cdots,\mathbf{S}_{\ell}^{*},\mathbf{I}_{\ell}^{*}\Big{)},$
which is globally asymptotically stable.

Proof :  It follows from 3.1 that it is sufficient to study the stability of
the reduced system

$\dfrac{d\,\mathbf{I}(t)}{dt}=\nu\mathrm{D}\,\mathbf{I}(t)-\mathrm{A}\,\mathbf{I}(t)+\Big{(}\mathbb{I}_{\ell}-\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathbf{I}(t))\Big{)}\mathrm{F}\,\mathbf{I}(t).$

Note that the set defined by

$K=\big{\\{}\big{(}(u_{1},\cdots,u_{\ell}),(v_{1},\cdots,v_{\ell})\big{)}\in\mathbb{R}_{+}^{\ell}\times\mathbb{R}_{+}^{\ell}:0\leq
v_{i}\leq u_{i},1\leq
i\leq\ell\;\text{and}\;\sum_{i=1}^{\ell}\\!u_{i}=1\big{\\}}$

is a compact positively invariant for the system (3.1). Define

$\mathcal{L}(\mathbf{I})=(\mathrm{F}+\mathrm{V})\mathbf{I}-\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathbf{I})\mathrm{F}\,\mathbf{I}.$

The derivative $\mathcal{D}\mathcal{L}(\mathbf{I})$ is

$\displaystyle\mathcal{D}\mathcal{L}(\mathbf{I})$ $\displaystyle=$
$\displaystyle(\mathrm{F}+\mathrm{V})-\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathbf{I})\mathrm{F}-\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathrm{F}\,\mathbf{I})$
$\displaystyle=$
$\displaystyle\nu\mathrm{D}-\mathrm{A}+\mathrm{F}-\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathbf{I})\mathrm{F}-\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathrm{F}\,\mathbf{I}).$

Notice that $\mathcal{D}\mathcal{L}(\mathrm{I})$ is an irreducible Metzler
matrix. Since $\mathrm{F}\geq 0$ and $\mathrm{F}\neq 0$,
$\mathcal{D}\mathcal{L}$ is clearly stricly decreasing with respect of
$\mathbf{I}$. Applying 3.2, we deduce that either all trajectories in K tend
to the origin, or there is a unique equlibrium in the interior of K and all
trajectories in $K\backslash([0,\infty)^{\ell}\times\\{0\\}^{\ell})$ tend to
this equilibrium.
We introduce the stability modulus $\alpha(M)$ of a matrix $M$, which is the
largest real part of the elements of the spectrum Spec(M) of M :

$\alpha(M)=\underset{\delta\in\text{Spec}(M)}{\max}\text{Re}(\delta).$

From Theorem 3.13 of Varga [21] (chapter 3), $\mathcal{R}_{0}>1$ is equivalent
to $\alpha(\mathrm{F}+\mathrm{V})>0$, and the disease free equilibrium is
unstable in this case. It then follows from 3.2 that there exists a unique
attracting endemic equilibrium $\mathbf{I}^{*}\neq 0$, which satisfies

(3.4)
$\displaystyle(\nu\mathrm{D}-\mathrm{A}+\mathrm{F})\mathbf{I}^{*}-\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathbf{I}^{*})\mathrm{F}\,\mathbf{I}^{*}$
$\displaystyle=$ $\displaystyle 0.$

Since $\mathrm{F}$ is a non-negative matrix and $\mathbf{I}^{*}\neq 0,$ by
using (3.4), it follows that

(3.5)
$\displaystyle\mathcal{D}\mathcal{L}(\mathrm{I}^{*})\mathbf{I}^{*}=-\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathrm{F}\mathbf{I}^{*})\,\mathbf{I}^{*}<0.$

Using the fact that $\mathcal{D}\mathcal{L}(\mathbf{I}^{*})$ is a Metzler
matrix, (3.5) implies that it is stable (Berman $\&$ Plemmons [6]: criteron
$I_{28}$ of Theorem 6.2.3). The stability modulus then satisfies
$\alpha\big{(}\mathcal{D}\mathcal{L}(\mathbf{I}^{*})\big{)}<0$. This proves
the local asymptotic stability of $\mathbf{I}^{*}$. Since the attractivity of
$\mathbf{I}^{*}$ is guaranteed by Hirsh’s 3.2, we conclude that the endemic
equilibrium $\mathbf{I}^{*}$ is globally asymptotically stable if
$\mathcal{R}_{0}>1$.

$\square$

Let us mention that, under the assumption $\nu_{I}=\nu_{S}:=\nu$, the DFE is
globally assymptotically stable when $\mathcal{R}_{0}=1$. Indeed,
$\mathcal{R}_{0}=1$ is equivalent to $\alpha(\mathrm{F}+\mathrm{V})=0$. But
since $\mathrm{F}+\mathrm{V}$ is an irreducible Metzler matrix, there exists a
positive vector $v$ such that $(\mathrm{F}+\mathrm{V})^{\mathtt{T}}v=0.$ Let
us consider the Lyapunov function
$\displaystyle\mathtt{L}(\mathbf{I})=\langle\;v\,|\,\mathbf{I}\;\rangle$. The
derivative of this function is

$\displaystyle\dot{\mathtt{L}}(\mathbf{I})$ $\displaystyle=$
$\displaystyle\langle\;v\,|\,\dot{\mathbf{I}}\;\rangle$ $\displaystyle=$
$\displaystyle\langle\;v\,|\,\mathrm{F}+\mathrm{V}-\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathbf{I}(t))\mathrm{F}\,\mathbf{I}(t)\;\rangle$
$\displaystyle=$
$\displaystyle-\langle\;v\,|\,\text{diag}(1/\mathbf{N}_{j}^{*})\text{diag}(\mathbf{I}(t))\mathrm{F}\,\mathbf{I}(t)\;\rangle$
$\displaystyle\leq$ $\displaystyle 0.$

Moreover, $\dot{\mathtt{L}}(\mathbf{I})=0$ only at the DFE. Hence the DFE is
GAS if $\mathcal{R}_{0}=1$.

##  4 Comparison of the equilibra: connected patches model, homogeneous model,
isolated patches

We now consider the deterministic model in an homogeneous community:

(4.1) $\left\\{\begin{aligned}
\frac{d\,\mathbf{S}}{dt}(t)&\\!=\\!-\lambda\mathbf{S}(t)\mathbf{I}(t)+\gamma\,\mathbf{I}(t)\\\\[5.69054pt]
\frac{d\,\mathbf{I}}{dt}(t)&\\!=\\!\lambda\mathbf{S}(t)\mathbf{I}(t)-\gamma\,\mathbf{I}(t),\end{aligned}\right.$

where $\lambda$ (resp. $\gamma$) is the rate of the disease transmission
(resp. recovery).
The endemic equilibrium of the system of ODEs (4.1) is
$\mathfrak{z}^{*}=\left(\dfrac{\gamma}{\lambda}\,,1-\dfrac{\gamma}{\lambda}\right)$.

We wish to compare this EE with the one of the deterministic heterogeneous
model.

$\bullet$ First, if the disease transmission and recovery rates are the same
on all patches, that is for all $j=1,\cdots,\ell$, $\lambda_{j}=\lambda$ and
$\gamma_{j}=\gamma$, then the EE of the ODEs (2.4) is
$z^{*}=\left(\dfrac{\gamma}{\ell\lambda},\dfrac{1}{\ell}\big{(}1-\dfrac{\gamma}{\lambda}\big{)},\cdots,\dfrac{\gamma}{\ell\lambda},\dfrac{1}{\ell}\big{(}1-\dfrac{\gamma}{\lambda}\big{)}\right)$.
In this case, we note that the proportion of the infectious subpopulation in
the hemogeneous model is equally distributed between all patches.

$\bullet$ We now look at the case where the patches have different disease
transmission and recovery rates. In this case it is difficult to obtain the
EE, even for a small number of patches. But it can be found relatively simply
using any numerical solver when the state space is small. Here, we consider
the case of two patches and use the solver "Wolfram Alpha" to compute the EE.

In the below table we give the values of the infectious subpopulation in each
patch at the equilibrium for several values of the parameters. We take
$\gamma_{1}=\gamma_{2}=1$ and consider three cases. First $\lambda_{1}=1.5$,
$\lambda_{2}=2$. In this case when the patches are isolated, the value of the
infectious subpopulation in patch 1 and patch 2 are $\mathbf{I}_{1}^{*}\approx
0.333$ and $\mathbf{I}_{2}^{*}\approx 0.5$, respectively. Secondly
$\lambda_{1}=3$, $\lambda_{2}=2.5$, and $\mathbf{I}_{1}^{*}\approx 0.666$ and
$\mathbf{I}_{2}^{*}\approx 0.600$ in isolated patches. Finally, in the case
$\lambda_{1}=1.5$, $\lambda_{2}=1.2$, we have $\mathbf{I}_{1}^{*}\approx
0.333$ and $\mathbf{I}_{2}^{*}\approx 0.166$.

$\lambda_{1}$ | $\lambda_{2}$ | $\gamma_{1}$ | $\gamma_{2}$ | $\nu_{I}$ | $\nu_{S}$ | $\left(\dfrac{\mathbf{I}_{1}^{*}}{\mathbf{S}_{1}^{*}+\mathbf{I}_{1}^{*}},\dfrac{\mathbf{I}_{2}^{*}}{\mathbf{S}_{2}^{*}+\mathbf{I}_{2}^{*}}\right)$
---|---|---|---|---|---|---
1.5 | 2 | 1 | 1 | 0.0001 | 0.0001 | (0.332 , 0.507)
1.5 | 2 | 1 | 1 | 0.0001 | 0.0005 | (0.334, 0.497)
1.5 | 2 | 1 | 1 | 0.001 | 0.0001 | (0.333, 0.497)
1.5 | 2 | 1 | 1 | 0.0001 | 0.001 | (0.332, 0.497)
|  |  |  |  |  |
3 | 2.5 | 1 | 1 | 0.0001 | 0.0001 | (0.667 , 0.598)
3 | 2.5 | 1 | 1 | 0.0007 | 0.0001 | (0.666 , 0.599)
3 | 2.5 | 1 | 1 | 0.001 | 0.0001 | (0.666 , 0.598)
3 | 2.5 | 1 | 1 | 0.0001 | 0.001 | (0.666 , 0.598)
|  |  |  |  |  |
1.5 | 1.2 | 01 | 1 | 0.0001 | 0.0001 | (0.332 , 0.165)
1.5 | 1.2 | 1 | 1 | 0.0001 | 0.0009 | (0.332 , 0.165)
1.5 | 1.2 | 1 | 1 | 0.001 | 0.0001 | (0.333 , 0.165)
1.5 | 1.2 | 1 | 1 | 0.0001 | 0.008 | (0.332 , 0.165)
Table 1: proportion of $\mathbf{I}_{1}^{*}$ and $\mathbf{I}_{2}^{*}$ when
patches are connected

In the above table, we have the proportions of the infectious subpopulation in
each patch at the equilibrium, for some values of the diffusion coefficients.
We observe that those proportions are very close to those when patches are
isolated.

We have shown that the stochastic model is well approximated by a
deterministic patch model. If $\mathcal{R}_{0}>1$, the system of ODEs (2.4)
has a unique endemic equilibrium which is globally asymptotically stable.
Moreover considering the case of two patches, it appears that in the
heterogeneity case, the final size of the epidemic in each patch is close to
that of isolated patches.
In a future work, we will study the fluctuations of the stochastic model
around its deterministic law of large numbers limit.

Acknowledgements. This paper is part of the author’s Ph.D. thesis written
under the supervision of Prof. Etienne Pardoux, whom the author would like to
thank for careful reading and plentiful suggestions that greatly improved the
paper.

Funding: This research was partially supported by a thesis scholarship from
the government of Ivory Coast, and a salary as instructor at University of
Aix–Marseille.

Conflict of Interest: The author declare that there is no conflict of
interest.

## References

  * [1] L. J. S. Allen, B. M. Bolker, Y. Lou and A. L. Nevai. Asymptotic profiles of the steady states for an SIS epidemic patch model. SIAM Journal on Applied Mathematics, 67(5), 1283-1309, 2007.
  * [2] H. Andersson and T. Britton. Stochastic epidemic models and their statistical analysis. Springer Lecture Notes in Statistics. New York: Springer Verlag, 2000.
  * [3] J. Arino, J. R. Davis, D. Hartley, R. Jordan, J. M. Miller and P. V. D. Driessche. A multi-species epidemic model with spatial dynamics. Math. Med. Biol., 22, pp. 129- 142, 2005.
  * [4] J. Arino and P. V. D. Driessche. The basic reproduction number in a multi-city compartmental epidemic model. Positive Systems. Springer, Berlin, Heidelberg, 135-142. 2003.
  * [5] N. T. J. Bailey. The Mathematical Theory of Infectious Diseases and its Applications: Second Edition. Griffin, London, 1975.
  * [6] A. Berman and R. J. Plemmons. Nonnegative Matrices in the Mathematical Sciences: Classics in Applied Mathematics. 9. Philadelphia, PA: SIAM, 1994.
  * [7] D. Bichara, Y. Kang, C. Castillo-Chavez, R. Horan, $\&$ C. Perrings. SIS and SIR epidemic models under virtual dispersal. Bulletin of mathematical biology, 77 (11), 2004-2034, 2015.
  * [8] M. Begon, M. Bennett, R. G. Bowers, N. P. French, S. M. Hazel and J. Turner. A clarification of transmission terms in host–microparasite models: numbers, densities and areas. Epidemiol. Infect., 129:147–153, 2002.
  * [9] T. Britton $\&$ E. Pardoux: Stochastic Epidemic Models with Inference, Lecture notes in Math. 2255, Springer 2019.
  * [10] D. Clancy. Strong approximations for mobile population epidemic models. Ann. Appl. Probab., 6:883–895, 1996
  * [11] P. V. D. Driessche and J. Watmough. Reproduction numbers and sub-threshold endemic equilibria for compartmental models of disease transmission, Math. Biosci., 180, pp. 29-48, 2002.
  * [12] S. N. Ethier and T. G. Kurtz. Markov processes: characterization and convergence, J. Wiley $\&$ Sons, 1986.
  * [13] G. R. Fulford, M. G. Roberts and J. A. P. Heesterbeek. The metapopulation dynamics of an infectious disease: tuberculosis in possums. Theoretical Population Biology, 61, no 1, p. 15-29, 2002.
  * [14] M. W. Hirsch. The dynamical systems approach to differential equations. Bulletin of The American Mathematical Society,  11(1): 1–64, 1984.
  * [15] Y. Jin and W. Wang. The effect of population dispersal on the spread of a disease, J. Math. Anal. AppL, 308: 343-364, 2005.
  * [16] W. O. Kermack and A. G. Mckendrick. A contribution to the mathematical theory of epidemics, part 1. Proc. R. Soc. Lond. Ser. A, 115:700–721, 1927.
  * [17] R. K. McCormack and L. J.S. Allen. Multi–patch deterministic and stochastic models for wildlife diseases. J. Biol. Dyn., 1:63–85, 2007.
  * [18] E. Pardoux. Markov processes and applications: algorithms, networks, genome and finance. John Wiley $\&$ Sons, 2008.
  * [19] M. Salmani and P. V. D. Driessche. A model for disease transmission in a patchy environment. Discrete Contin. Dyn. Syst. Ser. B, 6:185–202, 2006.
  * [20] A. Sani, D. P. Kroese, and P. K. Pollett. Stochastic models for the spread of HIV in a mobile heterosexual population. Math. Biosci., 208:98–124, 2007.
  * [21] R. Varga. Matrix Iterative Analysis (Prentice–Hall Series in Automatic Computation). Englewood Cliffs, NJ: Prentice-Hall, Inc, 1962.
  * [22] M. Vidyasagar. Decomposition techniques for large-scale systems with nonadditive interactions: stability and stabilizability. IEEE Transactions Automatic Control 25:773–779, 1980.
  * [23] W. Wang and G. Mulone. Threshold of disease transmission in a patch environment, J. Math. Anal. AppL, 285, pp. 321-335, 2003.
  * [24] W. Wang and X.-Q. Zhao. An epidemic model in a patchy environment.  Math. Biosci., 190, pp. 97-112, 2004.
  * [25] G. H. Weiss and M. Dishon. On the asymptotic behavior of the stochastic and deterministic models of an epidemic. Math. Biosci., 11:261–265, 1971.