{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Variational Quantum Metrology" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " Copyright (c) 2022 Institute for Quantum Computing, Baidu Inc. All Rights Reserved. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Background" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Quantum metrology is the study of high resolution and high sensitivity measurements of physical parameters using quantum theory (e.g., quantum entanglement) in order to further describe physical systems. Its theoretical aspect is quantum parameter estimation theory, and its experimental aspect is called quantum sensing. Previous studies have shown that the estimation accuracy by quantum theory is improved by taking the square root of the required number of samples compared with the classical method [1-3]. For an unknown parameter, the goal of quantum metrology is to maximize the accuracy of parameter estimation while minimizing the required resources (such as time, number of qubits, etc.).\n", "\n", "For example, given a unitary $e^{-i\\phi H}$ with a known Hamiltonian $H$, how can we extract the information about $\\phi$ by quantum metrology? It comprises the following four steps:\n", "\n", "1. Preparation. Prepare an input state $|\\psi\\rangle$.\n", "2. Parameterization. Obtain the parameterized quantum state $e^{-i\\phi H}|\\psi\\rangle$ after the evolution of $e^{-i\\phi H}$.\n", "3. Measurement. Measure the output state.\n", "4. Classical estimation. Estimate the parameters based on the results of multiple measurements.\n", "\n", "Combined with quantum parameter estimation theory, this tutorial is based on the idea of variational quantum sensors in [4], and the parameterized quantum circuit is constructed using Paddle Quantum to train the loss function and obtain a quantum sensor that can estimate the parameters that are normally distributed." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Parameter Estimation Theory" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Classical parameter estimation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Classical parameter estimation, such as the maximum-likelihood estimator (MLE), uses multiple samples to calculate data containing an unknown parameter. That is, given a probability distribution depending on an unknown parameter $\\phi$, where $f$ is the probability density function, and ${\\bf{X}}=\\{X_1,X_2,... X_N\\}$ is $N$ independent and identically distributed sample data, the estimated value $\\hat\\phi$ is obtained by using MLE:\n", "\n", "$$\n", "\\hat\\phi({\\bf X})=\\arg\\max_{\\phi}\\prod_i^Nf(X_i,\\phi), \\tag{1}\n", "$$\n", "\n", "which finds $\\phi$ such that $X_i(i=1,...,N)$ occurs with maximum probability. After obtaining the estimated parameters, how to measure the difference between the estimated parameters and the actual parameters? That is, how to measure the accuracy of the estimated parameters? In the parameter estimation theory, mean squared error (MSE) is generally used to measure the accuracy.\n", "\n", "The sample containing the unknown parameter $\\bf{\\phi}$ is ${\\bf{X}}=\\{X_1,X_2,... X_N\\}\\in {\\mathcal F}^N$, where ${\\mathcal F}^N$ is the sample space. Let $\\hat{\\phi}({\\bf X}):{\\mathcal F}^N\\rightarrow\\Phi$ be the estimator that estimates $\\phi\\in\\Phi$ ($\\Phi$ is the parameter space). Then the MSE of $\\hat{\\phi}(\\bf X)$ with respect to $\\phi$ is defined as\n", "\n", "$$\n", "\\begin{aligned}\n", "{\\rm{MSE}}&=\n", "E[(\\hat{\\phi}({\\bf X})-\\phi)^2]\\\\\n", "&=\\sum_{{\\bf X}\\in {\\mathcal F}^N}f({\\bf X};\\phi)(\\hat{\\phi}({\\bf X)}-\\phi)^2,\n", "\\end{aligned} \\tag{2}\n", "$$\n", "\n", "where $f({\\bf X}; \\phi)$ is the probability density of getting the current sample $\\bf X$ given the parameter $\\phi$. Although different estimators affect the value of MSE, regardless of the choice of $\\hat{\\phi}({\\bf X})$, there is ${\\rm{MSE}}\\geq\\frac{1}{N{\\mathcal I(\\phi)}}$. This lower bound is known as the Cramér–Rao (CR) bound [2], where $\\mathcal I(\\phi)$ is the Fisher information, which reflects to what extent a slight parameter change will change the probability distribution (see [Quantum Fisher Information](https://qml.baidu.com/tutorials/qnn-research/quantum-fisher-information.html) for the application of Fisher information in Paddle Quantum). " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Quantum parameter estimation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In quantum parameter estimation, the samples used in classical parameter estimation become a quantum state $\\rho_{\\phi}\\in{\\mathcal F}({\\mathcal H})$ to be measured, where $\\phi$ is the unknown parameter and ${\\mathcal F}({\\mathcal H})$ denotes the set of density operators on the Hilbert space $\\mathcal H$. According to the steps of quantum metrology and [4], assuming that the initial input state is $|0\\rangle$ and the estimator is $\\hat{\\phi}(m)$, where $m$ is related to the measured results (such as the difference in the number of 1s and the number of 0s in the measured bit string), then the MSE is\n", "\n", "$$\n", "\\begin{aligned}\n", "{\\rm MSE}&=E[(\\hat{\\phi}(m)-\\phi)^2]\\\\\n", "&=\\sum_m(\\hat{\\phi}(m)-\\phi)^2p(m|\\phi),\n", "\\end{aligned} \\tag{3}\n", "$$\n", "\n", "where $p(m|\\phi)$ is the probability of obtaining $m$ by measurement with a given parameter $\\phi$. Similarly, no matter how $\\hat{\\phi}(m)$ is chosen, there is a quantum CR bound ${\\rm{MSE}}\\geq\\frac{1}{NF(\\phi)}$, where $N$ is the number of repeated measurements of $\\rho_\\phi$, and $F(\\phi)$ is the quantum Fisher information (see [Quantum Fisher Information](https://qml.baidu.com/tutorials/qnn-research/quantum-fisher-information.html) for the application of quantum Fisher information in Paddle Quantum). " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Variational Quantum Sensors" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Quantum sensing is the application of quantum metrology. Based on [4], this tutorial mainly introduces a kind of variational Ramsey interferometer. The traditional Ramsey interferometer [2] (as shown in Figure 1) is a particle interferometry method that uses magnetic resonance phenomena to measure particle transition frequency and is used to measure unknown parameters. The variational Ramsay interferometer [6] (as shown in Figure 2) consists of two parameterized quantum circuits (denoted as $U_{\\rm{En}}(\\theta_{\\rm En})$ and $U_{\\rm{De}}(\\theta_{\\rm{De}})$) in the encoding and decoding parts of the circuit for setting entanglement and measuring quantum states. Previous studies have shown that by combining with quantum theory (such as quantum entanglement), the scaling of parameter estimation accuracy is enhanced to $\\frac{1}{N}$ from $\\frac{1}{\\sqrt{N}}$ [1-3], and the appropriate entanglement mode can be effectively found by the variational method.\n", "\n", "![Ramsey_interferomertry](./figures/QM-fig-RI.png \"Figure 1:Ramsey interferometer.\")\n", "