Density noise: mix the perturbed states per quantum number
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend, databases, performance
Research direction
Start with mix_noise_density in src/qops/renorm_bs.cpp, then read NoiseSource in include/qops/renorm_bs.hpp and the tuning paths in include/qops/config.hpp, src/qops/config.cpp, and src/qops/bindings_qops.cpp. Implement and verify the mode 2 behavior in both host and device paths, including deterministic results, conserved (N, 2Sz), and the specified density trace; run the noise tests in tests/python. Compare results at one and two MPI ranks before choosing how to combine channels.
Written by the indexing model from the issue text.
Description
🤖 AI text below 🤖
Carries forward the plan of #66, which is closed in favour of this issue. Related: #15, #24, #65.
Where it stands
- Cost. #66 measured the density half of the noise on the host at 22-54 % of a noisy sweep
(H16/H24 STO-3G). Since cea717f the noise channels' transforms and densities run as device GEMM
batches (same switch as the decimation's density build,DMRG_QOPS_GPU_DENSE). Measure again
before deciding anything on cost. - Quality, the open part. Over 25 cell/bond-dimension pairs with FCI references, our density
noise (noise_jitter=0) ended more than 0.1 mHa worse than its noiseless run in 7 cases, block2's
ReducedPerturbativeCollectedin 2. The per-quantum-number mix below is the proposed fix. noise_jitterfrom #24 runs the density half alone, which is what the A/B below needs.- Step 2 now has to go into both paths of
mix_noise_density(src/qops/renorm_bs.cpp): the host
channels and the device batches. - Spin-adapted runs (
sym='su2') have no noise yet. - The jitter half has its own proposed fix in #24 (jitter only a solve that accepted its guess in
one Davidson iteration); it is separate from this plan.
How today's density half differs (from #66)
- Operators. Ours are the old block's operators (cre/des, S, A, B, H), with the dot index untouched. The reference applies the operators of the enlarged block (block ⊗ dot).
- How channels combine. Ours builds one density per operator. The reference first sums the perturbed states that share a quantum number (at most 13 in SZ) and builds one density each.
- Scaling. Ours scales the whole sum once to
λ·tr ρ, so large operators (H, the integral-weighted S) dominate. The reference normalizes each perturbed state first, then the set.
Plan (from #66)
-
The switch. Add a
noise_densitytuning key andDMRG_NOISE_DENSITYenv var next tonoise_jitter(include/qops/config.hpp,src/qops/config.cpp,apply_tuninginsrc/qops/bindings_qops.cpp). Values:- −1/1: today's per-operator mix (the default);
- 2: the per-quantum-number mix;
- 0: density half off, which allows a jitter-only run and completes the A/B.
Carry the mode in
NoiseSource(include/qops/renorm_bs.hpp), set wherenoise_opsfills it (src/qops/dmrg_qops.cpp, sys and env decimation). Document it indocs/api.md. -
Per-quantum-number mix, in
mix_noise_density(src/qops/renorm_bs.cpp).- Keep the per-operator transform w = (O ⊗ 1)Ψ.
- Add w into one perturbed state per ΔQ = q(bra sector) − q(ket sector), keyed by (ΔQ, dot index, row start, column start).
- Normalize each state, then scale the set to
λ·⟨Ψ|Ψ⟩. - Build the ≤13 densities with the existing sector-grouped accumulation.
That cuts the density builds from one per operator to at most 13; the transforms stay one per operator. Keep it deterministic: fixed operator and ΔQ order, and the same parallel pattern.
Open for MPI: the channels are split by owner. Either reduce the densities as now, which makes the result depend on the rank count, or allreduce the ≤13 states, which is rank-independent and moves about 13×|Ψ| per bond. Decide after np=1 vs np=2.
-
Enlarged-block operators, only if 1-2 leave a gap to the reference. Add the dot's own operators and the block × dot terms.
grow_renorm_bsalready builds them in dot-transfer-block form O_ab (include/qops/qops.hpp). Apply them to Ψ's dot slices instead of projecting them. -
Optional: move the noise transforms and densities to the GPU.Done on main (cea717f): the per-operator transforms and sector densities run as device GEMM batches.
Tests and benchmark (from #66)
Tests, in tests/python:
noise_density=1is bit-identical to today.noise_density=0withnoise_jitter=0is bit-identical to the noiseless run.noise_density=2is bit-identical at 1/4/8 threads, stays in the target (N, 2Sz), and the added density has traceλ·tr ρ.- The existing noise gates stay green.
The benchmark is not a gate and goes to #65. It reruns the 25-pair table above (cold and CISD starts, noise_density 0/1/2 × jitter on/off) and the H16/H24 cost. The scheme is worth keeping if:
- mode 2 is worse than noiseless no more often than the reference;
dec/noisedrops by roughly the operator count over 13 on its density part;- the H24 noisy sweep comes clearly closer to a quiet one.
Refs #15, #24, #65.
The noise mechanisms note (noise-mechanisms.md from #24/#66, moved out of the repository)
The two noise mechanisms, and how they compare to block2
Written 2026-08-27 while investigating issue #15. Companion to the noise_jitter switch added in
PR #24. Read this before changing anything about noise.
Summary
A noise sweep in this engine perturbs the run in two independent places. They are not two
versions of the same idea. They fix different problems, and only one of them exists in block2's
default settings.
| half | what it does | block2 name | in block2 by default? |
|---|---|---|---|
| density enrichment | mixes extra directions into the density matrix, so different states survive truncation | Perturbative |
yes |
| guess jitter | adds small offsets to the Davidson starting guess, so the solve moves | Wavefunction |
no |
The density half is White's density-matrix perturbation. The jitter is not.
Issue #15 is caused by the jitter. Every escape the noise feature buys is also caused by the
jitter. That is the whole tension.
What the two halves are, in this code
Density enrichment — mix_noise_density, src/qops/renorm_bs.cpp:305. Before each
decimation:
rho <- rho + lambda * sum_O (O Psi)(O Psi)^T / trace
O runs over the operators of the block being absorbed: cre, des, S, A, B, H
(collected in noise_ops, src/qops/dmrg_qops.cpp:2145). These are the operators that live at
the bond, so the injected directions point along directions the Hamiltonian actually couples.
It has the form of White's 2005 correction and of block2's perturbative noise, but it is not the
same scheme. Three differences, read from both codes:
- Operators. Ours are the old block's, and the dot index is left untouched. White's are the
system block's operators inH = Σ A_i ⊗ B_i, and block2 applies its MPO's left operators on
the enlarged block (block ⊗ dot). - How channels combine. Ours builds one density per operator. block2's default (
Reduced)
first sums the perturbed states that share a quantum number, at most 13 in SZ, and builds one
density each. - Scaling. Ours scales the whole sum once to
λ·tr ρ, so the large operators (H, the
integral-weighted S) dominate. block2 normalizes each perturbed state first, then the set.
The cost differs with the second point: one density build per operator here, at most 13 there.
Guess jitter — solve_bond, src/qops/dmrg_qops.cpp:760. After the transported guess is
canonicalized and before the Davidson runs, every element of every existing block gets a
hash-derived offset scaled to lambda times the guess norm.
It only writes into blocks that already exist, so N and 2Sz are strictly conserved. It is not
"off-symmetry" noise. What it does not conserve is S-squared, and in this engine nothing else does
either — the sector is (N, 2Sz) only, by design. That is how a schedule can walk a singlet run
into a quintet.
How they map to block2 and to White
block2's NoiseTypes enum (read from the installed pyblock2):
Wavefunction 1 random noise on the wavefunction
DensityMatrix 2 random noise on the density matrix
Perturbative 4 White's perturbative noise
Reduced 8 |
Unscaled 16 | evaluation and memory variants of Perturbative,
Collected 32 | same underlying math
LowMem 64 |
MidMem 128 |
pyblock2/driver/core.py:4622 sets the default when the caller does not:
if noise_type is None:
noise_type = "ReducedPerturbativeCollected"
So block2's default is a density perturbation, and nothing else. Wavefunction noise exists there
but is not switched on unless you ask for it. It is not quite our jitter either: it perturbs the
solved state before the split, with norm √noise, where ours perturbs the Davidson guess before
the solve, with norm about λ/√3.
tuning={'noise_jitter': 0} runs our density half alone. That is the same kind of mechanism as
block2's default, not the same one (see above), and they do not behave the same:
| density noise vs its own noiseless run, 25 cell/M pairs | worse | better | worst |
|---|---|---|---|
| ours, cold start | 7 | 5 | +42.5 mHa |
ours, ci_guess='cisd' |
5 | 3 | +9.4 mHa |
| block2 default, SZ | 2 | 8 | +0.65 mHa |
Exact FCI references, the schedule below, 30 sweeps, a change of more than 0.1 mHa counted
(2026-09-25, on this tree). Ours also costs more: 40-54% of a noisy sweep on H24 at M = 1000.
The follow-up is the density-noise PR.
What we measured
All runs single-threaded, fixed integrals, on a busy box (correctness numbers only, no timings).
Probes are in the gitignored local/: probe_noise_jitter_ab.py and
probe_noise_jitter_escape.py.
The bug cell — N2/cc-pVDZ CAS(10,10) at r = 2.0, M = 64, plain compute(), schedule
[1e-3]*4 + [1e-4]*2 + [1e-5]*2:
| run | E - E(exact) | S^2 | sweeps |
|---|---|---|---|
| no noise | +3.365e-03 | 0.00 | 19, converged |
| both halves | +2.929e-02 | 6.00 | 28, converged |
| density only | +4.498e-03 | 0.00 | 30, not converged |
| density only, repeated | same bits | 0.00 | |
| jitter forced on | +2.929e-02 | 6.00 | same as default |
The cells the feature was written for (issue #5):
| cell | no noise | both halves | density only |
|---|---|---|---|
| OH 6-31G CAS(6,7), bd 16 / 24 / 40 | +2.641e-03, stuck | reaches CASCI | +2.641e-03, same as no noise |
| OH, bd 32 / 48 (already fine) | CASCI | CASCI | CASCI |
| OH, bd 12 | +1.696e-01, third eigenstate | +3.3e-05 | +1.696e-01, same as no noise |
| O2 STO-3G CAS(8,6), bd 8 | +2.211e-01, second eigenstate | +2.9e-03 | +2.211e-01, same as no noise |
Measured on main 552ef65 plus this branch (2026-09-24). The trapped OH rungs moved since #5:
bd 24 now traps and bd 32 does not.
On the trapped cells the density half matches the no-noise run (to 5e-10 at bd 12, which
truncates). It does nothing at all. A truncated cell such as N2 STO-3G bd 8 is not in this table:
there the schedule lands above or below the no-noise run depending on the orbital order and the
integral bytes (#15).
Why the density half cannot fix the OH trap
The OH trap has dw = 0. Nothing is discarded, so the kept basis is already the complete one.
A density-side noise can only change which states survive truncation. Where nothing is
truncated, there is nothing for it to change. The kept set is the same set with or without it, so
the run is identical.
This is not an implementation gap and it is not fixable by copying block2 more closely. It is what
a density-side noise is.
The consequence: the two halves cover different failure modes, and neither covers both.
| truncation active | lossless bond (dw = 0) |
|
|---|---|---|
| density (White / block2) | works — changes what is kept | powerless |
| jitter (wavefunction side) | works, and also picks a basin — the #15 bug | the only thing that can move the solve |
Prediction, not yet measured: block2 with its default noise cannot escape the OH trap either.
Worth running, because the issue's cross-check only ever ran block2 on the cell where our noise
misbehaves — never on the cells where our noise is the thing that works.
What block2 does when a run is stuck
- Spin adaptation (SU2), its default. A wrong-spin fixed point is unreachable, so the worst
version of this problem cannot happen. We cannot copy this: SZ only, by design. NoiseTypes.Wavefunction. The same idea as our jitter. Available, not default.- Bond-dimension ramps with noise schedules. Standard practice, and it works while truncation
is still active. - A random or different starting MPS. Re-rolls the basin rather than escaping it.
- Orbital reordering. Changes the landscape so the trap may not exist in the new ordering. We
have this too.
So block2's practical answer to "stuck" is mostly to make the wrong-spin case impossible up front,
plus re-rolling the start. It has no better escape than ours for a lossless trap. It has a stronger
constraint that stops the bad case from arising.
That is the reason the fix here is not "become more like block2". The jitter does something their
default cannot do. It just needs to stop firing when it is not needed.
Options
- Gate the jitter on a stalled solve. Apply it only when the Davidson finished in one
iteration, which means it accepted the transported guess unchanged. That is exactly the
lossless-trap case, and it excludes every solve that was already moving — which is where the
basin flipping happens. Both Davidson paths already report the iteration count
(g_bond_dav_iters,gpu_davidson_last_iters()) and both already share the residual across
ranks, so the decision is safe under MPI. - Make the jitter multiplicative.
v += amp * |v| * xiinstead ofv += amp * xi. It still
breaks a zero residual, but it cannot put weight into a configuration that has none, so it
cannot manufacture quintet character. One-line change, easy to compare against option 1. - Keep-the-best guard. Noise makes a run non-monotonic. Remembering the best clean sweep would
have made issue #15 report +3.4e-03 instead of +2.9e-02, whatever the noise did along the way.
Generic protection, independent of which noise is used. - S-squared penalty — checked and parked. It cannot be folded into the integrals: the
S+ S-terms are not spin-diagonal per index, sog2e_abcannot express them. It needs a real
S-squared operator inside the engine. Out of proportion to the problem for now.
Open experiments
- block2 on our trapped cells. Partly measured (2026-09-25). block2 starts from a random
MPS, and that start does not fall into the O2 bd 8 or OH bd 12 traps at all (0.000 and
+0.035 mHa noiseless). On OH bd 8 its default noise stays near the trap (+2.749 → +2.723 mHa)
where our jitter escapes (+0.084). The OH band (bd 16 / 24 / 40) is not run yet. - Noise against different starting points. Measured for the cold start,
ci_guess='cisd'
and a random dense CI vector (2026-09-25, same 25 pairs as the table above). Noiseless runs
ending more than 10 mHa above the best run: CISD 1, cold 9, random CI 12. CISD removes the
traps: O2 bd 8 +221.081 → 0.000, OH bd 12 +169.593 → +0.011, and #15's quintet (a singlet at
+10.6 / +3.4 mHa at M = 32 / 64). The guess that a CISD trial could be more trap-prone was
wrong on these cells.project()andrestart()are not in this run.
Status
- The switch exists:
DMRG_NOISE_JITTER/tuning={'noise_jitter': 0}. Default unchanged, both
halves on. See the gate table indocs/api.md. - Container suite: 87/87 with the switch in place.
- No fix yet. Issue #15 stays open.
- Dominant language
- C++
- Stars
- 3
- Forks
- 0
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 31
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Algorithmiq/exa-dmrg
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Algorithmiq/exa-dmrg#153 ·
Maintainers usually reply within 2 days
-
Add CITATION.cff once the paper is outPossibly taken @FabioTarocco claimed this 1 day ago. Opendocumentation request
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Algorithmiq/exa-dmrg#106 · 2 assignees ·
Maintainers usually reply within 2 days
-
bug
Difficulty 5/5 Over a week Newbie friendliness 35/100
Algorithmiq/exa-dmrg#161 ·
Maintainers usually reply within 2 days
-
bug cpp
Difficulty 5/5 Over a week Newbie friendliness 35/100
Algorithmiq/exa-dmrg#157 ·
Maintainers usually reply within 2 days
-
Shorten the tests of the wheels in cibuildwheelPossibly taken @robertodr claimed this 1 day ago. Openci request
Algorithmiq/exa-dmrg#155 · 1 comment · 1 assignee ·
Maintainers usually reply within 2 days
All issues in Algorithmiq/exa-dmrg
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
simnJS/AnyPS5#735 · 1 comment ·
Maintainers usually reply within 1 day
-
area:tests kind:test
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
? - Needs Triage bot_watch bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA/cudf-spark-jni#5594 ·
Maintainers usually reply within 1 day
-
Branch-master
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
TrinityCore/TrinityCore#32177 ·
Maintainers usually reply within 10 days