Repository navigation
Keep complete SQL training steps and optimizer state on GPU - #305
cromwellian wants to merge 9 commits into
Conversation
Support prepared SQL gradients, arithmetic chunk-grid counts and direct Arrow registration. Preserve Context metadata through extension installation, expose target partitions and guard physical reuse against value-dependent filters. Co-Authored-By: GPT-6 <noreply@openai.com>
Materialize shared reachable CTEs once, reuse stage programs with fresh physical state, and retain ddx differentiation of original views. Add optional session-local float64 CPU and float32 MLX kernel execution with SQL validation and fallback, using the separately maintained EinFold feature build. Co-Authored-By: GPT-6 <noreply@openai.com>
Build the upstream-compatible feature commit from the contribution fork. Co-Authored-By: GPT-6 <noreply@openai.com>
Lower supported DataFusion and ddx stages through EinFold compact programs, importing live inputs on each ordinary query and expanding coordinates only at Arrow snapshot boundaries. Bound computed intermediates, preserve row/NULL masks and retain conservative SQL fallback. Co-Authored-By: GPT-6 <noreply@openai.com>
Keep the compact executor build reproducible without copying native or array-program sources into this repository. Co-Authored-By: GPT-6 <noreply@openai.com>
Own finite rectangular state, reuse ddx primal outputs, and compile gradient, clipping and AdamW programs with explicit mutable inputs and atomic state publication. Add domain-checked GPU indices, checkpointable dropout, real Shakespeare training, independent nanoGPT validation and checkpoint/resume tests. Co-Authored-By: GPT-6 <noreply@openai.com>
Keep integration instructions aligned with the separate EinFold repository. Co-Authored-By: GPT-6 <noreply@openai.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Allow the clean persistent ddx checkout to satisfy the exact installer revision. Co-Authored-By: GPT-6 <noreply@openai.com>
Include their completed validation reports while keeping the tested numerical source unchanged. Co-Authored-By: GPT-6 <noreply@openai.com>
|
🌀 Claude: Thank you. A complete nanoGPT training step in SQL, with AdamW, clipping and dropout, gradients from ddx, and state kept on the GPU, at 101 ms against PyTorch MPS's 27 ms, is a remarkable result. Checking every loss, gradient, weight and optimizer moment against nanoGPT's own Strengths
Concerns
A suggested path: land demo 3 on the public APIs first, perhaps with the eager or plain path for now. The resident path can follow once #307 decides where |
🛠️ Codex Repeated training calls can prepare a SQL grad/VJP/JVP statement once with `Context.prepare` and write new Dataset values into existing input buffers. Fine-chunk registration counts partitions arithmetically and registers Arrow batches directly; extension handles retain Dataset metadata and invalidation state. `Context(threads=...)` exposes target parallel partitions. This independently useful change starts the NanoGPT optimization stack; shared/compact execution, resident training and the evidence report follow separately. Apple M5 Ultra measurements: one-cell-chunk registration 31.372→0.405 ms (77.44× for that specific case), update-and-sum 2.769→1.027 ms (2.70×), repeated-CTE preparation 1.709→1.307 ms (1.31×). Tiny-model warm time improved 1.11×, but its five-step total regressed due to setup; this does not claim universally faster startup. Validation: 47 focused AD/preparation tests passed, covering current inputs, changing join-key ranges, old-result snapshots, coordinate rejection and shared Context invalidation. The complete downstream stack passed 714 non-integration tests. Changed Python files pass Ruff. Review order: this PR → #302 (shared kernels) → #303 (compact arrays) → #305 (resident training). #304 contains the separate consolidated report and evidence. Closes #294 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Prepared queries now support gradient, vector-Jacobian product, and Jacobian-vector product operations, including repeated execution after registered table data is updated or re-registered. * Added an option to configure the number of query threads. * Added support for creating contexts with extensions. * **Bug Fixes** * Improved prepared-query results when join-key values change and when datasets are registered in smaller chunks. * Improved in-memory partitioning for datasets. * **Documentation** * Clarified that prepared queries retain programs for repeated execution. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Ray <cromwellian@Rays-Mac-Studio.local> Co-authored-by: GPT-6 <noreply@openai.com> Co-authored-by: Alex Merose <al@merose.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
🛠️ Codex
Keep complete SQL training steps and optimizer state on GPU.
TrainingSessionowns finite rectangular state, reuses the primal already computed by ddx, compiles gradient/clipping/AdamW stages with explicit mutable inputs, and atomically publishes state after validation. Bounded integer domains enable GPU token gathers and embedding-gradient scatter. Explicit seed/step dropout keys and NPZ checkpoints support deterministic resume; ordinary query input/snapshot behavior is preserved.Add real Shakespeare character training matching native nanoGPT: 10,745,088 parameters, batch 12/context 256, 6 layers/heads, width 384, exact GELU, dropout .2, clipped AdamW, original learning-rate/evaluation schedule.
--steps 5performs exactly five updates without shortening the schedule. An independent original-model/PyTorch oracle checks every loss, raw gradient, weight and optimizer moment outside the timer.Depends on compact SQL execution #303, EinFold #157, and ddx #256/#257. Incremental review: cromwellian/xarray-sql@codex/compact-sql-execution...codex/resident-sql-training . The upstream fork PR's default diff contains predecessors until they merge.
Measured resident GPU: 101.3 ms mean over updates 2–100, versus the earlier Arrow GPU path's 2.024 s (19.98×). Native PyTorch MPS measured 27.0 ms; SQL remains 3.76× slower. A separate fully checked five-step run measured 145.9 ms warm. All 100 timed resident steps exported zero arrays and read zero array bytes, while each read a validation flag and loss scalar. There was one whole-step compilation. Batch upload, evaluation, oracle exports and checkpoint I/O are outside the timer; startup caches were not isolated. The performance/evidence PR provides complete scope and raw records.
Validation: 714 non-integration tests passed against rebuilt dependency wheels, including ownership, failure atomicity, changed compiled tokens/LR, loss snapshots and checkpoint/resume. Changed-file Ruff and Rust formatting passed. The optional builders pin separately maintained dependency commits instead of carrying copied patches.