Skip to content

Commit 396e3a2

Browse files
default optimal stepsize per optimizer, v0.3.13
1 parent 1a21600 commit 396e3a2

44 files changed

Lines changed: 3897 additions & 4462 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.
44

55
---
66

7+
## [0.3.13] - April 13, 2026
8+
9+
### Changed
10+
11+
- **VQE CLI now matches calibrated optimizer-default behaviour**
12+
13+
`vqe --stepsize` is now optional. When omitted, the CLI preserves the same
14+
calibrated per-optimizer default stepsize behaviour as the Python APIs
15+
instead of forcing a legacy fixed `0.2` learning rate.
16+
17+
### Fixed
18+
19+
- Fixed stale VQE CLI argument forwarding that still cast `stepsize` eagerly in
20+
standard VQE, compare-noise, and post-VQE excited-state workflows, preventing
21+
the new optimizer-default resolution path from taking effect.
22+
- Fixed optimizer documentation to reflect the canonical
23+
`NesterovMomentum` registry entry, the alias model, and the current
24+
calibrated default-stepsize registry layout.
25+
- Fixed notebook and documentation path references so the renumbered
26+
`getting_started/` notebook names are referenced consistently.
27+
728
## [0.3.12] - April 13, 2026
829

930
### Added
@@ -156,7 +177,7 @@ All notable changes to this project will be documented in this file.
156177

157178
- **New VarQRTE notebooks**
158179

159-
- `notebooks/getting_started/13_getting_started_qrte_h2.ipynb` — prepared-state VarQRTE usage demo
180+
- `notebooks/getting_started/11_getting_started_qrte_h2.ipynb` — prepared-state VarQRTE usage demo
160181
- `notebooks/qite/H2/Real_Time.ipynb` — package-client VarQRTE workflow
161182
- `notebooks/benchmarks/qite/H2/Exact_QRTE_Benchmark.ipynb` — exact-vs-VarQRTE H2 quench benchmark
162183

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ model_res = run_vqe(
115115
print("Model VQE:", model_res["energy"])
116116
```
117117

118+
`run_vqe()` uses the calibrated default stepsize for the selected optimizer when `stepsize` is omitted.
119+
The `vqe` CLI does the same when `--stepsize` is omitted.
120+
118121
CLI:
119122

120123
```bash
@@ -274,9 +277,9 @@ Layout:
274277

275278
Recommended starting points:
276279

277-
- [`notebooks/getting_started/vqe_vs_qpe_from_scratch_h2.ipynb`](notebooks/getting_started/vqe_vs_qpe_from_scratch_h2.ipynb)
278-
- [`notebooks/getting_started/06_getting_started_qite_h2.ipynb`](notebooks/getting_started/06_getting_started_qite_h2.ipynb)
279-
- [`notebooks/getting_started/13_getting_started_qrte_h2.ipynb`](notebooks/getting_started/13_getting_started_qrte_h2.ipynb)
280+
- [`notebooks/getting_started/01_vqe_vs_qpe_from_scratch_h2.ipynb`](notebooks/getting_started/01_vqe_vs_qpe_from_scratch_h2.ipynb)
281+
- [`notebooks/getting_started/07_getting_started_qite_h2.ipynb`](notebooks/getting_started/07_getting_started_qite_h2.ipynb)
282+
- [`notebooks/getting_started/11_getting_started_qrte_h2.ipynb`](notebooks/getting_started/11_getting_started_qrte_h2.ipynb)
280283
- [`notebooks/benchmarks/qite/H2/Exact_QRTE_Benchmark.ipynb`](notebooks/benchmarks/qite/H2/Exact_QRTE_Benchmark.ipynb)
281284

282285
## Documentation

THEORY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ Supported optimizers:
273273
- Gradient Descent
274274
- RMSProp
275275
- Adagrad
276-
- Momentum / Nesterov
276+
- Momentum / NesterovMomentum
277277

278278
Differences:
279279

USAGE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ Guidance:
285285
| GradientDescent | baseline |
286286
| NesterovMomentum | faster convergence on smooth landscapes |
287287

288+
If `stepsize` / `--stepsize` is omitted for VQE workflows, the calibrated
289+
default for the selected optimizer is used.
290+
288291
See:
289292

290293
```

more_docs/vqe/optimizers.md

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,31 @@ The implemented optimizer names are:
77
- `Adam`
88
- `GradientDescent`
99
- `Momentum`
10-
- `Nesterov`
10+
- `NesterovMomentum`
1111
- `RMSProp`
1212
- `Adagrad`
1313

14-
These are exposed through the factory:
14+
These are exposed through the registry `OPTIMIZERS`, where each canonical name maps
15+
to:
16+
17+
- the PennyLane optimizer factory
18+
- a calibrated default `stepsize`
19+
- accepted aliases
20+
21+
The calibrated defaults currently used by `run_vqe()` when `stepsize` is omitted are:
22+
23+
- `Adam`: `0.15`
24+
- `GradientDescent`: `0.10`
25+
- `Momentum`: `0.10`
26+
- `NesterovMomentum`: `0.20`
27+
- `RMSProp`: `0.01`
28+
- `Adagrad`: `0.10`
29+
30+
The main helpers are:
1531

1632
```python
17-
get_optimizer(name: str = "Adam", stepsize: float = 0.2)
33+
get_optimizer(name: str = "Adam", stepsize: float | None = None)
34+
get_optimizer_stepsize(name: str = "Adam") -> float
1835
```
1936

2037
and are used inside the main VQE loop via a unified PennyLane interface.
@@ -64,7 +81,12 @@ where the update $\Delta \theta_t$ depends on the optimizer-specific rule.
6481
In `vqe.core.run_vqe`, the optimizer is constructed as
6582

6683
```python
67-
opt = engine_build_optimizer(str(optimizer_name), stepsize=float(stepsize))
84+
resolved_stepsize = (
85+
get_optimizer_stepsize(str(optimizer_name))
86+
if stepsize is None
87+
else float(stepsize)
88+
)
89+
opt = engine_build_optimizer(str(optimizer_name), stepsize=resolved_stepsize)
6890
```
6991

7092
and then applied through either
@@ -243,7 +265,7 @@ Instead of evaluating the gradient exactly at the current point, Nesterov moment
243265

244266
### Typical use in this repo
245267

246-
Nesterov is a useful intermediate option between simple momentum methods and more adaptive optimizers such as Adam.
268+
`NesterovMomentum` is a useful intermediate option between simple momentum methods and more adaptive optimizers such as Adam.
247269

248270
---
249271

@@ -412,7 +434,7 @@ The optimizers in this repository can be grouped roughly as follows.
412434

413435
- `GradientDescent`
414436
- `Momentum`
415-
- `Nesterov`
437+
- `NesterovMomentum`
416438

417439
These methods use a global learning rate $\eta$ without adaptive per-parameter normalization. They are simple and interpretable, but usually more sensitive to hyperparameter tuning.
418440

@@ -432,14 +454,14 @@ For most standard VQE experiments in this repository:
432454

433455
1. start with `Adam`
434456
2. use `GradientDescent` as a baseline if you want a clean reference
435-
3. try `Momentum` or `Nesterov` if you want simple inertial alternatives
457+
3. try `Momentum` or `NesterovMomentum` if you want simple inertial alternatives
436458
4. try `RMSProp` or `Adagrad` when parameter scales appear uneven
437459

438460
A practical rule of thumb is:
439461

440462
- **Adam** for general-purpose default use
441463
- **GradientDescent** for interpretability and baseline studies
442-
- **Momentum / Nesterov** for simple acceleration over GD
464+
- **Momentum / NesterovMomentum** for simple acceleration over GD
443465
- **RMSProp / Adagrad** for stronger per-parameter adaptation
444466

445467
---
@@ -487,29 +509,43 @@ So:
487509
The current optimizer registry is:
488510

489511
```python
490-
_OPTIMIZERS = {
491-
"Adam": qml.AdamOptimizer,
492-
"adam": qml.AdamOptimizer,
493-
"GradientDescent": qml.GradientDescentOptimizer,
494-
"gd": qml.GradientDescentOptimizer,
495-
"Momentum": qml.MomentumOptimizer,
496-
"Nesterov": qml.NesterovMomentumOptimizer,
497-
"RMSProp": qml.RMSPropOptimizer,
498-
"Adagrad": qml.AdagradOptimizer,
512+
OPTIMIZERS = {
513+
"Adam": {"factory": qml.AdamOptimizer, "stepsize": 0.15, "aliases": ("adam",)},
514+
"GradientDescent": {
515+
"factory": qml.GradientDescentOptimizer,
516+
"stepsize": 0.10,
517+
"aliases": ("gradientdescent", "gradient_descent", "gd"),
518+
},
519+
"Momentum": {
520+
"factory": qml.MomentumOptimizer,
521+
"stepsize": 0.10,
522+
"aliases": ("momentum",),
523+
},
524+
"NesterovMomentum": {
525+
"factory": qml.NesterovMomentumOptimizer,
526+
"stepsize": 0.20,
527+
"aliases": ("nesterov", "nesterovmomentum"),
528+
},
529+
"RMSProp": {"factory": qml.RMSPropOptimizer, "stepsize": 0.01, "aliases": ("rmsprop",)},
530+
"Adagrad": {"factory": qml.AdagradOptimizer, "stepsize": 0.10, "aliases": ("adagrad",)},
499531
}
500532
```
501533

502-
So the accepted user-facing names are:
534+
So the canonical user-facing names are:
503535

504536
- `Adam`
505-
- `adam`
506537
- `GradientDescent`
507-
- `gd`
508538
- `Momentum`
509-
- `Nesterov`
539+
- `NesterovMomentum`
510540
- `RMSProp`
511541
- `Adagrad`
512542

543+
Accepted aliases also include:
544+
545+
- `adam`
546+
- `gd`
547+
- `nesterov`
548+
513549
---
514550

515551
## Summary Table
@@ -518,7 +554,7 @@ So the accepted user-facing names are:
518554
| ----------------- | --------------------------------------------------- | -------------: | ------------------------------: | ----------------------------------------------------- |
519555
| `GradientDescent` | direct negative-gradient update | No | No | simple but stepsize-sensitive |
520556
| `Momentum` | gradient descent with velocity accumulation | Yes | No | faster than GD, can overshoot |
521-
| `Nesterov` | momentum with look-ahead gradient | Yes | No | often sharper updates, still tuning-sensitive |
557+
| `NesterovMomentum` | momentum with look-ahead gradient | Yes | No | often sharper updates, still tuning-sensitive |
522558
| `Adagrad` | cumulative squared-gradient scaling | No | Yes | adapts well early, can become too conservative |
523559
| `RMSProp` | moving-average squared-gradient scaling | No | Yes | adaptive and stable, but less full-featured than Adam |
524560
| `Adam` | momentum + adaptive second moment + bias correction | Yes | Yes | robust default, but more complex |

notebooks/README_notebooks.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ notebooks/
5555
│ └── vqe/
5656
5757
├── getting_started/
58-
│ ├── vqe_vs_qpe_from_scratch_h2.ipynb
59-
│ └── 13_getting_started_qrte_h2.ipynb
58+
│ ├── 01_vqe_vs_qpe_from_scratch_h2.ipynb
59+
│ └── 11_getting_started_qrte_h2.ipynb
6060
6161
├── vqe/
6262
│ ├── H2/
@@ -72,15 +72,15 @@ notebooks/
7272

7373
If you are new to the repository, begin with:
7474

75-
`notebooks/getting_started/vqe_vs_qpe_from_scratch_h2.ipynb`
75+
`notebooks/getting_started/01_vqe_vs_qpe_from_scratch_h2.ipynb`
7676

7777
This notebook provides compact, conceptual implementations of **VQE** and **QPE** before moving to the packaged workflows used elsewhere in the repository.
7878

7979
Fast path:
8080

81-
- start with `getting_started/01_getting_started_vqe_h2.ipynb` for the basic VQE API
82-
- use `getting_started/06_getting_started_qite_h2.ipynb` for VarQITE
83-
- use `getting_started/13_getting_started_qrte_h2.ipynb` for prepared-state VarQRTE usage
81+
- start with `getting_started/02_getting_started_vqe_h2.ipynb` for the basic VQE API
82+
- use `getting_started/07_getting_started_qite_h2.ipynb` for VarQITE
83+
- use `getting_started/11_getting_started_qrte_h2.ipynb` for prepared-state VarQRTE usage
8484
- use `benchmarks/qite/H2/Exact_QRTE_Benchmark.ipynb` when you want to validate VarQRTE against exact evolution
8585

8686
---
@@ -140,7 +140,7 @@ VarQITE and VarQRTE are demonstrated on H2 as package-client workflows.
140140
| Notebook | Purpose | Style |
141141
| ---------------------------------- | -------------------------- | -------------- |
142142
| `Real_Time.ipynb` | Noiseless VarQRTE on H2 | Package client |
143-
| `getting_started/13_getting_started_qrte_h2.ipynb` | Prepared-state VarQRTE intro on H2 | Package client |
143+
| `getting_started/11_getting_started_qrte_h2.ipynb` | Prepared-state VarQRTE intro on H2 | Package client |
144144

145145
Note:
146146

@@ -223,11 +223,11 @@ Notes:
223223

224224
1. **Conceptual starting point**
225225

226-
* `getting_started/vqe_vs_qpe_from_scratch_h2.ipynb`
226+
* `getting_started/01_vqe_vs_qpe_from_scratch_h2.ipynb`
227227

228228
2. **Core VQE workflow**
229229

230-
* `getting_started/01_getting_started_vqe_h2.ipynb`
230+
* `getting_started/02_getting_started_vqe_h2.ipynb`
231231
* `getting_started/09_bond_scan_h2.ipynb`
232232

233233
3. **Noise studies**
@@ -253,16 +253,16 @@ Notes:
253253

254254
6. **Larger systems and geometry**
255255

256-
* `getting_started/11_adapt_vqe_h3plus.ipynb`
256+
* `getting_started/10_adapt_vqe_h3plus.ipynb`
257257
* `benchmarks/comparisons/multi_molecule/Scaling_Benchmark.ipynb`
258258
* `benchmarks/vqe/H3plus/Ansatz_Comparison_Noiseless.ipynb`
259259
* `benchmarks/vqe/H3plus/Ansatz_Comparison_Noisy.ipynb`
260260
* `vqe/H2O/Bond_Angle.ipynb`
261261

262262
7. **Projected dynamics**
263263

264-
* `getting_started/06_getting_started_qite_h2.ipynb`
265-
* `getting_started/13_getting_started_qrte_h2.ipynb`
264+
* `getting_started/07_getting_started_qite_h2.ipynb`
265+
* `getting_started/11_getting_started_qrte_h2.ipynb`
266266
* `benchmarks/qite/H2/Exact_QRTE_Benchmark.ipynb`
267267
* `qite/H2/Real_Time.ipynb`
268268

0 commit comments

Comments
 (0)