Open refraction-ray opened 2 years ago
We consider float32-typical error bars sufficient for quantum machine learning. This is because all real QPUs have errors far greater than this, and TFQ is targeted at development of algorithms meant to be run on such noisy processors. So we don't consider it "vital for variational quantum algorithms", at least not until the far fault-tolerant era. That said, maybe @MichaelBroughton can weigh in on the prospects for enabling such higher precision?
That's correct @zaqqwerty . For most (if not all) of the NiSQ research we are doing float32 is more than enough precision. To add float64 support one would first need to look into adding it here:
https://github.com/quantumlib/qsim (for the SSE, AVX2, AVX512 and GPU sims) Then propogating it up to TFQ by registering new version of our ops using double precision.
@zaqqwerty , @MichaelBroughton , Thanks for the reply and confirmation on the status of float64 support in tfq.
I agree with you that float32 is more than enough for tasks related with NISQ experiments. But from theoretical investigation perspective, the expressiveness of some parameterized circuits can indeed reach the accuracy in the order of 10^-6 or 10^-7, similar to the float32-typical error bar. Of course, I admit that these PQCs and accuracies are only possible for fault tolerant setups, but there are still good problems to look into for theorists anyhow. And a float64 enabled quantum circuit simulator is helpful in such cases.
Does tfq currently support circuit simulation with float64/complex128 precision? At least the code demo below returns me a float32 tensor.
I wonder if there is a way to enable complex128 simulation in tfq.
I believe float64 support is vital for variational quantum algorithms, especially for quantum simulations such as VQE. This is different from common machine learning setups where float32 is more than enough.
For example, the above program should return zero, while it actually gives
<tf.Tensor: shape=(1, 1), dtype=float32, numpy=array([[2.9802322e-07]], dtype=float32)>
. The error bar is float32-typical, and cannot be simply overlooked for physics problems.