Next Article in Journal
The Standard Model Symmetry and Qubit Entanglement
Previous Article in Journal
CDFAN: Cross-Domain Fusion Attention Network for Pansharpening
Previous Article in Special Issue
Exploring Quantum Neural Networks for Demand Forecasting
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Overcoming Intensity Limits for Long-Distance Quantum Key Distribution

by
Ibrahim Almosallam
Ministry of Communications and Information Technology, Riyadh 12382, Saudi Arabia
Entropy 2025, 27(6), 568; https://doi.org/10.3390/e27060568
Submission received: 14 April 2025 / Revised: 15 May 2025 / Accepted: 22 May 2025 / Published: 27 May 2025

Abstract

:
Quantum Key Distribution (QKD) enables the sharing of cryptographic keys secured by quantum mechanics. The BB84 protocol assumes single-photon sources, but practical systems rely on weak coherent pulses vulnerable to Photon-Number-Splitting (PNS) attacks. The Gottesman–Lo–Lütkenhaus–Preskill (GLLP) framework addresses these imperfections, deriving secure key rate bounds under limited PNS scenarios. The decoy-state protocol further improves performance by refining single-photon yield estimates, but still considers multi-photon states as insecure, thereby limiting intensities and constraining key rate and distance. More recently, finite-key security bounds for decoy-state QKD have been extended to address general attacks, ensuring security against adversaries capable of exploiting arbitrary strategies. In this work, we focus on a specific class of attacks, the generalized PNS attack, and demonstrate that higher pulse intensities can be securely used by employing Bayesian inference to estimate key parameters directly from observed data. By raising the pulse intensity to 10 photons, we achieve a 50-fold increase in key rate and a 62.2% increase in operational range (about 200 km) compared to the decoy-state protocol. Furthermore, we accurately model after-pulsing using a Hidden Markov Model (HMM) and reveal inaccuracies in decoy-state calculations that may produce erroneous key-rate estimates. While this methodology does not address all possible attacks, it provides a new approach to security proofs in QKD by shifting from worst-case assumption analysis to observation-dependent inference, advancing the reach and efficiency of discrete-variable QKD protocols.

1. Introduction

QKD allows two parties, Alice and Bob, to share a secret key secured by quantum mechanics. The BB84 protocol [1] introduced QKD using single-photon polarization states and its unconditional security was proven in [2] via quantum error correction and entanglement purification, assuming ideal single-photon sources. True single-photon sources are hard to implement. Instead, most QKD systems use weak coherent pulses from attenuated lasers, which produce multi-photon states. These enable a Photon-Number-Splitting (PNS) attack [3], where an eavesdropper, commonly referred to as Eve, intercepts some photons and forwards the rest, gaining key information undetected and compromising security.
The GLLP framework [4] addresses this by extending security proofs to imperfect devices and multi-photon pulses. It ensures secure QKD by treating multi-photon pulses as “tagged” and deriving a secure lower bound on the secret key rate that can be extracted from the sifted key:
K max ( 1 Δ ) 1 H 2 δ / 1 Δ H 2 ( δ ) , 0 ,
where δ is the overall error rate, Δ is the fraction of tagged photons, and  H 2 is the binary Shannon entropy function.
Building on GLLP’s framework, the decoy-state protocol [5,6,7,8,9] improved key rates and operational ranges by enhancing single-photon yield estimation through random pulse-intensity variations, and it was first successfully demonstrated in [10]. However, while it improves performance, the decoy-state approach relies on conservative assumptions for multi-photon pulses—assuming they are fully compromised—which forces conservative intensity choices, limits maximum transmission distances, and imposes high detector efficiency requirements.
While decoy-state protocols extend BB84, other approaches, like SARG04 and Coherent One-Way (COW), also address PNS attacks. SARG04 [11] uses the original four BB84 states but alters the sifting procedure, improving resilience to multi-photon attacks at the expense of reduced key rates. The COW protocol [12] transmits weak coherent pulses in time-bin sequences and checks their coherence to detect eavesdropping. Although these methods enhance certain security aspects, they generally yield lower key rates and remain more susceptible to side-channel attacks compared to decoy-state protocols.
Despite its improved accuracy in estimating single-photon contributions, the decoy-state protocol still treats multi-photon pulses as insecure. By relying on additional intensity settings, it refines the statistical bounds on single-photon yields, but the need to suppress multi-photon probabilities enforces conservative intensity choices. This limits the maximum transmission distance and demands high detector efficiencies, posing significant experimental challenges for near-term implementations.
Advancements such as those presented in [13] have extended the security analysis by considering more general attack models, thereby further advancing the decoy-state framework. In summary, Ref. [13] broadens the scope of adversarial strategies beyond the conventional decoy approach.
Although previous works have accounted for various device imperfections, the correlations induced by after-pulsing are often overlooked. After-pulsing, where a detector emits spurious clicks following a real detection [14], induces correlations that violate the i.i.d. assumption. A common mitigation strategy is to increase the detector’s dead time, reducing after-pulse probabilities to negligible levels at the expense of lowering the achievable key rate. Even then, neglecting residual after-pulsing can still distort error estimates and weaken QKD security [15].
Twin-Field QKD (TF-QKD) [16] exploits quantum interference at a central node to surpass conventional rate-loss limits. By sending weak coherent pulses from both Alice and Bob to a measurement station, TF-QKD reduces reliance on trusted relays and enables secure key distribution over longer distances with minimal loss.
This work reframes QKD security from worst-case assumptions to a probabilistic inference model. Treating eavesdropper detection as an inference task, we use Bayesian methods to estimate key parameters like Δ from observed data. This tighter parameter estimation refines the GLLP formula, enabling higher pulse intensities and improving both key rate and operational range.
Instead of limiting source intensity to reduce Eve’s potential interference, we recast her presence as an inference problem. By modeling the QKD protocol as a probability distribution over system parameters and detection outcomes and applying Bayesian inference [17], we directly estimate Eve’s interception rate Δ from observed data. Notably, our analysis focuses on the generalized PNS attack model—which captures a broader spectrum of adversarial strategies than the conventional PNS attack—rather than the more comprehensive attack model discussed in [13]. This approach eliminates overly conservative assumptions, extends PNS-attack analysis to arbitrary interception scenarios and channel conditions, and enables secure operation at higher pulse intensities when Δ is negligible.
To account for temporal correlations introduced by detector effects like after-pulsing and device variabilities, we incorporate a Hidden Markov Model (HMM) [18]. This refinement yields more accurate error estimates and facilitates reliable key extraction.
Building on the GLLP framework without imposing intensity constraints, our approach supports greater operational distances, reduces reliance on high-efficiency detectors, and enhances key rates.
The remainder of this paper is organized as follows: Section 2 presents the probabilistic model; Section 3 outlines the Bayesian inference and HMM formulations; Section 4 provides simulation results and comparisons to the decoy-state protocol; Section 5 addresses time complexity; and Section 6 concludes with final remarks and potential future directions.

2. Probabilistic Modeling

To better analyze and secure Quantum Key Distribution (QKD) systems, a deeper understanding of the underlying processes is essential. Realistic devices are subject to various sources of noise and inherent randomness, making it necessary to adopt a probabilistic modeling approach. In this section, we construct a comprehensive probabilistic framework that captures these complexities, accounting for factors such as detector efficiency, dark counts, beam-splitter misalignment, laser intensity, and fiber attenuation. By modeling these random processes, we derive the probabilities of different click events, laying the foundation for a more rigorous security analysis of QKD implementations.
We begin by modeling each component of the QKD setup separately to understand how the distribution of photons evolves as they travel from Alice to Bob. This modular approach enables us to systematically build the complete probability distribution, ensuring that we incorporate all relevant factors that influence the detection process.
Next, we extend our analysis to incorporate eavesdropping scenarios, specifically generalizing the Photon-Number-Splitting (PNS) attack. By introducing Eve’s parameters into our model, we calculate how the probabilities of click events change under various strategies she might employ. This generalization enables us to quantify the security of the QKD system under more realistic and flexible attack models.
Following this, we address the temporal dependencies introduced by after-pulsing. We develop a Hidden Markov Model (HMM) to capture these dependencies and refine our probability estimates accordingly. The HMM framework allows us to model correlations between detection events, which are crucial for accurately assessing the impact of after-pulsing on error rates and key generation.
Finally, we derive the error and gain probabilities from both the independent and identically distributed (i.i.d.) model and the HMM-based model. These probabilities are essential for key rate calculations and form the basis for evaluating the security and performance of the QKD protocol under realistic conditions. By the end of this section, we will have constructed a detailed and adaptable probabilistic model that serves as the foundation for our Bayesian inference and subsequent analysis.

2.1. QKD Components

Accurately modeling the QKD system requires a detailed understanding of the components involved, including detectors, beam splitters, and the interaction with quantum channels. In this section, we construct a probabilistic framework to model the behavior of a QKD system, incorporating various noise sources and potential attack vectors.

2.1.1. Detectors

The detection process in QKD systems can be characterized by the following key probabilities:
  • p a  (After-pulse): probability of a click given a click in the previous detection window.
  • p c  (Efficiency): probability of a click given a single photon.
  • p d  (Dark count): probability of a click in the absence of a photon.
  • p e  (Misalignment): probability of a detection error due to misalignment.
Throughout the paper, we will also use the notation q = 1 p for several parameters, for example, q c = 1 p c , q d = 1 p d , and so on.
For detectors D 0 and D 1 , we denote their respective click probabilities as p c 0 and p c 1 , and similarly for dark count and after-pulse probabilities. When n photons reach a detector and each has an independent detection probability, p c , the detected signal photon count, s, is binomially distributed: s Binomial ( n , p c ) . Similarly, the occurrence of a dark count follows a Bernoulli distribution with probability p d : d Bernoulli ( p d ) .
These distributions assume independence and fixed probabilities. To overcome this, we will use a Bayesian inference framework, modeling parameters as random variables with priors and updating posteriors based on observed data to incorporate uncertainties. Additionally, a Hidden Markov Model (HMM) will address dependencies between successive detection events, relaxing the independence assumption.
The probability of a click event at the detector, D, can be considered as the combined probability of detecting at least one photon or registering a dark count; see Figure 1. Given these considerations, we present the following lemma, which formalizes the combined click probability at a detector:
Lemma 1.
Given n photons incident on a detector, each detected independently with probability p c , and a dark count probability p d , the detection event D, detecting at least one photon or registering a dark count, follows a Bernoulli distribution:
P ( D n , p c , p d ) = Bernoulli ( D p = 1 q d q c n ) ,
where q c = 1 p c and q d = 1 p d
Proof. 
The detection event D occurs if at least one signal photon is detected or a dark count occurs. Since these are independent events, the probability that neither occurs is:
P ( D = 0 n , p c , p d ) = P ( d = 0 ) P ( s = 0 ) = q d q c n .
Therefore, the probability of a detection event is:
P ( D = 1 n , p c , p d ) = 1 P ( D = 0 n , p c , p d ) = 1 q d q c n .
   □

2.1.2. Fiber-Detector

Optical fibers affect the probability of photons arriving at the detector by attenuating their intensity. The attenuation rate α (dB/km) determines the probability p f of a photon successfully traversing a distance d, given by:
p f = 10 α d 10 .
Each photon independently emerges with probability p f , making the number of photons k exiting the fiber, given n entered, follow a binomial distribution: k Binomial ( n , p f ) .
Given this model, the probability of a detection event at a detector with efficiency p c and dark count probability p d , after photons pass through a fiber with loss p f , is derived using the binomial distribution of photons emerging from the fiber and their detection probabilities. This is formally presented in Lemma 2 (see also Figure 2).
Lemma 2.
When n photons pass through a fiber before reaching a detector, the probability of a detection event at the detector, given the fiber transmission probability p f , detector efficiency p c , and dark count probability p d , is equivalent to the probability of a detection event for n photons directly incident on a detector, with its efficiency scaled by the fiber transmission probability. Specifically, this means:
P ( D n , p c , p d , p f ) = P ( D n , p c · p f , p d ) ,
where the right-hand side is the detection probability derived in Lemma 1.
Proof. 
Since each photon has a probability p f of passing through the fiber and reaching the detector, the number of photons k that reach the detector is a binomial random variable:
k Binomial ( n , p f ) .
The probability of a click event at the detector is computed by marginalizing over all possible values of k, summing the probabilities of a click given k, weighted by the probability that exactly k photons reach the detector:
P ( D = 1 n , p c , p d , p f ) = k = 0 n P ( D = 1 k , p c , p d ) P ( k n , p f ) ,
where:
  • P ( D = 1 k , p c , p d ) is the probability of a click given that k photons reach the detector, as previously derived in Lemma 1.
  • P ( k n , p f ) is the probability that exactly k photons pass through the fiber, modeled as Binomial ( k n , p f ) .
Substituting these into the sum:
P ( D = 1 n , p c , p d , p f ) = k = 0 n 1 q d q c k n k p f k ( 1 p f ) n k .
Expanding and simplifying:
P ( D = 1 n , p c , p d , p f ) = 1 q d k = 0 n n k q c p f k 1 p f n k .
Applying the binomial theorem [19]:
k = 0 n n k x k y n k = ( x + y ) n ,
where x = q c p f and y = 1 p f , we get:
P ( D = 1 n , p c , p d , p f ) = 1 q d q c p f + 1 p f n , = 1 q d 1 p c p f n .
This matches the form in Lemma 1, where the efficiency is effectively p c p f .    □

2.1.3. Fiber-Beam Splitter

If, after passing through the fiber, the photon stream encounters a beam splitter, each photon is independently directed to one of two paths, labeled 0 and 1, with probabilities p 0 and p 1 = 1 p 0 , respectively. Then, the number of photons taking the 0 path follows m 0 Binomial ( m , p 0 ) , while those taking the 1 path follow m 1 = m m 0 Binomial ( m , p 1 ) .
The objective is to derive the distribution of photons m i directed to detector D i ( i { 0 , 1 } ) given n photons initially entering the fiber, combining the effects of fiber attenuation and the beam splitter. This is formally presented in Lemma 3 (see also Figure 3).
Lemma 3.
If n photons go through a fiber with a transmission probability p f and then encounter a beam splitter that directs each photon to path i with probability p i , the number of photons m i directed towards detector i follows a binomial distribution with a combined success probability of p f p i . Formally, this can be expressed as:
m i Binomial ( n , p f p i ) .
Proof. 
m i results from two successive binomial processes: first, the probability of m successes in n trials with probability p f , and then the probability of m i successes in m trials with probability p i . To find the distribution of m i , we marginalize over the latent variable m:
P ( m i n , p f , p i ) = m = m i n P ( m i m , p i ) P ( m n , p f ) .
The index starts at m i , as  m i > m is not possible. Since P ( m i m , p i ) and P ( m n , p f ) are both binomial distributions, we substitute them as follows:
P ( m i n , p f , p i ) = m = m i n Binomial ( m i m , p i ) Binomial ( m n , p f ) = m = m i n m m i p i m i ( 1 p i ) m m i n m p f m ( 1 p f ) n m = m = m i n m m i p i m i q i m m i n m p f m q f n m = m = m i n m ! m i ! ( m m i ) ! p i m i q i m m i n ! m ! ( n m ) ! p f m q f n m = n ! m i ! p i m i m = m i n q i m m i p f m q f n m ( m m i ) ! ( n m ) ! .
Letting c = m m i and C = n m i , and re-indexing:
P ( m i n , p f , p i ) = n ! m i ! p i m i c = 0 n q i c p f c + m i q f C c c ! ( C c ) ! , = n ! m i ! p i m i p f m i c = 0 C q i c p f c q f C c c ! ( C c ) ! , = n ! m i ! C ! ( p f p i ) m i c = 0 C C ! c ! ( C c ) ! ( q i p f ) c q f C c , = n ! m i ! C ! ( p f p i ) m i c = 0 C C c ( q i p f ) c q f C c .
Recognizing the binomial theorem [19]:
P ( m i n , p f , p i ) = n ! m i ! C ! ( p f p i ) m i ( q i p f + q f ) C .
Simplifying and substituting back:
P ( m i n , p f , p i ) = n m i ( p f p i ) m i ( 1 p f p i ) n m i .
This has the form of the binomial distribution with number of trials m i and success probability p f p i .    □

2.1.4. Pair of Detectors

In practical BB84 implementations, two detectors are used to distinguish between the detection of a true 0 bit and the absence of photon arrival. Therefore, to fully characterize the detection system, we compute the four joint probabilities of detector outcomes:
  • P 00 : The probability of neither detectors clicking.
  • P 01 : The probability of only D 0 clicking.
  • P 10 : The probability of only D 1 clicking.
  • P 11 : The probability of both detectors clicking.
If we have access to the marginal probabilities for each detector:
P ( D 0 = 1 ) = P 1 = P 01 + P 11 ,
P ( D 1 = 1 ) = P 1 = P 10 + P 11 ,
as well as the union probability:
P ( D 0 D 1 = 1 ) = P = P 01 + P 10 + P 11 ,
we can use these to infer the joint probabilities as follows:
P 00 = 1 P ,
P 01 = P P 1 ,
P 10 = P P 1 ,
P 11 = P 1 + P 1 P .
The marginals are straight forward results of previously stated lemmas. From Lemma 3, we showed that the effect of a fiber with loss p f followed by a beam-splitter path probability p i is essentially equivalent to a single fiber with a loss of p f p i . Additionally, in Lemma 2, we showed that the effect of a fiber with loss p f connected to a detector with efficiency p c is equivalent to a single detector with an efficiency of p f p c . Therefore, we can combine these results and conclude that a fiber connected to a beam splitter that is connected to a detector is equivalent to a single detector with an efficiency of p f p i p c , or more formally:
P ( D i = 1 n , p c , p d , p f , p i ) = P ( D = 1 n , p f p i p c , p d )
In the following Lemma, we derive the union probability in order to derive the joint probabilities. A schematic representation of the two-detector system is presented in Figure 4.
Lemma 4.
If n photons encounter a beam splitter that independently directs each photon to one of two paths, i { 0 , 1 } , with probabilities p 0 and p 1 = 1 p 0 , and these paths lead to two detectors, D 0 or D 1 , with click probabilities p c 0 and p c 1 , and dark count probabilities p d 0 and p d 1 , respectively, then the probability of at least one of the detectors clicking is equivalent to the click probability of a single pseudo detector with n photons directly incident on it, where the click probability is p c and the dark count probability is p d . Formally, this probability is given by:
P ( D 0 D 1 = 1 n , p c , p d , p 0 ) = P ( D = 1 n , p c , p d ) ,
where
p c = p 1 p c 1 + p 0 p c 0 , p d = 1 q d 0 q d 1 ,
and P ( D = 1 n , p c , p d ) is as defined in Lemma 1.
Proof. 
To compute the probability that at least one detector, either D 0 or D 1 , registers a click, we sum over all possible numbers of photons k that could be passed to D 0 and marginalize over this variable:
P ( D 0 D 1 = 1 n , p c , p d , p 0 ) = k = 0 n P ( D 0 D 1 = 1 k , p c , p d ) Binomial ( k n , p 0 ) .
Since after the beam-split, the click events at D 0 and D 1 become independent, the probability that neither detector clicks is the product of their independent non-click probabilities. Therefore, the probability that at least one detector clicks (the union probability) is:
P ( D 0 D 1 = 1 k , p c , p d ) = 1 P ( D 0 = 0 k , p c 0 , p d 0 ) P ( D 1 = 0 n k , p c 1 , p d 1 ) .
We substitute the non-click probabilities:
P ( D 0 = 0 k , p c 0 , p d 0 ) = q d 0 q c 0 k , P ( D 1 = 0 n k , p c 1 , p d 1 ) = q d 1 q c 1 n k .
Thus, the probability of a click in either detector is:
P ( D 0 D 1 = 1 n , p c , p d , p 0 ) = k = 0 n 1 q d 0 q d 1 q c 0 k q c 1 n k Binomial ( k n , p 0 ) .
This can be rewritten by expanding and simplifying as:
P ( D 0 D 1 = 1 n , p c , p d , p 0 ) = 1 q d 0 q d 1 k = 0 n n k ( p 0 q c 0 k ) ( q 0 q c 1 ) n k .
Recognizing the binomial theorem [19]:
P ( D 0 D 1 = 1 n , p c , p d , p 0 ) = 1 q d 0 q d 1 ( p 0 q c 0 + q 0 q c 1 ) n .
Further simplifying:
P ( D 0 D 1 = 1 n , p c , p d , p 0 ) = 1 q d 0 q d 1 1 p d ( 1 ( p 1 p c 1 + p 0 p c 0 p c ) ) n .
This has the same form as the probability in Lemma 1, but with the dark count probability defined as 1 q d 0 q d 1 and the click probability defined as p 1 p c 1 + p 0 p c 0 .    □

2.1.5. Laser-Fiber

In Quantum Key Distribution (QKD) systems, when using a weak coherent laser source with randomized phases, the number of photons emitted by the source follows a Poisson distribution [8]:
n Poisson ( λ ) ,
where λ is the average photon number per pulse, determined by the intensity of the laser source. Since each of the n photons emitted from the laser has an independent probability p f of passing through the optical fiber, the number of photons m that successfully exit the fiber follows a binomial distribution with parameters n and p f .
To determine the distribution of m given λ and p f , we need to account for the combined effect of the Poisson-distributed photon source and the binomial transmission process through the fiber. This relationship is formally described in Lemma 5 and visually illustrated in Figure 5, which shows that the effect of the fiber is to reduce the average number of photons by a factor of p f .
Lemma 5.
If the number of photons n entering a fiber is Poisson-distributed with parameter λ, and each photon has an independent probability p f of being transmitted through the fiber, then the number of photons m exiting the fiber follows a Poisson distribution with parameter λ p f :
P ( m λ , p f ) = Poisson ( m λ p f ) .
Proof. 
To derive the distribution of m, we calculate the total probability of m photons exiting by summing over the probabilities of all possible photon counts n that could enter the fiber:
P ( m λ , p f ) = n = m P ( m n , p f ) P ( n λ ) = n = m Binomial ( m n , p f ) Poisson ( n λ ) ,
where the indexing is set to start at m, since Binomial ( m n , p f ) = 0 m > n . Expanding the expressions for the binomial and Poisson probabilities:
P ( m λ , p f ) = n = m n ! m ! ( n m ) ! p f m q f n m λ n n ! e λ .
Simplifying this expression:
P ( m λ , p f ) = p f m m ! e λ n = m λ n q f n m ( n m ) ! .
We define k = n m and re-index the sum:
P ( m λ , p f ) = p f m m ! e λ k = 0 λ k + m q f k k ! , = p f m m ! e λ λ m k = 0 ( λ q f ) k k ! ,
Recognizing the power series expansion for the exponential function [20]:
k = 0 ( λ q f ) k k ! = e λ q f ,
the expression simplifies to:
P ( m λ , p f ) = ( λ p f ) m m ! e λ p f .
This final form is the Poisson distribution with parameter λ p f .    □

2.1.6. Laser-Detector

Consider a scenario where a Poisson-distributed photon stream is directly connected to a detector with efficiency p c and a dark count probability p d . The objective is to derive the probability of a click event at the detector, considering the stochastic nature of both the photon emission process and the detection. This involves marginalizing over all possible numbers of photons n emitted by the source, weighting each by the probability that n photons cause a detection event. This process is formally presented in Lemma 6 and illustrated in Figure 6.
Lemma 6.
If a Poisson-distributed number of photons with mean λ enters a detector with efficiency p c and dark count probability p d , then the click event D is Bernoulli distributed as follows:
D Bernoulli p = 1 ( 1 p d ) e p c λ .
Proof. 
The probability that the detector registers at least one click, since the processes of incoming photons and dark counts are independent, can be expressed as:
P ( D = 1 λ , p c , p d ) = 1 P ( d = 0 p d ) P ( s = 0 λ , p c ) .
From Lemma 5, we know that if the laser source emits photons following a Poisson distribution with mean λ , and the signal detection process has efficiency p c , then the number of detected signal photons s is Poisson-distributed with mean λ p c . Thus, the probability that no photon is detected is:
P ( s = 0 λ , p c ) = Poisson ( s = 0 λ p c ) = e p c λ .
Combining these results, we have:
P ( D = 1 λ , p c , p d ) = 1 P ( d = 0 p d ) P ( s = 0 λ , p c ) = 1 ( 1 p d ) e p c λ ,
   □

2.2. PNS Attack

We now model Eve’s interception of the key, considering specific choices of the bit Alice sends (x) and the bases chosen by Alice (a) and Bob (b). The model integrates the effects of the laser source, fiber losses, Eve’s attack vector, misalignment in the optical components, and detector characteristics.

2.2.1. Eavesdropper Assumptions (The Generalized PNS Attack)

In our analysis, we consider a generalized Photon-Number-Splitting (PNS) attack, where Eve has a range of strategic choices that extend beyond the standard assumptions typically made in QKD security models. This model allows Eve to optimize her attack strategy according to a broader set of parameters, providing a more flexible and realistic scenario. Specifically, Eve can choose:
  • d AE  (Distance from Alice): Eve’s interception point is between Alice and Bob, with  0 d A E d A B , where d A B is their total distance.
  • Δ  (Proportion of intercepted pulses): Eve intercepts a fraction Δ of pulses, 0 Δ 1 , balancing information gain and detection risk.
  • k  (Number of intercepted photons): Eve intercepts k 1 photons per intercepted pulse.
  • p EB  (Channel efficiency): Eve selects a channel efficiency 0 p E B 1 to transmit intercepted pulses, simulating legitimate loss to avoid detection.
While many traditional PNS attack models assume that Eve optimizes the channel efficiency p E B to maintain the appearance of normal channel loss, they often implicitly assume some or all of the following:
  • Eve intercepts every pulse ( Δ = 1 ).
  • Eve intercepts immediately after Alice ( d A E = 0 ).
  • Eve intercepts exactly one photon per pulse ( k = 1 ).
By allowing Eve to vary these parameters beyond just optimizing p E B , the generalized PNS attack model captures a broader range of potential eavesdropping strategies, which is crucial for accurately inferring Δ , the proportion of intercepted pulses. Assuming a fixed scenario for d A E , k, or  Δ could lead to incorrect inferences about the extent of Eve’s presence. Furthermore, this generalized model enhances the inference on Δ ; for instance, if Eve intercepts k > 1 photons per pulse while the model assumes k = 1 , the model might compensate by predicting a larger Δ than actually exists. By considering a wider variety of possible attack scenarios, the generalized model provides a more comprehensive understanding of the robustness of QKD protocols and improves the accuracy of security assessments.

2.2.2. PNS Model

To simplify our derivation, we start with a basic scenario where Alice, Eve, and Bob are directly connected, with Bob using a single detector. This simplified model provides a foundational basis that can be extended to more complex and realistic setups using previously derived lemmas. More specifically, a detection setup that includes both a fiber and a detector can be modeled as a single detector with an effective efficiency that accounts for the fiber loss factor (Lemma 2). For setups involving multiple detectors, the beam-splitter probabilities can be integrated into the detection efficiencies (Lemmas 3 and 4). Additionally, a laser source followed by a fiber can be modeled as a source with reduced intensity, scaled by the fiber’s transmission probability (Lemma 5). This modular approach allows us to seamlessly extend the simplified model to more sophisticated real-world configurations without sacrificing analytical rigor.
In this scenario, Alice sends n photons, sampled from a Poisson distribution with parameter λ , directly to Bob, while Eve intercepts the pulse by capturing up to k photons. If  n < k , Eve captures all n photons, and Bob receives the remaining photons (see Figure 7). We present a closed-form expression for the probability of Bob’s detector clicking under these conditions in Theorem 1.
Theorem 1.
Consider a QKD setup where Alice’s photon source emits pulses with the number of photons following a Poisson distribution with mean λ. Eve intercepts up to k photons from each pulse. The remaining photons are sent to Bob, who uses a detector characterized by an efficiency p c and a dark count probability p d . Under these conditions, the detection event D at Bob’s detector is distributed as follows:
P ( D λ , p c , p d , k ) = Bernoulli D p = 1 q d q c k e p c λ γ ¯ ( k , q c λ ) q d Γ ¯ ( k , λ ) ,
where q c = 1 p c and q d = 1 p d . Γ ¯ ( s , x ) and γ ¯ ( s , x ) = 1 Γ ¯ ( s , x ) are the upper and lower regularized incomplete Gamma functions, respectively [20]. The regularized upper incomplete Gamma function is defined as [20]:
Γ ¯ ( s , x ) = Γ ( s , x ) Γ ( s , 0 ) , Γ ( s , x ) = x t s 1 e t d t .
Proof. 
To derive the click probability P ( D = 1 λ , p c , p d , k ) , we consider all possible numbers of photons n that Alice could send, and we marginalize over these photon counts to account for the different scenarios of interception and detection. The total probability is computed as:
P ( D = 1 λ , p c , p d , k ) = n = 0 P ( D = 1 p c , p d , n ) P ( n λ , k ) .
In this expression, the first term represents the click probability given n photons and the detector’s characteristics. For  n < k , Eve intercepts all photons, leaving none for Bob, so the click probability reduces to the dark count probability p d . For  n k , Eve intercepts exactly k photons, and the click probability is determined by the remaining n k photons. Therefore, we can split the summation into two parts based on the value of n:
P ( D = 1 λ , p c , p d , k ) = n = k P ( D = 1 p c , p d , n k ) P ( n λ ) + p d n = 0 k 1 P ( n λ ) .
Expanding this expression, we use the Bernoulli distribution for the click probability, from Lemma 1, and the Poisson distribution for the photon count:
P ( D = 1 λ , p c , p d , k ) = n = k 1 q d q c n k λ n e λ n ! + p d n = 0 k 1 λ n e λ n ! .
Recognizing that the second summation represents the Cumulative Distribution Function (CDF) of the Poisson distribution, and utilizing the following relationship [20]:
n = 0 k Poisson ( n λ ) = PoissonCDF ( k , λ ) = Γ ¯ ( k + 1 , λ ) ,
we rewrite the expression as:
P ( D = 1 λ , p c , p d , k ) = n = k 1 q d q c n k λ n e λ n ! + p d Γ ¯ ( k , λ ) .
To further simplify, we split the exponential series:
P ( D = 1 λ , p c , p d , k ) = n = k λ n e λ n ! q d n = k q c n k λ n e λ n ! + p d Γ ¯ ( k , λ ) , = 1 Γ ¯ k , λ q d q c k e λ n = k q c λ n n ! + p d Γ ¯ k , λ = 1 q d q c k e λ e q c λ n = k q c λ n n ! e q c λ Γ ¯ k , λ + p d Γ ¯ k , λ = 1 q d q c k e λ + q c λ γ ¯ k , q c λ 1 p d Γ ¯ k , λ = 1 q d q c k e p c λ γ ¯ k , q c λ q d Γ ¯ k , λ .
   □
Notably, by utilizing the relationship between the Poisson CDF and the incomplete Gamma function, we extend the domain of k to the non-negative real numbers. This extension is particularly useful when computing gradients later, as k can now be treated as a continuous parameter rather than as a discrete summation index, and the derivatives of the incomplete Gamma functions with respect to it can be derived.

Alice to Eve

According to Lemma 5, the combination of the laser source and the fiber from Alice to Eve can be modeled as a Poisson distribution with a reduced intensity parameter λ p A E , where p A E = 10 α d A E / 10 , d A E being the distance between Alice and Eve, λ representing the average photon number emitted by Alice, and  α as the attenuation coefficient in dB/km.

Eve to Bob

If the measured error probability due to misalignment in the beam splitter is p e , the corresponding angular misalignment can be computed as:
p ^ e = arcsin p e .
The probability that a photon reaches detector i for specific choices of bit x, and bases a and b, is given by:
p ( i x , a , b , p e ) = cos π 2 ( i + x ) π 4 ( a b ) + p ^ e 2 .
We can continue modeling the photon transmission through the system by applying Lemmas 2 and 3 to combine the effects of the fiber loss from Eve to Bob, the beam splitter, and the detector into a single detector model with an effective efficiency scaled by both the fiber loss and the beam-splitter path probability. We then state the following corollary derived from Theorem 1:
Corollary 1.
Let θ represent the set of system parameters:
θ = { λ , α , d A B θ A , p c , p d , p e θ B , d A E , p E B , k , Δ θ E } .
The probability of detection at detector D i for specific choices of bases (a and b), a bit choice (x), intensity (λ), and whether Eve intercepted or not (e), is given by:
P ( D i θ , a , b , x , e , λ ) = P ( D λ ^ , p c i , p d i , k ^ ) ,
where P ( D λ ^ , p ^ c , p d i , k ^ ) is the probability of detection from Theorem 1, and the adjusted parameters λ ^ , p ^ c , and  k ^ are defined as:
λ ^ = λ p A B ( 1 e ) p A E e ,
p ^ c = p ( i x , a , b , p e ) p c i p E B e ,
k ^ = e k ,
where p A E = 10 α d A E / 10 and p A B = 10 α d A B / 10 are the channel efficiencies from Alice to Bob and Alice to Eve, respectively.

2.2.3. All Possible Detection Events

We now have all the necessary components to derive the probabilities of the four joint detection events that Bob can observe, given the set of session parameters, θ , and pulse parameters, namely a, b, x, and e. By deriving the marginal and union probabilities, as discussed in Section 2.1.4, we have:
P a b x e λ ( θ ) = P ( D 0 D 1 = 1 θ , a , b , x , e , λ ) ,
P a b x e λ 1 ( θ ) = P ( D 0 = 1 θ , a , b , x , e , λ ) ,
P a b x e λ 1 ( θ ) = P ( D 1 = 1 θ , a , b , x , e , λ ) ,
which can also be expressed as:
P a b x e λ ( θ ) = P a b x e λ 11 ( θ ) + P a b x e λ 01 ( θ ) + P a b x e λ 10 ( θ ) ,
P a b x e λ 1 ( θ ) = P a b x e λ 01 ( θ ) + P a b x e λ 11 ( θ ) ,
P a b x e λ 1 ( θ ) = P a b x e λ 10 ( θ ) + P a b x e λ 11 ( θ ) ,
and the joint probabilities can be reconstructed as:
P a b x e λ 00 ( θ ) = 1 P a b x e λ ( θ ) ,
P a b x e λ 01 ( θ ) = P a b x e λ ( θ ) P a b x e λ 1 ( θ ) ,
P a b x e λ 10 ( θ ) = P a b x e λ ( θ ) P a b x e λ 1 ( θ ) ,
P a b x e λ 11 ( θ ) = P a b x e λ 1 ( θ ) + P a b x e λ 1 ( θ ) P a b x e λ ( θ ) .
From Lemma 4, we know that the union probability for a two-detector system can be modeled as a single detector with adjusted dark count and click probabilities:
p d = 1 q d 0 q d 1 ,
p c = p ( 1 , x , a , b , p e ) p c 1 + p ( 0 , x , a , b , p e ) p c 0 .
We denote the set of four possible outcomes given the session and pulse parameters as:
P a b x e λ ( θ ) = P a b x e λ 00 ( θ ) P a b x e λ 01 ( θ ) P a b x e λ 10 ( θ ) P a b x e λ 11 ( θ ) .

2.2.4. Marginalization of Unknowns in the Sifting Phase

For the purpose of inferring the percentage of tagged photons Δ , we rely only on the information available during the sifting phase, specifically, the basis choices a and b marginalize over the variables x and e:
P a b λ ( θ ) = x { 0 , 1 } e { 0 , 1 } P a b x e λ ( θ ) P ( e ) P ( x ) .
Assuming that Alice sends the bits with equal probabilities using a quantum random number generator, then P ( x = 0 ) = P ( x = 1 ) = 1 2 . If Eve tags a pulse with probability Δ , then P ( e = 1 ) = Δ and P ( e = 0 ) = 1 Δ . Note from Equation (20) that:
p ( i x , b , a , p e ) = p ( i 1 x , a , b , p e ) if a b , p ( i x , a , b , p e ) if a = b .
Thus, swapping the basis will either swap the terms of the sum in Equation (39) when a b , or it will have no effect when a = b . Consequently, the probability only depends on whether the bases matched or not, or more formally:
P a b λ ( θ ) = P b a λ ( θ ) .
Therefore, for analytical purposes, we can assume Bob always measures in a fixed basis (e.g., b = 1 ), while Alice switches her basis with 50% probability. The observed probabilities for a = b and a b will be identical.
In conclusion, for a specific intensity λ , Bob can observe two distinct probabilities for a given detector i based on whether the bases matched or not:
P m λ ( θ ) = P ( a = m ) ( b = 1 ) λ ( θ ) ,
where m is a flag to encode whether or not Alice and Bob have matching basis. Finally, the set of probabilities for all possible outcomes is:
P λ ( θ ) = P ( m = 0 ) λ ( θ ) P ( m = 0 ) P ( m = 1 ) λ ( θ ) P ( m = 1 ) ,
If we assume Alice and Bob switch bases with equal probability, P ( m = 0 ) = P ( m = 1 ) = 1 2 , this simplifies to:
P λ ( θ ) = P ( m = 0 ) λ ( θ ) P ( m = 1 ) λ ( θ ) / 2 .

2.2.5. Multiple Intensities

Thus far, our probabilistic model has assumed a single intensity λ for the session. However, as discussed in Section 2.2.1, Eve can manipulate the channel by choosing a different attenuation rate, allowing her to disguise her presence as normal channel loss. With a single intensity, Eve can select a channel efficiency that minimizes the statistical differences between the click distributions with and without her interference, potentially reducing the distinguishability between P ( θ | e = 0 ) and P ( θ | e = 1 ) (e.g., by minimizing the KL divergence between them).
To mitigate this, we must use multiple intensities, ensuring that Eve cannot conceal herself by tuning a single channel efficiency value. By varying the intensities, it becomes more challenging for Eve to simultaneously minimize the statistical differences across all intensity settings, thereby making her presence more detectable.
We adopt a straightforward strategy of selecting equally spaced intensities, using at least four to account for the four unknown parameters in Eve’s potential attack (i.e., d A E , p E B , k and Δ ). The range for the minimum and maximum intensity values is determined using the following heuristics:
  • λ min : The lowest intensity where, if Eve intercepts a single photon immediately after Alice, she must use a channel with efficiency p E B = 1 to avoid detection.
  • λ max : The highest intensity that maximizes the proportion of events where D 0 D 1 occurs, as cases where both detectors either click or do not click provide no useful information and appear uniformly random from Bob’s perspective.
To reflect the use of multiple intensities, we update our notation as follows:
P ( θ ) = P λ 1 ( θ ) P λ 2 ( θ ) P λ N λ ( θ ) / N λ ,
where N λ is the number of intensities. In this study, we assume that each intensity is equally likely to be selected. Note that while other protocols discard non-matching bases, we still probabilistically modeled them to utilize their statistics when inferring Eve’s presence (though not for key generation), thus increasing the statistical power to detect eavesdropping.

2.3. After-Pulsing

In real-world QKD systems, photon detectors are affected by after-pulsing, a phenomenon where a click from a prior detection event increases the chance of another click in the next pulse, regardless of whether or not a new photon is actually detected [14]. This effect can introduce correlations between detection events, breaking the independence assumption that would otherwise imply each event is isolated from the others. After-pulsing can be reduced by increasing the detector’s dead time, which lowers the pulse frequency and consequently reduces the key rate. On the other hand, simply neglecting the impact of after-pulsing results in incorrect error rate assessments and inaccurate key rate calculations. Both approaches fail to fully address the complexities introduced by after-pulsing, potentially compromising the security analysis of a QKD system or the key generation rate.
To address this challenge, we employ a Hidden Markov Model (HMM) to rigorously capture the behavior of detectors affected by after-pulsing. This approach improves the accuracy of security analysis and key rate calculations. We treat after-pulsing as an intrinsic property of the detector—unaffected by Eve—analogous to the way we model the dark-count rate. The details of this HMM-based modeling are presented in the following subsections.

2.3.1. Single Detector, Single Probability

Consider a scenario where Alice repeatedly sends identical pulses to Bob, consistently choosing the same bit value x, basis a, and intensity λ . Bob, on the other hand, measures these pulses in a fixed basis b, with no interference from Eve. The signal will cause the detector to click with probability p 1 , and, consequently, does not click with probability p 0 = 1 p 1 . The detector can then be in one of three internal states, depending on its recent detection history; see Figure 8:
  • State S 0 : No click occurs, at which it remains in this state with probability p 0 , or transition to the S 1 state with probability p 1 .
  • State S 1 : A click due to either a signal or a dark count. It will then transition to the after-pulse state S 1 ^ with probability q, or with probability p 0 ( 1 q ) transition to state S 0 or remain in state S 1 with probability p 1 ( 1 q ) .
  • State S 1 ^ : A click due to an after-pulse effect. This state occurs following a click in the previous detection window (state S 1 ). Then, it transitions to the S 0 state with probability p 0 or state S 1 with probability p 1 , but it cannot remain in this state.
Hidden Markov Models (HMMs) are characterized by three sets of probabilities:
  • Transition matrix ( T ): Probabilities of transitioning from one hidden state to another (gray arrows in Figure 8).
  • Emission matrix ( E ): Probabilities of observing specific outputs given the current hidden state (black arrows in Figure 8).
  • Initial state probabilities ( π ): Represents the probabilities of starting in each hidden state at the beginning of the process (usually assumed uniform or alwayas starts at a specific state).
For the HMM presented in Figure 8, the transition and emission matrix are defined as follows:
T ( p , q ) =     S 0   S 1 S 1 ^ S 0 S 1 S 1 ^ p 0 p 1 0 p 0 ( 1 q ) p 1 ( 1 q ) q p 0 p 1 0 , E = 0 1 S 0 S 1 S 1 ^ 1 0 0 1 0 1 ,
where p = p 0 p 1 . The emission matrix E , which represents the probabilities of observing each possible outcome (0 or 1) given the detector’s state, the black arrows in Figure 8, is structured as follows:
We assume a first-order Markov chain (i.e., the next state depends only on the current state) and disallow consecutive after-pulse states. This reflects typical detector behavior; however, the model is flexible: transition probabilities can be adjusted for different after-pulsing dynamics, and higher-order Markov chains can be implemented by expanding the state space [21].

2.3.2. Two Detectors, Single Probability

For a two-detector setup, the click probabilities for each detector combination—namely (00), (01), (10), and (11)—have already been derived in Equation (38) for specific pulse parameters a, b, x, e, and  λ . We denote these probabilities as p 00 , p 01 , p 10 , and  p 11 , respectively. Let q 0 and q 1 represent the after-pulse probabilities for detectors D 0 and D 1 , respectively. We also define the following marginal probabilities:
p 0 = p 00 + p 10 ,
p 1 = p 01 + p 11 ,
p 0 = p 00 + p 01 ,
p 1 = p 10 + p 11 .
For the after-pulse probabilities, we would need to derive the opposite; we already have access to the marginals, q 0 and q 1 , and we would like to derive the joint distributions. Since the after-pulse triggers are considered independent:
q 00 = ( 1 q 0 ) ( 1 q 1 ) ,
q 01 = 1 q 00 q 1 ,
q 10 = 1 q 00 q 0 ,
q 11 = q 0 q 1 .
In this two-detector scenario, the state and observation spaces expand accordingly. The set of possible states S and observations O are given by:
S = S 00 , S 01 , S 10 , S 11 , S 0 1 ^ , S 1 ^ 0 , S 1 1 ^ , S 1 ^ 1 , S 1 ^ 1 ^ ,
O = 00 , 01 , 10 , 11 ,
where, for example, S 0 1 ^ denotes the state where detector D 1 did not click and detector D 0 clicked due to an after-pulse.
The emission matrix E is constructed to reflect the probabilities of each possible observation given the detector states:
E =     00     01     10     11 S 00 S 01 S 10 S 11 S 0 1 ^ S 1 ^ 0 S 1 1 ^ S 1 ^ 1 S 1 ^ 1 ^ 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 .
Constructing the transition matrix T is more complex due to the extended state space. The matrix T captures the transition probabilities between each state, accounting for both the regular transitions and those influenced by after-pulsing effects:
T ( p , q ) = p 00 p 01 p 10 p 11 1 q 0 · p 00 p 01 p 10 p 11 1 q 1 · p 00 p 01 p 10 p 11 q 00 · p 00 p 01 p 10 p 11 p 00 p 01 p 10 p 11 p 00 p 01 p 10 p 11 1 q 1 · p 00 p 01 p 10 p 11 1 q 0 · p 00 p 01 p 10 p 11 p 00 p 01 p 10 p 11 [ 0 0 0 0 0 ] p 0 0 p 1 0 0 ] · q 0 [ 0 p 0 0 p 1 0 ] · q 1 p 0 q 01 p 0 q 10 p 1 q 01 p 1 q 10 q 11 [ 0 0 0 0 0 ] [ 0 0 0 0 0 ] [ 0 p 0 0 p 1 0 ] · q 1 p 0 0 p 1 0 0 ] · q 0 [ 0 0 0 0 0 ]
where p = p 00 p 01 p 01 p 01 and q = q 0 q 1 . The order of states in both the rows and columns of the transition matrix T is consistent with the order of the states in the rows of the emission matrix E .
The matrix is organized into sub-blocks to highlight different transitions. The left sub-block represents the transitions without after-pulsing, while the right sub-blocks account for transitions influenced by after-pulsing. For instance, when the system is in state S 01 , second row, there is a q 0 probability of transitioning to an after-pulse state, either S 0 1 ^ with probability p 0 or S 1 1 ^ with probability p 1 . If no after-pulse occurs, the system transitions among states S 00 , S 01 , S 10 , and  S 11 with their respective probabilities p 00 , p 01 , p 10 , and  p 11 but scaled by ( 1 q 0 ). An illustration for specific sets of p and q is provided in Figure 9.

2.3.3. Two Detectors, Multiple Probabilities

In the previous subsection, we considered the scenario where Bob receives a repeated pulse with fixed parameters (a, b, x, e, and  λ ). Under this condition, the behavior of the system could be modeled using a Hidden Markov Model (HMM) with a single transition matrix that corresponds to these fixed parameters.
Now, we consider a more complex scenario where Alice alternates her bit choice x between 0 and 1. Although in QKD protocols this bit switching is typically assumed to be independent and occur with equal probability, we will formulate a more general case. We define the transition probabilities between bit states as follows:
P ( 0 0 ) = P ( x t = 0 x t 1 = 0 ) ,
P ( 0 1 ) = P ( x t = 0 x t 1 = 1 ) ,
P ( 1 0 ) = P ( x t = 1 x t 1 = 0 ) ,
P ( 1 1 ) = P ( x t = 1 x t 1 = 1 ) .
Let T 0 and T 1 represent the detector dynamics for cases where Alice’s bit x was consistently 0 or 1, respectively. Given this setup, our goal is to construct an HMM that captures the combined dynamics of the system as Alice’s bit choice switches over time. The key is to describe both the intra-mode transitions (transitions within the same bit choice) and inter-mode transitions (transitions between different bit choices), effectively combining the two HMMs ( T 0 and T 1 ) that represent the system’s behavior for x = 0 and x = 1 (see Figure 10).
To demonstrate this, consider a generic state S i j representing the detectors’ internal states in a particular mode, either x = 0 or x = 1 . The mode here indicates which of the two separate HMMs (either T 0 or T 1 ) currently governs the transitions.
If the system is in state S i j and mode x = 0 , there are two possible types of transitions:
  • Intra-Mode Transition: With probability P ( 0 0 ) , the bit choice remains x = 0 . The system transitions according to the probabilities defined by the current state’s corresponding entry in T 0 . For example, the probability of transitioning from S i j in mode 0 to S k l in mode 0 is given by P ( 0 0 ) × T 0 ( S i j S k l ) .
  • Inter-Mode Transition: With probability P ( 1 0 ) , the bit choice switches to x = 1 . The system then transitions according to the probabilities defined by the corresponding entry in T 1 . For example, the probability of transitioning from S i j in mode 0 to S k l in mode 1 is P ( 1 0 ) × T 1 ( S i j S k l ) .
The analysis is equivalent if the system is in mode x = 1 ; however, the intra-mode transitions will involve P ( 1 1 ) and the inter-mode transitions will involve P ( 0 1 ) , transitioning according to either T 1 or T 0 , respectively.
Using this framework, the combined transition matrix T can be constructed to account for both the detector state transitions and the changes in Alice’s bit choice. This leads to the following block matrix structure:
T = P ( 0 0 ) T 0 P ( 1 0 ) T 1 P ( 0 1 ) T 0 P ( 1 1 ) T 1 .
The combined transition matrix T captures all possible transitions from any state S i j in any mode to any state S k l in any mode, encompassing the full dynamic process of the system as it evolves both within and between modes.

2.3.4. Constructing the Full Transition Matrix

This section constructs the full HMM by incorporating transitions for all pulse parameters, such as basis choices (a and b), bit choices (x), the eavesdropping flag (e), and intensity settings ( λ ), to fully describe the detection dynamics in a Quantum Key Distribution (QKD) system. The transition matrix is built incrementally, starting with individual components and progressively incorporating all relevant variables.

Intensity-Based Transitions

We begin by constructing the transition matrix for a specific set of pulse parameters. This matrix captures the transition dynamics when Alice and Bob’s bases ( a , b ), Alice’s bit choice (x), the presence or absence of eavesdropping (e), and the photon intensity ( λ i ) are all fixed:
T a b x e λ ( θ ) = T ( P a b x e λ ( θ ) , p a ) .
Here, P a b x e λ ( θ ) represents the click probabilities given the session and pulse parameters, as defined in Equation (38). The vector p a = p a 0 p a 1 denotes the after-pulse probabilities for detectors D 0 and D 1 , respectively. The parameter set θ = θ A , θ B , θ E includes Alice’s, Bob’s, and Eve’s parameters, where Bob’s parameters are updated to include the after-pulse probabilities:
θ B = p a , p c , p d , p e .
Next, we construct the transition matrix across all possible intensity settings λ i , using the same approach outlined in Section 2.3.3, by combining the individual matrices T a b x e λ i ( θ ) for each λ i . If Alice transitions between the different intensities uniformly and independently, the transition matrix simplifies to the following:
T a b x e ( θ ) = T a b x e λ 1 ( θ ) T a b x e λ N λ ( θ ) T a b x e λ 1 ( θ ) T a b x e λ N λ ( θ ) × 1 N λ .

Eavesdropping Transitions

To incorporate the possibility of eavesdropping, we expand the matrix T a b x e ( θ ) to account for scenarios where Eve transitions between intercepting ( e = 1 ) and not intercepting ( e = 0 ), with probabilities Δ and 1 Δ , respectively:
T a b x ( θ ) = ( 1 Δ ) T a b x ( e = 0 ) ( θ ) Δ T a b x ( e = 1 ) ( θ ) ( 1 Δ ) T a b x ( e = 0 ) ( θ ) Δ T a b x ( e = 1 ) ( θ ) .

Bit Choice Transitions

To model transitions associated with Alice’s bit choices, we assume she switches between x = 0 and x = 1 with equal probability (50%). The corresponding transition matrix that captures this behavior is given by:
T a b ( θ ) = T a b ( x = 0 ) ( θ ) T a b ( x = 1 ) ( θ ) T a b ( x = 0 ) ( θ ) T a b ( x = 1 ) ( θ ) × 1 2 .

Basis Choice Transitions

Similarly, we can construct the transition matrix to account for the basis choices made by Alice (a) and Bob (b), assuming that both choose their bases independently and uniformly, with equal probability for each choice. First by incorporating Bob’s basis transition:
T a ( θ ) = T a ( b = 0 ) ( θ ) T a ( b = 1 ) ( θ ) T a ( b = 0 ) ( θ ) T a ( b = 1 ) ( θ ) × 1 2 ,
then incorporating Alice’s basis transition:
T ( θ ) = T ( a = 0 ) ( θ ) T ( a = 1 ) ( θ ) T ( a = 0 ) ( θ ) T ( a = 1 ) ( θ ) × 1 2 .
This final matrix T ( θ ) encapsulates the complete set of transition probabilities, integrating all pulse parameters—basis choices, bit choices, eavesdropping scenarios, and intensity settings—to model the full dynamics of the QKD system.

2.3.5. Extracting the Probabilities of Click Events

The probabilities of different click events in an HMM, denoted as P ^ ( θ ) , are derived by first computing the state probabilities from the transition matrix T ( θ ) and then mapping these state probabilities to observations using the emission matrix E . The stationary distribution, v ( θ ) , represents the long-term probabilities of visiting each state and satisfies the following equation:
T ( θ ) v ( θ ) = v ( θ ) .
This is equivalent to finding the eigenvector corresponding to the eigenvalue of 1. Since the transition matrix T ( θ ) is aperiodic (states are not revisited at fixed intervals) and irreducible (every state is reachable from any other), the Perron–Frobenius theorem [22,23] shows that this eigenvector exists, is the maximum eigenvector, and is unique. This property guarantees that the system converges to an equilibrium representing its long-term behavior after sufficient transitions, regardless of the initial state [24]. Furthermore, since we are only interested in the eigenvector corresponding to the maximum eigenvalue, we can leverage more efficient decomposition algorithms, such as the Power Method or Krylov subspace methods [25,26].
By normalizing v ( θ ) , we obtain a valid probability distribution over the hidden states:
v ¯ ( θ ) = v ( θ ) i v i ( θ ) .
The vector v ¯ ( θ ) has a length of 144 × N λ , corresponding to the number of states ( | S | = 9 ) times the possible choices of a, b, x, and e ( = 16 ) times the number of intensities ( | Λ | = N λ ). To correctly project the vector v ¯ ( θ ) of state probabilities into observable probabilities using the emission matrix E , which is of size | S | × | O | , the vector is first “folded” into a matrix V ( θ ) of size | S | × ( 16 × N λ ) . This folding operation is defined by the mapping function:
F ( v , m ) = V , such that ,
F v = [ v 1 , v 2 , , v n ] , m V = v 1 v m + 1 v ( n m 1 ) × m + 1 v 2 v m + 2 v ( n m 1 ) × m + 2 v m v 2 m v n ,
where each column corresponds to a specific pulse configuration, and each row corresponds to one of the HMM states. We then compute the observable probabilities by projecting this folded matrix onto the emission matrix E :
P ^ ( θ ) = E V ¯ ( θ ) ,
where V ¯ ( θ ) = F v ¯ ( θ ) , | S | and P ^ ( θ ) represents the adjusted probabilities of the observable detection events.
At this point, we have obtained the probabilities of the four possible detection outcomes given any configuration of ( a , b , x , e , λ ) . However, Bob only observes a, b, and  λ . Therefore, we can marginalize over the variables x and e by summing over the corresponding columns in P ^ ( θ ) .
We can apply this to x, e and utilize the symmetry in Equation (41) to only focus on whether the basis matched or did not match. This allows us to obtain P ( θ ) , which contains 8 N λ outcomes (corresponding to 4 detection events, 2 cases of matching or non-matching bases, and  N λ intensity levels).
While this approach provides a complete probabilistic view for analytical purposes, it may not be the most computationally efficient due to the large size of the transition matrix T ( θ ) and the eigenvalue decomposition required. If we are only interested in P m λ ( θ ) instead of P a b x e λ ( θ ) , we can construct a smaller transition matrix directly based on the matching or non-matching cases. This results in a much smaller matrix of size 18 N λ , significantly reducing computational complexity.

2.4. Error and Gain Probabilities

To accurately compute the secure-key rate in the QKD protocol, particularly following the Gottesman–Lo–Lütkenhaus–Preskill (GLLP) formula, it is essential to derive the probabilities associated with the gain (probability of a detection events) and erroneous click events (probability of a click at the incorrect detector). Our previous results, encapsulated in the probability vector P a b x e λ ( θ ) , allow us to compute the detection probabilities under various configurations of basis settings, bit choices, intensities, and interception scenarios. By leveraging these configurations, we can rigorously determine the gain and error probabilities required for the secure-key rate calculation, which will be described in the following subsections.

2.4.1. Marginalizing over Eve’s Interception Flag

For each combination of basis settings (a and b), bit choice (x), and intensity ( λ ), we first marginalize over the possible states of Eve’s interception flag (e), where e = 1 represents interception and e = 0 represents no interception. This marginalization enables us to calculate the effective probabilities P a b x λ ( θ ) under the influence of Eve’s interception rate Δ :
P a b x λ ( θ ) = e 0 , 1 P a b e x λ ( θ ) P ( e ) , = P a b x ( e = 0 ) λ ( θ ) ( 1 Δ ) + P a b x ( e = 1 ) λ ( θ ) Δ .
The resulting vector P a b x λ ( θ ) comprises four elements corresponding to each detection outcome:
P a b x λ ( θ ) = P a b x λ 00 ( θ ) P a b x λ 01 ( θ ) P a b x λ 10 ( θ ) P a b x λ 11 ( θ ) ,
where each element represents the probability of a particular click configuration (e.g., P a b x λ 01 ( θ ) represents a click at detector D 0 only for a specific bit choice (x), bases configuration (a, n), and intensity λ ).

2.4.2. Gain and Error Probabilities

The gain probability Q a b x λ ( θ ) for a given bit choice x is obtained by summing the probabilities of the events where only one detector clicks (i.e., single-click events):
Q a b x λ ( θ ) = P a b x λ 01 ( θ ) + P a b x λ 10 ( θ ) .
The probability of an erroneous click event, E Q a b x λ ( θ ) , where the detector registers an error, depends on the bit choice x. Specifically:
E Q a b ( x = 0 ) λ ( θ ) = P a b ( x = 0 ) λ 10 ( θ ) , for x = 0 ,
E Q a b ( x = 1 ) λ ( θ ) = P a b ( x = 1 ) λ 01 ( θ ) , for x = 1 .

2.4.3. Marginalizing over Bit Choice

To obtain the total click and error probabilities for a given basis configuration and intensity, we marginalize over the bit choice x, assuming Alice’s bit choices are uniformly distributed. This leads to the overall gain Q a b λ ( θ ) and error probabilities E Q a b λ ( θ ) given by:
Q a b λ ( θ ) = 1 2 Q a b ( x = 0 ) λ ( θ ) + Q a b ( x = 1 ) λ ( θ ) ,
E Q a b λ ( θ ) = 1 2 E Q a b ( x = 0 ) λ ( θ ) + E Q a b ( x = 1 ) λ ( θ ) .
These expressions represent the probabilities of a signal and an erroneous click under the conditions specified by θ . To further simplify notation, we consider the two distinct cases of basis alignment, where a = b and a b . Referring to the symmetry from Equation (41), where P a b λ ( θ ) = P b a λ ( θ ) , we redefine the gain and error probabilities in terms of alignment cases:
Q m λ ( θ ) = Q ( a = m ) ( b = 1 ) λ ( θ ) ,
E Q m λ ( θ ) = E Q ( a = m ) ( b = 1 ) λ ( θ ) ,
where m = 1 denotes matching bases ( a = b ) and m = 0 denotes non-matching bases ( a b ).

2.4.4. Distribution of Gain and Error Counts

The number of gain clicks, G m λ , and error clicks, R m λ , for a specific bases alignment m and intensity λ are distributed as follows (assuming i.i.d.):
G m λ Binomial N m λ , Q m λ ( θ ) ,
R m λ Binomial N m λ , E Q m λ ( θ ) ,
where N m λ is the total number of pulses with basis alignment m and intensity λ . Here, G m λ and R m λ are not independent, as the number of error clicks is a subset of the number of gain clicks.
The number of error clicks R m λ can be viewed as resulting from sequential binomial sampling. First, the gain clicks G m λ are selected from N m λ with probability Q m λ ( θ ) , then R m λ is selected from G m λ with probability δ m λ ( θ ) (the conditional probability of an error given a signal). More formally,
R m λ Binomial G m λ , δ m λ ( θ ) .
To derive the conditional error probability δ m λ ( θ ) , we apply Lemma 3, which can be rephrased in terms of two sequential binomial sampling processes. If we first sample s Binomial ( N , p ) , and then sample r Binomial ( s , q ) , then r Binomial ( N , p · q )
This lemma shows that the effective success probability for sequential binomial sampling is the product of the individual probabilities in each stage. Applying this to R m λ , we have:
R m λ Binomial N m λ , Q m λ ( θ ) δ m λ ( θ ) .
Comparing this with Equation (85), we see that:
Q m λ ( θ ) δ m λ ( θ ) = E Q m λ ( θ ) ,
δ m λ ( θ ) = E Q m λ ( θ ) Q m λ ( θ ) .
We can apply the same principle of sequential binomial sampling to express G m λ and R m λ distributions in terms of N, the number of session pulses, directly. Since N m λ results from first selecting N m with probability P ( m ) = 1 / 2 (the probability of bases alignment), then selecting N m λ with probability P ( λ ) = 1 / N λ (assuming uniform intensity selection), we can also express them as:
G m λ Binomial N , P ( m ) P ( λ ) Q m λ ( θ ) ,
R m λ Binomial N , P ( m ) P ( λ ) E Q m λ ( θ ) .
While δ m λ ( θ ) and Q m λ ( θ ) are sufficient for secure-key rate calculations, we also derive E [ δ m λ ( θ ) ] and V [ δ m λ ( θ ) ] to facilitate a robust comparison between theoretical expectations and simulated data. The following lemma provides these values, establishing a basis for evaluating the alignment of our model with empirical results.
Theorem 2.
Let r be a random variable obtained through a two-step sampling process where first s Binomial ( N , p ) and then, given s, r s Binomial ( s , q ) . Define ρ = r s when s > 0 . Then, the expected value and variance of ρ are given by:
E [ ρ ] = q ,
V [ ρ ] = q ( 1 q ) E 1 s ,
where E 1 s is the expected value of the reciprocal of s.
Proof. 
First, compute the expected value E [ ρ ] using the law of total expectation [25]:
E [ ρ ] = E E ρ s .
Given s, since r s Binomial ( s , q ) and ρ = r s , we have:
E ρ s = E r s s = 1 s E r s = 1 s ( s q ) = q ,
therefore,
E [ ρ ] = E [ q ] = q .
The variance V [ ρ ] can be expressed using the law of total variance [25]:
V [ ρ ] = E V ρ s + V E ρ s .
Given s, the conditional variance is:
V ρ s = V r s s = 1 s 2 V r s = 1 s 2 ( s q ( 1 q ) ) = q ( 1 q ) s .
Thus,
E V ρ s = q ( 1 q ) E 1 s .
Since E ρ s = q is constant,
V E ρ s = V [ q ] = 0 .
Combining these results, we obtain:
V [ ρ ] = q ( 1 q ) E 1 s .
   □
Note that the derivation in Theorem 2 assumes s > 0 , ensuring that ρ = r s is well-defined. For clarity and simplicity, this condition has been omitted from the main expressions, but all expectations and variances are implicitly conditioned on s > 0 . Additionally, E 1 s does not have a closed-form expression for s Binomial ( N , p ) ; however, for large N p , it can be approximated as:
E 1 s 1 E s = 1 N p .
This leads to an approximate variance:
V [ ρ ] q ( 1 q ) N p .
This approximation holds well when N is large and p is not too small, rendering the probability P ( s = 0 ) negligible.
Applying this result to Equations (86) and (90), we obtain the expected value and variance of the error rate ρ for a basis alignment m and intensity λ as follows:
E ρ = δ m λ ( θ ) ,
V ρ δ m λ ( θ ) ( 1 δ m λ ( θ ) ) N Q m λ ( θ ) P ( m ) P ( λ ) .
Since ρ 0 , 1 , it is natural to model it with a Beta distribution. Using Equation (129), we derive parameters for a Beta distribution that match the expected value and variance in Equations (94) and (95). This allows us to approximate the distribution of the error rate as follows:
P ( ρ ) Beta ρ α m λ ( θ ) , β m λ ( θ ) ,
where α m λ ( θ ) and β m λ ( θ ) are calculated to ensure that the Beta distribution’s mean and variance align with Equations (94) and (95).

3. Bayesian Inference

In this section, we aim to infer the unknown parameters of the QKD system based on the observed detection events. Recall that the parameter set θ = θ A , θ B , θ E encompasses all aspects of the QKD system, where θ A represents Alice’s parameters, θ B represents Bob’s parameters, and  θ E captures Eve’s potential strategies. Let C be the vector of counts for each detection outcome:
C m = C m 00 C m 01 C m 10 C m 11 , C = C 0 C 1 ,
where C 0 01 , for example, represents the count of events where D 0 = 1 , D 1 = 0 , and the bases did not match.
The objective is to infer the unknown parameters associated with Eve, specifically θ E = { d A E , p E B , k , Δ } , based on observed data C and the known parameters θ A and θ B . Utilizing Bayes’ theorem, the posterior distribution of Eve’s parameters, given the observed data and known parameters, is formulated as:
Posterior ( θ E C , N , θ A , θ B , θ P ) = L ( C N , θ A , θ B , θ E ) P ( θ E θ P ) M ( C N , θ A , θ B , θ P ) ,
where
M ( C N , θ A , θ B , θ P ) = L ( C N , θ A , θ B , θ E ) P ( θ E θ P ) d θ E ,
where L ( C N , θ A , θ B , θ E ) is the likelihood of the data given the parameters, and  P ( θ E θ P ) is the prior distribution of Eve’s parameters, with  θ P representing the hyper-parameters of these priors, and  M ( C N , θ A , θ B , θ P ) is the marginal likelihood (or evidence) that normalizes the posterior distribution.

3.1. Constructing the Likelihood

To apply Bayesian inference, we first need to construct the likelihood function that describes the probability of observing the data given the parameters of the system. This is formally presented in the following theorem:
Theorem 3.
Let Alice emit a Poisson-distributed number of photons with average intensities selected uniformly at random from a set of N λ intensities { λ 1 , λ 2 , , λ N λ } . For each pulse, Alice randomly selects a basis a { 0 , 1 } with equal probability, and Bob independently measures in a randomly chosen basis b { 0 , 1 } , also with equal probability.
Let Eve be positioned at a distance d A E from Alice, potentially intercepting a fraction Δ of the total transmission and capturing k photons from each intercepted pulse. Bob is positioned at a distance d A B from Alice, with fiber attenuation α. Bob uses two detectors characterized by detection efficiencies p c 0 and p c 1 , dark count probabilities p d 0 and p d 1 , and a beam splitter with a misalignment error p e . The detection events are assumed to be independent.
Under these conditions, the vector of counts for the 8 N λ distinct detection outcomes—corresponding to each combination of intensity, basis choices, and detection results—is distributed according to a multinomial distribution:
P ( C N , θ ) = Multinomial N , P ( θ ) ,
where P ( θ ) is the vector of probabilities for each detection outcome, derived from the set of system parameters θ = { θ A , θ B , θ E } as in Equation (45).

HMM Likelihood

The likelihood of observing a specific sequence of detection events O = { O t } t = 1 N given state transition probabilities T , emission probabilities E , and initial state probabilities π can be computed using the forward algorithm [19]:
L ( O T , E , π ) = i = 1 N s α N ( i ) ,
where N s is the number of states and the forward probability at time t for state i, α t ( i ) is recursively expressed as:
α t ( i ) = E i , O t · j = 1 N s T j , i · α t 1 ( j ) ,
and the initial forward probability
α 1 ( i ) = π i E i , O 1 .
Computing the forward algorithm is computationally intensive and impractical for large N. Additionally, our primary interest lies not in the likelihood of a specific sequence of detection events but in the aggregated counts of detection outcomes over the session.
To address this, we can use the long-term stationary distribution P ^ ( θ ) as the parameter for the multinomial distribution. Although individual detection events are dependent, the aggregated counts over a large number of trials can be modeled using a multinomial distribution with these adjusted probabilities.
Theorem 4.
Given a Hidden Markov Model (HMM) with an irreducible and an aperiodic state transition matrix T ( θ ) , emission probabilities E , and initial state probabilities π , where the system accounts for dependencies induced by after-pulsing, the likelihood function for the aggregated counts C over N trials is formulated as:
P ( C N , θ ) = Multinomial ( C N , P ^ ( θ ) ) ,
where P ^ ( θ ) = E v ¯ ( θ ) represents the adjusted probabilities derived from the stationary distribution v ¯ ( θ ) of the Markov chain, as in Equation (72).
By replacing the i.i.d. probabilities with the adjusted probabilities from the stationary distribution, we effectively account for the dependencies introduced by after-pulsing. This allows us to use the multinomial likelihood function for the aggregated counts, enabling accurate and computationally efficient inference of the system parameters.

3.2. Constructing the Prior

To construct a robust Bayesian inference framework, it is essential to carefully choose priors for the unknown parameters θ E . The parameters θ E = { d A E , p E B , k , Δ } represent Eve’s distance from Alice, the channel efficiency chosen by Eve, the number of photons intercepted per pulse, and the fraction of intercepted pulses, respectively.

3.2.1. Assumptions and Independence

To address the uncertainty surrounding Eve’s strategy, we encode a bias towards worst-case scenarios while incorporating practical constraints. We assume that Eve’s choices are independent of Alice and Bob’s configurations, allowing her to select parameters freely from the allowable domains. Although a strategic Eve might optimize her settings to maximize information gain based on Alice’s and Bob’s choices, modeling such behavior would introduce another exploitable vulnerability. Instead, we take a precautious approach, treating Eve’s parameters as independent, ensuring that she cannot exploit any alignment with Alice and Bob’s configurations.

3.2.2. Priors for Bounded Parameters

The parameters d A E , p E B , and  Δ are all bounded within specific ranges:
0 d A E d A B ,
0 p E B 1 ,
0 Δ 1 .
Let θ b be a bounded parameter in θ E . For such a parameter, we utilize the Beta distribution due to its flexibility in modeling probabilities over a finite range after rescaling the parameter to the [ 0 ,   1 ] range. Specifically, the prior for θ b :
P ( θ b ϑ b ) = Beta θ b l b u b l b | α b , β b 1 u b l b ,
where ϑ b = { α b , β b , u b , l b } are the hyper-parameters of the prior distribution, namely the shape parameters of the Beta distribution ( α b and β b ), as well as the upper and lower bound of θ b ( u b and l b ). The scaling factor 1 u b l b ensures proper normalization over the interval [ l b , u b ] .

3.2.3. Prior for Semi-Bounded Parameters

The parameter k, representing the number of photons intercepted per pulse, is semi-bounded with k 1 . In Theorem 1, we utilized the incomplete Gamma function to extend the domain of k to the positive real numbers. This extension allows us to treat k as a continuous variable, which is particularly useful for gradient-based optimization or numerical integration techniques and more nuanced probabilistic modeling.
Given this extended domain, we employ a Gamma distribution for k, which is suitable for modeling continuous variables that are bounded below. Although, in this specific setting, there is only one semi-bounded parameter, i.e., k, in preparation for a fully Bayesian approach where we can treat other fixed variables as random variables, we will denote a semi-bounded parameter modeled with a Gamma prior as θ g :
P ( θ g ϑ g ) = Gamma ( θ g + l g α g , β g ) ,
where ϑ g = { α g , β g , u g , l g } are the hyper-parameters of the Gamma distribution. In the case of k, the distribution is shifted by l g = 1 to ensure alignment with the lower bound k = 1 , reflecting that if Eve intercepts, she must capture at least one photon.

3.2.4. Selection of Prior Parameters

For the bounded parameters, setting α = β = 1 in the Beta distribution yields a uniform distribution, reflecting maximal uncertainty within the given bounds. We apply this uniform distribution to parameters like p E B , encoding no prior preference over Eve’s channel efficiency. However, to introduce a cautious bias against Eve’s activity, we set α Δ = 2 and β Δ = 1 , making Δ = 1 more likely a priori. This choice implies a precautionary stance, assuming Eve’s presence unless data suggests otherwise.
For the distance parameter d A B , we set the prior parameters in the Beta distribution oppositely, with  α d A B = 1 and β d A B = 2 . This encodes the assumption that Eve is more likely to position herself closer to Alice, where the signal intensity is higher, minimizing the efficiency requirements for her alternative channel when intercepting photons.
For the semi-bounded parameter k, setting α k = 1 in the Gamma distribution places the mode of the distribution at k = 1 . This choice encodes the assumption that, in the absence of data, Eve is most likely to capture the minimum number of photons from an intercepted pulse, which is 1. To provide practical constraints within this framework, we define a useful pseudo upper bound on k:
  • k max : The maximum number of photons Eve can intercept from a pulse immediately emitted by Alice such that she would require a channel efficiency of p E B = 1 to avoid detection.
This pseudo upper bound, k max , serves as a guideline for setting the rate parameter β k of the Gamma distribution. Specifically, β k is chosen such that the expected value lies halfway between 1 and k max , ensuring that the prior realistically constrains Eve’s capabilities while remaining theoretically unbounded.

3.2.5. Final Formulation of the Prior

Combining the priors for each parameter, the joint prior distribution for Eve’s parameter θ E is given by:
P ( θ E θ P ) = Beta d A E d A B | α d A E , β d A E 1 d A B × Beta p E B α p E B , β p E B × Beta Δ α Δ , β Δ × Gamma k + 1 α k , β k ,
and
θ P = { α , β , u , l } ,
α = { α d A E , α p E B , α k , α Δ } ,
β = { β d A E , β p E B , β k , β Δ } ,
u = { d A B , 1 , , 1 } ,
l = { 0 , 0 , 1 , 0 } ,
where u and l are the upper and lower bounds of the parameters. We store these in the set of priors’ hyper-parameters as they will be used later to un-bound the parameters when constructing the posterior.

3.3. Constructing the Posterior

With the likelihood L ( C N , θ A , θ B , θ E ) and prior P ( θ E θ P ) established, the final step is to compute the marginal likelihood M ( C N , θ A , θ B , θ P ) , as defined in Equation (99), to derive the posterior distribution of Eve’s parameters θ E conditioned on the system parameters and observed data.
However, due to the complexity of the likelihood function in our model, stemming from the multiple parameters and the interactions modeled within the QKD system, analytically computing this marginal is infeasible. Additionally, an analytical approach might restrict our choice of priors to conjugate priors, which could fail to accurately represent the underlying physics and real-world constraints of the problem.

Methods for Approximating the Posterior

Given the challenges in deriving the posterior analytically, we consider several computational methods. One common approach is Markov Chain Monte Carlo (MCMC) [27,28], which can handle complex, high-dimensional distributions. MCMC methods, such as Metropolis–Hastings [27,28] or Gibbs sampling [29], do not require the posterior to have a specific form, allowing flexible modeling with realistic priors that reflect the physical constraints of the QKD system. Although MCMC converges to the true posterior with sufficient samples, it can be computationally intensive and requires careful tuning and convergence checks [30,31].
Variational Bayes (VB) [25] approximates the posterior by optimizing a simpler, parameterized distribution to minimize KL divergence. This can be more efficient than MCMC, especially with large datasets, but yields only an approximate posterior that depends on the chosen family of distributions. In security-critical QKD applications, where assumptions about the posterior can introduce vulnerabilities, we prefer methods that let the data define the distribution.
Bayesian Quadrature could be used for low-dimensional parameter spaces by modeling the integrand as a Gaussian process [32,33]. Although it may require fewer evaluations than traditional quadrature, it assumes integrand smoothness, which might miss important features in security-critical scenarios. Consequently, like VB, Bayesian Quadrature is less suitable when avoiding assumptions is essential for security.
Given the complexity of our parameter space, we also considered gradient-based numerical integration methods like Hamiltonian Monte Carlo (HMC) [34,35] and its adaptive variant, the No-U-Turn Sampler (NUTS) [36]. We computed gradients for all variables via the incomplete Gamma function, enabling a continuous likelihood function and methods that exploit gradient information to navigate the parameter space more efficiently [37].
Ultimately, we chose Covariance-Adaptive Slice Sampling [38], which incorporates gradient-based adaptation while retaining the robustness of slice sampling. With fewer hyper-parameters, it minimizes manual tuning and enhances reliability while efficiently exploring high-dimensional parameter spaces by adapting to local covariance structure. Our fully Bayesian framework—where any parameter can be switched from fixed to random by assigning a prior—maintains security guarantees in QKD systems by avoiding restrictive modeling assumptions [17].

3.4. From Bounded to Unbounded Variables

To perform effective Bayesian inference, especially using gradient-based numerical integration methods, it is crucial to transform the parameter space so that all variables are unbounded. However, this process is not as straightforward as simply applying a transformation step during posterior computation. Transformations alter the probability distribution non-uniformly, effectively mapping the original distribution into a different space. To ensure that sampling remains consistent with the true posterior, the Probability Density Function (PDF) must be adjusted to account for these changes. This adjustment is achieved through the transform of variables method, which ensures an accurate and mathematically consistent mapping between the original and transformed spaces.

3.4.1. Defining Transformations and Their Inverses

To transform the parameters θ E = { d A E , p E B , k , Δ } into an unbounded space and vice versa, we use the sigmoid, σ ( x ) , and logit, σ 1 ( x ) , transformations for the bounded parameters, and the exponential, e x , and logarithmic, log ( x ) , for the semi-bounded.
σ ( x ) = 1 1 + e x , σ 1 ( x ) = log x 1 x .
Let b be the set of bounded parameters modeled with a Beta prior, and g be the set of semi-bounded parameters modeled with a Gamma prior; we define the width w b = u b l b , where u b and l b are the parameter’s upper and lower bounds, respectively. The transformation to the unbounded space and its reverse are given by:
ϕ b = σ 1 θ b l b w b , θ b = σ ( ϕ b ) w b + l b ,
and for the semi-bounded variables,
ϕ g = log ( θ g l g ) , θ g = e ϕ g + l g .
More generally, let:
Φ ( θ E , θ P ) = ϕ E ,
Θ ( ϕ E , θ P ) = θ E ,
be the two mapping functions that transform the variables from and to different spaces. By applying these transformations, we define the new set of transformed variables ϕ E = { ϕ d A E , ϕ p E B , ϕ k , ϕ Δ } , where each ϕ now lies in the real, unbounded space R .

3.4.2. Jacobian of the Transformation

When transforming variables in a probability distribution, it is essential not only to transform the variables but also to update the Probability Density Function (PDF) accordingly. This is because the original PDF is defined over the original variable space, and a transformation changes the volume element in this space. The transformation can stretch, compress, or otherwise distort the space, altering the relative spacing between points.
To ensure that the transformed PDF correctly reflects the distribution of probabilities over the new variable space, we must incorporate the Jacobian determinant of the transformation. The Jacobian determinant represents the factor by which the volume element changes under the transformation. Mathematically, if we have a transformation y = g ( x ) and the original PDF is f X ( x ) , the transformed PDF f Y ( y ) is given by [19]:
f Y ( y ) = f X ( g 1 ( y ) ) d d y g 1 ( y ) .
This ensures that the total probability remains normalized to one after the transformation, preserving the properties of a probability distribution. For multidimensional distributions, it generalizes to finding the determinant of the Jacobian matrix J ( ϕ E , θ P ) of the transformation from ϕ E back to θ E :
J ( ϕ E , θ P ) = θ d A E ϕ d A E 0 0 0 0 θ p E B ϕ p E B 0 0 0 0 θ k ϕ k 0 0 0 0 θ Δ ϕ Δ .
The individual partial derivatives, using the inverse functions of the transformations, are:
θ b ϕ b = ϕ b σ ( ϕ b ) w b + l b = σ ( ϕ b ) ( 1 σ ( ϕ b ) ) w b ,
θ g ϕ g = ϕ g e ϕ g + l g = e ϕ g .
Considering that w p E B = w Δ = 1 and  w d A E = d A B , the determinant of the Jacobian matrix, J ( ϕ E , θ P ) , can be expressed as:
J ( ϕ E θ P ) = J ( ϕ E , θ P ) = σ ( ϕ d A E ) 1 σ ( ϕ d A E ) d A E σ ( ϕ p E B ) 1 σ ( ϕ p E B ) ) σ ( ϕ Δ ) 1 σ ( ϕ Δ ) e ϕ k .

3.4.3. Updating the Posterior with the Jacobian

The posterior distribution with respect to the transformed variables ϕ E is given by incorporating the Jacobian determinant to adjust for the change of variables:
Posterior ( ϕ E C , N , θ A , θ B , θ P ) L ( C N , θ A , θ B , Θ ( ϕ E ) ) P ( Θ ( ϕ E ) θ P ) J ( ϕ E θ P ) ,
where L ( C N , θ A , θ B , Θ ( ϕ E ) ) = Multinomial C N , P θ A , θ B , Θ ( ϕ E ) is the likelihood as derived in Theorem 3 and P ( Θ ( ϕ E ) θ P ) is the prior as in Equation (110), but with θ E = Θ ( ϕ E ) .

3.5. From Fixed to Random Variables

Until now, our modeling approach has operated under the assumption that the parameters governing our system are fixed and known, leading to the treatment of detection events as independent and identically distributed (i.i.d.). Under the i.i.d. framework, each detection event is considered independent, and the probability distribution governing these events remains constant over time. However, this assumption of identically distributed data does not align with the inherent stochasticity present in real-world Quantum Key Distribution (QKD) systems, where variables such as the intensity of a laser source or detector efficiencies may vary due to external conditions or device imperfections.
By transitioning from a fixed-parameter model to a Bayesian framework, we allow these parameters to be treated as random variables. This shift introduces prior distributions over the parameters, which are updated as more data become available, reflecting their true variability. As an example, consider the intensity λ of a laser source. Instead of assuming that λ is fixed and known, we can model it as a random variable with a Gamma prior distribution, Gamma ( α λ , β λ ) , where α λ and β λ are the shape and rate parameters of the Gamma distribution, respectively.
To illustrate, suppose the laser’s intensity λ has an expected value E [ λ ] and a variance V [ λ ] based on the laser’s specifications. We can set the parameters of the Gamma prior to match these moments [25]:
E [ λ ] = α λ β λ , V [ λ ] = α λ β λ 2 .
Solving these equations for α λ and β λ gives:
α λ = E [ λ ] 2 V [ λ ] , β λ = E [ λ ] V [ λ ] .
This formulation provides a prior distribution for λ that reflects both its expected value and the uncertainty due to variability, allowing our model to capture the true stochastic nature of the laser intensity. Similarly, for the detector efficiency p c , a Beta distribution Beta ( α p c , β p c ) can be used as a prior.
Applying the same method to the Beta distribution, the parameters α p c and β p c can be derived from the expected value E [ p c ] and variance V [ p c ] as [25]:
α p c = E [ p c ] 2 ( 1 E [ p c ] ) V [ p c ] E [ p c ] , β p c = E [ p c ] ( 1 E [ p c ] ) 2 V [ p c ] + E [ p c ] 1 .
By setting these parameters, we construct a Beta prior distribution for p c that accurately reflects both the expected efficiency and the uncertainty inherent in the detector’s performance.
By adopting this approach, we move along a spectrum from deterministic models with fixed parameters to fully Bayesian models that account for uncertainties in all parameters. At one extreme, a fixed parameter can be viewed as having a Dirac delta function as its prior [25], reflecting complete certainty about its value. At the other extreme, we have models like those used for Eve’s parameters, where the priors are non-informative or represent maximal uncertainty. In between, partially informative priors, such as those for λ and p c , provide a balanced representation that incorporates both prior knowledge and observed data.
An alternative approach is to remodel the likelihood by integrating over the prior distribution of the parameter, thus accounting for its uncertainty directly in the likelihood function. For example, the distribution of photons n from a laser with intensity λ could be updated as follows:
P ( n α λ , β λ ) = 0 Poisson ( n λ ) Gamma ( λ α λ , β λ ) d λ .
This is known to follow a negative binomial distribution with parameters r = α λ (number of successes) and p = β λ β λ + 1 (success probability) [39], or more precisely:
P ( n α λ , β λ ) = NegativeBinomial n r = α λ , p = β λ β λ + 1 , = Γ ( n + α λ ) n ! Γ ( α λ ) β λ 1 + β λ α λ 1 1 + β λ n .
A similar approach can be applied to the p parameter in a binomial distribution. If p is a random variable following a Beta distribution, the probability of observing k successes in n trials with a variable success probability p can be expressed as:
P ( k n , α p , β p ) = 0 1 Binomial ( k n , p ) Beta ( p α p , β p ) d p .
This scenario is modeled by a Beta-Binomial distribution [25], specifically:
P ( k n , α p , β p ) = Beta - Binomial k n , α p , β p , = n k B k + α p , n k + β p B α p , β p ,
where B ( x , y ) denotes the Beta function:
B ( x , y ) = Γ ( x ) Γ ( y ) Γ ( x + y )
Modeling the photon distribution of the laser and the detector’s efficiency in this manner accounts for the uncertainty in the device parameters. However, while this approach is mathematically elegant and can simplify calculations under certain conditions, it constrains the choice of priors and necessitates a comprehensive reformulation of the likelihood function. By contrast, the first approach—placing priors directly on the parameters and updating them through the posterior—offers greater flexibility and allows for more nuanced modeling of the actual dynamics of the physical system. This flexibility is particularly crucial in security-critical applications like QKD, where the accurate modeling of all system components is essential to ensure robustness against potential attacks [40].
With this framework in place, we have moved beyond the assumption of identically distributed detection events by treating key parameters as random variables with their own distributions.

4. Experimental Results

This section presents the validation and performance assessment of the proposed probabilistic framework through a series of simulations and comparisons with the decoy-state protocol. First, we test the accuracy of the probabilistic model (both i.i.d. and HMM) in predicting detection events and errors. Next, we evaluate the error modeling and its alignment with simulated results. The third subsection focuses on the secure key generation rate, highlighting improvements over the decoy-state approach. Finally, we explore the advantages of the Bayesian inference framework, demonstrating its robustness under after-pulsing scenarios (via HMM) and noisy conditions, emphasizing the superiority of the fully Bayesian approach.

4.1. Validation Through Simulation

This section is dedicated to assessing how well the theoretical models developed in this work fit the data generated by simulations. Specifically, we aim to evaluate the extent to which the theoretical model captures the observed behavior under both i.i.d. and Hidden Markov Model (HMM) conditions.
The first subsection focuses on validating the i.i.d. model as formalized in Theorem 3, using data generated by the simulation algorithm described in Algorithm 1. The second subsection examines the HMM model, as formulated in Theorem 4, with data produced according to Algorithm 2. By examining these models in turn, we determine the degree to which each theoretical framework explains the simulated detection events.
To model realistic QKD conditions, we adopted the Gobby–Yuan–Shields (GYS) configuration [41], providing parameterization suitable for real-world applications and establishing a foundation for later comparison with the decoy-state protocol [8]. The main simulation parameters are presented in Table 1. Additionally, we introduced variability in detector-specific parameters to test asymmetric scenarios, as shown in Table 2. For the i.i.d. test, the after-pulse probability p a was set to 0. The selected intensities for this experiment correspond to the minimum and maximum values, λ min and λ max , as described in Section 2.2.5. Each simulation was run 10,000 times with 10,000 pulses per run, ensuring sufficient data for a comprehensive validation of the theoretical predictions.
Algorithm 1 Simulation of QKD detection events under the i.i.d assumption
1:
function simulateiid( N , θ A , θ B , θ E )
2:
      [ Λ , α , d A B ] θ A
3:
      [ p a 0 , p a 1 , p c 0 , p c 1 , p d 0 , p d 1 , p e ] θ B
4:
      [ d A E , p E B , k , Δ ] θ E
5:
      p A B 10 α d A B / 10
6:
      p A E 10 α d A E / 10
7:
      N λ | Λ |
8:
      p ^ e arcsin p e
9:
     Initialize D 0 , D 1 , a, b, x, e and e
10:
   for  i = 1 to N do
11:
         l [ i ] Multinomial ( 1 , [ 1 1 1 ] / N λ )            % Choose random intensities
12:
         x [ i ] , a [ i ] , b [ i ] Bernoulli ( 1 2 )                     % Alice and Bob choose random bits & bases
13:
         e [ i ] Bernoulli ( Δ )                                        % Eve chooses random pulses to intercept
14:
         n a Poisson ( Λ [ l [ i ] ] )                                  % Sample n photons given intensity l [ i ]
15:
        if  e [ i ] = = false  then
16:
             n b Binomial ( n a , p A B )                              % If Eve does not intercept, apply fiber p A B
17:
        else
18:
             n e Binomial ( n a , p A E )                              % If Eve intercepts, apply fiber p A E ,
19:
             n e max ( n e k , 0 )                                  % then grab k photons,
20:
             n b Binomial ( n e , p E B )                              % then apply fiber p E B .
21:
        end if
22:
         p 0 cos π 2 x [ i ] π 4 ( a [ i ] b [ i ] ) + p ^ e 2      % Compute probability of D 0
23:
         n 0 Binomial ( n b , p 0 )                                   % Photons directed to D 0
24:
         n 1 n b n 0                                                 % The remaining are directed to D 1
25:
26:
        for  j = 0 to 1 do                                         % For each detector,
27:
             d j Bernoulli ( p d j )                                   % Produce a random dark click
28:
             s j Binomial ( n j , p c j )                               % Sample s photons to be detected
29:
             D j [ i ] d j s j 1                                % Click if at least one photon or dark count
30:
        end for
31:
    end for
32:
    return  D 0 , D 1 , l , a , b , x , e
33:
end function
Algorithm 2 Simulation of QKD detection events under the HMM assumption
1:
function simulateHMM( N , θ A , θ B , θ E )
2:
     D 0 , D 1 , l , a , b , x , e SIMULATE IID N , θ A , θ B , θ E       % First run an i.i.d. simulation
3:
    Initialize a 0 , a 1                                                         % After-pulses for detectors D 0 and D 1
4:
    for  i = 2 to N do
5:
        for  j = 0 to 1 do
6:
             if  D j [ i 1 ] ¬ a j [ i 1 ]  then                       % If previous is a click and not an after-pulse
7:
                  a j [ i ] Bernoulli ( p a j )                                 % Set to after-pulse with probability p a j
8:
             end if
9:
              D j [ i ] D j [ i ] a j [ i ]                                      % Click if a genuine click or an after-pulse
10:
        end for
11:
    end for
12:
    return  D 0 , D 1 , l , a , b , x , e
13:
end function

4.1.1. Validation of the i.i.d. Model

According to Theorem 3, the distribution of clicks in the i.i.d. scenario should follow a multinomial distribution with parameters N and P ( θ ) . Here, P ( θ ) is a probability vector of length 2 × 4 × 2 = 16 , corresponding to two intensity levels ( λ min and λ max ), four possible detection outcomes (00, 01, 10, and 11), and two basis configurations (matching and non-matching).
We can infer the distribution for any specific detection scenario—defined by a particular basis alignment, click pattern, and intensity level—by marginalizing over all remaining variables in P ( θ ) . When focusing on a single outcome within a multinomial distribution, the marginal distribution of each individual outcome follows a binomial distribution. More formally,
If c i Multinomial ( n , p ) , then c i Binomial ( n , p i ) ,
where i denotes the index of the variable of interest, c i represents its count, and p i is the corresponding probability component in the vector p .
Having derived the binomial distribution for each specific case within P ( θ ) , we compare the resulting histograms from simulated data against the theoretical binomial distributions inferred from the marginalized multinomial model. Using the parameters of each binomial distribution, we computed the 99% credible interval to capture the expected range of variation.
The results are reported in Figure 11, where each panel represents a unique combination of intensity level, detection outcome, and basis alignment configuration. In each plot, the normalized histogram of simulated data is shown alongside the theoretical Probability Mass Function (PMF) for the binomial distribution, with the 99% credible interval shaded. This comparison assesses the degree of alignment between theory and data, providing empirical validation of the i.i.d. model under the conditions specified.
In addition to validating the general detection probabilities, we conducted an experiment to assess the accuracy of our theoretical model for the distribution of signal and erroneous clicks. Specifically, we tracked the number of gain clicks G m λ and erroneous clicks R m λ for each basis alignment configuration m (matching or non-matching) and intensity level λ .
For each combination of basis alignment and intensity, the histogram of simulated counts for gain clicks G m λ and erroneous clicks R m λ was compared with the theoretical binomial distributions, as defined in Equations (90) and (91).
The results are reported in Figure 12, where it clearly shows the alignment between the theoretical Probability Mass Functions (PMFs) and the empirical histograms from the simulated data. The 99% confidence intervals derived from the binomial distributions are shaded in each plot, providing a benchmark for the expected range of counts. Observing that the simulated data closely adhere to the theoretical PMF within these confidence intervals further confirms the robustness of our model in capturing both signal and error probabilities for different basis alignments and intensities.

Comparison with the Decoy-State Protocol

As a key difference between the proposed method and the decoy-state protocol, the proposed framework provides the ability to compute the probabilities of individual detection events (00, 01, 10, and 11) for both matching and non-matching bases. In contrast, the decoy-state protocol does not distinguish between these specific detection outcomes. Instead, the decoy-state protocol simplifies the analysis by focusing on aggregated quantities—the gain count (G) and error count (R)—while treating double-click events as both signal and error and restricting its analysis to the matching bases ( a = b ).
Due to these distinctions, a figure equivalent to Figure 11 cannot be generated for the decoy-state protocol, as its authors did not provide theoretical predictions for individual click patterns. However, the decoy-state protocol does give testable theoretical predictions for the number of signal and error clicks under the matching basis case, which can be evaluated. For this experiment, we adjusted the counting to include double-click events in both G and R and restricted the analysis to matching bases ( a = b ). The results of this comparison are presented in Figure 13.
The results in Figure 13 reveal discrepancies between the simulated data and the theoretical predictions of the decoy-state protocol, particularly for the gain counts (G) under the low-intensity level λ 1 . These deviations highlight the limitations of the decoy-state protocol in accurately modeling the detection process, as it does not account for the finer distinctions between individual click patterns or non-matching bases. While this analysis focuses on the specific configuration of the matching case, later experiments will demonstrate that such deviations become more significant as intensity decreases.
By comparison, the proposed framework, as demonstrated in Figure 11 and Figure 12, consistently aligns closely with theoretical predictions across a broader range of scenarios. This further underscores the robustness of the proposed method in accurately capturing both the individual detection events and the aggregated signal and error counts, providing a more comprehensive and reliable framework for QKD security analysis.

4.1.2. Validation of the HMM Model

In this subsection, we validate the Hidden Markov Model (HMM) framework, as formalized in Theorem 4. This validation method we employ here mirrors the i.i.d. approach in Section 4.1.1 but incorporates after-pulsing in the simulation by setting p a = 0.1 and uses the HMM-based probability vector P ^ ( θ ) in the likelihood (10% variation between the detectors was employed; see Table 2).
For comparison, we also applied the i.i.d.-based probability vector P ( θ ) to the same HMM-generated data to assess the extent of deviation when dependencies are present.
Figure 14 and Figure 15 illustrate strong alignment between the simulated HMM data and the theoretical distributions derived from P ^ ( θ ) , supporting the validity of the HMM model under these experimental conditions. In contrast, a clear deviation is shown when the i.i.d. model is applied to the data affected by after-pulsing.

4.2. Error Rate Estimation

To validate the error rate calculations derived from our proposed method and compare them to the decoy-state protocol, we analyze the error rate δ m λ ( θ ) , as defined in Equation (89). To ensure comparability with the decoy-state protocol, we consider a scenario with symmetric detectors and define a gain as any pulse where either of the detectors registers a click. By applying Lemmas 4 and 6, we simplify the calculations for Q m λ ( θ ) and E Q m λ ( θ ) under the conditions of matching bases, no eavesdropper intervention, and a signal intensity μ . This yields the following expressions for our model:
Q μ ( θ ) = 1 ( 1 p d ) 2 e μ · p A B · p c ,
E Q μ ( θ ) = 1 ( 1 p d ) e μ · p A B · p c · p e ,
whereas for the decoy-state protocol, the corresponding calculations are given by:
Q μ ( θ ) = p d + 1 e μ · p A B · p c ,
E Q μ ( θ ) = e 0 · p d + p e ( 1 e μ · p A B · p c ) ,
where e 0 = 1 2 , and we omit the subscript m = 1 for brevity. The decoy-state protocol justified their approximation under the assumption that p d is small, making it a reasonable simplification for most practical scenarios. However, in a subsequent experiment, we will demonstrate that this approximation can lead to significant errors in certain cases.
For the purpose of this experiment, both the proposed method and the decoy-state protocol treat double-click events as both a gain and an error to enable a one-to-one comparison. While necessary for consistency, double-click events inherently provide no useful information and have an error rate of 50%. The decoy-state protocol, however, assumes an error rate of 100% for double-click events, even when employing more refined calculations. This assumption contradicts fundamental information-theoretic principles, as a 100% error rate corresponds to minimum Shannon entropy, implying more information than a 50% error rate, where entropy is maximized. Consequently, this misrepresentation underestimates the true entropy of the data and leads to an overestimation of the secure-key rate, introducing significant discrepancies in the security analysis.

4.2.1. Simulation Setup and Results

To evaluate the performance of the decoy-state protocol and our proposed method in estimating δ , we conducted simulations using the parameter set from Table 1. To enable a direct comparison with the decoy-state protocol, we configured the detectors symmetrically and set the intensity to μ = 0.48 (the optimal intensity for the GYS configuration as per [8]). We also incorporated after-pulse probabilities of 5% and 10% to evaluate their impact on performance. Each session consisted of 10 9 pulses, and the experiment was repeated over various distances between Alice and Bob, ranging from 0 to 150 km in 5 km increments.
For each configuration, we recorded the number of gain and erroneous clicks, treating double-click events as both a signal and an error to maintain consistency with the decoy-state approach. We then calculated the empirical error rates and compared them to the theoretical 99% confidence intervals of the approximate Beta distribution described in Equation (96), whose parameters were derived based on the mean and approximate variance from Theorem 2. While the confidence intervals are approximate, the expected value is derived exactly.
The results are presented in Figure 16, which shows the error rates as a function of distance for various after-pulse probabilities. The shaded regions represent the 99% confidence intervals, while the expected values are depicted as solid lines. The figure highlights the differences between the error rate estimates provided by our method and the decoy-state protocol across different scenarios.

4.2.2. Analysis of Results

The results in Figure 16 clearly illustrate that the error rate increases with distance for all scenarios, with higher after-pulse probabilities exacerbating the increase. The proposed method consistently provides more accurate error rate estimates, as indicated by the alignment of the empirical error rates with the theoretical confidence intervals. In contrast, the decoy-state protocol’s approximation underestimates the error rate, particularly at greater distances and higher after-pulse probabilities.
This discrepancy highlights a significant limitation of the decoy-state protocol’s approximation, which assumes a negligible dark count probability p d . As shown, this assumption becomes increasingly problematic as distance and after-pulse probability increase, leading to overconfident secure-key rate calculations. Our approach, which accounts for these effects more rigorously, provides a more reliable estimate, emphasizing the importance of using accurate error rate models in QKD implementations.

4.3. Secure-Key Rate Comparison

Building on our validation of the theoretical gain and error rates, we now examine the secure-key rates of the proposed protocol in comparison with the decoy-state protocol.

4.3.1. Experimental Setup

For this experiment, we implemented the weak+vacuum decoy-state protocol with intensity parameters μ = 0.48 , ν 1 = 0.05 , and ν 2 = 0 to match the setup detailed in [8]. The experiment was conducted using the GYS configuration with parameters specified in Table 1. Additionally, the detectors were symmetrized to align with the assumptions made in the decoy-state protocol paper. To highlight the advantages of the proposed protocol, we extended the analysis to include three additional intensities: μ = 1 , μ = 5 , and μ = 10 . These intensities were chosen to demonstrate the broader operational range achievable with the proposed method.
It is worth noting that later refinements of the decoy-state, such as [42,43,44], still treat all multi-photon pulses as insecure; by contrast, our observation-based Bayesian framework uses the measured click statistics to bound the actual fraction of compromised multi-photon pulses, thereby establishing an ultimate upper limit that any worst-case decoy analysis cannot surpass. We therefore retain the canonical weak + vacuum variant for familiarity and ease of comparison.

4.3.2. Secure-Key Rate Calculation

The secure-key rate for the decoy-state protocol is calculated as follows (after a slight change of notation from the original paper and omitting the dependency on θ for brevity):
K Decoy q · Q μ f δ μ H 2 δ μ + Q 1 1 H 2 e 1 ,
where q is the protocol efficiency, 1 2 for the BB84 protocol, and f ( δ μ ) is the error correction efficiency, set to 1.22 (an upper bound for this experiment [8]). The terms are defined as:
e 1 = E Q ν 1 e ν 1 E Q ν 2 e ν 2 Y 1 ( ν 1 ν 2 ) ,
Q 1 = Y 1 μ e μ ,
Y 1 = μ μ ν 1 μ ν 2 ν 1 2 + ν 2 2 Q ν 1 e ν 1 Q ν 2 e ν 2 ( ν 1 2 ν 2 2 ) Q μ e μ Y 0 μ 2 ,
Y 0 = max ν 1 Q ν 2 e ν 2 ν 2 Q ν 1 e ν 1 ν 1 ν 2 , 0 .
Furthermore, we recalculated the secure-key rate for the decoy-state protocol using corrected gain and error probabilities. Specifically, we replaced E Q μ and Q μ in Equations (137) and (138) with the corrected versions in Equations (135) and (136) and proceeded with the secure-key rate calculation as outlined.
For the proposed protocol, the secure-key rate calculation is based on the GLLP formulation, incorporating the signal yield Q μ , the error-correction factor f ( δ μ ) , and the protocol efficiency q:
K q · Q μ · f δ μ H 2 δ μ + 1 Δ 1 H 2 δ μ 1 Δ .
The calculations for the proposed method assume Δ = 0 , indicating no eavesdropping intervention. This assumption is informed by our previously developed Bayesian framework, which allows for the inference of Δ from the observed data. Unlike the decoy-state protocol, which relies on an intensity-based approach, the proposed method leverages an observation-based approach, providing greater flexibility in assessing the presence of eavesdropping. For the purpose of this analysis, we present the secure-key rate assuming Δ = 0 , with the understanding that as the session length increases, the inference of Δ = 0 becomes increasingly robust. Thus, the reported secure-key rate reflects the asymptotic behavior under this assumption.
The resulting secure-key rate performance is shown in Figure 17. The figure includes the secure-key rates for the proposed protocol across various intensities, alongside both the original and corrected versions of the decoy-state protocol for direct comparison.

4.3.3. Analysis of Secure-Key Rates

Figure 17 compares the secure-key rates of our proposed protocol against the decoy-state protocol in this asymptotic regime. Under the same intensity setting and across its operational range, our approach achieves a median improvement of about 2.5 times the key generation rate and a 12.44% increase in distance compared to the decoy-state protocol using the same intensity. Moreover, by increasing the pulse intensity to 10 photons per pulse (a cap chosen to ensure numerical precision in the incomplete Gamma function computations), we obtain up to 50 times the key generation rate and a 62.2% increase in operational distance (approximately 200 km).
In addition to increasing key rate, this approach grants access to operational regimes that were previously inaccessible. Moreover, operating at higher intensities enables the use of less sensitive and more cost-effective detectors.

4.4. Testing the Bayesian Framework

In this section, we explore the robustness and accuracy of the Bayesian framework in inferring key system parameters under different modeling assumptions. We conduct two main experiments: one assuming the i.i.d. model and another incorporating the Hidden Markov Model (HMM) to account for after-pulse effects. The aim is to validate the posterior distributions constructed using the Bayesian framework and assess the impact of these modeling choices on the inferred secure-key rates.

4.4.1. Inference of Eve’s Parameters Under the i.i.d. Model

The first experiment focuses on inferring Eve’s parameters, θ E = { d A E , p E B , k , Δ } , while assuming an i.i.d. model for photon detection events. All other parameters were kept constant as per Table 1. The number of intensity levels was set to eight (twice the number of parameters in θ E ), evenly spaced between λ min and a capped λ max = 10 , to ensure numerical precision due to limitations in the software’s incomplete function implementation (all computations were performed using Matlab R2024b). The capping avoids potential inaccuracies caused by the function returning identical values for different parameters when the intensity difference exceeds 10, ensuring reliable and precise calculations within the function’s resolution.
We utilized the Shrinking-Rank Slice Sampler (SRSS) [45], a variant of Covariance-Adaptive Slice Sampling [38]. Although the derivation of the gradients is excluded from this paper for brevity, they were computed and are available in our code implementation [46]. The session length was 10 9 pulses, with 10 5 samples drawn and a burn-in of 10 3 iterations. Instead of sampling multiple chains and performing convergence diagnostics, we relied on manual inspection and ensured that our chosen sample size exhibited convergence for this configuration. To minimize the risk of poor starting points, we began with the expected value of the prior, optimized to the Maximum a Posteriori (MAP) estimate using gradient-based optimization techniques, and used this MAP estimate as our initial sample. This approach allowed us to employ a relatively small burn-in size, as the initialization ensured that sampling started from a high-probability region of the posterior.
The posterior distributions for Eve’s parameters are shown in Figure 18. The histograms, along with Kernel Density Estimates (KDEs) normalized as Probability Density Functions (PDFs), illustrate the inferred distributions. The empirical Cumulative Distribution Functions (CDFs) from the KDEs were used to highlight the 99% confidence intervals, with the true parameter values indicated for comparison.
Because the secure-key rate K is a deterministic, one-to-one function of the parameters ( Q μ , δ μ , Δ ) , every MCMC draw of those parameters can be converted directly into a draw of K. Specifically, for each posterior sample we substitute the triplet into Equation (144) to obtain a single key-rate value; collecting all such values yields the posterior distribution of K, which we analyse separately for each intensity level.
Unlike the decoy-state protocol, which primarily uses the signal intensity ( μ ) for key generation, our approach ensures that no intensity is wasted. As long as K > 0 for a given intensity level, it contributes to the secure-key generation, enabling efficient utilization of all pulses and maximizing the extracted key rate. The transformed secure-key rate distributions are depicted in Figure 19.

Analysis of the Inference Results

The results in Figure 18 indicate a high degree of accuracy in inferring Eve’s parameters. The ground truth values lie well within the 99% confidence intervals and close to the empirical mean, demonstrating that the Bayesian framework can reliably capture the underlying parameter distributions. Additionally, the kernel density estimates provide smooth approximations of the posteriors, validating the sampling method’s efficiency. The corresponding secure-key rate distributions in Figure 19 show that, for all intensity levels, the key rates remain consistently above zero, confirming that the proposed method can effectively leverage the full range of intensities for key generation.

4.4.2. Inference of Eve’s Parameters Under the HMM Model

The second experiment incorporates after-pulsing effects into the simulation and uses the Hidden Markov Model (HMM) to capture the resulting temporal correlations. In this setup, the after-pulse probability p a was set to 0.1, with a 10% variation applied between the two detectors, consistent with the parameters used in Table 2. The experimental configuration and sampling approach remained the same as in the i.i.d. case.

Results for the HMM Model

The posterior distributions for Eve’s parameters under the HMM model are shown in Figure 20. As in the i.i.d. case, the histograms represent sampled values, the solid black lines correspond to Kernel Density Estimates (KDEs), and the shaded regions denote the 99% confidence intervals. The true parameter values are indicated by red vertical lines for reference.
When incorporating after-pulsing effects, the results demonstrate a high level of accuracy in parameter inference, with the ground truth values well-contained within the confidence intervals. This highlights the robustness of the Bayesian framework under the more complex after-pulsing scenario. The inferred distributions show slightly broader confidence intervals compared to the i.i.d. case, reflecting the increased uncertainty introduced by temporal correlations. Despite this, the model effectively captures the true parameter values.

Comparison with the i.i.d. Model

To assess the impact of neglecting after-pulsing, we performed the same experiment under the incorrect i.i.d. assumption while using data generated with Algorithm 2, which incorporates after-pulsing effects. The posterior distributions inferred using the i.i.d. model are shown in Figure 21. The results highlight severe discrepancies between the inferred parameters and their true values, accompanied by unwarranted confidence in these erroneous estimates. Most importantly, Δ —a critical parameter for secure-key rate calculations—is significantly underestimated, with a mean value of 0.0149 compared to the ground truth of 0.2. This underestimation of Δ is particularly costly, as it leads to overestimated secure-key generation rates, thereby compromising the protocol’s security. The high confidence intervals around these incorrect predictions further underscore the failure of the i.i.d. model to capture the temporal correlations introduced by after-pulsing.

Secure-Key Rate Analysis

We also transformed the inferred posterior distributions into secure-key rate distributions for both the HMM model and the mismatched i.i.d. model. The results are depicted in Figure 22 and Figure 23, respectively. Under the HMM model, the secure-key rates for the first four intensity levels are effectively zero. This behavior differs from the case without after-pulsing, where these intensities still contributed to the key rate. After-pulsing increases the error rate, which, in turn, suppresses secure-key generation for these lower intensities. However, for higher intensity levels, the HMM model effectively leverages as much information as possible, resulting in significantly larger secure-key rates with tight confidence intervals closely centered around the ground truth values.
In contrast, the i.i.d. model applied to data generated with after-pulsing results in highly inaccurate secure-key rate estimates. The key rates were consistently and significantly overestimated. Moreover, the model exhibited unwarranted confidence in these highly inaccurate results.

4.4.3. Testing the Fully Bayesian Model

Building on the previous evaluations, we next tested the proposed approach under a fully Bayesian framework, treating all system parameters as random variables with appropriate priors. The setup follows the same structure as the HMM experiment but incorporates variability in all parameter values.

Experimental Setup

Instead of using fixed parameter values as in Table 1, we introduced randomness to the system parameters by sampling them from distributions with 5% standard deviation around their reported means. For example, if the reported value of α is 0.21, we sampled from a Gamma distribution with parameters chosen to match the reported mean of 0.21 and standard deviation of 0.042 . For parameters that are bounded, such as probabilities, we sampled from Beta distributions with similarly matching means and standard deviations. The sampled values were assumed fixed for the duration of the session. Priors were chosen to reflect realistic uncertainties: Beta distributions for bounded parameters and Gamma distributions for semi-bounded ones. The priors were designed to have the same means as the reported parameters but with standard deviations doubled to 10%, ensuring a reasonable level of variability. The simulation was run for 10 9 pulses, with the sampling and inference conducted using the same Shrinking-Rank Slice Sampler (SRSS) methodology as in previous experiments. The inferred posterior distributions for the fully Bayesian model are shown in Figure 24, while the secure-key rates derived from these posteriors are presented in Figure 25.

Testing the Fixed-Parameter Assumption

To investigate the impact of incorrectly assuming fixed parameters, we repeated the analysis using data generated from the same randomly sampled parameters but assumed that these parameters were fixed at their expected values during inference. This assumption mirrors the earlier experiments with mismatched models, such as assuming independence when after-pulsing is present. The results for parameter inference under this fixed assumption are depicted in Figure 26, and the corresponding secure-key rate distributions are shown in Figure 27.

Analysis of Results

The results in Figure 24 and Figure 25 demonstrate the effectiveness of the fully Bayesian model in accurately capturing the true distributions of both system parameters and secure-key rates. The posterior distributions align well with the true values, and the confidence intervals are tight, indicating high reliability in the inferred values. Importantly, the secure-key rate distributions remain above zero across all intensity levels, reflecting the model’s capacity to utilize the full range of available data for key generation.
In contrast, Figure 26 and Figure 27 highlight the substantial inaccuracies that arise when assuming fixed parameters during inference. The posterior distributions show significant deviations from the true parameter values, and the secure-key rates are mostly severely overestimated. This underscores the risks of neglecting parameter variability in QKD systems, as such oversimplifications can lead to erroneous security assessments.
These findings highlight the robustness of the fully Bayesian framework in handling parameter uncertainties, providing a reliable foundation for analyzing real-world QKD systems where parameter variability is inevitable.

5. Time Complexity Analysis

In this section, we analyze the computational complexity of evaluating the posterior for both the i.i.d. and Hidden Markov Model (HMM) frameworks. The vector of counts C is assumed to be precomputed and available. Evaluating the posterior involves computing the likelihood function, prior distribution, and Jacobian determinant, as well as their derivatives with respect to the parameters.

5.1. Computational Complexity for the i.i.d. Model

The likelihood function for the i.i.d. model is given by:
L ( C N , θ ) = Multinomial C N , P ( θ ) ,
where P ( θ ) is the vector of detection probabilities computed based on the model parameters θ , as in Equation (45).

5.1.1. Function Evaluation

The computational cost for evaluating P ( θ ) involves calculating detection probabilities for all possible detection outcomes (00, 01, 10, 11) and matching/non-matching cases. The length of P ( θ ) is therefore 8 N λ . Thus, the time complexity for computing the likelihood in the i.i.d. case is:
T L = O ( N λ ) .
Evaluating the prior distribution P ( θ θ P ) and the Jacobian determinant involves computations for each of the N θ parameters:
T P = O ( N θ ) , T J = O ( N θ ) .

5.1.2. Derivative Evaluations

Computing the derivatives of the likelihood function with respect to each parameter involves calculating the derivatives of P ( θ ) for each detection probability. This results in N θ × 8 N λ derivative computations. The time complexity for computing the derivatives of the likelihood is therefore:
T L = O ( N θ N λ ) .
The cost for evaluating the derivative of the prior and the Jacobian is linear in N θ :
T P = O ( N θ ) , T J = O ( N θ ) .

5.1.3. Total Computational Cost

Let T f and T f represent the time complexity for evaluating the posterior and its derivatives, respectively. For the i.i.d. model, these complexities are:
T f = T L + T P + T J = O ( N λ + 2 N θ ) ,
T f = T L + T P + T J = O ( N θ N λ ) .

5.2. Computational Complexity for the HMM Model

In the HMM model, detection events are dependent due to after-pulsing effects. The likelihood function involves computing the stationary distribution of a Markov chain represented by the transition matrix T ( θ ) , with number of states N T = 2 | S | N λ , then projecting it using the emission matrix E . Since the matrix T ( θ ) is constructed from the base transition matrix T ( p , q ) in Equation (58), the density of the full matrix T ( θ ) will be the same. Thus, from Equations (46) and (58), we have the following density factors:
Ω T = 49 | S | 2 60.5 % , Ω E = 9 | S | | O | = 25 % .

5.2.1. Function Evaluation

The likelihood function involves computing P ^ ( θ ) in Equation (74), which has three main steps: (1) constructing the transition matrix T ( θ ) , (2) computing the stationary distribution v ¯ ( θ ) , and (3) projecting the stationary distribution onto the observable probabilities using the emission matrix E .

Transition Matrix

Constructing T ( θ ) has a complexity proportional to the number of non-zero elements:
T T ( θ ) = O ( Ω T N T 2 ) = O ( N λ 2 ) .

Stationary Distribution

The stationary distribution is computed using an iterative eigenvalue solver, requiring N I iterations. The complexity is therefore:
T v ¯ ( θ ) = O ( N I Ω T N T 2 ) = O ( N I N λ 2 ) .

Emission Projection

Projecting v ¯ ( θ ) has a complexity:
T E V ¯ ( θ ) = O ( Ω E | O | | S | N λ ) = O ( N λ ) .
The total time complexity for evaluating the likelihood is:
T L ^ = T T ( θ ) + T v ¯ ( θ ) + T E V ¯ ( θ ) = O ( N I N λ 2 ) .

5.2.2. Derivative Evaluations

Computing the derivatives of the likelihood involves taking the derivatives of the above steps with respect to each parameter, which have the same time complexities:
T T ( θ ) / θ i = T T ( θ ) ,
T v ¯ ( θ ) / θ i = T v ¯ ( θ ) ,
T E V ¯ ( θ ) / θ i = T E V ¯ ( θ ) .
The total derivative complexity is:
T L ^ = N θ T T ( θ ) / θ i + T v ¯ ( θ ) / θ i + T E V ¯ ( θ ) / θ i = O ( N θ N I N λ 2 ) .

5.2.3. Total Computational Cost

Let T f ^ and T f ^ represent the time complexity for evaluating the HMM posterior and its derivatives, respectively. For the i.i.d. model, these complexities are:
T f ^ = T L ^ + T P + T J = O ( N I N λ 2 + 2 N θ ) ,
T f ^ = T L ^ + T P + T J = O ( N θ N I N λ 2 ) .

5.3. Analysis of Time Complexities

We summarize the computational complexities for both the i.i.d. and HMM models in Table 3 (assuming N λ > 2 N θ as we do in practice). The i.i.d. model exhibits linear scaling with the number of intensity levels N λ and the number of parameters N θ for function evaluation, and scales linearly with their product for derivative computation. In contrast, the HMM model shows a quadratic dependence on N T , the number of states in the Markov chain, which itself is proportional to N λ .
Analyzing these results, we observe that the HMM model incurs significantly higher computational costs compared to the i.i.d. model. The quadratic dependence on N λ in the HMM model arises from the need to compute the stationary distribution and its derivatives. Despite the higher computational complexity, the HMM model captures the dependencies introduced by after-pulsing effects and other temporal correlations in the detection events, which are neglected in the i.i.d. framework.
While the HMM model is computationally more expensive than the i.i.d. model, it enables accurate analysis of QKD systems with detector dependencies and temporal correlations, such as after-pulsing. This approach allows us to assess whether or not after-pulsing significantly impacts error rates and evaluate trade-offs, such as increasing the detector dead time to lower the key rate or accepting additional post-processing time to maintain a higher key rate. Such flexibility ensures tailored solutions based on specific application requirements.
In addition, the added computational effort unlocks the ability to analyze scenarios that traditional methods, like the decoy-state protocol, cannot handle. This framework provides a practical means to push the limits of secure key distribution, such as operating at higher intensities for longer distances. By overcoming the fundamental limitations of existing protocols, this approach prioritizes expanding the boundaries of what is possible in secure key distribution. Once these new limits are achieved, further optimizations can focus on improving efficiency, ensuring that both capability and performance evolve together.

6. Conclusions

We have presented a Bayesian, observation-driven framework for decoy-state DV-QKD that replaces worst-case tail bounds with high-credibility inferences while leaving the GLLP key-rate expression intact. An HMM captures after-pulsing memory, and fully Bayesian parameter updates remove the identical-parameter premise, thereby relaxing the conventional i.i.d. assumption.
Leveraging the full detection statistics at the post-processing level makes the method agnostic to the specific DV-QKD variant and applicable to any implementation that employs decoy states (e.g., [16,47]). This data-driven approach, in turn, yields significantly higher secure-key rates, extends the operational distance, and permits the use of less-efficient, more cost-effective detectors—all without changes to the optical hardware.
Future work will optimize protocol parameters—selecting the intensity set and session length that bound key quantities such as Eve’s interception fraction Δ —and implement the scheme in hardware to validate the theoretical predictions.

Funding

This research and the APC was funded by the Ministry of Communications and Information Technology, Riyadh, Saudi Arabia.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The author declares no conflicts of interest.

References

  1. Bennett, C.H.; Brassard, G. Quantum cryptography: Public key distribution and coin tossing. In Proceedings of the IEEE International Conference on Computers, Systems and Signal Processing, Bangalore, India, 9–12 December 1984; pp. 175–179. [Google Scholar]
  2. Shor, P.W.; Preskill, J. Simple proof of security of the BB84 quantum key distribution protocol. Phys. Rev. Lett. 2000, 85, 441–444. [Google Scholar] [CrossRef] [PubMed]
  3. Huttner, B.; Imoto, N.; Gisin, N.; Mor, T. Quantum cryptography with coherent states. Phys. Rev. A 1995, 51, 1863. [Google Scholar] [CrossRef] [PubMed]
  4. Gottesman, D.; Lo, H.K.; Lütkenhaus, N.; Preskill, J. Security of quantum key distribution with imperfect devices. Quantum Inf. Comput. 2004, 4, 325–360. [Google Scholar]
  5. Lo, H.K.; Ma, X.; Chen, K. Decoy state quantum key distribution. Phys. Rev. Lett. 2005, 94, 230504. [Google Scholar] [CrossRef]
  6. Hwang, W.Y. Quantum key distribution with high loss: Toward global secure communication. Phys. Rev. Lett. 2003, 91, 057901. [Google Scholar] [CrossRef] [PubMed]
  7. Lo, H.K. Quantum key distribution with vacua or dim pulses as decoy states. In Proceedings of the International Symposium on Information Theory, Chicago, IL, USA, 27 June–2 July 2004; p. 137. [Google Scholar]
  8. Ma, X.; Qi, B.; Zhao, Y.; Lo, H.K. Practical decoy state for quantum key distribution. Phys. Rev. A—At. Mol. Opt. Phys. 2005, 72, 012326. [Google Scholar] [CrossRef]
  9. Wang, X.B. Beating the photon-number-splitting attack in practical quantum cryptography. Phys. Rev. Lett. 2005, 94, 230503. [Google Scholar] [CrossRef]
  10. Zhao, Y.; Qi, B.; Ma, X.; Lo, H.K.; Qian, L. Experimental quantum key distribution with decoy states. Phys. Rev. Lett. 2006, 96, 070502. [Google Scholar] [CrossRef]
  11. Scarani, V.; Bechmann-Pasquinucci, H.; Cerf, N.J.; Dušek, M.; Lütkenhaus, N.; Peev, M. SARG04: A secure quantum key distribution protocol against photon number splitting attacks. Phys. Rev. Lett. 2004, 92, 077902. [Google Scholar] [CrossRef]
  12. Barrett, H.; Becker, F.; Scarani, V. Coherent one-way quantum cryptography with enhanced security. Phys. Rev. A 2005, 72, 052307. [Google Scholar]
  13. Lim, C.C.W.; Curty, M.; Walenta, N.; Xu, F.; Zbinden, H. Concise security bounds for practical decoy-state quantum key distribution. Phys. Rev. A 2014, 89, 022307. [Google Scholar] [CrossRef]
  14. Restelli, A.; Bienfang, J.C.; Clark, C.W. Afterpulse probability and detection efficiency of free-running InGaAs/InP single-photon avalanche diodes. J. Appl. Phys. 2013, 113, 043101. [Google Scholar]
  15. Yuan, Z.; Sharpe, A.W.; Shields, A.J. Unconditionally secure one-way quantum key distribution using decoy pulses. Appl. Phys. Lett. 2007, 90, 011118. [Google Scholar] [CrossRef]
  16. Lucamarini, M.; Yuan, Z.; Dynes, J.F.; Shields, A.J. Overcoming the rate–distance limit of quantum key distribution without quantum repeaters. Nature 2018, 557, 400–403. [Google Scholar] [CrossRef]
  17. Gelman, A.; Carlin, J.B.; Stern, H.S.; Dunson, D.B.; Vehtari, A.; Rubin, D.B. Bayesian Data Analysis, 3rd ed.; Chapman and Hall/CRC: Boca Raton, FL, USA, 2013. [Google Scholar]
  18. Rabiner, L.R. A tutorial on hidden Markov models and selected applications in speech recognition. Proc. IEEE 1989, 77, 257–286. [Google Scholar] [CrossRef]
  19. Bishop, C.M. Pattern recognition and machine learning. Springer Google Sch. 2006, 2, 1122–1128. [Google Scholar]
  20. Olver, F.W.J.; Daalhuis Olde, A.B.; Lozier, D.W.; Schneider, B.I.; Boisvert, R.F.; Clark, C.W.; Miller, B.R.; Saunders, B.V.; Cohl, H.S.; McClain, M.A. (Eds.) NIST Digital Library of Mathematical Functions; Release 1.2.2 of 2024-09-15. Available online: https://dlmf.nist.gov/ (accessed on 30 October 2024).
  21. Murphy, K.P. Dynamic Bayesian Networks: Representation, Inference and Learning. Ph.D. Thesis, University of California, Berkeley, CA, USA, 2002. [Google Scholar]
  22. Perron, O. Zur Theorie der Matrices. Math. Ann. 1907, 64, 248–263. [Google Scholar] [CrossRef]
  23. Frobenius, G. Über Matrizen aus nicht negativen Elementen. In Sitzungsberichte; Deutsche Akademie der Wissenschaften zu Berlin: Berlin, Germany, 1912; pp. 456–477. [Google Scholar] [CrossRef]
  24. Norris, J.R. Markov Chains; Cambridge University Press: Cambridge, UK, 1998. [Google Scholar] [CrossRef]
  25. Murphy, K.P. Probabilistic Machine Learning: An Introduction; MIT Press: Cambridge, MA, USA, 2022. [Google Scholar]
  26. Stewart, G. A Krylov-Schur algorithm for large eigenproblems. SIAM J. Matrix Anal. Appl. 2001, 23, 601–614. [Google Scholar] [CrossRef]
  27. Metropolis, N.; Rosenbluth, A.W.; Rosenbluth, M.N.; Teller, A.H.; Teller, E. Equation of state calculations by fast computing machines. J. Chem. Phys. 1953, 21, 1087–1092. [Google Scholar] [CrossRef]
  28. Hastings, W.K. Monte Carlo sampling methods using Markov chains and their applications. Biometrika 1970, 57, 97–109. [Google Scholar] [CrossRef]
  29. Geman, S.; Geman, D. Stochastic relaxation, Gibbs distributions, and the Bayesian restoration of images. IEEE Trans. Pattern Anal. Mach. Intell. 1984, PAMI-6, 721–741. [Google Scholar] [CrossRef]
  30. Cowles, M.K.; Carlin, B.P. Markov chain Monte Carlo convergence diagnostics: A comparative review. J. Am. Stat. Assoc. 1996, 91, 883–904. [Google Scholar] [CrossRef]
  31. Robert, C.P.; Casella, G. Monte Carlo Statistical Methods; Springer: New York, NY, USA, 2004. [Google Scholar]
  32. Osborne, M.A.; Garnett, R.; Roberts, S.J. Active learning of model evidence using Bayesian quadrature. In Proceedings of the Advances in Neural Information Processing Systems, Lake Tahoe, NV, USA, 3–8 December 2012; pp. 46–54. [Google Scholar]
  33. Gunter, T.; Osborne, M.A.; Garnett, R.; Hennig, P.; Roberts, S.J. Sampling for inference in probabilistic models with fast Bayesian quadrature. In Proceedings of the Advances in Neural Information Processing Systems, Montreal, QC, Canada, 8–13 December 2014; pp. 2789–2797. [Google Scholar]
  34. Duane, S.; Kennedy, E.; Pendleton, B.; Roweth, D. Hybrid Monte Carlo. Phys. Lett. B 1987, 195, 216–222. [Google Scholar] [CrossRef]
  35. Neal, R.M. Chapter 5: MCMC using Hamiltonian dynamics. In Handbook of Markov Chain Monte Carlo; Chapman and Hall/CRC: Boca Raton, FL, USA, 2011; pp. 113–162. [Google Scholar]
  36. Hoffman, M.D.; Gelman, A. The No-U-Turn Sampler: Adaptively setting path lengths in Hamiltonian Monte Carlo. J. Mach. Learn. Res. 2014, 15, 1593–1623. [Google Scholar]
  37. Betancourt, M. A conceptual introduction to Hamiltonian Monte Carlo. arXiv 2017, arXiv:1701.02434. [Google Scholar]
  38. Thompson, M.B.; Neal, R.M. Covariance-adaptive slice sampling. In Proceedings of the Advances in Neural Information Processing Systems, Vancouver, BC, Canada, 6–11 December 2010; pp. 2244–2252. [Google Scholar]
  39. Greenwood, M.; Yule, G.U. An inquiry into the nature of frequency distributions representative of multiple happenings with particular reference to the occurrence of multiple attacks of disease or of repeated accidents. J. R. Stat. Soc. 1920, 83, 255–279. [Google Scholar] [CrossRef]
  40. Scarani, V.; Bechmann-Pasquinucci, H.; Cerf, N.J.; Dušek, M.; Lütkenhaus, N.; Peev, M. The security of practical quantum key distribution. Rev. Mod. Phys. 2009, 81, 1301–1350. [Google Scholar] [CrossRef]
  41. Gobby, C.; Yuan, a.; Shields, A. Quantum key distribution over 122 km of standard telecom fiber. Appl. Phys. Lett. 2004, 84, 3762–3764. [Google Scholar] [CrossRef]
  42. Hayashi, M. Practical evaluation of security for quantum key distribution. New J. Phys. 2007, 9, 284. [Google Scholar] [CrossRef]
  43. Tsurumaru, T.; Tamaki, K. Efficient protocol for practical decoy-state quantum key distribution. Phys. Rev. A 2008, 77, 022319. [Google Scholar] [CrossRef]
  44. Hayashi, M.; Nakayama, R. Upper bounds of eavesdropper’s performances in finite-length code with decoy method. J. Phys. A: Math. Theor. 2016, 49, 165301. [Google Scholar] [CrossRef]
  45. Neal, R.M. CASS: Software for Covariance-Adaptive Slice Sampling. Available online: https://glizen.com/radfordneal/cass.software.html (accessed on 21 November 2024).
  46. Almosallam, I. Generalized PNS. 2024. Available online: https://github.com/csibrahim/generalized_pns_qkd/ (accessed on 28 December 2024).
  47. Pan, D.; Lin, Z.; Wu, J.; Zhang, H.; Sun, Z.; Ruan, D.; Yin, L.; Long, G.L. Experimental free-space quantum secure direct communication and its security analysis. Photonics Res. 2020, 8, 1522–1531. [Google Scholar] [CrossRef]
Figure 1. Schematic representation of the detection process in a single-photon detector considering n incoming photons with a detector efficiency of p c and dark count probability p d . The detection event, D, will follow a Bernoulli distribution as per Lemma 1.
Figure 1. Schematic representation of the detection process in a single-photon detector considering n incoming photons with a detector efficiency of p c and dark count probability p d . The detection event, D, will follow a Bernoulli distribution as per Lemma 1.
Entropy 27 00568 g001
Figure 2. Illustration of the detection process considering both photon transmission through a fiber and the detector’s response. The detection event D will follow a Bernoulli distribution as per Lemma 2.
Figure 2. Illustration of the detection process considering both photon transmission through a fiber and the detector’s response. The detection event D will follow a Bernoulli distribution as per Lemma 2.
Entropy 27 00568 g002
Figure 3. A diagram representing the probabilistic model for a fiber followed by a beam splitter. The number of photons m i directed towards detector D i will follow a binomial distribution as per Lemma 3.
Figure 3. A diagram representing the probabilistic model for a fiber followed by a beam splitter. The number of photons m i directed towards detector D i will follow a binomial distribution as per Lemma 3.
Entropy 27 00568 g003
Figure 4. A diagram illustrating the detection setup for two detectors after a beam splitter. The detection event follows a Bernoulli distribution as per Lemma 4.
Figure 4. A diagram illustrating the detection setup for two detectors after a beam splitter. The detection event follows a Bernoulli distribution as per Lemma 4.
Entropy 27 00568 g004
Figure 5. Schematic representation of a laser source connected to a fiber. The number of photons m that passes the fiber follows a Poisson distribution as per Lemma 5.
Figure 5. Schematic representation of a laser source connected to a fiber. The number of photons m that passes the fiber follows a Poisson distribution as per Lemma 5.
Entropy 27 00568 g005
Figure 6. Illustration of the detection process for photons emitted directly from a laser source. The detection event follows a Bernoulli distribution as per Lemma 6.
Figure 6. Illustration of the detection process for photons emitted directly from a laser source. The detection event follows a Bernoulli distribution as per Lemma 6.
Entropy 27 00568 g006
Figure 7. Model representation of the Photon-Number-Splitting (PNS) attack scenario. Here, Alice uses a laser source emitting photons following a Poisson distribution with mean λ . Eve intercepts the communication, capturing k photons using a PNS attack strategy. The remaining photons, m = max ( n k , 0 ) , reach Bob. The probability of a detection event at Bob’s detector follows a Bernoulli distribution as per Theorem 1.
Figure 7. Model representation of the Photon-Number-Splitting (PNS) attack scenario. Here, Alice uses a laser source emitting photons following a Poisson distribution with mean λ . Eve intercepts the communication, capturing k photons using a PNS attack strategy. The remaining photons, m = max ( n k , 0 ) , reach Bob. The probability of a detection event at Bob’s detector follows a Bernoulli distribution as per Theorem 1.
Entropy 27 00568 g007
Figure 8. Hidden Markov Model (HMM) representation of the single detector scenario. The states S 0 , S 1 , and S 1 ^ represent no click, a click due to signal or dark count, and a click due to an after-pulse, respectively. Arrows indicate possible state transitions with associated probabilities.
Figure 8. Hidden Markov Model (HMM) representation of the single detector scenario. The states S 0 , S 1 , and S 1 ^ represent no click, a click due to signal or dark count, and a click due to an after-pulse, respectively. Arrows indicate possible state transitions with associated probabilities.
Entropy 27 00568 g008
Figure 9. State transition diagram for a specific set of pulse parameters. The figure illustrates the transitions for the probabilities p = [ 0.1 0.7 0.1 0.1 ] and after-pulse probabilities q 0 = q 1 = 0.1 . Each state represents a unique combination of detector responses and after-pulse conditions. Arrows indicate the possible transitions between states, with the thickness of the lines being proportional to their associated transition probabilities.
Figure 9. State transition diagram for a specific set of pulse parameters. The figure illustrates the transitions for the probabilities p = [ 0.1 0.7 0.1 0.1 ] and after-pulse probabilities q 0 = q 1 = 0.1 . Each state represents a unique combination of detector responses and after-pulse conditions. Arrows indicate the possible transitions between states, with the thickness of the lines being proportional to their associated transition probabilities.
Entropy 27 00568 g009
Figure 10. State transition diagram for a specific set of pulse parameters. The left and right clusters represent transitions within the HMMs corresponding to different pulse parameters, specifically for cases where Alice’s bit x changes. For illustrative purposes, T 0 was constructed using probabilities p = [ 0.1 , 0.7 , 0.1 , 0.1 ] and T 1 using probabilities p = [ 0.1 , 0.1 , 0.7 , 0.1 ] , both with after-pulse probabilities q = [ 0.1 , 0.1 ] .
Figure 10. State transition diagram for a specific set of pulse parameters. The left and right clusters represent transitions within the HMMs corresponding to different pulse parameters, specifically for cases where Alice’s bit x changes. For illustrative purposes, T 0 was constructed using probabilities p = [ 0.1 , 0.7 , 0.1 , 0.1 ] and T 1 using probabilities p = [ 0.1 , 0.1 , 0.7 , 0.1 ] , both with after-pulse probabilities q = [ 0.1 , 0.1 ] .
Entropy 27 00568 g010
Figure 11. Comparison of simulated detection events (histograms) against theoretical binomial PMFs (solid lines) for various detection outcomes and intensities, with 99% confidence intervals (shaded area). Each subplot represents a unique combination of intensity and detection outcome (00, 01, 10, 11) across matching and non-matching bases.
Figure 11. Comparison of simulated detection events (histograms) against theoretical binomial PMFs (solid lines) for various detection outcomes and intensities, with 99% confidence intervals (shaded area). Each subplot represents a unique combination of intensity and detection outcome (00, 01, 10, 11) across matching and non-matching bases.
Entropy 27 00568 g011
Figure 12. Comparison of simulated gain (G) and error (R) counts (histograms) against theoretical binomial PMFs (solid lines) for various basis alignments and intensity levels. The shaded areas represent the 99% confidence intervals for each case.
Figure 12. Comparison of simulated gain (G) and error (R) counts (histograms) against theoretical binomial PMFs (solid lines) for various basis alignments and intensity levels. The shaded areas represent the 99% confidence intervals for each case.
Entropy 27 00568 g012
Figure 13. Comparison of simulated gain (G) and error (R) counts (histograms) against theoretical binomial PMFs (solid lines) for the decoy-state protocol. Double-click events are included in both gain and error counts, and only matching bases are considered, consistent with the assumptions of the decoy-state protocol. The shaded areas represent the 99% confidence intervals derived from the theoretical binomial distributions.
Figure 13. Comparison of simulated gain (G) and error (R) counts (histograms) against theoretical binomial PMFs (solid lines) for the decoy-state protocol. Double-click events are included in both gain and error counts, and only matching bases are considered, consistent with the assumptions of the decoy-state protocol. The shaded areas represent the 99% confidence intervals derived from the theoretical binomial distributions.
Entropy 27 00568 g013
Figure 14. Comparison of simulated detection events (histograms) against theoretical PMFs under the HMM model (solid lines) for various detection outcomes and intensities. The shaded areas represent the 99% confidence intervals for each case.
Figure 14. Comparison of simulated detection events (histograms) against theoretical PMFs under the HMM model (solid lines) for various detection outcomes and intensities. The shaded areas represent the 99% confidence intervals for each case.
Entropy 27 00568 g014
Figure 15. Comparison of simulated gain (G) and error (R) counts (histograms) under HMM conditions against theoretical PMFs from the HMM model (solid lines) for various basis alignments and intensity levels. Shaded areas indicate the 99% confidence intervals.
Figure 15. Comparison of simulated gain (G) and error (R) counts (histograms) under HMM conditions against theoretical PMFs from the HMM model (solid lines) for various basis alignments and intensity levels. Shaded areas indicate the 99% confidence intervals.
Entropy 27 00568 g015
Figure 16. Error rate δ as a function of distance between Alice and Bob, plotted for different after-pulse probabilities ( p a = 0%, 5%, and 10%). The shaded regions represent the 99% confidence intervals and the solid lines indicate the expected values. Comparisons are made with the decoy-state protocol and our proposed method.
Figure 16. Error rate δ as a function of distance between Alice and Bob, plotted for different after-pulse probabilities ( p a = 0%, 5%, and 10%). The shaded regions represent the 99% confidence intervals and the solid lines indicate the expected values. Comparisons are made with the decoy-state protocol and our proposed method.
Entropy 27 00568 g016
Figure 17. Comparison of secure-key rates as a function of distance for the proposed protocol and the decoy-state protocol. The decoy-state protocol is evaluated using the original error and gain rate calculations (dotted lines) and the corrected calculations (dashed lines). The proposed protocol is shown for intensities μ = 0.48 , μ = 1 , μ = 5 , and μ = 10 , illustrating higher key-rates and an extended operational range.
Figure 17. Comparison of secure-key rates as a function of distance for the proposed protocol and the decoy-state protocol. The decoy-state protocol is evaluated using the original error and gain rate calculations (dotted lines) and the corrected calculations (dashed lines). The proposed protocol is shown for intensities μ = 0.48 , μ = 1 , μ = 5 , and μ = 10 , illustrating higher key-rates and an extended operational range.
Entropy 27 00568 g017
Figure 18. Posterior distributions of Eve’s parameters θ E . Data were simulated using Algorithm 2. The plots include sample histograms, ground truth values (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Figure 18. Posterior distributions of Eve’s parameters θ E . Data were simulated using Algorithm 2. The plots include sample histograms, ground truth values (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Entropy 27 00568 g018
Figure 19. Posterior distributions of the secure-key rate for each intensity level under the i.i.d. model (data generated using Algorithm 1). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Figure 19. Posterior distributions of the secure-key rate for each intensity level under the i.i.d. model (data generated using Algorithm 1). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Entropy 27 00568 g019
Figure 20. Posterior distributions of Eve’s parameters under the HMM model, with after-pulsing present (data generated using Algorithm 2). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Figure 20. Posterior distributions of Eve’s parameters under the HMM model, with after-pulsing present (data generated using Algorithm 2). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Entropy 27 00568 g020
Figure 21. Posterior distributions of Eve’s parameters under the i.i.d. model, with after-pulsing present (data generated using Algorithm 2). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Figure 21. Posterior distributions of Eve’s parameters under the i.i.d. model, with after-pulsing present (data generated using Algorithm 2). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Entropy 27 00568 g021
Figure 22. Posterior distributions of the secure-key rate for each intensity level under the HMM model, with after-pulsing present (data generated using Algorithm 2). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Figure 22. Posterior distributions of the secure-key rate for each intensity level under the HMM model, with after-pulsing present (data generated using Algorithm 2). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Entropy 27 00568 g022
Figure 23. Posterior distributions of the secure-key rate for each intensity level under the i.i.d. model, with after-pulsing present (data generated using Algorithm 2). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Figure 23. Posterior distributions of the secure-key rate for each intensity level under the i.i.d. model, with after-pulsing present (data generated using Algorithm 2). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Entropy 27 00568 g023
Figure 24. Posterior distributions of all parameters, treating all parameters as random variables, under the i.i.d. model (data generated using Algorithm 1). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Figure 24. Posterior distributions of all parameters, treating all parameters as random variables, under the i.i.d. model (data generated using Algorithm 1). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Entropy 27 00568 g024
Figure 25. Posterior distributions of secure the secure-key rates for each intensity level, treating all parameters as random variables, under the i.i.d. model (data generated using Algorithm 1). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Figure 25. Posterior distributions of secure the secure-key rates for each intensity level, treating all parameters as random variables, under the i.i.d. model (data generated using Algorithm 1). The plots show sample histograms, ground truths (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Entropy 27 00568 g025
Figure 26. Posterior distributions of Eve’s parameters under the i.i.d. model, assuming that only the parameters in θ E are treated as random variables, while the others remain fixed (data generated using Algorithm 1). The plots include sample histograms, ground truth values (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Figure 26. Posterior distributions of Eve’s parameters under the i.i.d. model, assuming that only the parameters in θ E are treated as random variables, while the others remain fixed (data generated using Algorithm 1). The plots include sample histograms, ground truth values (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Entropy 27 00568 g026
Figure 27. Posterior distributions of the secure-key rate for each intensity level under the i.i.d. model, assuming that only the parameters in θ E are treated as random variables, while the others remain fixed (data generated using Algorithm 1). The plots include sample histograms, ground truth values (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Figure 27. Posterior distributions of the secure-key rate for each intensity level under the i.i.d. model, assuming that only the parameters in θ E are treated as random variables, while the others remain fixed (data generated using Algorithm 1). The plots include sample histograms, ground truth values (red lines), empirical means (dashed lines), kernel density estimates (solid black lines), and 99% confidence intervals (shaded regions).
Entropy 27 00568 g027
Table 1. Parameter configuration for the simulation experiment, grouped by Alice’s parameters ( θ A ), Bob’s parameters ( θ B ), Eve’s parameters ( θ E ), and session parameters ( θ S ).
Table 1. Parameter configuration for the simulation experiment, grouped by Alice’s parameters ( θ A ), Bob’s parameters ( θ B ), Eve’s parameters ( θ E ), and session parameters ( θ S ).
Parameter Configuration for the Simulation Experiment
θ A (Alice)
ParameterDescriptionValue
Λ Intensity levels λ min , λ max
α Channel attenuation (dB/km)0.21
d A B Distance from Alice to Bob (km)50
θ B (Bob)
ParameterDescriptionValue
p a After-pulse probability0.1
p c Detection efficiency0.045
p d Dark count probability 1.7 × 10 6
p e Misalignment probability0.033
θ E (Eve)
ParameterDescriptionValue
d A E Distance from Alice to Eve (km)10
Δ Fraction of intercepted pulses0.2
kPhotons intercepted per pulse3
p E B Channel efficiency from Eve to Bob (if Eve intercepts)optimized
θ S (Session)
ParameterDescriptionValue
NNumber of pulses per session10,000
N R Number of simulation runs10,000
Table 2. Detector-specific values for Bob’s parameters: after-pulse probability p a , detection efficiency p c , and dark count probability p d for detectors D 0 and D 1 .
Table 2. Detector-specific values for Bob’s parameters: after-pulse probability p a , detection efficiency p c , and dark count probability p d for detectors D 0 and D 1 .
Detector-Specific Parameter Adjustments
Parameter D 0 D 1
After-pulse probability p a 0 = p a × 0.9 p a 1 = p a × 1.1
Detection efficiency p c 0 = p c × 0.9 p c 1 = p c × 1.1
Dark count probability p d 0 = p d × 0.9 p d 1 = p d × 1.1
Table 3. Summary of computational complexities for evaluating the posterior and its derivatives under the i.i.d. and HMM models (assuming N λ > 2 N θ ).
Table 3. Summary of computational complexities for evaluating the posterior and its derivatives under the i.i.d. and HMM models (assuming N λ > 2 N θ ).
ModelFunction EvaluationDerivative Evaluation
i.i.d. O ( N λ ) O ( N θ N λ )
HMM O ( N I N λ 2 ) O ( N θ N I N λ 2 )
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Almosallam, I. Overcoming Intensity Limits for Long-Distance Quantum Key Distribution. Entropy 2025, 27, 568. https://doi.org/10.3390/e27060568

AMA Style

Almosallam I. Overcoming Intensity Limits for Long-Distance Quantum Key Distribution. Entropy. 2025; 27(6):568. https://doi.org/10.3390/e27060568

Chicago/Turabian Style

Almosallam, Ibrahim. 2025. "Overcoming Intensity Limits for Long-Distance Quantum Key Distribution" Entropy 27, no. 6: 568. https://doi.org/10.3390/e27060568

APA Style

Almosallam, I. (2025). Overcoming Intensity Limits for Long-Distance Quantum Key Distribution. Entropy, 27(6), 568. https://doi.org/10.3390/e27060568

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop