Skip to content

Add eigh eigenvalue error check#156

Open
msaroufim wants to merge 1 commit into
mainfrom
add-eigh-eigenvalue-bound
Open

Add eigh eigenvalue error check#156
msaroufim wants to merge 1 commit into
mainfrom
add-eigh-eigenvalue-bound

Conversation

@msaroufim

Copy link
Copy Markdown
Member

Summary

  • Add a direct eigenvalue accuracy gate for eigh outputs using torch.linalg.eigvalsh(A).
  • Keep the existing invariant checks for A @ Q = Q @ diag(L), reconstruction, orthogonality, sorting, shapes, devices, and finiteness.
  • Document the eigenvalue check in the problem description.

Rationale

The residual invariants validate the returned decomposition, but they do not explicitly bound the returned eigenvalue spectrum. Eigenvalues do not have the sign/eigenspace ambiguity that eigenvectors do, so comparing L against eigvalsh(A) is a clean extra correctness gate.

The new check uses a loose n * eps32-scaled tolerance consistent with the existing residual checks, and scales the error by the larger of ||eigvalsh(A)||_inf, ||A||_1 / n, and 1.0.

Validation

  • /Users/mark/Dev/kernelbot/.venv/bin/ruff check problems/linalg/eigh_py
  • /Users/mark/Dev/kernelbot/.venv/bin/python -m py_compile problems/linalg/eigh_py/*.py problems/linalg/eigh_py/submissions/*.py
  • git diff --check
  • Parsed task.yml: tests=39, benchmarks=13
  • Local KernelBot debug API on B200:
    • torch_eigh.py test: 39/39 passed, evaluator duration 7.396s
    • triton_diagonal_fast_path.py test: 39/39 passed, evaluator duration 7.470s

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.

1 participant