What is VQE?
VQE (Peruzzo et al. 2014) minimizes the expectation value ⟨ψ(θ)|H|ψ(θ)⟩ of a Hamiltonian H with respect to variational circuit parameters θ. By the variational principle, this expectation value is an upper bound on the ground state energy — the optimization finds the tightest bound achievable by the chosen ansatz circuit.
VQE is primarily used for quantum chemistry (molecular electronic structure) and condensed matter physics (Ising models, Heisenberg models). It is not designed for combinatorial optimization — use QAOA or GPU Annealing for QUBO problems.
Usage
import nerox
client = nerox.Client()
# Hydrogen molecule ground state (Jordan-Wigner mapped to 4 qubits)
H2_hamiltonian = {
"terms": [
{"pauli": "II", "coeff": -1.0523732},
{"pauli": "IZ", "coeff": 0.3979374},
{"pauli": "ZI", "coeff": -0.3979374},
{"pauli": "ZZ", "coeff": -0.0112801},
{"pauli": "XX", "coeff": 0.1809312},
],
"n_qubits": 4,
}
job = client.optimize.vqe(
hamiltonian=H2_hamiltonian,
ansatz="uccsd", # uccsd | hardware_efficient | hva
optimizer="l_bfgs_b", # l_bfgs_b | adam | cobyla
max_iter=500,
)
result = job.wait(timeout=7200)
print(f"Ground state energy: {result.objective:.6f} Hartree")
print(f"Circuit depth: {result.circuit_depth}")
print(f"Gate count: {result.n_gates}")Supported ansätze
Limitations
VQE is limited to ~50 qubits (GPU statevector simulation). Runtime is 10 minutes to several hours depending on Hamiltonian size, ansatz depth, and optimizer convergence. It is research-grade, not production-grade. For production combinatorial optimization, use GPU Annealing.
