Skip to content

Keep complete SQL training steps and optimizer state on GPU - #305

Draft
cromwellian wants to merge 9 commits into
xqlsystems:mainfrom
cromwellian:codex/resident-sql-training
Draft

cromwellian wants to merge 9 commits into
xqlsystems:mainfrom
cromwellian:codex/resident-sql-training

Conversation

@cromwellian

@cromwellian cromwellian commented Nov 2, 2026 •

Copy link
Copy Markdown

🛠️ Codex

Keep complete SQL training steps and optimizer state on GPU. TrainingSession owns 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 5 performs 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.

Ray and others added 7 commits November 1, 2026 23:24
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>
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

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>

This branch has not been deployed

No deployments
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