trunk/98a0190638f271ea6e37e7e5891ea9823d11baae: Handle empty linalg.lstsq inputs in shared code (#199696)
linalg.lstsq handed degenerate shapes straight to the backend, so each one inherited LAPACK's quick-return behavior, and those disagree with each other and with the math: gels zeroes B when min(m, n, nrhs) == 0 , so for n == 0 CPU reported zero residuals instead of ||B||^2 (and the backward, which assumes the true residual, disagreed with them).
Executive Summary
linalg.lstsq handed degenerate shapes straight to the backend, so each one inherited LAPACK's quick-return behavior, and those disagree with each other and with the math: gels zeroes B when min(m, n, nrhs) == 0 , so for n == 0 CPU reported zero residuals instead of ||B||^2 (and the backward, which assumes the true residual, disagreed with them). gelsy sets rank = 0 when nrhs == 0 , although the rank of A doesn't depend on B.
Artificial Intelligence Architecture & Model Evaluation
From an artificial intelligence architecture, model weights governance, and inference efficiency perspective: - **Weights Accessibility & Sovereignty:** Evaluates whether weights are open for private self-hosting or locked behind centralized cloud APIs. - **Quantization & Edge Performance:** Kernel optimizations (4-bit/8-bit GGUF, AWQ, EXL2) allow high tokens-per-second on consumer GPUs and Apple Silicon. - **Reasoning & Architectural Scaling:** Scrutinizes mixture-of-experts (MoE), attention mechanisms, and fine-tuning datasets against open community benchmarks.
Impact on the Open Ecosystem
Protects developers and enterprises from proprietary black-box entrapment, fostering auditable, sovereign AI infrastructure.