# ManyTypes4Py: A Benchmark Python Dataset for Machine Learning-based Type
Inference

Amir M. Mir  Department of Software Technology
Delft University of Technology
Delft, The Netherlands
<EMAIL_ADDRESS>Evaldas Latoškinas  Department of Software Technology
Delft University of Technology
Delft, The Netherlands
<EMAIL_ADDRESS>Georgios Gousios  Department of Software
Technology
Delft University of Technology
Delft, The Netherlands
<EMAIL_ADDRESS>
###### Abstract

In this paper, we present ManyTypes4Py, a large Python dataset for machine
learning (ML)-based type inference. The dataset contains a total of 5,382
Python projects with more than 869K type annotations. Duplicate source code
files were removed to eliminate the negative effect of the duplication bias.
To facilitate training and evaluation of ML models, the dataset was split into
training, validation and test sets by files. To extract type information from
abstract syntax trees (ASTs), a light-weight static analyzer pipeline is
developed and accompanied with the dataset. Using this pipeline, the collected
Python projects were analyzed and the results of the AST analysis were stored
in JSON-formatted files. The ManyTypes4Py dataset is shared on zenodo and its
tools are publicly available on GitHub.

###### Index Terms:

Type Inference, Machine Learning, Python, Type Annotations, Static Analysis

##  I Introduction

In recent years, dynamic programming languages (DPLs) have become immensely
popular as they give developers fast prototyping [1]. However, DPLs lack
static typing, which causes several issues such as unexpected run-time
exceptions, sub-optimal support for integrated development environments
(IDEs), and less precise program analysis. To address these issues, optional
static typing is introduced for DPLs like Python [2], JavaScript [3], and PHP
[4]. Yet, developers are required to manually add type annotations to their
existing codebases, which is a laborious task [5]. To ease the type annotation
burden, researchers have recently employed machine learning (ML) techniques to
infer types for DPLs [6, 7, 8].

ML techniques need a sufficiently large dataset to achieve an acceptable level
of generalization for the task at hand [9]. Concerning the ML-based type
inference for DPLs, it is difficult to create a benchmark dataset that
contains software projects with a sufficient number of type annotations.
Because of the optional static typing, many software projects written in DPLs
lack type annotations. Nevertheless, to train an ML-based type inference model
for Python, researchers created their own dataset by either gathering a small
set of projects with type annotations [7] or employ static type inference
tools to add type annotations to existing projects [8].

We believe that there is a need for a large benchmark dataset that facilitates
training ML-based type inference models, especially for Python. Unlike
TypeScript’s compiler, the Python interpreter cannot infer the type of
variables or function signatures at compile time [10]. Motivated by this, we
present the ManyTypes4Py dataset, a large dataset to train ML models for
predicting type annotations in Python. Currently, we are working on the
Type4Py model [11], which is trained on the earlier version of the
ManyTypes4Py dataset. The experimental results show that the model trained on
our dataset is overall more accurate when compared to the same model trained
on a smaller dataset [11].

In summary, the paper has the following contributions:

  * •

ManyTypes4Py dataset, which features 5,382 Python projects with more than 869K
type annotations. The latest version of the dataset can be downloaded on
zenodo111https://zenodo.org/record/4479714.

  * •

LibSA4Py tool, a light-weight static analyzer pipeline to process Python
projects and extract type hints/features for training ML-based type inference
models. The tool is publicly available on a GitHub
repository222https://github.com/saltudelft/libsa4py.

Figure 1: Overview of light-weight static analysis pipeline (LibSA4Py tool)

##  II Method

We created the ManyType4Py dataset using the following methodology:

  * •

To find Python projects with type annotations, we intuitively search for
projects that have mypy as a depdendency on libraries.io. Since mypy is the
most used type checker for Python, projects that use mypy have most likely
type annotations. Our search resulted in 5,382 Python projects that are
publicly available on GitHub. We cloned all the discovered projects in Sep.
2020 and created a file that contains projects’ URL and their latest commit
hash.

  * •

As demonstrated by Allamanis [12], it is essential to de-duplicate a code
corpora before training ML models, as code duplication negatively affects the
performance of ML models when testing on duplicated code corpora. Following
this, we de-duplicated the collected Python corpora using our code de-
duplication tool, namely, CD4Py333https://github.com/saltudelft/CD4Py. In
short, the CD4Py tool tokenizes Python source code files, vectorizes files
using Term Frequency-Inverse Document Frequency (TF-IDF), and performs
$k$-nearest neighbor search to identify candidate duplicates files.

  * •

After removing duplicate files, we split the dataset into three sets by files,
i.e., 70% training data, 10% validation data, and 20% test data. This is a
common practice that is considered in recent research work [7, 8], concerning
machine learning-based models for type inference.

  * •

Given the de-duplicated code corpora and a list of files for the three sets,
we ran light-weight static analysis pipeline, which is depicted in Figure 1.
First, the Abstract Syntax Tree (AST) of Python source files are visited.
Second, type hints and features are statically extracted from imports,
modules, classes, and functions, inspired by recent ML-based type inference
approaches [7, 6]. Third, the seq2seq representation444Each token is aligned
with a type if present. Otherwise, zero is inserted. of source code files [13]
are generated by removing comments, string, number literals, and propagating
types. Forth, common Natural Language Processing (NLP) practices such as
tokenization and lemmatization are applied to identifier names in source code
files. Finally, the processed Python projects are stored as a JSON-formatted
file.

After completing all the aforementioned steps, a zip file is created which
contains: (1) JSON file of processed Python projects (2) a file containing
projects’ URL and their latest commit hash (3) a file containing duplicate
files in the dataset (4) a CSV file containing a list of files and their
corresponding set. The helper scripts and instructions for preparing the
dataset are publicly available on a GitHub
repository555https://github.com/saltudelft/many-types-4-py-dataset.

TABLE I: Duplication statistics across the ManyTypes4Py dataset Duplication stats | Value
---|---
# Detected duplicate files | 400,245 (78.43%)
# Detected clusters | 45,836
Avg. # of files per clusters | 8.73
Median # of files per clones | 3.00
Duplication ratio | 69.45%
TABLE II: Characteristics of the ManyTypes4Py Dataset

Metrics | Dataset
---|---
| All | Training | Validation | Test
Repositoriesa | 5,382 | 4,913 | 2,789 | 3,796
Lines of codeb | 22M | - | - | -
Files | 183,916 | 132,409 | 14,675 | 36,832
…with type annotations | 50,838 (27.6%) | 36,542 | 4,105 | 10,191
Functions | 2,096,797 | 1,509,048 | 169,519 | 418,230
…with comment | 1,129,573 (53.8%) | 812,632 | 91,325 | 225,616
…with return type annotations | 325,532 (15.5%) | 234,319 | 26,104 | 65,109
Arguments | 3,923,667 | 2,822,699 | 310,685 | 790,283
…with comment | 220,976 (5.6%) | 159,453 | 16,924 | 44,599
…with type annotations | 480,793 (12.2%) | 347,898 | 37,148 | 95,747
Types | 869,825 | 347,898 | 89,334 | 192,102
…unique | 67,060 | 53,614 | 13,995 | 23,572

  * a

Note that there is an intersection among repositories in the three sets as the
dataset is split by files.

  * b

Comments and blank lines are ignored when counting lines of code.

##  III Description

Before describing the characteristics of the ManyTypes4Py dataset, we first
describe the duplication statistics across the dataset, which is shown in
Table I. The duplication ratio of the dataset is 69.45% as detected by the
CD4Py tool. This is in line with the findings of Lopes et al. [14], which
showed that the Python ecosystem on GitHub has 71% file-level duplicates. It
should be noted that the duplication ratio is obtained using the following
formula:

$\frac{(\text{no. of duplicate files}-\text{ no. of detected
clusters})}{\text{no. of source code files}*100.0}$ (1)

After keeping a file from each duplicate cluster, we removed 354,409 duplicate
files from the dataset.

The characteristics of the ManyTypes4Py are shown in Table II after code de-
duplication. Overall, the dataset has 5,382 Python projects and 183,916 source
code files (i.e. .py files). 27.6% of source code files have type annotations,
i.e., there is at least one type-annotated function in those files. Of
2,096,797 functions in the dataset, 53.8% has comments666Note that here
comments are functions’ docstring in Python, which can be a one-line
description or a complete description of a function.777Our LibSA4Py tool can
detect Google, reST, and NumPy docstrings. and 15.5% has return type
annotations. However, Of 3,923,667 functions’ arguments, 5.6% have comments
and 12.2% have type annotations.

As shown in Table II, there are a total of 869,825 type annotations and 67,060
unique types in the ManyTypes4Py dataset. To demonstrate the distribution of
types, top 10 most frequent types in the dataset are shown in Figure 2. Of
869,825 types, 50.56% of them are present in the top 10 most frequent types.
As can be observed from Figure 2, types follow a long-tail distribution. In
other words, the majority of type annotations are either str, None, int, or
bool.

Figure 2: Top 10 most frequent types in the ManyTypes4Py dataset

As stated in Section II, the dataset provides processed Python projects in
JSON-formatted files, which contains various type hints and features. As of
this writing, there are 23 fields in JSON-formatted files that are described
in Table III. Of 23 extracted fields, 16 of them are natural/contextual type
hints or features that can be used for training ML-based type inference
models. For instance, the name field stores the name of a class or a function,
which is a natural source of information for predicting types [6]. The
ret_exprs and params_occur fields provide return expression(s) of a function
and usages of functions’ parameter(s) in its body, respectively. These are
considered contextual type hints, i.e., the context in which a variable or an
argument is used provides a hint for predicting types [7]. Also, the
untyped_seq and typed_seq fields provide the normalized seq2seq representation
of a Python source code file and the type of identifiers in the file,
respectively. They both can directly be used for training an ML-based type
inference model.

TABLE III: Description of fields in the JSON file of projects produced by the LibSA4Py pipeline Field Name in the JSON | Description
---|---
Project
author/repo | The name of a project and its author on the GitHub URL
src_files | Contains the path of a project’s source code files
file_path | The path of a source code file to differentiate it with other files
Module
untyped_seq | The normalized seq2seq representation of an analyzed source code file
typed_seq | Contains the type of identifiers in untyped_seq if present. Otherwise $0$ is inserted.
imports | Contains the name of imports in an analyzed source code file
variables | Contains variables’ name and their type defined in a module (i.e. global variables)
classes | Contains the JSON object of analyzed classes in a module which is described below
funcs | Contains the JSON object of analyzed functions in a module, which are described below
set | The set to which a source code file belongs to, i.e., train, valid, test
Class
name | The name of an analyzed class in a module
variables | Contains class variables’ name and their type if present
funcs | Contains the JSON object of analyzed functions in a class, which are described below
Function
name | The name of an analyzed function in either a class or a module
params | Contains an analyzed function’s parameter names and their type if present
ret_exprs | Contains the return expression(s) of an analyzed function
ret_type | The return type of an analyzed function if present
variables | Contains local variables’ name and their type in an analyzed function
params_occur | Contains parameters and their usages in the body of an analyzed function
docstring | Contains docsting of an analyzed function if present, which has the below subfields
docstring.func | One-line description of an analyzed function if present
docstring.ret | Description of what an analyzed function returns if present
docstring.long_descr | Long description of an analyzed function if present

##  IV Applications

### ML-based type inference

In this task, ML models are trained to predict the type of functions’
arguments, return types, and variables for DPLs (e.g. Python). To do so, the
AST of source code files are analyzed to extract features that give a hint for
predicting types. By processing ASTs, the ManyTypes4Py dataset provides common
features, i.e., natural and contextual type hints that can be employed to
create code embeddings and train an ML model. Moreover, the provided seq2seq
representation of source code files gives the full context around identifiers.

### Learning-based code completion

In this application, an ML model is expected to predict part of a word or
token for a function or a variable. For DPLs, code completion is a challenging
task as there is no type information available. To overcome this, ASTs are
statically analyzed while providing type information [15]. The ManyTypes4Py
dataset can be used as a baseline for training a code completion model as it
provides partial type annotations for functions and variables. Also, our AST
analysis pipeline (LibSA4Py tool) can further be extended to infer types of
nodes and variables for simple cases.

##  V Limitations

Currently, our static analysis pipeline cannot parse source code files in
Python 2. Therefore, Python2-style type
annotations888https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-
python-2-7-and-straddling-code cannot be extracted. Due to this limitation,
about 1% of source code files in the dataset cannot be parsed.

##  VI Related Work

There are several Python code corpora that can be used for machine learning-
based type inference. Recently, Allamanis et al. [8] proposed the Typilus
model, which is a graph-based neural model that predicts type annotations for
Python. The Typilus model [8] is accompanied by a dataset that contains 600
Python projects. Moreover, the source code files of Typilus’ dataset are
converted to graph representations that are only suitable for training the
Typilus model. The ManyTypes4Py dataset provides JSON-formatted analyzed
source code files that contains useful type hints for training various machine
learning models. Raychev et al. [16] published the Python-150K dataset in
2016, which contains 8,422 Python projects. Unlike our dataset, the
Python-150K dataset [16] is not collected solely for the ML-based type
inference task, meaning that a large number of projects in the dataset may not
have type annotations at all, especially given the time that the dataset was
created. Allamanis [12] showed that the Python-150K dataset suffers from code
duplication despite the removal of project forks.

##  VII Conclusion

In this paper, we present the ManyTypes4Py dataset, a benchmark Python dataset
for ML-based type inference. It contains 5,382 Python projects from GitHub
with more than 869K type annotations. The collected Python projects were de-
duplicated by removing duplicate source code files to ensure that trained ML
models do not have duplication bias. Using the accompanying LibSA4Py tool, the
AST of Python source code files were analyzed to provide 16 type hints plus a
seq2seq representation for training ML-based type inference models. For each
analyzed project, the result of the AST analysis is saved in a JSON-formatted
file. Although the dataset’s main application is ML-based type inference, it
can be a useful baseline for learning-based code completion.

In the near future, we will extend our static analysis pipeline (LibSA4Py
tool) to add more type annotations to the dataset by implementing cheap and
simple type inference heuristics. Also, we will perform data and control flow
analysis to create graph representation of source code files for training
graph-based neural models. To include more projects with type annotations, we
will consider projects that use other type checkers other than mypy.

## Acknowledgment

This research work was funded by H2020 grant 825328 (FASTEN).

## References

  * [1] [n. d.], “Ieee spectrum’s the top programming languages 2019,” https://spectrum.ieee.org/computing/software/the-top-programming-languages-2019.
  * [2] G. Van Rossum, J. Lehtosalo, and L. Langa, “Pep 484–type hints,” _Index of Python Enhancement Proposals_ , 2014.
  * [3] G. Bierman, M. Abadi, and M. Torgersen, “Understanding typescript,” in _European Conference on Object-Oriented Programming_. Springer, 2014, pp. 257–281.
  * [4] S. Klingström and P. Olsson, “Type inference in php using deep learning,” _LU-CS-EX_ , 2020.
  * [5] J.-P. Ore, S. Elbaum, C. Detweiler, and L. Karkazis, “Assessing the type annotation burden,” in _Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering_ , 2018, pp. 190–201.
  * [6] R. S. Malik, J. Patra, and M. Pradel, “Nl2type: inferring javascript function types from natural language information,” in _2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE)_. IEEE, 2019, pp. 304–315.
  * [7] M. Pradel, G. Gousios, J. Liu, and S. Chandra, “Typewriter: Neural type prediction with search-based validation,” in _Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering_ , 2020, pp. 209–220.
  * [8] M. Allamanis, E. T. Barr, S. Ducousso, and Z. Gao, “Typilus: neural type hints,” in _Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation_ , 2020, pp. 91–105.
  * [9] C. Sun, A. Shrivastava, S. Singh, and A. Gupta, “Revisiting unreasonable effectiveness of data in deep learning era,” in _Proceedings of the IEEE international conference on computer vision_ , 2017, pp. 843–852.
  * [10] M. L. Scott, _Programming Language Pragmatics_ , 4th ed. Morgan Kaufmann, 2016.
  * [11] A. M. Mir, E. Latoskinas, S. Proksch, and G. Gousios, “Type4py: Deep similarity learning-based type inference for python,” _arXiv preprint arXiv:2101.04470_.
  * [12] M. Allamanis, “The adverse effects of code duplication in machine learning models of code,” in _Proceedings of the 2019 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software_ , 2019, pp. 143–153.
  * [13] V. J. Hellendoorn, C. Bird, E. T. Barr, and M. Allamanis, “Deep learning type inference,” in _Proceedings of the 2018 26th acm joint meeting on european software engineering conference and symposium on the foundations of software engineering_ , 2018, pp. 152–162.
  * [14] C. V. Lopes, P. Maj, P. Martins, V. Saini, D. Yang, J. Zitny, H. Sajnani, and J. Vitek, “Déjàvu: a map of code duplicates on github,” _Proceedings of the ACM on Programming Languages_ , vol. 1, no. OOPSLA, pp. 1–28, 2017.
  * [15] A. Svyatkovskiy, Y. Zhao, S. Fu, and N. Sundaresan, “Pythia: Ai-assisted code completion system,” in _Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining_, 2019, pp. 2727–2735.
  * [16] V. Raychev, P. Bielik, and M. Vechev, “Probabilistic model for code with decision trees,” _ACM SIGPLAN Notices_ , vol. 51, no. 10, pp. 731–747, 2016\.


# On-chip quantum interference with heralded photons from two independent
micro-ring resonator sources in silicon photonics

Imad I. Faruque<EMAIL_ADDRESS>Gary F. Sinclair  Damien Bonneau
John G. Rarity  Mark G. Thompson

###### Abstract

High visibility on-chip quantum interference among indistinguishable single-
photons from multiples sources is a key prerequisite for integrated linear
optical quantum computing. Resonant enhancement in micro-ring resonators
naturally enables brighter, purer and more indistinguishable single-photon
production without any tight spectral filtering. The indistinguishability of
heralded single-photons from multiple micro-ring resonators has not been
measured in any photonic platform. Here, we report on-chip
indistinguishability measurements of heralded single-photons generated from
independent micro-ring resonators by using an on-chip Mach-Zehnder
interferometer and spectral demultiplexer. We measured the raw heralded two-
photon interference fringe visibility as $72\pm 3\%$. This result agrees with
our model, which includes device imperfections, spectral impurity and multi-
pair emissions. We identify multi-pair emissions as the main factor limiting
the nonclassical interference visibility, and show a route towards achieving
near unity visibility in future experiments.

## Introduction

Integrated photonics represents a promising concept for quantum photonic
technologies. Several platforms have achieved notable success constructing the
fundamental building blocks for on-chip quantum computing. However, we are
still at an early stage with regards to the full-scale integration of optical
and electronic components into a single monolithic [1, 2, 3], heterogeneous
[4] or hybrid architecture [7]. Among the key challenges remaining is the
integration of several identical high-performance single-photon sources [8].
To be considered ideal, a source should: emit single-photons on demand
(deterministic), produce a high rate of single-photons (bright) and emit each
photon in a single mode (pure). In addition, it should be possible to
construct many such identical sources, such that the photons they produce are
indistinguishable. A wide variety of single-photon sources have been
demonstrated across several material platforms that exhibit, or promise, some
degree of on-chip integration. These sources can be broadly characterised as
single-emitter systems (quantum dots, colour centres, etc) and photon-pair
sources based on parametric nonlinearities. Recent advances in quantum dot
sources have demonstrated single-photon production with high spectral purity
($>92\%$) for resonant excitation and moderately high extraction efficiency
[9, 10]. However, achieving both metrics simultaneously remains highly
challenging [11], particularly in a waveguide integrated form [12]. In
addition, the ability to produce several such indistinguishable sources
remains unproven [13, 14]. Also most single-emitters require cryogenic
temperature (except some colour centres such as [15]). Nonetheless, quantum
dot sources have found recent application as a high-brightness source for
boson sampling [16, 17], allowing much faster collection of scattering
statistics than has been achieved using parametric sources.

In contrast, parametric photon sources have proven themselves readily
integrable, operate at room temperature and have demonstrated high purity and
indistinguishability in a wide range of two-photon experiments [18, 19, 20, 3,
21, 22]. Four-photon heralded Hong-Ou-Mandel (HOM) interference [23] has also
been demonstrated between independent sources with a visibility of above
$90\%$ for directly laser written silica waveguides [24], $88\%$ in silicon-
on-insulator (SOI) [25] and microstructured optical fibre [27] and $93\%$ in
Periodically-Poled Lithium Niobate (PPLN) sources [28], although none of these
four-photon experiments have yet been performed in a fully-integrated form.
Parametric sources are however, intrinsically non-deterministic and must be
operated at low brightness to avoid the deleterious effects of higher-order
photon number terms. Nonetheless, this can be mitigated by the active
multiplexing of several such sources [5, 6, 7, 29, 30].

All the four-photon heralded Hong-Ou-Mandel (HOM) interference experiments
[26, 25] in SOI have been restricted to the use of non-resonant sources
(waveguides). However, in our work we employ narrow-linewidth ring resonators
for photon-pair generation. This allows for the more efficient and compact
generation of photon-pairs [31, 32] (compared to linear waveguide sources) and
eliminates the requirement for tight spectral filtering of the generated
photon-pairs to improve the purity of the heralded photons [33, 34], as is
often required in linear waveguide sources.

In this work, we demonstrate for the first time the on-chip quantum
interference between single-photons heralded from two independent micro-ring
resonators. Also, photon-pair generation, spectral demultiplexing and
nonclassical interference are all fully-integrated onto a monolithic silicon
photonic chip, representing an important step in the on-chip integration of
quantum optical experiments.

Numerous previous works have demonstrated the combined on-chip generation and
manipulation of single-photons from resonators, but have been restricted to
the generation of a single photon-pair [22]. In contrast, our work shows the
on-chip interference among photons heralded from two independent sources as
4-fold coincidences, allowing us to estimate the indistinguishability among
multiple micro-ring resonators. This implies the feasibility of on-chip
integration of two or more micro-ring resonators as heralded single-photon
sources, as they all have to be identical for scalable integration for
photonic quantum computing. A 4-fold measurement also allows us to directly
explore the effect that photon purity, indistinguishability and the presence
of higher photon-number contamination have on the all-important visibility of
nonclassical interference.

Figure 1:  (a) shows the experimental setup. A pulsed laser passes through a
broadband filter (BF) and a tunable filter (TF) to suppress broadband
background emission and to match the bandwidth of the laser to the micro-ring
resonator sources. A polarisation controller (PC) is used to optimise
transmission onto the chip via a grating coupler. The photonic circuit
consists of a directional coupler (DC1), micro-ring resonator sources (S1 and
S2), micro-ring resonator filters (F1, F2), and an MZI composed of directional
couplers (DC2, DC3) and a thermal phase-shifter ($\Phi_{\mathrm{MZI}}$).
Photon-pairs generated by the sources are coupled off-chip and filtered (BF1
to BF4) and collected by single-photon detectors (D1 to D4) connected to a
time-tagger (TT). Analysis of four-fold coincidences is done in
postprocessing. (b) The electric field intensity of the fundamental transverse
electric (TE) mode of the silicon nanowire waveguide used in the chip is
calculated with Lumerical Mode Solver. Waveguide dimensions were
$500\text{\,}\mathrm{n}\mathrm{m}$ $\times$ $220\text{\,}\mathrm{n}\mathrm{m}$
and the group index was estimated as $n_{g}=4.16$ at the wavelength
$1550\text{\,}\mathrm{n}\mathrm{m}$. (c) Spectral profiles of the source
micro-ring resonators S1 and S2. Both sources are seen to be largely
spectrally indistinguishable, with linewidths of
$33\text{\,}\mathrm{p}\mathrm{m}$ and $31\text{\,}\mathrm{p}\mathrm{m}$
(Q-factor $\sim 5\times 10^{4}$). (d) Due the sensitivity of the high Q-factor
sources, the resonance shifts when the heater of the MZI dissipates heat. In
this figure, the resonance of the source S2 shifts
$43\text{\,}\mathrm{p}\mathrm{m}$, when the MZI dissipates
$60\text{\,}\mathrm{m}\mathrm{W}$ heat ($2\pi$ phase) from its off position.
Counteracting this thermal crosstalk is essential to perform the experiment
and explained in detail in Appendix A.

## Experimental Setup

Our experimental setup is illustrated in Fig. 1(a). It consists of three major
parts: laser pulse preparation for photon-pair generation; the reconfigurable
photonic circuit for on-chip single-photon generation and indistinguishability
measurements and single-photon detection system with logic unit. The chip is
fabricated by Institute of Microelectronics Singapore through a standard
multi-project wafer run.

We chose a $50\text{\,}\mathrm{M}\mathrm{H}\mathrm{z}$ repetition rate pulsed
laser (Pritel, FFL) as a pump for spontaneous four wave mixing photon-pair
generation. The laser emits secant hyperbolic solitonic pulses which are
nearly transform limited. The central wavelength of the laser is tuned to
Channel 39 ($1546.12\text{\,}\mathrm{n}\mathrm{m}$) of International Telegraph
Union (ITU) frequency grid. A tuneable bandwidth filter (Yenista XTA-50, TF in
Fig. 1(a)) is used to match the bandwidth of the pump laser to the linewidth
of the micro-ring resonators used as sources
($\sim$$30\text{\,}\mathrm{p}\mathrm{m}$, Fig. 1(c)). The bandwidth was set to
$200\text{\,}\mathrm{p}\mathrm{m}$ to suppress the generation of background
photons (from spurious four wave mixing) in the input coupling waveguides
(Appendix A), while at the same time, filling the entire pump resonance of the
sources, allowing for a maximum heralded photon purity [37]. The background
laser noise is suppressed by the use of two consecutive
$200\text{\,}\mathrm{G}\mathrm{H}\mathrm{z}$ channel spacing Dense Wavelength
Division Multiplexers (DWDM) as denoted by BF in Fig. 1(a). BFs reduce the
background laser noise by at least $80\text{\,}\mathrm{d}\mathrm{B}$ at the
wavelengths where signal-idler photon-pairs will be generated. Afterwards, an
optimal polarisation is chosen using the polarisation controller (PC) to
couple the transverse electric (TE) mode into the chip. This is because the
waveguide width ($500\text{\,}\mathrm{n}\mathrm{m}$), and the vertical grating
couplers are optimised for TE polarisation mode.

The vertical grating couplers (VGCs) couple the light in (and out of) the chip
with an average efficiency of $35.5\%$ ($-4.5\text{\,}\mathrm{d}\mathrm{B}$
loss). At this point, approximately $1\text{\,}\mathrm{m}\mathrm{W}$ of power
is in the chip. After the VGC, the pump is split by a directional coupler
(DC1) and routed towards the micro-ring resonator sources (S1 and S2). Photon-
pairs, historically called signals and idlers, are produced in S1 and S2 by a
nonlinear parametric process: spontaneous four wave mixing (SFWM). Both S1 and
S2 are thermally tuned to be resonant with the pump (Channel 39) and have a
free-spectral range such that signal-idler photon-pairs are produced in
Channel 31 ($1552.52\text{\,}\mathrm{n}\mathrm{m}$) and Channel 47
($1539.77\text{\,}\mathrm{n}\mathrm{m}$) of the ITU grid. Micro-ring resonator
add-drop filters (F1) and (F2) are also thermally tuned to be resonant with
the idler photons and route these off-chip for heralding using detectors D1
and D3. The heralded signal photons are passed on to the integrated Mach-
Zehnder Interferometer (MZI) section of the chip. The MZI is formed of two
directional couplers (DC2, DC3) and a thermal phase-shifter
($\Phi_{\mathrm{MZI}}$). After the MZI interference, the signal photons are
coupled off-chip, filtered to suppress residual pump and coupled to single-
photon detectors (D2 and D4). Just before the detectors, the aforementioned
suppression of the residual pump is performed using
$200\text{\,}\mathrm{G}\mathrm{H}\mathrm{z}$ DWDM filters on all four signal-
idler channels. We note that this filtering is solely to suppress pump noise,
and is much wider than the narrow bandwidth idler photons generated by the
ring resonator sources ($\sim$ $3.8\text{\,}\mathrm{G}\mathrm{H}\mathrm{z}$),
so does not have an appreciable influence on the heralded photon purity. After
pump suppression, the photons are detected using commercially available
Superconducting Nanowire Single Photon Detectors (SNSPDs - Photon Spot, Inc.).
All four detectors (D1 to D4: average efficiency 75%, dark counts $<$
$200\text{\,}\mathrm{c}\mathrm{o}\mathrm{u}\mathrm{n}\mathrm{t}\mathrm{s}\mathrm{/}\mathrm{s}$)
are connected to a picosecond-resolution timetagger (TT - HydraHarp,
PicoQuant). The timetagger records the photon arrival times which are post-
processed to identify four-fold coincidence events ($P_{\mathrm{4f}}$) as a
function of the MZI phase ($\Phi_{\mathrm{MZI}}$).
$P_{\mathrm{4f}}(\Phi_{\mathrm{MZI}})$ represents the interference fringe.

Figure 2: 4-fold coincidences as a function of the MZI phase. (a) The
experimentally measured 4-fold coincidence fringes, demonstrating a fitted
visibility of 72% for indistinguishable photons. The reduced visibility
compared to the ideal case arises due to several factors which are included in
the fit: contributions from higher photon-number terms; spectral impurity of
the heralded photons and potentially the spectral distinguishability of the
sources. These are discussed in the Results and Analysis section. (b)
Theoretical 4-fold coincidence probability assuming ideal sources and MZI. The
MZI fringe visibility (defined by Eq. (1)) has a maximum of 100% for
indistinguishable photons and 33% for distinguishable photons. When the phase,
$\phi_{\mathrm{MZI}}$, is adjusted to $\pi/2$ the MZI has a 50:50 splitting
ratio ($R=T=0.5$, where $R$ and $T$ are the reflection and transmission
coefficients of the MZI). (c) Theoretical 4-fold coincidence probability
assuming ideal sources, but an imperfect MZI. The MZI is assumed to be
constructed from two non-ideal directional couplers (see DC2 and DC3 of Fig.
1) that have a 35:65 splitting ratio, as was the case for our fabricated chip.
It is seen that the shape of the fringe changes as a result of the imperfect
splitting ratio of the directional couplers. However, the global maximum and
minimum probabilities achieved for both distinguishable and indistinguishable
fringes remains the same. The main effect of the non-balanced splitting ratio
of the directional couplers is to reduce the effective transmitivity of the
MZI at the fringe peak where $\phi_{\mathrm{MZI}}=\pi$ (T$<$ 1). This does not
reduce the fringe peak at $\phi_{\mathrm{MZI}}=0$ (R=1) and so will not limit
the fringe visibility. The details of the theoretical models and the full
fittings that includes spectral impurity and multi-pair (upto 10 photon-pairs)
emissions are in Appendix B.

One of the experimental considerations was to mitigate the thermal crosstalk
between the photonic components. In this reconfigurable circuit, when the
large heater of the MZI is used to change the phase, the dissipated heat
shifts the resonance position of the resonator sources S1 and S2 as much as
$43\text{\,}\mathrm{p}\mathrm{m}$ and $31\text{\,}\mathrm{p}\mathrm{m}$
respectively: this is termed as thermal crosstalk. A full parametric model of
the heat compensation has been developed to keep all the four resonators (S1,
S2, F1, F2) at the same resonance wavelength for any phase configuration
during the experiment, as explained in Appendix A.

## Results and Analysis

The performance of our heralded single-photon sources is reflected in the the
measured visibility of the four-fold coincidence fringe, as shown in Fig.
2(a). This fringe shows the rate of four-fold coincidence events as a function
of the MZI phase ($\Phi_{\mathrm{MZI}}$). Typically, the visibility of a MZI
fringe [35] is defined by,

$V_{\mathrm{MZI}}=\frac{(P_{\mathrm{4f}})_{\mathrm{max}}-(P_{\mathrm{4f}})_{\mathrm{min}}}{(P_{\mathrm{4f}})_{\mathrm{max}}+(P_{\mathrm{4f}})_{\mathrm{min}}}.$
(1)

As shown in Figs. 2(b) and 2(c) above, for ideal sources producing pure
single-photons, we expect a fringe visibility of 100% for indistinguishable
photons and 33% for distinguishable photons. Here, the imperfect directional
couplers (DC2, DC3) of the MZI does not influence the value of the visibility,
in contrast to a Hong-Ou-Mandel experiment [36]. The deviation of the
splitting ratio of the directional couplers from its ideal value (balanced
50:50) is due to fabrication imperfections. The splitting ratio of our
directional couplers were found to be 35:65. This resulted in a distortion of
the measured fringe shape, but did not impact on the maximum visibility
observed, as discussed in Appendix B. Briefly, the distortion occurs due to
incomplete destructive interferences of some specific MZI phase values for the
imperfect directional couplers.

In our experiment, a fringe visibility of $V_{\mathrm{MZI}}=71.84\pm 3.1\%$
(95% confidence interval) was found for indistinguishable photons, and
$V_{\mathrm{MZI}}=32.47\pm 3.0\%$ for distinguishable photons by fitting the
data using the model described by Eq. (16) of the Appendix B, that takes into
account the factors discussed below. There are several factors that can lead
to a reduction in the fringe visibility, such as spectral distinguishability
between the sources, reduced spectral purity of the heralded single-photons
and the contribution of higher photon-number terms.

Figure 3: (a) Simulation of the joint spectral amplitude (JSA) of the micro-
ring resonators used for this experiment shows a spectral purity of $92\%$.
(b) Visibility of the MZI fringe as a function of the source brightness,
$\bar{n}$ including multi-mode and multi-pair emissions. Identical sources
with a purity of $0.92$ are considered which which can be modelled well by two
effective Schmidt modes. A total 10 photon-pairs generated from both of the
sources at a time are considered to include the multi-pair effects. In our
experiment we determined an average source brightness of $0.110\pm 0.012$
photons produced from each source per pump pulse. From the experiment, the MZI
fringe visibility is found as $72\pm 3\%$. The simulated graph (blue solid
line) goes through the intersection of these error margins, showing the
agreement between the simulation and the experiment.

We begin by considering the spectral distinguishability of both ring resonator
sources. As shown in Fig. 1(c), having a Full Width Half-Maximum (FWHM)
linewidth of $33\text{\,}\mathrm{p}\mathrm{m}$ and
$31\text{\,}\mathrm{p}\mathrm{m}$ for sources S1 and S2 respectively, both
sources had an excellent spectral overlap. In addition, as discussed in the
Appendix A, by careful control of the chip temperature and consideration of
the thermal crosstalk between components, the stability of the overlap was
ensured. We do not therefore expect the spectral distinguishability of the
sources to make a significant contribution to the reduced fringe visibility.
We note that the spectral purity of photons heralded from a ring resonator
source has been shown to have an upper limit of $93\%$, by calculating purity
from the joint spectral amplitude (JSA) [37]. Following the same procedure as
in [37], the JSA simulation of our sources S1 and S2 designs, with DWDM
filtering shows $92\%$ purity as shown in Fig. 3(a). Therefore, our sources
are seen to be approaching the optimal purity for a simple ring resonator
design. It has been proposed that by tailoring the ratio of the linewidths at
the pump and photon-pair wavelengths, it should be possible to achieve
arbitrarily high purities from a modified ring design [38]. We should not
therefore view the current non-ideal purity as a fundamental limit of all
resonant sources, but rather solely a limitation of our current basic micro-
ring resonator design.

The final contribution to the reduced fringe visibility comes from the
contribution of multiphoton terms. Due to the probabilistic nature of our
parametric photon-pair sources, we know that sometimes two or more photons-
pairs will be produced simultaneously from a single source. Without photon-
number resolving detectors, we are unable to distinguish the heralding of
these higher photon-number states from the single-photons that we wish to
interfere in the MZI stage of the chip. Several authors have developed models
describing the effect of higher photon-number terms on the visibility of
nonclassical interference [27, 26, 24]. A full model considering the effect of
these higher photon-number terms, along with the impurity of the heralded
photons (approximated by the first two Schmidt modes), is developed in the
Appendix B. The effect of the pump brightness (which leads to higher photon-
number terms) on the MZI fringe visibility is shown in Fig. 3(b) for impure
($\sim 92\%$ purity) heralded photonic states. The brightness of a photon-pair
source is often represented by the number of photon-pairs generated per pump
pulse, $\bar{n}$. The solid blue line shows that the MZI fringe visibility
reduces with $\bar{n}$ due to multi-pair contamination. Our micro-ring
resonator sources have an average brightness of $\bar{n}=0.110\pm 0.012$
within 95% confidence interval. As shown in the figure, within the margin of
errors of the measured visibility and the average brightness (represented by
semi-transparent grey rectangles), the modelled visibility matches. Therefore,
the model agrees with our experimental results and identifies multi-pair
contamination as the most drastic cause of visibility reduction. It also shows
that if the multi-photon contamination is removed (e.g. using photon-number
resolving detectors), we can achieve $92\%$ interference visibility.

To determine the brightness of our ring sources, we examine the two-fold
coincidence counts as a function of optical input power (Appendix C). From
this we determine a brightness of $\bar{n}_{\mathrm{S1}}=0.093\pm 0.001$ and
$\bar{n}_{\mathrm{S2}}=0.123\pm 0.001$ with 68% confidence interval for each
source. Ideally, we would reduce the contribution of higher photon-number
terms by reducing the pump power and collecting four-fold coincidence events
over a longer time period. However, the four-fold count rate is currently
limited by system losses, largely due to the grating couplers ($\sim$
$4.5\text{\,}\mathrm{d}\mathrm{B}$ loss) and off-chip filtering ($\sim$
$2\text{\,}\mathrm{d}\mathrm{B}$) and channel loss before the detection. In
future, the use of higher efficiency grating couplers [39] ($\sim$
$0.6\text{\,}\mathrm{d}\mathrm{B}$) and on-chip filtering [40] both have the
potential to greatly improve the system detection efficiency. This should
allow the use of lower pair production rates at the source and therefore
reducing higher photon-number contamination.

## Conclusions

Our experiment demonstrates a high degree of integration with sources,
spectral demultiplexing add-drop filters and an MZI all on a monolithic
silicon chip and successfully independently controlled by thermal tuning.
Using this chip, we have interfered two heralded single-photons from two
independent micro-ring resonators for the first time, enabling a MZI raw
fringe visibility of 72%. In contrast to previous experiments, which generally
interfered a single path-entangled photon-pair, our experiment allows for the
direct evaluation of the indistinguishability of independently generated
heralded photons - a vital prerequisite for the scalable construction of all
optical quantum computers.

We also identify the main factors that are currently limiting the non-unity
fringe visibility: residual impurity of the heralded single-photons and the
contribution of higher photon-number terms to the fringe visibility. As
discussed above, a clear path exists to overcoming both of these constraints.
Designs have recently been proposed that should allow near unity heralded
photon purity by suitable engineering of the ring resonator coupling at pump,
signal and idler wavelengths [38]. Higher photon-number terms can be removed
by using photon number resolving detectors and/or improving the system
detection efficiency. Improving the system detection efficiency of our single-
photon detectors, primarily by reducing grating coupler losses, will allow
weaker pumping of the micro-ring resonator sources whilst maintaining a
suitably high four-fold coincidence rate. Operating in this regime, the
reduction of fringe visibility to higher photon-number terms is known to be
mitigated [27, 26, 24]. Thus, our fringe visibility of 72% should be seen as a
basis from which higher visibilities can be achieved in future, with some
appropriate photonic engineering.

## Acknowledgements

This work was supported by the Marie Curie Actions within the Seventh
Framework Programme for Research of the European Commission, under the Initial
Training Network PICQUE, Grant No. 608062, the Engineering and Physical
Sciences Research Council (EPSRC) through grant EP/L024020/1 and The European
Research Council (ERC). M.G.T. acknowledges fellowship support from the EPSRC
(EP/K033085/1). J.G.R. acknowledge fellowship support from the (EPSRC, UK).
The author thanks Dr. Hugo Cable, Dr. Jonathan Mathews for useful discussions
and Dr. Philip Sibson for lending the HydraHarp.

Figure 4: Spectral response of the device by adding the two output ports of
the MZI ($\mathrm{PM}_{i}$: power-meter value of the $i^{th}$ port). (a)
Without any spectral alignments, all the resonators S1, S2, F1, F2 are in
spectrally distinguishable. (b) Using the thermal phase-shifter to align S1,
S2 to match the the resonances with the DWDMs’ ITU grid channels 47, 39 and 31
for idler, pump and signal spectra respectively.

## Appendix A: spectral response and thermal crosstalk

One of the principle challenges of this experiment is to maintain spectral
alignment between sources S1 and S2 while the MZI thermal phase-shifter,
$\Phi_{MZI}$, is swept over a 2$\pi$ range (approximately 0 to
$42\text{\,}\mathrm{m}\mathrm{W}$ power). Due to the narrow resonance
linewidth of the micro-ring resonator sources (shown in Fig. 1(c)), the micro-
ring resonators are sensitive to thermo-optic crosstalk from neighbouring
heaters, which are used to align the sources, filters and perform the MZI
phase shift. The spectral response of the whole device is shown in Fig. 4 with
and without spectral alignments using the on-chip thermal phase-shifters.

In practice, the MZI heater is the dominant source of thermal crosstalk, due
the large range of powers over which it operates. Figure 5(b) demonstrates the
excellent stability of the micro-ring resonator sources whilst in the
quiescent state over the time required to take a complete four-photon fringe.
The chip temperature is maintained by use of an Arroyo Instruments 5240
Thermoelectric Controller, which ensures a temperature stability better than
$0.01\text{\,}\mathrm{K}$ (corresponding to a micro-ring resonator stability
of $0.7\text{\,}\mathrm{p}\mathrm{m}$). The micro-ring resonator position was
measured by scanning a low-power CW probe (Yenista T100S-HP) to determine the
resonance position from the transmission spectrum, whilst calibrating the
wavelength against a wavemeter (Bristol Instruments 721B-IR). However, when
the MZI heater power is altered, a shift in the resonance position of the
sources is observed (see Fig. 1(d), Fig. 5(a)). This is due to the relatively
high power of the MZI heater (up to $60\text{\,}\mathrm{m}\mathrm{W}$) and the
quite close proximity of the heater to the micro-ring resonator source
(200$\sim$$350\text{\,}\mathrm{\SIUnitSymbolMicro m}$). To compensate for
thermal crosstalk, a characterisation was first performed to measure the shift
in each micro-ring position (S1, S2, F1, F2) as a function of the MZI heater
power. Therefore, by reducing the power supplied directly to each micro-ring
as the MZI heater power was increased, the resonance position could be
maintained whilst performing a fringe. Electrical control of the on-chip
heaters was performed using a prototype high-resolution voltage driver with
current readout capability (Qontrol Systems LLP).

Figure 5: Wavelength stability of micro-ring resonator sources. (a) Thermal
cross-talk between the MZI heater and source S1. In this test, the position of
source S1 is measured, while the MZI heater power is adjusted over its full
range. A large thermal crosstalk is observed between the MZI heater and source
S1, which needs to be compensated for. This is achieved, by reducing the
heater power supplied directly to S1 in proportion to the thermal crosstalk
from the MZI heater. In this way, the resonance position of S1 can be held
constant. The same technique is applied between S2, F1 and F2 and the MZI
heater to ensure stability of both sources and on-chip filters. (b) Measured
position of the micro-ring resonator source S1 over a period of 1100 minutes,
which is equal to the time required for the acquisition of a complete fringe.
The shaded area represents the FWHM of the resonance and the black trace
represents a series of 111 measured resonance peak positions. The measured
resonance positions have a standard deviation of
$1.0\text{\,}\mathrm{p}\mathrm{m}$, compared to the FWHM of
$33\text{\,}\mathrm{p}\mathrm{m}$ for Source 1 (relative drift: 7.1%).

When using the full pump-width it was noticed that the input waveguide from
the VGC to the DC1 was long enough
($\sim$$730\text{\,}\mathrm{\SIUnitSymbolMicro m}$) such that the pump
produced noticeable amount of four wave mixing photon-pairs in the waveguide.
These pairs are identified as spurious four wave mixing photon-pairs and
considered as background contributions. As our detectors are not wavelength
sensitive, they accumulate all of the photon-pairs generated in the waveguide
and the micro-resonator sources S1 and S2. The total accumulated background
photons from the waveguide can be substantial over the whole bandwidth of the
DWDM channels. This is because the high-Q micro-resonators generate a
significantly higher number of photon-pairs per unit bandwidth, but in a very
narrow wavelength range ($\sim$$30\text{\,}\mathrm{p}\mathrm{m}$) compared to
the bandwidth of the DWDM channels
($\sim$$1100\text{\,}\mathrm{p}\mathrm{m}$). As shown in Fig. 6, if the
accumulated photons in the blue shades and green shades are $C_{S1}$,
$C_{S2}$, and $C_{Bg}$, then $(C_{S1}+C_{S2})/C_{Bg}\approx 1.05$. For a
2-fold coincidence experiment, this value can modify the actual result from
the resonators. A tuneable bandwidth filter is used after the laser to narrow
down the pump pulse to $200\text{\,}\mathrm{p}\mathrm{m}$ FWHM. Considering
the solitonic $sech$ pulses are transform limited, the narrowed FWHM will
reduce the peak power of the pulses significantly. Thus, the amount of photon-
pairs produced in the waveguide will reduce drastically, while the spectral
power density coupled into the micro-ring (and hence photon production rate)
will remain largely unchanged.

Figure 6: Spurious four wave mixing in the input waveguide
($L_{WG}\sim$$730\text{\,}\mathrm{\SIUnitSymbolMicro m}$) is substantial over
the whole bandwidth of the DWDM channels. As shown in the inset, a CW pump
laser ($\lambda_{p}$) is scanned over Ch 39 of the ITU grid, while signal-
idler photon-pairs are collected as 2-fold coincidences for each pump
wavelength $\lambda_{p}$ from Ch 47 and Ch 31. The filter resonators F1 and F2
are detuned off the pump channel for this experiment. The plot shows the
background photon-pair generated by the waveguide in shaded green, and by the
resonators by shaded blue. If the accumulated source and background photons
are $C_{S1}$, $C_{S2}$, and $C_{Bg}$, then $(C_{S1}+C_{S2})/C_{Bg}\approx
1.05$.

## Appendix B: Theoretical model

The nonclassical interference of single-photons is an essential requirement
for linear-optical quantum computing. Here, we briefly review the nonclassical
interference behaviour expected in our four-photon triggered fringe
experiment. In the first section, we initially assume our sources,
interferometer and detectors are all ideal. In our experiment however, it was
found that fabrication imperfections resulted in a splitting ratio of the
directional couplers that was 35:65, rather than the ideal 50:50 ratio of the
intended design. Therefore, we next examine how deviations from the nominal
splitting ratio of the on-chip directional couplers will affect the shape of
the four-photon fringe, but will not limit the observed maximum fringe
visibility. Afterwards, the effects of various experimental imperfections
(multi-mode fields, multi-pair emission) discussed in the Results and Analysis
section are then included in the model to derive a equation to fit the MZI
fringe.

### Ideal Sources and MZI

We begin by supposing that a pair of pure single-photons are simultaneously
heralded from both sources (S1 and S2 in Fig. 1). We assume that they are
indistinguishable in all degrees of freedom, other than being in separate
spatial modes: heralded photons generated in S1 are denoted as being in
spatial mode ‘a’ and photons heralded from S2 are in spatial mode ‘b’. The
heralded initial state is therefore
$|\psi_{\mathrm{in}}\rangle=\hat{a}^{\dagger}\hat{b}^{\dagger}|\mathrm{vac}\rangle$,
where $\hat{a}^{\dagger}$ and $\hat{b}^{\dagger}$ are the single-mode creation
operators for photons in spatial modes ‘a’ and ‘b’ respectively and
$|\mathrm{vac}\rangle$ is the vacuum state. In the Heisenberg picture, for an
ideal MZI with perfectly balanced directional couplers (50:50 splitting ratio)
the creation operators for the input modes (‘a’ and ‘b’) and output modes (‘c’
and ‘d’) are related by,

$\left(\begin{array}[]{c}\hat{c}^{\dagger}\\\
\hat{d}^{\dagger}\end{array}\right)=\frac{1}{2}\left(\begin{array}[]{cc}1&1\\\
1&-1\end{array}\right)\left(\begin{array}[]{cc}e^{i\phi_{\mathrm{MZI}}}&0\\\
0&1\end{array}\right)\left(\begin{array}[]{cc}1&1\\\
1&-1\end{array}\right)\left(\begin{array}[]{c}\hat{a}^{\dagger}\\\
\hat{b}^{\dagger}\end{array}\right),$ (2)

where $\phi_{\mathrm{MZI}}$ is the phase shift applied in one arm of the MZI
(see Fig. 1). We note that the transformation effected by the MZI can also be
written as the transformation of a variable beam splitter [41], with some
phase shifts on the input and output modes:

$\left(\begin{array}[]{c}\hat{c}^{\dagger}\\\
\hat{d}^{\dagger}\end{array}\right)=e^{i\phi_{\mathrm{MZI}}/2}\left(\begin{array}[]{cc}1&0\\\
0&i\end{array}\right)\left(\begin{array}[]{cc}\cos(\phi_{\mathrm{MZI}}/2)&\sin(\phi_{\mathrm{MZI}}/2)\\\
\sin(\phi_{\mathrm{MZI}}/2)&-\cos(\phi_{\mathrm{MZI}}/2)\end{array}\right)\left(\begin{array}[]{cc}1&0\\\
0&i\end{array}\right)\left(\begin{array}[]{c}\hat{a}^{\dagger}\\\
\hat{b}^{\dagger}\end{array}\right).$ (3)

The probability of a four-fold coincidence is given by the overlap of the
output state with the state describing the simultaneous scattering of one
photon into output mode ‘c’ and the other into output mode ‘d’. That is, for
indistinguishable single-photons,

$P^{\mathrm{ind}}_{\mathrm{4f}}(\phi_{\mathrm{MZI}})=|\langle\psi_{\mathrm{out}}|\hat{c}^{\dagger}\hat{d}^{\dagger}|\mathrm{vac}\rangle|^{2}=\left|\langle\psi_{\mathrm{out}}|(R-T)\hat{a}^{\dagger}\hat{b}^{\dagger}|vac\rangle\right|^{2}=\frac{1}{2}\left[1+\cos\left(2\phi_{\mathrm{MZI}}\right)\right],$
(4)

where $R=\sin^{2}(\phi_{\mathrm{MZI}}/2)$ and
$T=\cos^{2}(\phi_{\mathrm{MZI}}/2)$ are the effective reflection and
transmission coefficients of the MZI ($R+T=1$). These two terms ($R$ and $T$)
arise from the simultaneous reflection or simultaneous transmission of both
input photons into the output modes. We note that the phase of these terms
always results in a destructive interference between both processes, due to
the unitarity of the transformation Eq. (3). A minimum of the four-fold
coincidence probability is seen to occur at the point
$\phi_{\mathrm{MZI}}=\pi/2$, where $R=T=0.5$ and therefore
$P^{\mathrm{ind}}_{\mathrm{4f}}=0$ (see Fig. 2(a)). That is, this corresponds
to the point at which the MZI is perfectly balanced (50:50 splitting ratio)
and is exactly the situation in which we expect to observe HOM interference
between the indistinguishable photon-pairs.

Over the range $\phi_{\mathrm{MZI}}\in[0,2\pi)$ the four-fold coincidences
peak when $\phi_{\mathrm{MZI}}=\\{0,\pi\\}$. Examining the MZI transformation
given by Eq. (3) we see that these correspond to points at which the MZI is
completely transmitting or completely reflecting. That is,
$\phi_{\mathrm{MZI}}=0$, and hence $T=\cos^{2}(\phi_{\mathrm{MZI}}/2)=1$
(complete transmission) or $\phi_{\mathrm{MZI}}=\pi$, with
$R=\sin^{2}(\phi_{\mathrm{MZI}}/2)=1$ (complete reflection). In both of these
situations, only the simultaneous reflection of both input photons ($R=1$) or
simultaneous transmission of both input photons ($T=1$) will contribute a non
zero term in Eq. (4). Due to the absence of destructive interference between
both of these processes we therefore expect a maximum in the probability of
four-fold counts between both independent sources at these two points
($P^{\mathrm{ind}}_{\mathrm{4f}}=1$).

We turn now to the situation in which the heralded photons are distinguishable
in some way, for example, when both photons are heralded at different times.
Now, the photons are assumed to be generated not only in separate spatial
modes, as before, but also in separate temporal modes. We denote the non-
overlapping temporal modes by placing a prime on the corresponding mode
operators. That is, we now have two sets of input and output mode operators:
{$\hat{a},\hat{b},\hat{c},\hat{d}$} for photons heralded at time $t=t_{1}$,
and {$\hat{a}^{\prime},\hat{b}^{\prime},\hat{c}^{\prime},\hat{d}^{\prime}$}
for photons heralded at time $t=t_{2}$. Both sets of mode operators are
assumed to satisfy the MZI transformation equations given by Eq. (3). In this
case, the initial state input to the MZI is given by a pair of photons
heralded in distinguishable spatial and temporal modes
$|\psi_{\mathrm{in}}\rangle=\hat{a}^{\dagger}\hat{b^{\prime}}^{\dagger}|\mathrm{vac}\rangle$.
Given that we have input two photons in separate temporal modes, the four-fold
coincidence probability is now given by the sum of two terms, each one
corresponding to the temporally distinguishable photons scattering into either
of the two output spatial modes:

$P^{\mathrm{dist}}_{\mathrm{4f}}(\phi_{\mathrm{MZI}})=|\langle\psi_{\mathrm{out}}|\hat{c}^{\dagger}\hat{d^{\prime}}^{\dagger}|\mathrm{vac}\rangle|^{2}+|\langle\psi_{\mathrm{out}}|\hat{c^{\prime}}^{\dagger}\hat{d}^{\dagger}|\mathrm{vac}\rangle|^{2}=\frac{1}{2}+\frac{1}{4}\left[1+\cos\left(2\phi_{\mathrm{MZI}}\right)\right].$
(5)

From these equations for the four-fold coincidence probability, Eq. (4) and
Eq. (5), we see that the nonclassical destructive interference of
indistinguishable single-photons results in a fringe with much higher contrast
than that produced by distinguishable photons. The probabilities for a four-
fold coincidence for indistinguishable Eq. (4) and distinguishable photons Eq.
(5) are depicted in Fig. 2(b). Maxima and minima of the four-fold probability
remain at the same positions, but the minimum four-fold probability at
$\phi_{\mathrm{MZI}}=\pi/2$ has increased to
$P^{\mathrm{dist}}_{\mathrm{4f}}=0.5$, indicating the absence of non-classical
HOM interference due to the temporal distinguishability of the heralded
photons. In the above, we have compared the interference of distinguishable
and indistinguishable single-photons. However, a comparison could also be made
between indistinguishable single-photons and thermal states (as a
representative ‘classical’ state of the light field). In this case, it has
been shown that a maximum HOM visibility of 33% is found [42, 26] (assuming
ideal detectors and low average photon number).

### Effect of an Imperfect Splitting Ratio of the MZI Directional Couplers

In our experiment, it was found that the splitting ratio of the on-chip
directional couplers deviated significantly from the intended 50:50 ratio.
Although this is seen to result in a change to the shape of the interference
fringe, we show that it does not limit the achievable fringe visibility, as
shown below. We begin again by assuming a pair of photons heralded in spatial
modes ‘a’ and ‘b’, which are otherwise indistinguishable in all degrees of
freedom:
$|\psi_{\mathrm{in}}\rangle=\hat{a}^{\dagger}\hat{b}^{\dagger}|\mathrm{vac}\rangle$,
where all symbols have the same meanings as defined above. The input and
output modes of the MZI are then related by,

$\left(\begin{array}[]{c}\hat{c}^{\dagger}\\\
\hat{d}^{\dagger}\end{array}\right)=\left(\begin{array}[]{cc}\sin\theta&\cos\theta\\\
\cos\theta&-\sin\theta\end{array}\right)\left(\begin{array}[]{cc}e^{i\phi_{\mathrm{MZI}}}&0\\\
0&1\end{array}\right)\left(\begin{array}[]{cc}\sin\theta&\cos\theta\\\
\cos\theta&-\sin\theta\end{array}\right)\left(\begin{array}[]{c}\hat{a}^{\dagger}\\\
\hat{b}^{\dagger}\end{array}\right),$ (6)

where the splitting ratio ($\eta_{DC}$) of the directional couplers (DC2 and
DC3) are assumed to be equal and are determined by $\theta$, such that
$\eta_{DC}=\sqrt{sin(\theta)}$, and the relative phase shift imparted on one
arm of the MZI is given by $\phi_{\mathrm{MZI}}$. Again, this relationship
between the input and output modes of the MZI can be expressed as a variable
beamsplitter, with phase shifts on the input and output modes [41]:

$\left(\begin{array}[]{c}\hat{c}^{\dagger}\\\
\hat{d}^{\dagger}\end{array}\right)=e^{i\phi_{\mathrm{MZI}}/2}\left(\begin{array}[]{cc}e^{i\Phi/2}&0\\\
0&e^{-i\Phi/2}\end{array}\right)\left(\begin{array}[]{cc}-i\cos(\eta/2)&-\sin(\eta/2)\\\
\sin(\eta/2)&i\cos(\eta/2)\end{array}\right)\left(\begin{array}[]{cc}ie^{i\Phi/2}&0\\\
0&-ie^{-i\Phi/2}\end{array}\right)\left(\begin{array}[]{c}\hat{a}^{\dagger}\\\
\hat{b}^{\dagger}\end{array}\right).$ (7)

Here, the effective splitting ratio of the MZI is determined by
$\eta=2\arcsin\left[\sin(\phi_{\mathrm{MZI}}/2)\sin(2\theta)\right]$ and the
input and output mode phase shifts are given by
$\displaystyle\Phi=-\frac{i}{2}\log\left[\frac{1+e^{i\phi_{\mathrm{MZI}}}\tan^{2}\theta}{\tan^{2}\theta+e^{i\phi_{\mathrm{MZI}}}}\right]$.
A four-fold coincidence occurs when heralded single-photons from each source
are simultaneously detected on output modes ‘c’ and ‘d’. Using Eq. (6) to
relate the input and output modes, we find that the four-fold detection
probability for indistinguishable single-photons is,

$P^{\mathrm{ind}}_{\mathrm{4f}}(\phi_{\mathrm{MZI}})=\left|\langle\psi_{\mathrm{out}}|\hat{c}^{\dagger}\hat{d}^{\dagger}|\mathrm{vac}\rangle\right|^{2}=\left|\langle\psi_{\mathrm{out}}|(R-T)\hat{a}^{\dagger}\hat{b}^{\dagger}|\mathrm{vac}\rangle\right|^{2}=\left[2\sin^{2}(\phi_{\mathrm{MZI}}/2)\sin^{2}(2\theta)-1\right]^{2},$
(8)

where,

$\displaystyle
R=\sin^{2}(\eta/2)=\sin^{2}(\phi_{\mathrm{MZI}}/2)\sin^{2}(2\theta)$ (9)
$\displaystyle
T=\cos^{2}(\eta/2)=\left|\cos(\phi_{\mathrm{MZI}}/2)-i\sin(\phi_{\mathrm{MZI}}/2)(\sin^{2}\theta-\cos^{2}\theta)\right|^{2}$
(10)

are the effective reflection and transmission coefficients for the MZI. In our
experiment, characterisation of the chip using classical light showed that the
splitting ratio of the directional couplers was 35:65, which corresponds to a
value of $\theta=\arccos(\sqrt{0.65})=0.63$ in Eq. (6). The four-fold
coincidence probability assuming this imperfect splitting ratio is plotted in
Fig. 2(c). We see that the imperfect splitting ratio of the directional
couplers results in a slight change in shape of the fringe, particularly in
the region around $\phi_{\mathrm{MZI}}=\pi$. At this point, a local maximum
occurs in the four-fold probability, with
$P^{\mathrm{ind}}_{\mathrm{4f}}(\phi_{\mathrm{MZI}}=0)=\cos^{2}(4\theta)\leq
1$. However, whereas $\phi_{\mathrm{MZI}}=\pi$ previously corresponded to
complete transmission ($T=1$), in the MZI with imperfect directional couplers
we have $T=\cos^{2}(2\theta)<1$. In this case, the MZI no longer acts as a
perfect cross-over between the input and output modes ($T<1,R\neq 0)$, and
there will be a residual destructive interference between both terms in Eq.
(8) that give rise to coincidences. This results in a reduction of the
coincidence probability ($P^{\mathrm{ind}}_{\mathrm{4f}}<1$) at
$\phi_{\mathrm{MZI}}=\pi$. Nonetheless, this does not preclude our ability to
reach a maximum of the four-fold coincidence probability, since another
maximum occurs at the point $\phi_{\mathrm{MZI}}=0$, at which point the MZI is
completely reflecting to the input photons ($R=1$). This point of complete
reflection can be achieved irrespective of the directional coupler splitting
ratio, and ensures that we can measure at least one point where the
coincidence probability is a maximum.

We note that the imperfect splitting ratio of the directional couplers also
has the effect of slightly changing the position of the four-fold minima given
by Eq. (8). By finding the stationary points of Eq. (8) we see that the minima
occur where $\cos(\phi_{\mathrm{MZI}})=\csc^{2}(2\theta)+1$. Nonetheless,
these points continue to correspond to a balanced effective splitting ratio of
the MZI ($R=T=0.5$) and therefore remain the point of maximum nonclassical
interference between the heralded photon-pairs
($P^{\mathrm{ind}}_{\mathrm{4f}}=0$). Thus, although we have shown that the
fringe shape does change due to the imperfect splitting ratio of the
constituent directional couplers, we nonetheless see that the global maximum
and minimum points on the four-fold probability fringe are not changed.

For completeness, we also derive the probability of a four-fold coincidence
event, given a pair of distinguishable photons interfering in an imperfect
MZI. As before, we say that a pair of heralded single-photons are generated by
sources S1 and S2 in separate spatial modes, which we denote ‘a’ and ‘b’, and
in separate temporal modes, which we distinguish by placing a prime next to
one of the mode labels: thus,
$|\psi_{\mathrm{in}}\rangle=\hat{a}^{\dagger}\hat{b^{\prime}}^{\dagger}|vac\rangle$.
Using the transformation for the mode operators in the Heisenberg picture Eq.
(6) we find that the four-fold coincidence probability for a pair of
distinguishable photons can be written as:

$P^{\mathrm{dist}}_{\mathrm{4f}}=\left|\sin^{2}(\phi_{MZI}/2)\sin^{2}(2\theta)\right|^{2}+\left|1-\sin^{2}(\phi_{MZI}/2)\sin^{2}(2\theta)\right|^{2}.$
(11)

Again, it can be shown that maxima and minima of the four-fold probability
occur at the same values of $\phi_{\mathrm{MZI}}$ as for the indistinguishable
photon fringe given above Eq. (4). Examination of the global maxima and minima
of Eq. (11) similarly shows that despite the change in fringe shape due to the
imperfect splitting ratio of the directional couplers, the global maximum and
minimum fringe values remain unchanged.

In summary, although the fringe shape is modified due to the imperfect
splitting ratio of the directional couplers in our chip, we nonetheless find
that the global minimum and maximum of the four-fold probability fringes
remain unchanged. This ensures that the individual fringe visibilities for
both distinguishable and indistinguishable photon-pairs are not reduced due to
this device imperfection. Importantly, the HOM visibility (discussed below)
that depends on the global minimum of both fringes will also remain unchanged
as a result of the fringe distortion. Essentially this is due to our continued
ability to achieve a 50:50 effective splitting ratio of the MZI, despite the
fabrication imperfections of the directional couplers.

### MZI fringe, $P_{\mathrm{4f}}$, including impurity and multi-pair emission

The wave-vector for multi-mode SFWM squeezed state can be expressed in terms
of the Fock bases as [43],

$\displaystyle|\Psi\rangle$
$\displaystyle=\underset{k}{\otimes}\enskip\sqrt{1-x_{k}}~{}\sum_{n_{k}=0}^{\infty}~{}\sqrt{x^{n_{k}}}~{}|n_{k},n_{k}\rangle$
(12)

Where $k$ represents the $k^{th}$ optical mode, $x_{k}$ is the squeezing
strength of $k_{th}$ mode and $|n_{k},n_{k}\rangle$ represents $n$ number of
signal and idler photons in $k_{th}$ mode. If the density matrix from each
source is $\hat{\rho}=|\Psi\rangle\langle\Psi|$, the lumped detection
efficiency of a idler photon is $\eta_{i}$, and the probability of detecting
$k$ idler photon is $P_{i}(k)$ for a generic non photon-number-resolving
detector[44], then the reduced density matrix of the heralded signal photons
for multi-mode twin-beam squeezer can be expressed by detecting at least one
idler photon in at least one of the Schmidt modes $k$ with normalization
constant $N$,

$\hat{\rho}_{s}=N\sum_{\begin{subarray}{c}n_{1},...n_{k}=0\\\
n_{1}+...n_{k}\geq 1\end{subarray}}^{\infty}P_{i}(n_{1}+...n_{k})\langle
n_{1}|...\langle n_{k}|\hat{\rho}|n_{k}\rangle...|n_{1}\rangle$ (13)

In principle, photons propagating through a photonic circuit can be described
as a general interferometer expressed as an unitary transformation matrix $U$.
Considering the input optical modes of $U$ from source 1 and source 2 are
$\hat{a}_{1i}$ and $\hat{a}_{2j}$ respectively with $i$ and $j$ as $i^{th}$
and $j^{th}$ Schmidt modes, and the output optical modes of the transformation
are $\hat{c}^{\dagger}_{ij}$ and $\hat{d}^{\dagger}_{ij}$, then the
transformation for distinguishable photons will be,

$\displaystyle\hat{a}^{\dagger}_{11}\rightarrow
U_{11}\hat{c}^{\dagger}_{11}+U_{12}\hat{d}^{\dagger}_{11};\qquad$
$\displaystyle\hat{a}^{\dagger}_{12}\rightarrow
U_{11}\hat{c}^{\dagger}_{12}+U_{12}\hat{d}^{\dagger}_{12}$ (14)
$\displaystyle\hat{a}^{\dagger}_{21}\rightarrow
U_{21}\hat{c}^{\dagger}_{21}+U_{22}\hat{d}^{\dagger}_{21};\qquad$
$\displaystyle\hat{a}^{\dagger}_{22}\rightarrow
U_{21}\hat{c}^{\dagger}_{22}+U_{22}\hat{d}^{\dagger}_{22}$ (15)

For indistinguishable case, we can assume that both first and second Schmidt
mode of source 2 will be the same as source 1 in the above equations:
$\hat{c}^{\dagger}_{21}\rightarrow\hat{c}^{\dagger}_{11}$ and
$\hat{c}^{\dagger}_{22}\rightarrow\hat{c}^{\dagger}_{12}$ and same treatment
for mode $\hat{d}^{\dagger}$. Therefore, the probability of detecting two
heralding idler photons, and heralded signal photons at both of the output
modes of the unitary can be recorded as a four-fold coincidence event $P_{4F}$
describing heralded two-photon quantum interference. Thus, after the unitary
transformation, $\hat{\rho}\xrightarrow{U}\hat{\rho^{\prime}}$, the
probability of detecting a four-fold event for the single mode squeezed state
will be,

$\displaystyle
P_{\mathrm{4f}}=N_{1}N_{2}\sum_{\begin{subarray}{c}n_{c_{1}},...n_{c_{k}}=0\\\
n_{c_{1}}+...n_{c_{k}}\geq
1\end{subarray}}^{\infty}\sum_{\begin{subarray}{c}n_{d_{1}},...n_{d_{k}}=0\\\
n_{d_{1}}+...n_{d_{k}}\geq 1\end{subarray}}^{\infty}$ $\displaystyle
P_{s}(n_{c_{1}}+...n_{c_{k}})P_{s}(n_{d_{1}}+...n_{d_{k}})$
$\displaystyle\langle n_{c_{1}}|\langle n_{d_{1}}|...\langle n_{c_{k}}|\langle
n_{d_{k}}|\hat{\rho^{\prime}}|n_{c_{1}}\rangle|n_{d_{1}}\rangle...|n_{c_{k}}\rangle|n_{d_{k}}\rangle$
(16)

where $P_{s}(k)$ is the probability of detecting $k$ signal photons
considering a lump detection efficiency $\eta_{s}$, and $c_{k}$ and $d_{k}$
are output optical modes of the $U$. The equation remains similar for multi-
mode squeezed state but with more modes in the outputs. In an MZI, the phase
$\Phi_{MZI}$ is scanned to get the minimum and maximum four-fold coincidences
which is used to estimate visibility and infer indistinguishability.
Typically, the visibility of a MZI fringe [35] is defined by,

$V_{\mathrm{MZI}}=\frac{(P_{\mathrm{4f}})_{\mathrm{max}}-(P_{\mathrm{4f}})_{\mathrm{min}}}{(P_{\mathrm{4f}})_{\mathrm{max}}+(P_{\mathrm{4f}})_{\mathrm{min}}}.$

Using Eq. (4) and Eq. (5) we see that the ideal fringe visibility for
indistinguishable photons is $V^{\mathrm{ind}}_{\mathrm{MZI}}=1$, and reduces
to $V^{\mathrm{dist}}_{\mathrm{MZI}}=1/3$ for distinguishable single-photons.
In Eq. (16), adding a second Schmidt mode and setting multi-photon emission
upto 10, we can numerically calculate an interference fringe as a function of
MZI phase and device parameters such as the directional coupler splitting
ratio $\eta_{DC}$. This equation has been used to fit the 4-fold data obtained
from the measurements with the fitting parameters: maximum coincidence counts
($C_{max}$) and phase offset ($\phi_{off}$) which is due to inevitable slight
path length mismatches between both arms of the MZI. For the data shown in
Fig. 2(a), the fitting values are $C_{max}=242.7964$ and
$\phi_{off}=-0.2383\pi$.

Figure 7: Brightness for source S1 and S2. Signal and idler singles counts for
S1 (a) and S2 (c). Signal-idler coincidence counts and the corresponding
coincidence to accidental ratio (CAR) for S1 (b) and S2 (c).

## Appendix C: Brightness ($\bar{n}$) estimation

If the lumped efficiency of the four wave mixing process is $\gamma_{eff}$
($\mathrm{pairs/s/mW^{2}}$), the input power is $P_{in}$ and the signal and
idler photons detection efficiencies are $\eta_{s}$ and $\eta_{i}$, then the
rate of detecting only signal photons, only idler photons and signal-idler
coincidences from each sources can be written as,

$\displaystyle C(s)=(\eta_{s}\gamma_{eff})P_{in}^{2}+\beta_{s}P_{in}+DC_{s}$
(17) $\displaystyle
C(i)=(\eta_{i}\gamma_{eff})P_{in}^{2}+\beta_{i}P_{in}+DC_{i}$ (18)
$\displaystyle CC(s,i)=(\eta_{i}\eta_{s}\gamma_{eff})P_{in}^{2}+ACC$ (19)
$\displaystyle ACC=C(s)C(i)\tau$ (20)

Here, $\beta_{s}$ and $\beta_{i}$ are the linear noise photon terms (e.g. pump
leakage, scattered light, broken pairs etc.) including the detection
efficiency, $DC$ represents dark counts and $ACC$ represents accidentals where
$\tau$ is the size of the integration window. The factor $\gamma_{eff}$ lumps
the total SFWM strength of the resonator. Fitting the above equations with the
experimental data, $\gamma_{eff}$ can be estimated. If the repetition rate of
the laser is $R$, then for an input power $P_{in}$, the average photon number
generated per pulse will be, $\bar{n}=\gamma_{eff}P_{in}^{2}/R$. Our sources
S1 and S2 have brightness values $\bar{n}_{1}=0.100\pm 0.012$ and
$\bar{n}_{2}=0.122\pm 0.012$ with 95% confidence interval as in Table 1.
Therefore, $\bar{n}=\sqrt{n_{1}n_{2}}=0.110\pm 0.012$. The extra losses in the
signal and idler detection channels are due to the routing from the
experimental setup to the single-photon detection systems. The average
transmission per channel is $\eta=1.36\%$.

Table 1:  Average photon number per pulse estimation Source | $\eta_{s}$ | $\eta_{i}$ | $\gamma_{eff}$ |  $\bar{n}$ @ $1~{}mW$
---|---|---|---|---
1 | $0.0080$ | $0.0135$ | $5.013$ | $0.100\pm 0.012$
2 | $0.0111$ | $0.0287$ | $6.130$ | $0.122\pm 0.012$

The values of the $\beta_{s}$ = {$12.9979$, $32.2330$}
$\mathrm{kcounts/s/mW}$, and $\beta_{i}$ = {$49.9532$, $37.3080$}
$\mathrm{kcounts/s/mW}$ respectively for the two sources.

## References

  * [1] C. M. Gentry, J. M. Shainline, M. T. Wade, M. J. Stevens, S. D. Dyer, X. Zeng, F. Pavanello, T. Gerrits, S. W. Nam, R. P. Mirin, and M. A. Popović, “Quantum-correlated photon pairs generated in a commercial 45 nm complementary metal-oxide semiconductor microelectronic chip,” Optica 2(12), 1065 (2015).
  * [2] C. Sun, M. T. Wade, Y. Lee, J. S. Orcutt, L. Alloatti, M. S. Georgas, A. S. Waterman, J. M. Shainline, R. R. Avizienis, S. Lin, B. R. Moss, R. Kumar, F. Pavanello, A. H. Atabaki, H. M. Cook, A. J. Ou, J. C. Leu, Y.-H. Chen, K. Asanović, R. J. Ram, M. A. Popović, and V. M. Stojanović, “Single-chip microprocessor that communicates directly using light,” Nature 528 (7583), 534–538 (2015).
  * [3] S. Paesani, A. A. Gentile, R. Santagati, J. Wang, N. Wiebe, D. P. Tew, J. L. O’Brien, and M. G. Thompson, “Experimental Bayesian quantum phase estimation on a silicon photonic chip," Phys. Rev. Lett. 118, 100503 (2017).
  * [4] T. Komljenovic, M. Davenport, J. Hulme, A. Y Liu, C. T Santis, A. Spott, S. Srinivasan, E. J Stanton, C. Zhang, and J. E Bowers, “Heterogeneous silicon photonic integrated circuits,” J. Lightwave Technol. 34(1), 20–35 (2016).
  * [5] A. L. Migdall, D. Branning, and S. Castelletto, “Tailoring single-photon and multiphoton probabilities of a single-photon on-demand source,” Phys. Rev. A 66, 053805 (2002).
  * [6] E. Jeffrey, N. A. Peters, and P. G. Kwiat, “Towards a periodic deterministic source of arbitrary single-photon states,” New J. Phys. 6, 100 (2004).
  * [7] T. Meany, L. A. Ngah, M. J. Collins, A. S. Clark, R. J. Williams, B. J. Eggleton, M. J. Steel, M. J. Withford, O. Alibart, and S. Tanzilli, “Hybrid photonic circuit for multiplexed heralded single photons,” Laser Photonics Rev. 8(3), L42–L46 (2014).
  * [8] M. Varnava, D. E. Browne, and T. Rudolph, “How good must single photon sources and detectors be for efficient linear optical quantum computation?,” Phys. Rev. Lett. 100, 060502 (2008).
  * [9] N. Somaschi, V. Giesz, De Santis, L., J C., Loredo, M P., Almeida, G. Hornecker, S L., Portalupi, T. Grange, C. Antón, J. Demory, C. Gómez, I. Sagnes, N D., Lanzillotti-Kimura, A. Lemaítre, A. Auffeves, A G., White, L. Lanco, and P. Senellart, “Near-optimal single-photon sources in the solid state,” Nat. Photonics 10(5), 340–345 (2016).
  * [10] X. Ding, Y. He, Z. C. Duan, N. Gregersen, M. C. Chen, S. Unsleber, S. Maier, C. Schneider, M. Kamp, S. Höfling, C.-Y. Lu, and J.-W. Pan, “On-demand single photons with high extraction efficiency and near-unity indistinguishability from a resonantly driven quantum dot in a micropillar,” Phys. Rev. Lett. 116, 020401 (2016).
  * [11] J. Iles-Smith, D. P. S. McCutcheon, A. Nazir, and J. Mørk, “Phonon scattering inhibits simultaneous near-unity efficiency and indistinguishability in semiconductor single-photon sources,” Nat. Photonics 11, 521–526 (2017).
  * [12] C. P. Dietrich, A. Fiore, M. G. Thompson, M. Kamp, and S. Höfling, “GaAs integrated quantum photonics: towards compact and multi-functional quantum photonic integrated circuits,” Laser Photonics Rev. 10(6), 870–894 (2016).
  * [13] P. Gold, A. Thoma, S. Maier, S. Reitzenstein, C. Schneider, S. Höfling, and M. Kamp, “Two-photon interference from remote quantum dots with inhomogeneously broadened linewidths,” Phys. Rev. B 89, 035313 (2014).
  * [14] Y. He, Y.-M. He, Y.-J. Wei, X. Jiang, M.-C. Chen, F.-L. Xiong, Y. Zhao, C. Schneider, M. Kamp, S. Höfling, C.-Y. Lu, and J.-W. Pan, “Indistinguishable photons emitted by spin-flip raman transitions in InGaAs quantum dots,” Phys. Rev. Lett. 111, 237403 (2013).
  * [15] G. D. Marshall, T. Gaebel, J. C. F. Matthews, J. Enderlein, J. L. O’Brien and J. R. Rabeau, “Coherence properties of a single dipole emitter in diamond,” New J. Phys. 13, 055016 (2011).
  * [16] J. C. Loredo, M. A. Broome, P. Hilaire, O. Gazzano, I. Sagnes, A. Lemaitre, M. P. Almeida, P. Senellart, and A. G. White, “Boson sampling with single-photon fock states from a bright solid-state source,” Phys. Rev. Lett. 118, 130503 (2017).
  * [17] H. Wang, Y. He, Y.-H. Li, Z.-E. Su, B. Li, H.-L. Huang, Xi. Ding, M.-C. Chen, C. Liu, J. Qin, J.-P. Li, Y.-M. He, C. Schneider, M. Kamp, C.-Z. Peng, S. Höfling, C.-Y. Lu, “High-efficiency multiphoton boson sampling,” Nat. Photonics 11(6), 361–365 (2017).
  * [18] J. W. Silverstone, D. Bonneau, K. Ohira, N. Suzuki, H. Yoshida, N. Iizuka, M. Ezaki, C. M. Natarajan, M. G. Tanner, R. H. Hadfield, V. Zwiller, G. D. Marshall, J. G. Rarity, J. L. O’Brien, and M. G. Thompson, “On-chip quantum interference between silicon photon-pair sources,” Nat. Photonics 8(2), 104–108 (2013).
  * [19] J. W. Silverstone, R. Santagati, D. Bonneau, M. J. Strain, M. Sorel, J. L. O’Brien, and M. G. Thompson, “Qubit entanglement between ring-resonator photon-pair sources on a silicon chip,” Nat. Commun. 6, 7948 (2015).
  * [20] H. Jin, F. M. Liu, P. Xu, J. L. Xia, M. L. Zhong, Y. Yuan, J. W. Zhou, Y. X. Gong, W. Wang, and S. N. Zhu, “On-chip generation and manipulation of entangled photons based on reconfigurable lithium-niobate waveguide circuits,” Phys. Rev. Lett. 113(10), 103601 (2014).
  * [21] J. Wang, S. Paesani, R. Santagati, S. Knauer, A. A. Gentile, N. Wiebe, M. Petruzzella, J. L. O’Brien, J. G. Rarity, A. Laing, and M. G. Thompson, “Experimental quantum Hamiltonian learning,” Nat. Phys. 13, 551–555 (2017).
  * [22] S. F. Preble, M. L. Fanto, J. A. Steidle, C. C. Tison, G. A. Howland, Z. Wang, and P. M. Alsing, “On-chip quantum interference from a single silicon ring-resonator source,” Phys. Rev. Applied 4, 021001 (2015).
  * [23] R. Kaltenbaek, B. Blauensteiner, M. Żukowski, M. Aspelmeyer, and A. Zeilinger, “Experimental interference of independent photons,” Phys. Rev. Lett. 96, 240502 (2006).
  * [24] J. B. Spring, P. L. Mennea, B. J. Metcalf, P. C. Humphreys, J. C. Gates, H. L. Rogers, C. Söller, B. J. Smith, W. Steven Kolthammer, P. G. R. Smith, and I. A. Walmsley, “Chip-based array of near-identical, pure, heralded single-photon sources,” Optica 4(1), 90 (2017).
  * [25] X. Zhang, R. Jiang, B. Bell, D.-Y. Choi, C. Chae, and C. Xiong, “Interfering heralded single photons from two separate silicon nanowires pumped at different wavelengths,” Technologies 4(3), 25 (2016).
  * [26] K.-i. Harada, H. Takesue, H. Fukuda, T. Tsuchizawa, T. Watanabe, K. Yamada, Y. Tokura, and S.-i. Itabashi, “Indistinguishable photon pair generation using two independent silicon wire waveguides,” New J. Phys. 13(6), 065005 (2011).
  * [27] J. Fulconis, O. Alibart, W. J. Wadsworth, and J. G. Rarity, “Quantum interference with photon pairs using two micro-structured fibres,” New J. Phys. 9, 276 (2007).
  * [28] P. Aboussouan, O. Alibart, D. B. Ostrowsky, P. Baldi, and S. Tanzilli, “High-visibility two-photon interference at a telecom wavelength using picosecond-regime separated sources,” Phys. Rev. A 81, 021801 (2010).
  * [29] M. J. Collins, C. Xiong, I. H. Rey, T. D. Vo, J. He, S. Shahnia, C. Reardon, T. F. Krauss, M. J. Steel, A. S. Clark, and B. J. Eggleton, “Integrated spatial multiplexing of heralded single-photon sources,” Nat. Commun. 4, 2582 (2013).
  * [30] C. Xiong, X. Zhang, Z. Liu, M. J. Collins, A. Mahendra, L. G. Helt, M. J. Steel, D.-Y D-Y Choi, C. J. Chae, P. H. W. Leong, and B. J. Eggleton, “Active temporal multiplexing of indistinguishable heralded single photons,” Nat. Commun. 7, 10853 (2016).
  * [31] M. Savanier, R. Kumar, and S. Mookherjea, “Photon pair generation from compact silicon microring resonators using microwatt-level pump powers,” Opt. Express 24(4), 3313–3328 (2016).
  * [32] M. Davanaço, J. R. Ong, A. B. Shehata, A. Tosi, I. Agha, S. Assefa, F. Xia, W. M. J. Green, S. Mookherjea, and K. Srinivasan, “Telecommunications-band heralded single photons from a silicon nanophotonic chip,” Appl. Phys. Lett. 100(26), 261104 (2012).
  * [33] Z. Vernon and J. E. Sipe, “Spontaneous four-wave mixing in lossy microring resonators,” Phys. Rev. A 91(5), 053802 (2015).
  * [34] Z. Vernon, M. Liscidini, and J. E. Sipe, “No free lunch: the trade-off between heralding rate and efficiency in microresonator-based heralded single photon sources,” Opt. Lett. 4(4), 788–791 (2016).
  * [35] J. G. Rarity, P. R. Tapster, E. Jakeman, T. Larchuk, R. A. Campos, M. C. Teich, and B. E. A. Saleh, “Two-photon interference in a Mach-Zehnder interferometer,” Phys. Rev. Lett. 65, 1348–1351 (1990).
  * [36] C. K. Hong, Z. Y. Ou, and L. Mandel, “Measurement of subpicosecond time intervals between two photons by interference,” Phys. Rev. Lett. 59, 2044 (1987).
  * [37] L. G. Helt, Z. Yang, M. Liscidini, and J. E. Sipe, “Spontaneous four-wave mixing in microring resonators,” Opt. Lett. 35(18), 3006–3008 (2010).
  * [38] Z. Vernon, M. Menotti, C. C. Tison, J. A. Steidle, M. L. Fanto, P. M. Thomas, S. F. Preble, A. M. Smith, P. M. Alsing, M. Liscidini, and J. E. Sipe, “Truly unentangled photon pairs without spectral filtering,” Opt. Lett. 42(18), 3638-3641 (2017).
  * [39] Y. Ding, C. Peucheret, H. Ou, and K. Yvind, “Fully etched apodized grating coupler on the SOI platform with -0.58 db coupling efficiency,” Opt. Lett. 39(18), 5348–5350 (2014).
  * [40] M. Piekarek, D. Bonneau, S. Miki, T. Yamashita, M. Fujiwara, M. Sasaki, H. Terai, M. G. Tanner, C. M. Natarajan, R. H. Hadfield, J. L. O’Brien, and M. G. Thompson, “High-extinction ratio integrated photonic filters for silicon quantum photonics,” Opt. Lett. 42(4), 815–818 (2017).
  * [41] U. Leonhardt, “Quantum physics of simple optical instruments,” Rep. Prog. Phys. 66(7), 1207 (2003).
  * [42] Z. Y. Ou, J.-K. Rhee, and L. J. Wang, “Photon bunching and multiphoton interference in parametric down-conversion,” Phys. Rev. A 60, 593 (1999).
  * [43] A. Christ, K. Laiho, A. Eckstein, K. N. Cassemiro, and C. Silberhorn, “Probing multimode squeezing with correlation functions,” New J. Phys. 13, 033027 (2011)
  * [44] P. Kok and S. L. Braunstein, “Postselected versus nonpostselected quantum teleportation using parametric down-conversion,” Phys. Rev. A 61(4), 042304 (2000).