Skip to content

feat: PT2 configuration selection for HI-NQS v3 (ADR-005)#31

Merged
George930502 merged 22 commits into
QuantumNoLab:mainfrom
thc1006:feat/pt2-selection
Apr 2, 2026
Merged

feat: PT2 configuration selection for HI-NQS v3 (ADR-005)#31
George930502 merged 22 commits into
QuantumNoLab:mainfrom
thc1006:feat/pt2-selection

Conversation

@thc1006
Copy link
Copy Markdown
Member

@thc1006 thc1006 commented Apr 1, 2026

feat: HI-NQS v3 PT2 配置篩選(ADR-005)

重新實作 PR #30@leo07010)的演算法改進,遵循專案慣例。

Co-authored-by: leo07010 leo07010@gmail.com

變更內容

  • PT2 配置篩選:Epstein-Nesbet PT2 scoring 篩選 NQS 樣本(use_pt2_selection=True
  • ASCI 係數驅逐:保留最高 |c_i|² 的 configs(max_basis_size
  • 3-term NQS teacher loss:teacher KL + energy REINFORCE + entropy 正則化
  • 溫度退火:線性排程 initial_temperaturefinal_temperature
  • IBM solve_fermion 自動啟用:安裝 qiskit_addon_sqd 時自動使用 α×β Cartesian product(精度大幅提升)
  • 移除 S-CORE:經典 NQS 樣本不需要量子硬體噪聲修復(NH₃: 1.5 hr → 5 s)
  • _pt2_helpers.py:獨立純函式(PT2 scoring、eviction、temperature)
  • _train_nqs_teacher 加強驗證energy_weight > 0 但沒給 hamiltonian 時 raise ValueError
  • 測試穩定性:patch _IBM_SQD_AVAILABLE 確保不受安裝環境影響

Benchmark 結果

小分子(HI-NQS IBM)

系統 能量 (Ha) 誤差 組態數 時間
H₂O 14Q -75.0129 FCI exact 333 4.7s
NH₃ 16Q -55.5192 FCI exact 905 5.2s

C2H2 24Q — HI-NQS vs SCI 對比(Numba + IBM solver,充足參數)

方法 能量 (Ha) 組態數 時間
SCI(自然收斂) -76.0245276 7,406 1,088s
HI-NQS IBM(5K samples) -76.0245738 5,432 456s

HI-NQS 低 0.46 mHa,快 2.4 倍,組態更少。

N₂ CAS(10,20) 40Q — SCI vs HI-NQS 對比

方法 能量 (Ha) 組態數 時間 RAM
SCI(50K 上限,未收斂) -109.2132 50,000 3h45m 60 GB
HI-NQS IBM(5K samples) -109.1844 6,868 20 min ~2 GB

SCI 低 28.8 mHa,但 11.5x 時間、30x 記憶體、仍未收斂。差距改善方向:Issue #35 Tier 1(H-connection + E_PT2)。

實作進度

  • P0: Config fields(9 個新 frozen fields,向後相容)
  • P1: 獨立 helpers(_pt2_helpers.py:PT2 scoring、eviction、temperature)
  • P2: 3-term NQS loss(teacher + energy + entropy)
  • P3: 整合至 run_hi_nqs_sqd 主迴圈
  • P4: CIPSI sparse fallback
  • P5: Self code review + Copilot review 修復
  • P6: 最終 benchmark 驗證(含 SCI 對比)

設計文件

docs/decisions/005-pt2-selection-hi-nqs-v3.md(ADR-005)。

測試計畫

  • 35 個單元測試
  • H₂O、NH₃ 達到 FCI exact
  • C₂H₂ 24Q:HI-NQS 低 SCI 0.46 mHa
  • N₂ 40Q:-109.1844 Ha(6,868 configs)
  • SCI vs HI-NQS 完整對比(C2H2 + 40Q,充足參數)
  • 測試 patch _IBM_SQD_AVAILABLE 確保行為確定性

部分解決 Issue #35(Tier 1 改善延後至 follow-up)

thc1006 and others added 2 commits April 2, 2026 04:55
Co-authored-by: leo07010 <leo07010@gmail.com>
- HINQSSQDConfig: 9 new frozen fields (use_pt2_selection, pt2_top_k,
  max_basis_size, convergence_window, temperatures, loss weights)
  All default to backward-compatible values.

- New _pt2_helpers.py with 3 pure functions:
  - compute_pt2_scores: EN-PT2 scoring via get_connections
  - evict_by_coefficient: ASCI-pattern |c_i|² eviction
  - compute_temperature: linear annealing

- 22 TDD tests (11 config + 3 PT2 + 4 eviction + 4 temperature)

Co-authored-by: leo07010 <leo07010@gmail.com>
_train_nqs_teacher now accepts teacher_weight/energy_weight/entropy_weight
kwargs. Uses full |c_x|² joint distribution (NOT α/β marginal product).
Energy term uses diagonal advantage with REINFORCE gradient.
Gradient clipping (max_norm=1.0) added for training stability.
Backward compatible: default weights give teacher-only loss.

Co-authored-by: leo07010 <leo07010@gmail.com>
@thc1006 thc1006 force-pushed the feat/pt2-selection branch from a94ac57 to 4c87876 Compare April 1, 2026 21:53
thc1006 and others added 3 commits April 2, 2026 06:00
…P3, ADR-005)

When use_pt2_selection=True:
- Temperature annealing (initial→final linear schedule)
- PT2 EN scoring filters unique_new configs (keep top_k)
- Coefficient-based eviction after diag (ASCI |c_i|² pattern)
- Convergence window (N consecutive ΔE < threshold)
- 3-term loss weights passed to _train_nqs_teacher

When use_pt2_selection=False (default): zero change to existing behavior.
All 32 PT2 tests + 405 regression tests pass.

Co-authored-by: leo07010 <leo07010@gmail.com>
When basis exceeds _SPARSE_DIAG_THRESHOLD (10K), CIPSI uses
build_sparse_hamiltonian + scipy eigsh instead of dense
matrix_elements_fast + numpy eigh. Prevents OOM on large bases.

Co-authored-by: leo07010 <leo07010@gmail.com>
- Fix np.argsort()[::-1] producing negative-stride arrays that torch
  cannot handle — add .copy() in hi_nqs_sqd.py and _pt2_helpers.py
- Update AGENTS.md: add _pt2_helpers.py to repo structure
- Update CHANGELOG.md: add PT2 selection, 3-term loss, CIPSI sparse entries

LiH E2E verified: PT2 ON = 0.07 mHa (7.7x better than OFF = 0.54 mHa)

Co-authored-by: leo07010 <leo07010@gmail.com>
@thc1006 thc1006 marked this pull request as ready for review April 1, 2026 22:10
Copilot AI review requested due to automatic review settings April 1, 2026 22:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements ADR-005’s PT2-based configuration selection flow for HI+NQS+SQD v3, reintroducing the PR #30 ideas with updated conventions and adding a CIPSI sparse diagonalization fallback.

Changes:

  • Add standalone PT2 utilities (Epstein–Nesbet scoring, coefficient eviction, temperature annealing) and wire them into run_hi_nqs_sqd behind a config gate.
  • Extend HINQSSQDConfig and enhance _train_nqs_teacher with optional 3-term loss weights.
  • Add sparse eigsh diagonalization path in CIPSISolver for large bases, plus a comprehensive new PT2 selection test suite and ADR documentation.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/qvartools/methods/nqs/_pt2_helpers.py New helper module for PT2 scoring, eviction, and annealing.
src/qvartools/methods/nqs/hi_nqs_sqd.py Config extensions + PT2 selection integration + 3-term teacher training weights.
src/qvartools/solvers/subspace/cipsi.py Sparse diagonalization fallback for large CIPSI bases.
tests/test_methods/test_pt2_selection.py New tests covering config defaults, helper functions, teacher loss signature, integration wiring, and CIPSI sparse path.
docs/decisions/005-pt2-selection-hi-nqs-v3.md New ADR documenting design decisions and implementation plan.
CHANGELOG.md Changelog entries for PT2 selection, helpers, 3-term loss, and CIPSI sparse fallback.
AGENTS.md Updates repository map to include _pt2_helpers.py and PT2 selection notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py
Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
Comment thread src/qvartools/methods/nqs/_pt2_helpers.py
Comment thread src/qvartools/methods/nqs/_pt2_helpers.py
Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
Comment thread src/qvartools/solvers/subspace/cipsi.py
Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py
Critical fixes:
- #1/#2: Use persistent prev_coeffs/prev_batch_configs for PT2 scoring
  (was using best_coeffs before it was defined in current iteration)
- QuantumNoLab#5: Eviction checks cumulative_basis size (was checking best_batch_configs)
- QuantumNoLab#7: Convert numpy indices to torch.LongTensor before indexing CUDA tensor
- QuantumNoLab#8: Default energy_weight=0.0, entropy_weight=0.0 (was 0.1/0.05,
  silently changing existing behavior)

Lower priority fixes:
- QuantumNoLab#6: CIPSI docstring mentions build_sparse_hamiltonian requirement
- QuantumNoLab#9: Warn when energy_weight>0 but hamiltonian=None

Not applicable (won't fix):
- QuantumNoLab#3/QuantumNoLab#4: config_integer_hash returns tuple for n_sites>=64; our CAS max
  is 58Q (<64), so int cast is safe

Co-authored-by: leo07010 <leo07010@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
Comment thread tests/test_methods/test_pt2_selection.py Outdated
thc1006 and others added 2 commits April 2, 2026 06:36
Remove int() casts on config_integer_hash results. For n_sites >= 64,
the hash is a tuple (hash_hi, hash_lo), not an int. Using hash values
directly as dict keys works for both int (<64) and tuple (>=64) cases.

Previously dismissed as "not applicable" (max registry 58Q) but
user confirmed 64-72Q support is planned.

Co-authored-by: leo07010 <leo07010@gmail.com>
Copilot fixes:
- #1: top_idx on same device as unique_new (CUDA compat)
- #2: use prev_energy (consistent with prev_coeffs eigenvector)
- QuantumNoLab#3: eviction log only when eviction actually occurred
- QuantumNoLab#4: remove dead test code, clarify as smoke test

New:
- 64+Q hash support (remove int() casts, use hash values directly)
- Cr₂-CAS(12,32) @ 64Q and Cr₂-CAS(12,36) @ 72Q registry entries
- Both MOLECULE_REGISTRY and _MOLECULE_INFO_REGISTRY synced (26 total)

Co-authored-by: leo07010 <leo07010@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
Comment thread tests/test_methods/test_pt2_selection.py
Comment thread tests/test_methods/test_pt2_selection.py Outdated
Comment thread tests/test_methods/test_pt2_selection.py Outdated
Comment thread tests/test_methods/test_pt2_selection.py Outdated
Critical fix: eviction previously used best_batch_configs (random subset)
as cumulative_basis replacement, silently discarding configs from other
batches. Now runs a dedicated full-basis diag (dense or sparse) to get
|c_i|² for ALL configs before evicting — correct ASCI approach.

Also:
- CIPSI sparse test now spies on build_sparse_hamiltonian to verify dispatch
- prev_batch_configs.clone() prevents memory leak from tensor reference
- Log warning when max iterations exhausted without convergence

Co-authored-by: leo07010 <leo07010@gmail.com>
@thc1006 thc1006 force-pushed the feat/pt2-selection branch from 517004c to df38dd1 Compare April 1, 2026 22:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py
Comment thread tests/test_methods/test_pt2_selection.py Outdated
Comment thread tests/test_methods/test_pt2_selection.py Outdated
…lot PR QuantumNoLab#31)

- diag_e moved to NQS device to prevent device mismatch
- CIPSI test uses monkeypatch instead of manual restore (exception-safe)
- Renamed test to test_cipsi_sparse_energy_matches_dense with actual comparison

Co-authored-by: leo07010 <leo07010@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
Comment thread src/qvartools/solvers/subspace/cipsi.py
- cipsi.py: h_matrix.detach().cpu().numpy() instead of np.asarray (CUDA safe)
- hi_nqs_sqd.py: after eviction, persist post-eviction basis/coeffs/energy
  as PT2 reference (was using stale pre-eviction batch state)

Co-authored-by: leo07010 <leo07010@gmail.com>
CI flaky failure on Python 3.11 due to non-deterministic NQS sampling.

Co-authored-by: leo07010 <leo07010@gmail.com>
thc1006 and others added 3 commits April 2, 2026 08:52
- Use α/β marginals for teacher weights (not Cartesian product expansion
  which caused 76GB memory + 2.5hr runtime)
- Add nuclear_repulsion to solve_fermion energy (returns electronic only)
- C2H2 verified: -76.0246 Ha (0.004 mHa gap vs PR QuantumNoLab#30 target)

Co-authored-by: leo07010 <leo07010@gmail.com>
α×β Cartesian product in solve_fermion gives dramatically better accuracy:
- C2H2 24Q: 0.004 mHa (vs 133 mHa with gpu_solve_fermion)
- N₂ 40Q: 13.1 mHa (vs 126 mHa with gpu_solve_fermion)

Auto-detect at runtime; falls back to gpu_solve_fermion when not installed.

Co-authored-by: leo07010 <leo07010@gmail.com>
- Remove recover_configurations (S-CORE) from IBM path — designed for
  noisy quantum hardware, not clean NQS samples. NH3 went from 1.5hr
  to 5.2s with no accuracy loss (FCI precision).
- Remove dead import of recover_configurations
- Read spin_sq from mol_info instead of hardcoded singlet (spin_sq=0)

Verified: H2O FCI exact, NH3 FCI exact, C2H2 0.004 mHa, N₂ 40Q 13.1 mHa.

Co-authored-by: leo07010 <leo07010@gmail.com>
@thc1006
Copy link
Copy Markdown
Member Author

thc1006 commented Apr 2, 2026

關於 3 個 Copilot 留言(3025025401, 3025025430, 3025025439):

已在 commit e0423b3 修復:

  • Docstring defaults:更新為 0.0 匹配實際程式碼
  • inspect.getsource test:刻意的 wiring smoke test(H2 只有 16 configs 無法行為測試;E2E 驗證於 C2H2 和 40Q)
  • _CIPSI_SPARSE_THRESHOLD:移除(dead code)

最終 Benchmark(IBM solve_fermion + Numba,充足參數)

系統 能量 (Ha) 組態數 時間 備註
H₂O 14Q -75.0129 333 4.7s FCI exact
NH₃ 16Q -55.5192 905 5.2s FCI exact
C₂H₂ 24Q -76.0245738 5,432 456s HI-NQS 贏 SCI 0.46 mHa
N₂ 40Q -109.1844 6,868 1,173s SCI 贏 28.8 mHa

詳細 SCI 對比見最新留言。

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/qvartools/methods/nqs/_pt2_helpers.py
Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
Comment thread tests/test_methods/test_pt2_selection.py
Code fixes:
- _train_nqs_teacher raises ValueError when energy_weight > 0 without hamiltonian
- Tests patch _IBM_SQD_AVAILABLE=False for deterministic behavior

Documentation updates:
- AGENTS.md: 26 molecules (12+14 CAS), 64/72Q rows, IBM solver + S-CORE gotchas
- README.md: 26 molecules, Cr2-CAS(12,32) 64Q and Cr2-CAS(12,36) 72Q
- CHANGELOG.md: IBM solver auto-enable, S-CORE removal, nuclear_repulsion fix
- api_reference.md: _pt2_helpers API (PT2 scoring, eviction, temperature)

Co-authored-by: leo07010 <leo07010@gmail.com>
@thc1006
Copy link
Copy Markdown
Member Author

thc1006 commented Apr 2, 2026

SCI vs HI-NQS 最終 Benchmark 對比(2026-04-02,Numba + IBM solver,充足參數)

C2H2 24Q

方法 能量 (Ha) 組態數 時間 收斂
SCI(自然收斂) -76.0245276301 7,406 1,088s
HI-NQS IBM(5K samples/iter) -76.0245737905 5,432 456s

HI-NQS 比 SCI 低 0.46 mHa,快 2.4 倍,組態更少。

N₂ CAS(10,20) 40Q

方法 能量 (Ha) 組態數 時間 收斂 RAM
SCI(50K 上限) -109.2132327214 50,000 13,505s (3h45m) 60 GB
HI-NQS IBM(5K samples/iter) -109.1844383603 6,868 1,173s ~2 GB

SCI 能量低 28.8 mHa,但花了 11.5 倍時間、30 倍記憶體,且在 50K configs 仍未收斂。

分析

  1. ≤24Q:HI-NQS 已超越 SCI — 能量更低、速度更快、組態更少。IBM solve_fermion 的 α×β Cartesian product 是關鍵。
  2. 40Q:SCI 的系統化 H-connection expansion 找到更多重要 determinants,但代價巨大(3h45m + 60GB)。HI-NQS 只需 1/11 時間、1/30 記憶體。
  3. HI-NQS 精度和取樣量正相關:C2H2 從 2K samples(-76.02297)增加到 5K samples(-76.02457)改善 1.6 mHa。40Q 同理,增加取樣可進一步改善。
  4. 40Q 差距(28.8 mHa)的改善方向:Issue perf: accuracy improvement roadmap for 40Q+ CAS (28.8 mHa gap vs SCI) #35 Tier 1 — 將 H-connection expansion 整合進 HI-NQS,結合 NQS 的速度優勢和 SCI 的系統化搜索。
  5. SCI 實作瓶頸:固定 expansion_size=500(應倍增)、無 E_PT2 修正、無 heat-bath sampling。文獻中 SHCI 在同規模系統只需 14 秒。

thc1006 added 2 commits April 2, 2026 14:12
Add smoke test, docs build, concurrency, pip cache descriptions
to match the merged CI workflow.
C2H2: HI-NQS wins SCI by 0.46 mHa, 2.4x faster.
40Q: SCI wins by 28.8 mHa but 11.5x slower, 30x more RAM.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/qvartools/methods/nqs/hi_nqs_sqd.py Outdated
advantage(x) = H_xx - <H_xx>_{p_teacher} (teacher-weighted mean),
not H_xx - E_0 as previously documented.
@George930502
Copy link
Copy Markdown
Collaborator

Code review

Found 3 issues:

  1. use_ibm_solver=False is silently overridden when qiskit_addon_sqd is installed. The line use_ibm = cfg.use_ibm_solver or _IBM_SQD_AVAILABLE uses or instead of and, so the IBM solver activates regardless of the user's explicit opt-out. The config docstring says "Set to True only if qiskit_addon_sqd is installed with a compatible API version", and ADR-005 D4 says "preserve the existing pattern" of the guard. The or should be and.

# dramatically better accuracy: 13 mHa vs 126 mHa at 40Q).
use_ibm = cfg.use_ibm_solver or _IBM_SQD_AVAILABLE
if use_ibm and not cfg.use_ibm_solver:
logger.info("Auto-enabling IBM solve_fermion (qiskit_addon_sqd available)")

  1. CIPSI sparse diagonalization path is dead code. _SPARSE_DIAG_THRESHOLD = 10_000 equals _MAX_BASIS_SIZE = 10_000. The CIPSI loop breaks when n_basis >= max_basis_size, so n_basis can never exceed 10,000. The sparse path triggers at n_basis > _SPARSE_DIAG_THRESHOLD, which requires n_basis > 10_000 -- impossible under the current growth cap. Either lower the sparse threshold (e.g., 8,000) or raise the max basis size.

_MAX_ITERATIONS = 30
_MAX_BASIS_SIZE = 10_000
_CONVERGENCE_THRESHOLD = 1e-5 # Hartree
_EXPANSION_SIZE = 500
_SPARSE_DIAG_THRESHOLD = 10_000 # switch to sparse eigsh above this basis size

  1. prev_energy used as E0 in PT2 scoring is set from best_batch_energy (the minimum energy from a batch sub-sample of the cumulative basis), not the full-basis ground-state energy. As the cumulative basis grows larger than max_configs_per_batch, the sub-batch energy diverges from the true ground-state energy, making PT2 scores inconsistent with the EN-PT2 formula described in ADR-005.

prev_coeffs = best_coeffs.copy()
prev_batch_configs = best_batch_configs.clone()
prev_energy = best_batch_energy

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

1. use_ibm_solver: tri-state (None=auto, True=force, False=disable)
   instead of bool that silently overrides user opt-out
2. CIPSI _SPARSE_DIAG_THRESHOLD: 10K → 8K so sparse path is reachable
   with default max_basis_size=10K
3. Document PT2 E0 approximation from batch sub-sample vs full-basis

Co-authored-by: leo07010 <leo07010@gmail.com>
@thc1006
Copy link
Copy Markdown
Member Author

thc1006 commented Apr 2, 2026

回覆 code review(3 條,commit c961e0b

1. use_ibm_solver opt-out 問題 ✅ 已修正

  • 改為 tri-state:None(default)= auto-detect、True = 強制啟用、False = 強制停用
  • 之前 bool + or 邏輯無法區分「未設定」和「明確停用」

2. CIPSI sparse dead code ✅ 已修正

  • _SPARSE_DIAG_THRESHOLD 從 10K 降至 8K
  • Default max_basis_size=10K 時,basis 8001-10000 會走 sparse path
  • 自訂 max_basis_size>10K 時(如我們的 50K benchmark)本來就能觸發

3. prev_energy batch 近似 ✅ 已加文件說明

  • 當 cumulative_basis > max_configs_per_batch 時,best_batch_energy 是隨機子集的近似值
  • 這是精度-效能的 trade-off:full-basis diag 每 iteration 太貴
  • eviction path 已使用 full-basis diag,確保驅逐時 E0 是精確的
  • 在 comment 中說明了這個近似及其合理性

@George930502 George930502 merged commit 0fbf1c4 into QuantumNoLab:main Apr 2, 2026
7 checks passed
@thc1006 thc1006 deleted the feat/pt2-selection branch April 2, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants