Sampling device and sampling method

The sampling device and method optimize memory usage and processing speed by generating replicas with varying precision and exchanging samples efficiently, addressing the memory constraints of REMCMC methods in spectral decomposition.

JP7616412B2Active Publication Date: 2025-01-17NIPPON TELEGRAPH & TELEPHONE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
JP2023555946
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2021-10-27
Publication Date
2025-01-17
Estimated Expiration
2041-10-27

AI Technical Summary

Technical Problem

Existing methods for spectral decomposition using Bayesian inference and Replica Exchange Markov Chain Monte Carlo (REMCMC) require significant memory resources due to the need to store all temperature sampling points, leading to inefficiencies in computational cost and memory usage.

Method used

A sampling device and method that generates replicas with varying quantization precision, performs parallel sampling, and exchanges samples between replicas using shift operations or bit operations to satisfy the detailed balance condition, reducing memory requirements by storing samples as fixed-point numbers and optimizing memory usage.

Benefits of technology

The proposed approach reduces memory requirements and enhances processing speed by efficiently managing replicas with different precision levels, allowing for effective sampling without the need for extensive memory storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007616412000009
    Figure 0007616412000009
  • Figure 0007616412000010
    Figure 0007616412000010
  • Figure 0007616412000011
    Figure 0007616412000011
Patent Text Reader

Abstract

This sampling device comprises a replica generation unit (1) for quantizing an original probability distribution to be sampled and generating a plurality of replicas that differ from one another in terms of the accuracy of quantization, a sampling execution unit (2) for sampling the plurality of replicas simultaneously in parallel, a memory (4) for storing samples extracted from each of the plurality of replicas through sampling, and a replica exchange unit (3) for exchanging the samples of the plurality of replicas stored in the memory (4) with a probability that satisfies a detailed balance condition.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to a sampling device and a sampling method using a replica-exchange Markov chain Monte Carlo method. [Background technology]

[0002] Many information processing problems involve finding the maximum or minimum of a non-convex probability distribution, or the numerical integral of an arbitrary probability distribution. There are several methods for solving these types of problems numerically, one of which is the sampling method using Monte Carlo simulation.

[0003] Replica Exchange Markov Chain Monte Carlo (REMCMC) sampling is a method for reducing the amount of calculation in a sampling method using Monte Carlo simulation (see Non-Patent Document 1).

[0004] Before describing the REMCMC method, we will now explain Bayesian estimation using the exchange Monte Carlo method disclosed in Non-Patent Document 1. Spectral decomposition is a problem of extracting physical properties of a target by regressing spectral data having a complex peak structure measured by, for example, spectroscopic analysis, using a superposition of unimodal basis functions such as Gaussian functions.

[0005]

number

[0006] where K is the number of Gaussian functions, and μ k is the mean value of the kth Gaussian function, and a k is the magnitude of the kth Gaussian function. σ k 2 corresponds to the variance of the kth Gaussian function. Here, the parameter set θ is defined as θ={a k ,μ k ,σ k}k=1 K In spectroscopy, each unimodal basis function that makes up a multimodal spectrum corresponds to the energy levels of the electrons that make up a substance. Therefore, by decomposing a multimodal spectrum into unimodal basis functions, it is possible to determine the electronic state of the target.

[0007] The number K of Gaussian functions above is the number of peaks in the multimodal spectrum, and the number K corresponds to the number of energy levels to be measured. The mathematical goal of the computational theory of spectral decomposition is to find the N data sets D={x i ,y i} i=1 N Therefore, the number K of basis functions corresponding to the number of peaks in the multimodal spectrum and the associated parameter set θ are appropriately determined from the data.

[0008] Generally, the least squares method is often used to determine the parameter set θ, but the number of peaks K cannot be determined using the least squares method. Therefore, spectral decomposition based on Bayesian inference is used. In Bayesian inference, the causal law by which the observed data y was generated is probabilistically formulated. First, it is considered that the number K of energy levels of the target material is generated according to the probability p(K). Next, it is considered that the parameter set θ is given by the conditional probability p(θ|K) according to K. For simplicity, it is assumed that p(K) and p(θ|K) are uniform. It is assumed that the observed data y is observed by superimposing Gaussian noise ε with mean 0 and variance 1 on the true value according to equation (1). y = G(x;θ,K) + ε (2)

[0009] From these assumptions, the observed data y is generated with a conditional probability of the input x given the number of peaks K and the parameter set θ.

[0010]

number

[0011] Each data (xi ,y i ) are obtained independently, the conditional probability of N pieces of data D given the parameter θ is given by the following formula:

[0012]

number

[0013] p(D|θ,K) follows the Boltzmann distribution when the error function E(θ,K) is regarded as energy and N is regarded as the inverse temperature. Here, it is possible to formally write down the joint probability p(D,θ,K) of all the variables that have appeared so far as follows:

[0014]

number

[0015] Given this joint probability, we can use Bayes' theorem and marginalization procedures to express the posterior probability p(θ|D,K) of a parameter set, given data D and the number of basis functions K, as follows:

[0016]

number

[0017] Here, we use the fact that p(K) and p(θ|K) are uniform. From equations (8) and (9), the maximum posterior probability estimation, in which θ that maximizes the posterior probability p(θ|D,K) is the estimated parameter value, coincides with θ obtained from the least squares method. When data D is given, the posterior probability p(K|D) of the number K of basis functions is given as follows:

[0018]

number

[0019] As before, the number of peaks K given D is estimated using maximum a posteriori probability estimation, and the estimate K is set to maximize the a posteriori probability p(K|D) in equation (11). The right-hand side of equation (11) corresponds to the partition function in statistical mechanics. The partition function is used to define the free energy F(K) as follows:

[0020]

number

[0021] Due to the monotonicity of logarithms, the K that maximizes the posterior probability p(K|D) is the same as the K that minimizes the free energy F(K). Therefore, to search for the K that maximizes the posterior probability p(K|D), we can see that we need to examine the free energy F(K).

[0022] There are two difficulties in performing Bayesian inference for the above spectral decomposition. One is that the mean squared error E(θ,K) of the least squares method and the error function E(θ,K) of equation (9) have local solutions, so it is difficult to find the parameter θ that minimizes the error function. The other is that numerical integration with respect to θ in equations (11) and (12) is difficult. To solve these problems, we use the REMCMC method, which will be briefly explained below.

[0023] (I) Introduce the inverse temperature β=1 / T into the probability distribution to be sampled and consider the following probability distribution. p β (θ|D,K)∝exp(-NβE(θ,K)) ···(13)

[0024] Temperature is entropy, and a probability distribution with a low inverse temperature is gentle, while a probability distribution with a high inverse temperature is steep. In the REMCMC method, multiple probability distributions with different temperatures T are prepared. These multiple probability distributions are called replicas. Figure 7A shows the original probability distribution to be sampled, Figure 7B shows a replica with a high inverse temperature, and Figure 7C shows a replica with a low inverse temperature. Next, the following (II) and (III) are executed alternately.

[0025] (II) Each probability distribution p βl (θ l Sampling in |D,K) is performed simultaneously in parallel using the conventional MCMC sampling method. As shown in Figure 8A, the conventional MCMC method focuses on sampling around the minimum value regardless of whether it is local or global. Also, the steeper the area around the minimum value is, such as the probability distribution with a high inverse temperature in Figure 8A, the more focused the sampling is on the area around the minimum value. However, if the area is gentle, such as the probability distribution with a low inverse temperature in Figure 8B, the whole area can be sampled evenly.

[0026] (III) The current sample θ of the two probability distributions at each appropriate step l and θ l+1 are exchanged with the following probability u.

[0027]

number

[0028] The probability u is constructed to satisfy a property called the detailed balance condition. Figure 9 shows two probability distributions p βl andp βl+1 This shows an example of exchanging samples between

[0029] In the REMCMC method, replicas are stochastically exchanged between adjacent temperatures during the simultaneous sampling of each temperature. This allows us to incorporate not only the effect of annealing, which gradually lowers the temperature, but also the effect of heating, which gradually raises the temperature, and thus allows us to escape from local minimum values ​​and efficiently search for a global minimum. In addition, we can efficiently sample the entire distribution.

[0030] However, the REMCMC method requires that all temperature sampling points be stored in memory, necessitating a large memory space proportional to the number of sampling points and the number of temperatures. [Prior art documents] [Non-patent literature]

[0031] [Non-Patent Document 1] Kenji Nagata, Kenji Tanaka, “Computer Architecture for Sparse Modeling and Data-Driven Science”, Systems / Control / Information, Vol. 61, No. 4, 2017 Summary of the Invention [Problem to be solved by the invention]

[0032] The present invention has been made in order to solve the above-mentioned problems, and has an object to provide a sampling device and a sampling method that can reduce the required memory amount. [Means for solving the problem]

[0033] The sampling device of the present invention is characterized in that it comprises a replica generation unit configured to quantize an original probability distribution to be sampled and generate a plurality of replicas with different quantization precisions, a sampling execution unit configured to simultaneously sample the plurality of replicas in parallel, a memory configured to store samples extracted from each of the plurality of replicas by the sampling, and a replica exchange unit configured to exchange the samples of the plurality of replicas stored in the memory with a probability that satisfies a detailed balance condition. In one configuration example of the sampling device of the present invention, the samples extracted from each of the plurality of replicas are stored in the memory as fixed-point numbers.

[0034] Furthermore, in one configuration example of the sampling device of the present invention, when exchanging a first replica sample with a second replica sample having higher accuracy than the first replica, the replica exchange unit shifts the first replica sample read from the first memory space of the memory to the left and stores it in the second memory space of the memory, and at the same time shifts the second replica sample read from the second memory space to the right and stores it in the first memory space. Furthermore, in one configuration example of the sampling device of the present invention, when exchanging a first replica sample with a second replica sample having higher accuracy than the first replica, the replica exchange unit adds 0 to the end of the first replica sample read from the first memory space of the memory and stores it in the second memory space of the memory, while simultaneously storing only the upper bits of the second replica sample read from the second memory space, which correspond to the accuracy of the first replica, in the first memory space.

[0035] In addition, the present invention is a sampling method for performing processing by a computer having a CPU and a storage device, The method includes a first step of quantizing an original probability distribution to be sampled and generating multiple replicas with different quantization accuracy, a second step of sampling the multiple replicas simultaneously in parallel, and a third step of exchanging the samples of the multiple replicas stored in memory with a probability that satisfies a detailed balance condition. and making the CPU execute the program stored in the storage device. It is characterized by the above. In one configuration example of the sampling method of the present invention, the samples extracted from each of the plurality of replicas are stored in the memory as fixed-point numbers.

[0036] Furthermore, in one configuration example of the sampling method of the present invention, the third step is characterized in that, when exchanging a first replica sample with a second replica sample having higher accuracy than the first replica, the first replica sample read from the first memory space of the memory is left-shifted and stored in a second memory space of the memory, and at the same time, the second replica sample read from the second memory space is right-shifted and stored in the first memory space. Furthermore, in one configuration example of the sampling method of the present invention, the third step is characterized in that, when exchanging a first replica sample with a second replica sample having higher accuracy than the first replica, the third step includes a step of adding 0 to the end of the first replica sample read from the first memory space of the memory and storing the first replica sample in the second memory space of the memory, and at the same time storing only the upper bits of the second replica sample read from the second memory space, which correspond to the accuracy of the first replica, in the first memory space. Effect of the Invention

[0037] According to the present invention, the amount of memory required for calculations can be reduced by quantizing the original probability distribution to be sampled and generating a plurality of replicas with different quantization precisions. [Brief description of the drawings]

[0038] [Figure 1] FIG. 1 is a block diagram showing the configuration of a sampling device according to an embodiment of the present invention. [Diagram 2] FIG. 2 is a flowchart illustrating the operation of the sampling device according to the embodiment of the present invention. [Figure 3A-3G] 3A-3G are diagrams showing the original probability distribution and its replica that are sampled in an embodiment of the present invention. [Figure 4] FIG. 4 is a diagram showing a state update by a sampling unit and a replica exchange unit according to an embodiment of the present invention. [Diagram 5] FIG. 5 is a diagram illustrating the exchange of samples between replicas in an embodiment of the present invention. [Figure 6] FIG. 6 is a block diagram showing an example of the configuration of a computer that realizes a sampling device according to an embodiment of the present invention. [Figure 7A-7C] 7A-7C show the original probability distribution to be sampled and its replica. [Figure 8A-8B] 8A and 8B are diagrams illustrating the characteristics of sampling by the MCMC method. [Figure 9] FIG. 9 shows an example of swapping samples between two probability distributions. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0039] Hereinafter, an embodiment of the present invention will be described with reference to the drawings. Fig. 1 is a block diagram showing the configuration of a sampling device according to an embodiment of the present invention. The sampling device comprises a replica generation unit 1 that quantizes an original probability distribution to be sampled and generates multiple replicas with different quantization accuracy, a sampling execution unit 2 that simultaneously samples the multiple replicas in parallel, a replica exchange unit 3 that exchanges the samples of the multiple replicas with a probability that satisfies a detailed balance condition, and a memory 4 that stores the multiple replicas and samples extracted from each of the multiple replicas.

[0040] Fig. 2 is a flow chart explaining the operation of the sampling device of this embodiment. The replica generation unit 1 generates multiple replicas from the original probability distribution to be sampled (Fig. 2, step S1). In this embodiment, quantization is used instead of inverse temperature when generating replicas. In other words, a gradual probability distribution with a low inverse temperature is approximated by low-precision quantization, and a steep probability distribution with a high inverse temperature is approximated by high-precision quantization.

[0041] Fig. 3A shows the original probability distribution to be sampled, and Fig. 3B to Fig. 3G show replicas with quantization accuracy changed from high accuracy to low accuracy. In this way, in this embodiment, multiple replicas with different quantization accuracy are generated. The replicas generated by the replica generation unit 1 are stored in the memory 4. In this embodiment, the amount of memory to be secured can be reduced by quantizing the original probability distribution and generating a replica.

[0042] Next, the sampling execution unit 2 simultaneously performs sampling of the multiple replicas stored in the memory 4 using, for example, the MCMC method (step S2 in FIG. 2). The samples extracted from each of the multiple replicas by sampling are stored in the memory 4. In this embodiment, the samples of each replica are stored as fixed-point numbers in the memory 4. This makes it possible to save memory space.

[0043] Next, the replica exchange unit 3 exchanges samples between adjacent replicas among the multiple replicas with the probability u explained in equations (14) and (15) (FIG. 2, step S3). 4 shows how the state is updated by the sampling execution unit 2 and the replica exchange unit 3. Here, the case where four replicas p1, p2, p3, and p4 are generated is shown.

[0044] In Fig. 4, horizontal arrows 40 represent sampling by the MCMC method, arrows 41 represent sample exchange between adjacent replicas, and crosses 42 represent sample exchanges that are rejected.

[0045] Furthermore, in this embodiment, the processing speed can be increased by using shift operations or bit operations to exchange samples. Fig. 5 is a diagram for explaining the exchange of samples between replicas in this embodiment. Fig. 5 shows an example in which three replicas p1, p2, and p3 are generated, where replica p1 is represented by 3 bits, replica p2 is represented by 4 bits, and replica p3 is represented by 5 bits. The sample of replica p1 is stored in memory space M1, the sample of replica p2 is stored in memory space M2, and the sample of replica p3 is stored in memory space M3.

[0046] For example, when exchanging a sample of low-precision replica p1 with a sample of medium-precision replica p2, the replica exchange unit 3 shifts the sample of replica p1 read from memory space M1 to the left by one bit, converts it to 4 bits, and stores it in memory space M2, and at the same time shifts the sample of replica p2 read from memory space M2 to the right by one bit, converts it to 3 bits, and stores it in memory space M1.

[0047] In addition, when exchanging a sample of medium-precision replica p2 with a sample of high-precision replica p3, for example, the replica exchange unit 3 shifts the sample of replica p2 read from memory space M2 to the left by one bit, converts it to 5 bits, and stores it in memory space M3, and at the same time shifts the sample of replica p3 read from memory space M3 to the right by one bit, converts it to 4 bits, and stores it in memory space M2.

[0048] In addition, when exchanging a sample of low-precision replica p1 with a sample of medium-precision replica p2, for example, the replica exchange unit 3 may add 0 to the end of the sample of replica p1 read from memory space M1 to convert it to 4 bits and store it in memory space M2, while at the same time storing only the most significant 3 bits of the sample of replica p2 read from memory space M2 in memory space M1.

[0049] In addition, when exchanging a sample of medium-precision replica p2 with a sample of high-precision replica p3, for example, the replica exchange unit 3 may add a zero to the end of the sample of replica p2 read from memory space M2 to convert it to 5 bits and store it in memory space M3, while at the same time storing only the most significant 4 bits of the sample of replica p3 read from memory space M3 in memory space M2.

[0050] Thereafter, the processes of steps S2 and S3 are executed alternately until all sampling is completed. In this way, in this embodiment, the use of shift operations or bit operations for exchanging samples enables high-speed processing. Also, the exchange probability u that satisfies the detailed balance condition can be easily implemented by a combinational circuit such as a look-up table.

[0051] The sampling device described in this embodiment can be realized by a computer equipped with a CPU (Central Processing Unit), a storage device, and an interface, and a program that controls these hardware resources. An example of the configuration of this computer is shown in FIG. 6. The computer is equipped with a CPU 200, a storage device 201, and an interface device (I / F) 202. In such a computer, a program for realizing the sampling method of the present invention is stored in the storage device 201. The CPU 200 executes the processing described in this embodiment in accordance with the program stored in the storage device 201.

[0052] Furthermore, at least a part of the sampling device may be configured with hardware logic such as an application specific integrated circuit (ASIC) or a field-programmable gate array (FPGA). [Industrial Applicability]

[0053] The present invention can be applied to a technique for estimating a state of an object from a probability distribution. [Explanation of symbols]

[0054] 1...replica generation unit, 2...sampling execution unit, 3...replica exchange unit, 4...memory.

Claims

1. a replica generation unit configured to quantize an original probability distribution to be sampled and generate a plurality of replicas having different quantization precisions; a sampling execution unit configured to simultaneously perform sampling of the plurality of replicas in parallel; a memory configured to store samples extracted from each of the plurality of replicas by the sampling; and a replica exchange unit configured to exchange the plurality of replica samples stored in the memory with a probability that a detailed balance condition is satisfied.

2. 2. The sampling device according to claim 1, A sampling device, characterized in that the samples extracted from each of the plurality of replicas are stored in the memory as fixed-point numbers.

3. 3. The sampling device according to claim 1, The replica exchange unit, when exchanging a first replica sample with a second replica sample having higher accuracy than the first replica, shifts the first replica sample read from a first memory space of the memory to the left and stores it in a second memory space of the memory, and at the same time shifts the second replica sample read from the second memory space to the right and stores it in the first memory space.

4. 3. The sampling device according to claim 1, The replica exchange unit, when exchanging a first replica sample with a second replica sample having higher precision than the first replica, adds 0 to the end of the first replica sample read from a first memory space of the memory and stores it in a second memory space of the memory, while simultaneously storing only the most significant bits of the second replica sample read from the second memory space, which correspond to the precision of the first replica, in the first memory space.

5. A sampling method for performing processing by a computer having a CPU and a storage device, comprising: a first step of quantizing an original probability distribution to be sampled to generate a number of replicas having different quantization resolutions; a second step of sampling the plurality of replicas simultaneously and in parallel; a third step of exchanging the samples of the plurality of replicas stored in a memory with a probability that satisfies a detailed balance condition; A sampling method comprising causing the CPU to execute a program stored in the storage device.

6. The sampling method according to claim 5, A sampling method, comprising the steps of: storing in the memory, as fixed-point numbers, samples extracted from each of the plurality of replicas.

7. The sampling method according to claim 5 or 6, the third step includes a step of left-shifting the first replica sample read from a first memory space of the memory and storing it in a second memory space of the memory, and simultaneously right-shifting the second replica sample read from the second memory space and storing it in the first memory space, when exchanging a first replica sample with a second replica sample having higher accuracy than the first replica.

8. The sampling method according to claim 5 or 6, the third step includes a step of, when exchanging a first replica sample with a second replica sample having higher precision than the first replica, adding 0 to the end of the first replica sample read from a first memory space of the memory and storing the sample in a second memory space of the memory, while simultaneously storing only the most significant bits of the second replica sample read from the second memory space, which correspond to the precision of the first replica, in the first memory space.