-
Notifications
You must be signed in to change notification settings - Fork 376
High-level simulator random seed for circuit jobs #1463
Comments
So don't set I believe Aer and BasicAer behave differently in regards of the seed_simulator when there are multiple circuits in a job - or at least they did in the past, I do not know if it has been changed. Chris knew about the differences. |
But, what if I want the entire QAOA run to be restorable? |
I take it that the expected outcome should be different but small. The sample size here means that this difference might be lost. Can you not increase the shot count? Or change the eps of the optimizer to make larger differences if its an issue with finite gradient. As I said Aer and BasicAer differ on what they do if these circuits are batched in job as to how seed_simulator is used. I cannot recall which one does what - Aer might use the seed for the whole job, whereas BasicAer for each circuit in the job. It sounds as though you are asking to have a different higher level seed for the simulator that would be set on quantum instance but used to generate an pseudo-random seed for seed_simulator each time a job (set of circuits is run). Even so if circuits are grouped into ajob for execution then its still dependent on the simulator behavior which as I mentioned differs (or at least did when I last talked to Chris about differences I had seen between Aer and BasicAer in regards of execution) |
I'm indeed thinking of a higher level seed, as you describe. It would help me if it existed. But if you disagree, then it's OK to close this issue, or label it as "enhancement" rather than "bug". |
Once the experiment class is ready and integrated with Aqua, this request of a high level random seed will fit naturally there. |
A seed-experiment sounds fine for whatever integration becomes of QuantumInstance and experiment class. I am still doubtful of its applicability to your described problem. It seems that when things are close to somehow try to rely on different outcome from a different seed may not turn out as expected and still give the same outcome. For sure with the exact same seed there is no chance for a different outcome. In general though if I did a batch of the identical ccts in an experiment (or job) I might reasonably expect them to have different outcomes and not all be identical - I think for a job this is how Aer behaves and last I saw BasicAer was identical results (but this was a while ago and as I said Chris was aware of the differences and it had been raised as an issue before). To assure things over a single job though is now simulator dependent - and of course we often want to group ccts together to minimize overhead. Anyway simulation within a job would need looking at too I think. |
I suggest to close the issue for now, and return to this topic later with the experiment class. |
Closing as suggested. |
Fixing the random seed when using Aqua consists, to my knowledge, of three steps:
aqua_globals.random_seed
.seed_transpiler
parameter inQuantumInstance
.seed_simulator
parameter inQuantumInstance
.The fixing of the
seed_simulator
causes an undesired behavior, where each execution of the variational circuit begins with the same random seed. Since the parameter values (to bind to the circuit) are only slightly modified between executions, often several consecutive executions result in the same counts.The desired behavior is to be able to control the randomizations of the simulations, with different randomizations in different simulations.
The text was updated successfully, but these errors were encountered: