Skip to content

Kaggle T4: Latest_compile and Vision_FLA_compile legs, plus gpt-oss completions and GGUF - #9700

Merged
danielhanchen merged 129 commits into
mainfrom
ci/kaggle-latest-compile
Sep 1, 2026
Merged

danielhanchen merged 129 commits into
mainfrom
ci/kaggle-latest-compile

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Builds out three of the leg set, and fixes four bugs the legs found on the way. Stacked on r9596 (#9596).

What is new

Latest_compile trains unsloth/gemma-4-E2B-it on the newest transformers and trl, beside a plain-TRL control arm (naive_trl_compare.py) that runs in its own process where unsloth is never imported.

The comparison deliberately does not assert the two arms agree. frontier already measured transformers 5.5.0 and 5.15.1 producing different step-1 losses on identical weights, data and seed (10.3222 against 6.4367), so the loss itself moves between versions and an equality check would go red on ordinary drift. It asserts what a comparison is entitled to: the plain path ran, it converged, and it ran the same number of steps as the arm it is printed beside.

Three details that are not incidental:

  • The control runs after the cycles. Two 4bit models resident at once on a 14.56 GB T4 is how a comparison becomes an OOM blamed on the thing being compared.
  • It refuses to start if unsloth is in sys.modules. Unsloth patches transformers, trl and peft at import, so an in-process control is unsloth against itself with extra steps.
  • Its crash cannot fail the leg. A control that could not install should not turn a passing unsloth run red.

Vision_FLA_compile (unsloth/Qwen3.5-2B) checks which fast kernels the model got and where each came from. The failure it exists to catch is not "kernel missing" but "kernel built from source", which is silent, correct, slow on 4 vCPUs, and reports the same __version__ as the wheel.

gptoss gains completions-only training and the GGUF export.

Two assumptions in the brief that hardware contradicted

Measured on unsloth-probe-vision-recon-c76ea3, a real 2xT4:

  • causal_conv1d and mamba_ssm are not installed on the notebook path, before or after the load. The wheel-first installer in studio/backend/utils/ssm_runtime.py belongs to Studio's training worker, and this path never calls it. They are reported, not asserted; asserting them would go red on correct behaviour.
  • FLA is vendored inside unsloth_zoo (unsloth_zoo/_vendored/fla, 0.5.1) and importable only after the model load, because unsloth reaches for it lazily. Reading provenance up front reports it absent.

FlashAttention-2 is not asserted to run, because on sm_75 it cannot. The rule instead fails if anything selects FA2 on a Turing card, which is the regression that would otherwise surface as an unexplained crash at the first forward.

Four bugs found, three of them mine

Upstream (fixed in unslothai/unsloth-zoo#1103): gemma-4-E2B-it does not load at all on transformers 5.15.1. __fix_dtype reads back every key to_dict() reports, and a heterogeneous config raises AmbiguousGlobalPerLayerAttributeError from __getattribute__. getattr(..., None) only suppresses AttributeError, so it kills the whole load.

A vision model's tokenizer is a processor. ProcessorMixin.__call__ is (self, images=None, text=None, videos=None, ...), so a positional list of prompts is taken as images and transformers tries to fetch each prompt string as an image URL. Both gemma-4 and Qwen3.5-2B hit it. Three call sites; the third was found by the guard, not by a traceback.

The gpt-oss export went into the 21 GB artifact volume. It needs 27.6 GB and failed in 2.8 s with "no disk space left" - a message that reads like an export bug and is a code bug, because the code chose the volume. Now /tmp, which has 1102.5 GB free.

mxfp4 is not an accepted quantization request. gpt-oss overrides q8_0 to MXFP4 and says so; asking for mxfp4 directly is rejected before the conversion starts. So the leg requests q8_0 and accepts only mxfp4, which looks backwards and is the only pairing that works.

Both legs ship UNWIRED, with the open question named

Latest_compile and Vision_FLA_compile are in UNWIRED. vram_gb is a placeholder for both, and the admission scheduler schedules against that number - too low and a leg co-tenants a card it cannot share, which the driver's own comment records coming back as an OOM that read like a code failure.

The vision recon could not settle it: it read 0.92 GB peak on cuda:0, but the model was split across both cards (897.7 MB + 1017.1 MB) because a probe body sees both T4s where a leg gets one. A single-card measurement is required, not a doubling of a number measured wrong.

Tests

tests/kaggle: 648 passed. New guards: 9 for the plain-TRL rules, 11 for kernel provenance, 9 for gpt-oss, 6 for the Studio password path. All mutations caught.

One guard was vacuous when first written and its mutation caught it: asserting "a Return somewhere in the branch" passes for if not failures: return ..., which still falls through on the failure path - the single case the guard exists for.

Also here

Studio starts headless with --password and logs in with it, with no fallback to the bootstrap password: a fallback would make the run green while proving the flag does nothing. The password is minted per run and registered as a secret before anything can log it.

danielhanchen and others added 30 commits August 23, 2026 07:48
…ind the legs

The Studio payload is ~0.75 GPU-h standalone and most of that is CPU work:
clone, pip, a Playwright browser download. The notebook kernel meanwhile spends
646.3s with both T4s busy and nothing at all using the CPU.

So the payload is split in half and packed into the same kernel. The install
half takes no card and starts at t=0 beside the four training legs; the GPU
half waits for the card queue to drain and then takes both cards. Simulated
against the measured per-leg durations from run 32607621452:

  studio_install.ipynb    -       0.1 -> 400.1
  t4_gptoss.ipynb         gpu0    0.1 -> 384.2
  t4_frontier.ipynb       gpu1    5.2 -> 312.3
  t4_canary.ipynb         gpu1  312.3 -> 503.8
  t4_control.ipynb        gpu0  384.2 -> 563.2
  studio_test.ipynb       -     563.3 -> 763.3

The install is fully hidden: it finishes at 400.1s inside a 646.3s card queue.
Makespan 763.3s against 646.3s, so ~0.21 GPU-h against ~0.18, still under the
0.25 h envelope every figure in the budget block is derived from. No same-card
overlap.

What this does not do: it does not widen the paths filter, and it does not
change kaggle-t4-studio-gpu-ci.yml. A studio/** change still gets its dedicated
standalone run on its own budget. This is the same payload answering for the
events the notebook workflow already triggered on, bought for 0.03 h.

The install half is a gate as well as a lane. If it fails, the GPU half is
skipped rather than run against a Studio that is not there, and the skip is
reported rather than silent.

Two reporters now read one evidence directory, each rendering only the labels
it owns: four training legs, or one studio-gpu payload. Each also recomputes
its own verdict rather than reading the launcher's kernel-wide one, because a
failing training leg would otherwise print "Studio GPU smoke: FAIL" above a
section listing zero failures and send someone to the wrong half of a
13-minute kernel. The T4 reporter is told the LEG count, not the payload count,
since it filters the Studio report out before comparing.

Guards, each mutation-tested by reintroducing the bug it catches: the build
step still passes --with-studio; both reporters and the evidence collector run;
the T4 reporter gets `legs` and not `payloads`; a failing payload reddens only
the reporter that owns it, in both directions; the CPU lane never takes a card;
Studio is excluded from the card queue; the install-failure gate holds.
…r around both

Three changes to one schedule, measured rather than assumed.

PREFETCH. Downloading a model is CPU and network work that today holds a T4
idle for its whole duration. A lane in the driver's own interpreter warms the
HF cache from t=0: gpt-oss first (~12 GB, and the leg the order is built
around), then the small model. It takes no card and no virtualenv, so it starts
at t=0 rather than after a venv build, and it deliberately does not set HF_HOME
because the legs read the image default and the point is to land where they
read.

It is not a correctness mechanism. A failed prefetch is a no-op: the leg
downloads the model itself exactly as before, so the cost is seconds. Retries
are a watchdog rather than an except: Xet handles 408/429/5xx itself with
backoff (5 attempts, 3s base, a 6 minute cap per delay), so a stalled transfer
sits inside one call for minutes without raising. Each attempt gets a
wall-clock budget and the last one sets HF_HUB_DISABLE_XET to fall back to
classic HTTP, because retrying a stalling transport is how a retry loop eats
the session.

ORDER. gptoss moves to position three, first pick of the second wave.
Simulated over every permutation against the durations measured on run
32611343797, across a range of the unknown gpt-oss download time D:

  canary, control, gptoss, frontier   prefetch   worst 528.1s   mean 504.1s
  gptoss, frontier, canary, control   none       worst 563.1s   mean 563.1s
  gptoss, frontier, canary, control   prefetch   worst 603.1s   mean 603.1s
  frontier, canary, control, gptoss   prefetch   worst 651.1s   mean 585.2s

Prefetching without reordering is a regression: gptoss starts at t=0 so there
is no window in front of it. Putting gptoss last is worse still for any D under
~120s, since ending on the longest leg idles the other card for its whole
duration. The chosen order is never worse than today at any D tested, and
degrades to ~568s if the prefetch fails outright.

CO-SCHEDULING. The peaks in that run's evidence: canary, control and frontier
each reserve 0.70 GB of a 14.56 GB card; gptoss reserves 12.78. One leg per
card was leaving a card 95% empty for three quarters of the run. Cards now
admit legs against a 13.0 GB budget, so two small legs share and gptoss is
alone by arithmetic rather than by a special case. Capped at two per card
because VRAM is not the scarce resource: a session has 4 vCPUs and a leg is
~87% install, import and download.

That raises the live-virtualenv ceiling from 2 to 4, and each carries its own
torch and NVIDIA runtime. /kaggle/working is 19.5 GB and is also the artifact
Kaggle ships home, so the venvs move to the ~1 TB overlay; only evidence stays
where Kaggle collects it. Four torch trees would not have fit, and the failure
would have arrived as an install dying midway for reasons that look nothing
like a full disk.

Studio's two models were being pulled inside run_studio_gpu.py, which is the
TEST half, so the merged kernel hid its clone, pip and browser and then paid
full price for its downloads with both cards idle. They move to the install
cell, under Studio's own HF_HOME, read off the payload's own argv rather than a
second copy of the defaults.

The job summary gains a prefetch table: bytes, download seconds, achieved MB/s
and the transport actually used, per repo. That is the instrument. The gpt-oss
download time has never been measured -- an earlier "~282s" was subtraction --
and it is what decides whether this reorder paid for itself.

Guards, each mutation-tested by reintroducing the bug: no card is asked to hold
more than 13.0 GB; two small legs really do share one (every other guard is a
bound satisfied by co-scheduling nothing); gptoss never shares; the admission
ledger balances; virtualenvs are never built on the artifact volume, checked at
creation because teardown hides where they were built; the prefetch lane takes
no card; it does not redirect HF_HOME; a failing prefetch does not fail the
kernel; the last attempt falls back to classic HTTP; the declared VRAM matches
the peaks committed in measured_vram.json; the report table is wired into the
summary and not merely rendered.
… for the drain

The merged kernel runs Studio's GPU half only after every training leg has
released its card. Measured on run 32626562583 that is a real cost: the
makespan floor is Studio's own serial chain (258s install + 339s test = 597s),
the legs have slack against it, and 184.2s of card idle is forced.

--studio-concurrent gives Studio its own lane that admits itself through the
SAME VRAM gate the legs use, so it can take a card while a small leg is still
on it. Studio is priced at 2.2 GB; the small legs measure 0.70 GB and gptoss
12.78 GB against a 13.0 GB per-card budget, so the gate arithmetically forbids
the one pairing that matters: 12.78 + 2.2 is 14.98, and a card shared with
gptoss is how the contention came back as an OOM that read like a code failure.

Also flips PREFETCH_REPOS to Qwen-first. Three of four legs plus Studio's
training assertion want the small model and the first of them starts at t=0,
so it is the fetch with no lead time in front of it; gpt-oss does not start
until the second wave and has ~190s of window to use.

The guard is driven with gptoss as the only leg so the placement is
deterministic. An earlier version used all four and asserted on recorded
overlaps, which was vacuous: the small legs finished while Studio was still
building its venv, so no overlap was ever recorded and deleting the VRAM check
left the test green.
…ore any worker sees it

Run 32667451396 went green while doing three things wrong.

The prefetch fetched unsloth/gpt-oss-20b. That is an MXFP4 checkpoint, sm_75
cannot read MXFP4, and unsloth redirects to -unsloth-bnb-4bit at load time, so
55.1 GB was downloaded that no leg ever opens while the leg fetched the real
one for itself. The guard that should have caught this compared the list
against the payload's DEFAULT_MODEL, which is the name asked for and not the
one loaded, so it agreed with the bug. LOAD_REDIRECTS now records the
redirect, the guard applies it, and a second assertion pins that the redirect
being claimed is one the payload actually shows.

The prefetch also had no allow_patterns, so Qwen3.5-2B-GGUF came down entire:
69.1 GB of every quant in the repo to serve the one UD-Q4_K_XL file Studio
loads. The variant is read off argv next to the model names, for the same
reason they are - a hardcoded quant would filter on the wrong one the moment a
dispatch overrode it. The glob is loose at both ends because a split GGUF is
named ...UD-Q4_K_XL-00001-of-00002.gguf.

Together that is ~128 GB fetched to serve ~14 GB of weights on a 4-core box,
and it shows up in the durations: the Studio install went 258s to 673.5s and
the legs went 180-384s to 691-780s.

Third, control and gptoss shared one card for 691s - 13.48 GB against a 13.0 GB
budget. A seed's seat was taken inside its own worker, AFTER a 5s start
stagger, so card 1 sat unreserved while a free worker looked at it, saw an
empty card and put gptoss there. When the seed worker woke, _admit correctly
refused and the caller discarded the answer. Seats are now taken before any
worker thread exists.

test_no_card_is_ever_asked_to_hold_more_than_it_has asserts that exact budget
and passed throughout, because with default stub durations every leg finishes
inside the 5s stagger and no overlap is ever recorded. The new guard picks
durations that hold the window open instead.

Prefetch order goes Qwen-first here too. Three legs and Studio's training
assertion want the small model and the first of them starts at t=0, so it is
the only fetch with no lead time in front of it.
…ore any worker sees it

Run 32667451396 went green while doing three things wrong.

The prefetch fetched unsloth/gpt-oss-20b. That is an MXFP4 checkpoint, sm_75
cannot read MXFP4, and unsloth redirects to -unsloth-bnb-4bit at load time, so
55.1 GB was downloaded that no leg ever opens while the leg fetched the real
one for itself. The guard that should have caught this compared the list
against the payload's DEFAULT_MODEL, which is the name asked for and not the
one loaded, so it agreed with the bug. LOAD_REDIRECTS now records the
redirect, the guard applies it, and a second assertion pins that the redirect
being claimed is one the payload actually shows.

The prefetch also had no allow_patterns, so Qwen3.5-2B-GGUF came down entire:
69.1 GB of every quant in the repo to serve the one UD-Q4_K_XL file Studio
loads. The variant is read off argv next to the model names, for the same
reason they are - a hardcoded quant would filter on the wrong one the moment a
dispatch overrode it. The glob is loose at both ends because a split GGUF is
named ...UD-Q4_K_XL-00001-of-00002.gguf.

Together that is ~128 GB fetched to serve ~14 GB of weights on a 4-core box,
and it shows up in the durations: the Studio install went 258s to 673.5s and
the legs went 180-384s to 691-780s.

Third, control and gptoss shared one card for 691s - 13.48 GB against a 13.0 GB
budget. A seed's seat was taken inside its own worker, AFTER a 5s start
stagger, so card 1 sat unreserved while a free worker looked at it, saw an
empty card and put gptoss there. When the seed worker woke, _admit correctly
refused and the caller discarded the answer. Seats are now taken before any
worker thread exists.

test_no_card_is_ever_asked_to_hold_more_than_it_has asserts that exact budget
and passed throughout, because with default stub durations every leg finishes
inside the 5s stagger and no overlap is ever recorded. The new guard picks
durations that hold the window open instead.

Prefetch order goes Qwen-first here too. Three legs and Studio's training
assertion want the small model and the first of them starts at t=0, so it is
the only fetch with no lead time in front of it.
The list moved to Qwen-first but the comment above it still argued for
gpt-oss-first, which is the version of this that gets 'fixed' back by the next
reader who trusts the prose over the code.
…le/working

Venvs moved to /tmp because co-scheduling made four torch-bearing venvs
possible at once and four do not fit in the 19.5 GB /kaggle/working, which is
also the shipped artifact. The fallback for a box with no writable /tmp says it
keeps a one-leg-per-card run working, but MAX_LEGS_PER_CARD was a plain
constant, so the fallback put the venvs back on the small partition and went on
building two per card anyway. That is the exact configuration the comment above
it says does not fit, and it would have surfaced as an install dying halfway
through for reasons that look nothing like a full disk.

The guard exercises the real branch rather than simulating it: the preferred
root is pointed at a path whose parent is a regular file, so mkdir raises
OSError exactly as it would on such a box. Rewriting the literal straight to
WORK would only have tested an assignment.

Found while accounting for disk on run 32667451396. Disk was never the binding
constraint there - the 128 GB prefetch landed on the ~1 TB overlay, and the
Studio payload's own two free-space readings bracket its share of it at
1093.5 GB down to 1013.7 GB. The cost was CPU and IO, not space. This is the
one place where space could actually have bitten.
The flag has existed since the branch was opened, is threaded from the CLI all
the way to AFTER_GPU_CONCURRENT, and had unit tests. The workflow never passed
it, so on hardware it was dead code.

That cost a run. 32674263571 was dispatched as the VARIANT of an A/B on exactly
this behaviour: it built with AFTER_GPU_CONCURRENT False, ran the control's
schedule, and the comparison was a configuration against itself. Nothing went
red. AFTER_GPU_SHARED was simply absent from kernel.log, and an absent sentinel
is not something a green tick reports.

It is a dispatch input defaulting to false rather than the new shape. Sharing
costs the property that Studio chooses its own card out of two, which the
Studio builder keeps on purpose, so it has to be asked for. The run that asks
prints a notice saying what coverage it gave up.

The guard asserts the whole chain - input exists, defaults false, something
converts it to the flag, the flag reaches the build command, and the spelling
matches what the CLI defines. Dropping $STUDIO_CONCURRENT from the build
command, flipping the default, and removing the input are all caught.

Not useless, that run: two executions of the same schedule put run-to-run noise
at 13.1s of ~1180s, 1.1%. Any scheduling claim now has to beat that.
…wheels once

Two changes, and the first is a bug that predates the second.

Every leg had its own venv and its own UNSLOTH_COMPILE_LOCATION, and that was
assumed to be the whole story. It is not. torch and triton key their caches off
$TMPDIR rather than off the interpreter: on torch 2.9.1 an unset
TORCHINDUCTOR_CACHE_DIR resolves to tempfile.gettempdir()/torchinductor_$USER
(torch/_inductor/runtime/cache_dir_utils.py:22) and the triton cache lands under
that same directory. So four legs whose entire purpose is to install DIFFERENT
transformers/TRL/peft versions and compile the same modules were sharing one
/tmp/torchinductor_root. Each leg now gets its own TORCHINDUCTOR_CACHE_DIR,
TRITON_CACHE_DIR and TMPDIR.

Per-leg directories rather than TORCHINDUCTOR_FORCE_DISABLE_CACHES or
TRITON_ALWAYS_COMPILE. Both exist and both work, but they force every leg to
recompile from cold, which spends time on the critical path this kernel is
being shortened along and makes the legs measure a machine no user has.
Isolation is wanted here, not cache defeat.

Second: every leg installs unsloth_zoo and unsloth from the same two pinned
SHAs, and pip does not cache a VCS build, so run 32679427416 cloned and built
both of them four times. Install was 149-191s per leg, the largest single phase
of each and 41% of gpt-oss. They are built once now, before any leg starts.

Synchronous, and that is the design. A background lane would lose the race it
exists to win: the legs are admitted to their cards and start installing at
t=0, so a wheel still building when they get there saves nothing. Studio's CPU
lane starts first so its 345s overlaps the build.

The spec list is DERIVED from the legs' own install groups, never declared
again, so the wheel is main-plus-the-PR by construction rather than by a second
copy of two SHAs that drifts silently -- a wheel built from the wrong ref
installs perfectly and fails nothing. It is the INTERSECTION across legs: a
spec only one leg carries is part of what that leg tests, and two legs pinning
one package to different refs share nothing at all. A missing wheel falls back
to the original git spec, so a failed build costs its own time and changes
nothing about what is tested.

Also adds per-group install timing. 'install took 191s' was all any artifact
ever said, which cannot tell you which group cost it or whether this helped.
… flag

Two dispatches could not run side by side, which is why the last A/B compared a
configuration against itself. The t4-smoke job used ONE concurrency group, and
GitHub allows only one PENDING run per group -- so a second queued run cancels
the first rather than queueing behind it. That killed run 32674255736.

A Kaggle account allows 2 concurrent GPU sessions and this job takes one, so
the cap has to be 2, and a group cannot express 'at most two'. Two explicit
slots can: the input offers 1 or 2 and nothing else, so the account can never
be asked for a third, and anything that is not a dispatch lands in slot 1,
which is exactly the old behaviour for pushes and pull requests.

The shared wheel build becomes an input, default off. Run 32689629906 measured
it helping the leg that runs ALONE (gpt-oss install 191.2s -> 152.6s) and
costing the three that run CONCURRENTLY (149-163s -> 319-334s) -- but that run
changed the torch/triton cache layout at the same time, so neither effect is
attributable to either change. Shipping it on by default would be a guess
wearing a measurement's clothes.

The anomaly worth recording, because it is what the next run has to explain:
with git specs, three legs installing CONCURRENTLY cost 149-163s each, LESS
than the 191.2s the same install cost gpt-oss running ALONE. Concurrent work
being cheaper per unit than solitary work means the legs were sharing
something -- pip caches a wheel built from a VCS URL under ~/.cache/pip, and
HOME is shared across legs, so two of the three were very likely skipping the
clone and build that the first paid for. If that is right, the build was
already deduplicated and doing it up front bought nothing while adding 105.8s
of serial time.
The job-level group already carried the slot, but the workflow-level one
did not, so two dispatches meant to hold the account's two Kaggle session
slots at once still shared a single queue position. GitHub keeps at most
one PENDING run per group and discards the older one when a newer run
queues, so the second dispatch cancelled the first before either started.
That is what happened to run 32674255736.

The guard now asserts the slot at both levels; reverting either one fails
it.
Each leg currently spends 158-207s resolving its own install groups, and
three of the four differ only in which transformers/TRL versions they
end up with. An overlay expresses that difference directly: resolve the
closure with pip --dry-run --report, filter out anything native, install
the remainder --no-deps --target, and prepend it to the payload child's
PYTHONPATH.

Measured on a real T4 (kernel unsloth-probe-overlay-t4-r2-38ac4d):
transformers==4.57.6 + trl~=0.22.0 resolves to three packages, 115.9 MB,
installed in 10.0s, with transformers and trl imported from the overlay
and torch still from the base.

This is the mechanism Studio already ships as the .venv_t5_* sidecars in
studio/backend/utils/transformers_version.py, with its stated limits:
pure-Python only, and nothing may import the ambient copy first. The
deny-list enforces the first; passing the path through the environment
rather than editing sys.path enforces the second.

No leg declares an overlay yet, so this is inert until one does.

bitsandbytes is now asserted rather than assumed. It is in no dependency
set this CI resolves - unsloth_zoo does not declare it at all, and git
main unsloth declares only seven unconditional dependencies - so without
the explicit install group a leg fails inside from_pretrained after the
model download.

Guards, each mutation-tested: building an overlay without exporting
PYTHONPATH, dropping the deny-list so the overlay shadows torch, and
removing bitsandbytes from BASE_INSTALL all turn the suite red.
Batched generation with left padding is the surface that has broken here
most often and is covered by nothing: #3699 (left-padding plus caching
produced incorrect output), #1066 (gibberish), #1456 (inconsistent for a
self-trained model), #2138 (a release silently forced the tokenizer
padding side to right during inference).

After training, the payload now generates each prompt alone and then at
batch sizes 2, 4 and 8, greedy throughout so any difference is padding
or cache handling rather than sampling, and requires them to match.

Two things are guarded that a naive version of this check would miss.

Left padding only happens when prompts in a batch differ in length, so a
batch of equal-length prompts agrees perfectly having never padded once.
The record therefore carries the token lengths, the prompts are built
with a deliberate spread, and a spread of one is itself a failure.

The padding side is read twice, before and after generating, because the
override in #2138 happened inside the inference path -- the value the
payload sets is not evidence of the value that was used.

Also failed: empty output at every batch size (agreement alone is not
health, since a model emitting nothing agrees with itself), too few
prompts to form the largest batch, and a missing record, which must not
be indistinguishable from a passing one.

That last rule caught its own fixture: _cycle() fabricates a healthy run
and had no such record, so every simulated run went red. The fixture was
corrected rather than the rule weakened.
…tched generation

Two Kaggle GRPO ladder probes failed four rungs each on the same FlashInfer
link, the second WITH VLLM_USE_FLASHINFER_SAMPLER=0 already set. That variable
was never wrong, it is just set at a layer that does not survive: unsloth_zoo's
patch_vllm assigns both vLLM knobs itself during model load,

    vllm_utils.py:2494  VLLM_ATTENTION_BACKEND      = "FLASHINFER"
    vllm_utils.py:2502  VLLM_USE_FLASHINFER_SAMPLER = "1"

each behind `elif Version(vllm_version) >= Version("0.11.0")`, which the leg's
0.19.1 pin satisfies. The guard in front of them checks only that nvcc and ninja
exist; Kaggle has both, and what it lacks is the driver stub the compiled
objects then link against. UNSLOTH_VLLM_NO_FLASHINFER is read ahead of every
assignment and is the only one of the three that reaches vLLM, so the grpo leg
now carries it.

The Default leg then ran on a real T4. The overlay works under training, not
just inference: transformers 4.57.6 and trl 0.22.2 resolved from the overlay
against the image's untouched torch 2.10.0, 10 of 10 steps at 1.16 it/s. It
died after training on a NameError in batched_generation, where torch was used
without the function-local import every other torch user in that file has.

No CPU test caught that because all seven batched-generation guards feed the
rule a hand-written dict and never execute the code that produces one. The new
end-to-end test drives the real function with a stub tokenizer and model that
pad, generate and decode; removing the import reproduces the Kaggle NameError
on CPU in 0.05s. That stub immediately found a second bug in the same function:
`pad_token_id or eos_token_id` falls through whenever pad_token_id is 0, which
is an ordinary id, so batches were padded with end-of-sequence tokens.

The Default leg stays unwired until its batched-generation assertions have run
on hardware once and it has a reference band. Adding it also exposed two latent
test bugs: a partition assertion comparing two separately sorted lists, which
held only while every unwired leg sorted after every wired one, and a payload
filename interpolated from the registry key rather than from leg.name.
…that was asked for

Both questions the last round left open are now answered on hardware.

GRPO. The FlashInfer failure needed the package gone, not another environment
variable. Round 3 established that UNSLOTH_VLLM_NO_FLASHINFER=1 does reach the
child and does stop the sampler build, and that the failure simply moves to the
attention prefill kernels, which are chosen by VLLM_ATTENTION_BACKEND (already
TRITON_ATTN, already confirmed inherited) and for which vLLM exposes no
prefill-specific opt-out. Round 4 removed flashinfer-python and flashinfer-cubin
after the vLLM install, in 3.9s, and the ladder passed at the FIRST rung. So legs
gain an `uninstall` field, and the env vars are kept beside it rather than
replaced: they are what stops unsloth reaching for FlashInfer at all, and an
image that does ship the driver stub should still take the deliberate path.

gpu_memory_utilization goes 0.5 to 0.95, the value originally asked for. The 0.5
came from Qwen3-4B probes and was never measured for the 0.6B this leg trains.
Measured now on both platforms, each stopping at the first rung of a
0.95/0.8/0.6/0.5 ladder with three sleep/wake cycles: Colab (torch 2.11.0) peak
reserved 11.76 GB, Kaggle (torch 2.10.0) 11.30 GB, both about 3 GB under the
card. Kaggle also loads in 170.0s against Colab's 465.4s, because vllm 0.19.1
pins the torch Kaggle already has, which is the whole argument for that pin.

Default. At max_steps 10 Qwen3-0.6B learns the canary but not to stop after it,
emitting `__UNSLOTH__!!!__`. At 20 both repeats emit it exactly and the leg
passes in full, with the batched-generation contract green on a T4: four distinct
prompt lengths so padding really happened, left padding observed before and after
generating, and batch 2, 4 and 8 all agreeing with batch 1. --no-require-canary
would have made the check vacuous; the rule was right and simply tuned against a
different model.

The leg is wired, which takes MAX_LEGS_PER_KERNEL from 4 to 5. That number caps
wall clock rather than cards, and its own comment asks for the arithmetic: the
longest column today is about 8 minutes, so about 16 with Default added, against
a 12 hour session kill.

Three latent test bugs surfaced while doing this. Two assertions hardcoded the
leg count that ALL_FOUR derived, so the name is now ALL_LEGS and both read the
registry. A second site interpolated a payload filename from the registry key
rather than leg.name, the same bug fixed in the harness last round, which
`default` versus `Default` is the first pair to expose.
Both claims were mine and both were wrong in ways a reader would have acted on.

The grpo leg's comment said the driver stub is "simply absent from this image"
and "not fixable from here". The leg's own report disproves it: libcuda_shim
reports needed true, applied true, real /usr/local/cuda/compat/libcuda.so, and
run_grpo_t4.py:597 has symlinked that onto LIBRARY_PATH since #8440. The stub
exists; flashinfer's own -L paths just do not include the directory holding it,
and the leg supplies it. The hand-written ladder probes had no shim, which is
the likeliest reason they hit the link error while the leg does not. The
flashinfer uninstall stays, because removing it demonstrably breaks the leg, but
it is now documented as earning its place for a reason still being established
rather than for the link error.

Removing it does not reproduce a link error at all. It fails with the
intermittent illegal memory access that UNWIRED["grpo"] already documents, which
has not recurred with the uninstall in place. That crash runs at roughly two
failures in three, so a few clean runs is suggestive and not proof; the guard
asserts only that the uninstall is present and reaches the payload, and its
docstring now says so explicitly rather than implying a root cause.

The MAX_LEGS_PER_KERNEL comment reasoned about serial per-card columns and
estimated 16 minutes. The measured five-leg kernel is 792.2s, 13.2 minutes, and
the intervals show why: legs do not queue one per card. The VRAM admission lets
light legs co-tenant, so frontier and canary hold gpu0 for their whole lives at
0.7 GB each, while gptoss at 12.78 GB waits for an empty card and starts at
492.7s. Admission governs, not the card count and not a queue, and a fifth heavy
leg would be a different question from a fifth light one.
…ion it sees

The grpo leg's dominant failure was never the crash. Three runs with the
flashinfer uninstall in place produced no illegal memory access at all, and two
of the three still went red with

    reward_std was zero on every step ([0.0, 0.0, 0.0])

which reads like a broken generation path and was really a reward that had
stopped measuring anything.

reward_length was min(len(t), 200) / 200.0, under a docstring claiming it was
"SENSITIVE to a group's diversity". It was not. Kernels
unsloth-probe-grpo-rep2-b03be8 and -rep3-bc3828 recorded completions of 2534 to
3396 characters, an order of magnitude past the cap, so every completion scored
exactly 1.0 and every group tied. The cap was set below the range the model
actually occupies, so the one region the function discriminated in was the one
region the run never visited.

Replaced with len/(len+200), which is strictly increasing on the whole domain,
maps into (0, 1) and equals 0.5 at 200 characters, so it stays informative at
every length rather than only below a threshold. At the observed lengths it now
separates: 2534 and 3396 score 0.92685 and 0.94438.

Three guards, mutation-tested by restoring the cap. Two of them fail on it; the
important detail is that they assert discrimination at the lengths actually
recorded on hardware, because the old function passes any test written with
short completions, which is how it survived review in the first place. The third
guards the other direction: genuinely identical completions should still tie,
since that is degenerate generation and the leg is right to fail on it.
Every leg is meant to export to GGUF and none has any export code, so this is
the module the rest will use. It is written against a probe on real hardware
rather than against the API's shape, because two things a natural
implementation gets wrong are silent.

The GGUF is not in the directory you pass. save_pretrained_gguf("/tmp/q8p", ...)
put the merged model.safetensors (1136.9 MB) in /tmp/q8p and the actual
qwen3-0.6b.Q8_0.gguf (609.8 MB) in the sibling /tmp/q8p_gguf. Code that globs
the directory it passed finds no .gguf, raises nothing, and reports a successful
export. find_ggufs searches both and records which one held the file, and the
failure message names the sibling so a reader does not have to already know.

install_llama_cpp returns a tuple of (llama-quantize, convert_hf_to_gguf.py),
not a path to a bin directory. An earlier probe treated it as one and reported
"0 binaries", which was the probe being wrong rather than the bundle being
empty. llama_cpp_facts derives the directory from the returned paths, so a
release that changes the layout surfaces as a missing binary instead of a wrong
path, and flags a source build separately: the failure to catch is not "kernel
missing" but "kernel built from source", which is silent, correct and many
minutes on 4 vCPUs.

Running the result does not use llama-cli. It hung for its entire budget twice,
600s and then 180s with stdin closed and -no-cnv, while 16 tokens from a 610 MB
Q8_0 on CPU is seconds of work. Whatever it waits for is not stdin, so run_gguf
uses binaries that cannot be interactive: llama-bench runs a fixed workload and
exits, llama-completion is one-shot, and the second is only tried when the first
is unavailable or failed.

A model that refuses the requested quantization is not a failure. gpt-oss
answers q8_0 with "Overriding to MXFP4 format" by design, so callers pass the
set of names they accept rather than this module assuming q8_0 is universal.

Ten guards. The sibling search is executed against a real directory pair rather
than a hand-written dict, since where the file is is the whole point, and it is
mutation-tested by narrowing the search back to the passed directory.
…ill can read it

The Default leg passed 3 of 3 in one arm of a same-commit A/B and failed 3 of 3
in the other, on `PicklingError: Can't pickle <class 'MonthDayNano'>`. Two
defects, and the first one produces the second.

**The venv interpreter was never pinned.** uv's default python-preference is
`managed`, so once any managed CPython exists under ~/.local/share/uv/python a
bare `uv venv` builds on that instead of the image's. `--system-site-packages`
is still honoured and still inherits nothing, because a 3.13 venv cannot see a
3.12 site-packages. Measured, deterministic per arm:

| arm | Default leg python | torch | datasets | verdict |
|---|---|---|---|---|
| A, 3 runs | 3.12.13 | 2.10.0+cu128 | 4.3.0 | pass 3/3 |
| B, 3 runs | 3.13.13 | 2.12.1+cu130 | 5.0.1 | fail 3/3 |

Every other leg in both arms stayed on 3.12.13. The overlay resolve on the 3.13
runs found nothing satisfied and pulled 44 packages, including pyarrow,
datasets and dill, where arm A resolved 3. So the leg was also testing a stack
no Kaggle user has, and paying minutes for it, with nothing red.

**The overlay directory was hostile to dill**, which is what turned the wrong
interpreter into a crash. dill pickles a module by reference only if its
`__file__` starts with a sys prefix, ends with an extension suffix, or contains
the literal string `site-packages`. `pip install --target
/tmp/t4ci_venvs/overlay_X` satisfies none of the three, so everything in the
overlay is pickled by value; `Dataset.from_dict` fingerprints through dill,
reaches the pyarrow module, and dies on pyarrow's Cython `MonthDayNano`.

Reproduced on CPU in seconds against a byte-identical package tree with the
directory name as the only variable: the plain `--target` directory raised, the
copy named site-packages returned a fingerprint.

Both fixed here: `--python sys.executable` on the venv, the resulting version
reported in the `_VENV` record so the next wrong interpreter is visible rather
than inferred, and the overlay installed into a `site-packages` directory.

The upstream half is #9791, which makes the same crash
survivable for any user on a `--target` or PYTHONPATH install. This change is
not conditional on that one.

Seven guards, four mutations reintroduced and caught. The dill rule is asserted
by evaluating the driver's own `_ov_dir` expression and feeding the result to
dill's real `_is_builtin_module`, with a negative control on the old path so
the rule fails if dill ever changes its mind.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ab921555b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

)

if not failures:
tuned, problems = _say(gguf, None, "exported")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Compare the export against an equivalently quantized base

With the committed defaults, the control loads unsloth/Qwen3.5-2B-MTP-GGUF as UD-Q4_K_XL, while gguf is an export of the separate training checkpoint using q8_0. Even if the adapter merge is a no-op, those different source artifacts and quantizations can produce different greedy text, so tuned != base_one marks the merge as successful. Loading the base twice only proves the UD-Q4 control is deterministic; compare against an unadapted export of the same training checkpoint at the same quantization, or verify the merged weights directly.

Useful? React with 👍 / 👎.

body = path.read_text(encoding = "utf-8", errors = "replace")
except OSError:
continue
if token in body or token in path.name:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require the execution token in the file contents

When the Python tool creates the requested token-named file but fails before writing the token bytes, this or still records the file as carrying the token and the assertion passes. That contradicts the check's stated filesystem evidence and can hide a broken or partial code-execution result; the verdict should require token in body, while the filename can remain diagnostic evidence only.

Useful? React with 👍 / 👎.

f"card cannot run it, so this would fail at the first forward"
)

return failures

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce the no-source-build provenance invariant

When a kernel dependency is installed from an sdist and compiled locally, this function still returns success: it only checks that vendored FLA imports and that Turing did not select FlashAttention-2, and neither probe_kernels() nor this verdict consumes an install log or records whether a wheel was used. A source-built module has the same version and ordinary site-packages path as its wheel, so the explicit “nothing was built from source” invariant remains unenforced and an unexpectedly multi-minute compilation can leave the leg green.

Useful? React with 👍 / 👎.

Comment on lines +151 to +152
turing = _is_turing(capability)
if turing:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail when the Turing capability cannot be verified

When environment_fingerprint() cannot read the GPU capability or its spelling is not recognized, _is_turing() returns false and this skips every attention assertion without reporting that the instrument was unavailable. On the actual T4 leg, that lets a missing attention record—or even a FlashAttention-2 selection—pass while the coverage the leg uniquely claims was never verified; treat an absent or unrecognized capability as an unverifiable failure rather than as evidence that the card is non-Turing.

Useful? React with 👍 / 👎.

… this driver's bug

The multi_gpu note said the Default leg failed 3 of 3 whenever this leg was
present, with `PicklingError: Can't pickle <class 'MonthDayNano'>`, and blamed a
sixth concurrent install perturbing another leg's overlay resolution. That was
two defects in the driver, fixed in the previous commit: the leg venv was built
on CPython 3.13 against a 3.12 image, so `--system-site-packages` inherited
nothing, the overlay resolved 44 packages instead of 3, and pyarrow landed in a
--target directory that dill pickles by value.

unsloth-probe-venvfix-r1-b50886 and -r2-8799a3 run this exact six-leg set with
both fixes in: Default passes 2 of 2, every leg reports python 3.12.13, and
neither session contains a PicklingError anywhere.

The timing count is not withdrawn, it is suspended. Every arm-B run behind the
mean +243.6s was also building a 3.13 virtualenv and downloading torch 2.12 and
41 other packages that arm A got from the image, which is exactly the wall clock
the figure was attributing to this leg. The sign may survive -- a session has 4
vCPUs and a leg is mostly install -- but the number cannot be quoted as it
stands, so the note says so and names the run that settles it.

The unwired-note guard grows a fourth category for that, UNDER RE-MEASUREMENT,
because the three it had would each have forced a false statement here:
REJECTED keeps a withdrawn measurement standing as a finding, SUPERSEDED is not
true, and STILL UNKNOWN throws away everything that is known. It requires both
an unblock condition and a NAMED deciding run, since "we will re-run it" is how
a measurement stays pending for a year. Two mutations, both caught.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a90ae3dbb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

--zoo-ref '${{ steps.pins.outputs.zoo_ref }}' \
--smoke-args "--max-steps $MAX_STEPS" \
--per-run-timeout 3300 \
--with-studio \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Omit Studio flags from single-leg runs

When the new nightly runs, LEG_LIST is set to grpo, so this workflow selects --legs grpo but still passes --with-studio. The builder explicitly rejects that combination at .github/scripts/kaggle_t4_ci/build_kernel.py:1788-1792 with --with-studio requires --all-kernels, causing the build step to exit before creating or launching a notebook. The same failure affects every manual dispatch using the new legs override; pass the Studio flags only for the --all-kernels path, or allow Studio with an explicitly selected leg.

Useful? React with 👍 / 👎.

Comment on lines +277 to +278
elif not export.get("files"):
failures.append(f"the export reported ok and wrote nothing to {export.get('dir')!r}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require model weights in the vision merge export

When save_pretrained_merged() returns without producing merged weights but leaves ancillary files such as tokenizer or config JSON, this check passes because export["files"] contains every file under the directory. The newly wired vision leg then reports its merged-export assertion as healthy even though no checkpoint exists to load or deploy. Require at least one nontrivial model-weight artifact such as a .safetensors/.bin shard, or reload the exported checkpoint before accepting it.

Useful? React with 👍 / 👎.

…than per-PR

Four sessions, one commit, both accounts, arm A the wired five legs plus Studio
and arm B the same plus this leg:

    account   A        B        delta
    r1        1511.8   1684.2   +172.4
    r2        1508.7   1548.4    +39.7

Slower in 2 of 2, mean +106.1s on a ~1510s makespan. Arm A reproduced to 3.1s
across two accounts, so the baseline is not the noisy part; arm B varies by
135.8s, which is why this records a sign and a range rather than one number.

The cost is attributable rather than mysterious. vision_fla_compile sets the
makespan alone on gpu0 and is the leg that slows, 1486.2 -> 1644.8 and 1480.3
-> 1518.7, so what a sixth concurrent install buys on 4 vCPUs is a slower
critical-path leg. The brief for this leg was multi-GPU coverage at no
wall-clock cost, and +106s is a cost.

So it joins grpo on the nightly, where the coverage is free, and the note says
which of the two reasons applies to which leg: grpo is nightly because it
crashes 44% of the time, multi_gpu because it costs makespan. The leg itself is
green in both arms of this A/B and in both venvfix sessions.

The two nightly legs also serialise cleanly rather than contending: grpo
declares 13.8GB and admits no co-tenant, and multi_gpu reserves on every card,
so neither can start beside the other.

The earlier claim that this leg broke the Default leg is withdrawn in the note,
with what actually caused it, because it stood in this file as a finding.

Guards: the nightly leg list is now read as a list rather than a single name,
every name in it must be a real leg, the set must fit in one kernel, and none
of them may also be wired per-PR. Three mutations reintroduced and caught. One
correction along the way: the first version of the helper matched the schedule
fallback in general and picked up the gate bypass, reporting the nightly leg
set as ["true"], so it is anchored on LEG_LIST.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4eb259ad3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +145 to +146
if disable_xet:
os.environ["HF_HUB_DISABLE_XET"] = "1"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Run the HTTP retry in a fresh interpreter

When either initial Xet attempt stalls or fails, setting HF_HUB_DISABLE_XET here does not make the final attempt use classic HTTP: the first attempt has already imported huggingface_hub, whose transport setting is cached in module constants at import time, so the later snapshot_download reuses the Xet configuration despite the environment change. The repository's own inference and training fallback paths respawn workers for this reason; run this retry in a fresh process with the variable set before import, otherwise the advertised alternate-transport recovery repeats the failing transport.

Useful? React with 👍 / 👎.

Comment on lines +985 to +988
ctx = applied.get("context_length")
if ctx is None:
failures.append("the status reports no context_length")
elif int(ctx) > self.args.studio_ctx:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Verify the requested context pin instead of only its ceiling

When Studio ignores the requested 2048-token pin and starts llama.cpp with a smaller context such as 512, this condition passes because it rejects only values above the request. That makes the subsequent compaction test exercise an unintended window while server_flags still reports success. InferenceStatusResponse exposes requested_context_length specifically to distinguish the requested n_ctx from the resolved context_length; require that field to equal studio_ctx (and separately validate the effective value) so a silently shortened or ignored pin cannot pass.

Useful? React with 👍 / 👎.

# Conflicts:
#	.github/scripts/kaggle_studio_ci/build_kernel.py
#	tests/kaggle/test_t4_smoke_harness.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f2d144ee4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"""The pass rule, pure so it is checkable on CPU without a model."""
failures = []

pixels = result.get("pixels") or {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce the recorded vision response mask

When UnslothVisionDataCollator stops masking the user/image prompt, the wired Vision_FLA_compile leg still passes: pixel_evidence() records label_tokens and masked_tokens, but vision_failures() only validates the pixel tensors and never consumes either masking field. The loss, adapter-update, and image-inference checks can all remain healthy while the leg trains on the entire conversation instead of its declared completions-only objective; fail when masking evidence is absent, zero, or leaves no completion tokens.

Useful? React with 👍 / 👎.

danielhanchen and others added 2 commits August 27, 2026 08:03
The leg is green end to end (unsloth-probe-lcleg-tmpdir-ac53ca: passed true,
failures [], naive_trl_failures [], Q8_0 plus mmproj from the prebuilt
llama.cpp bundle, llama-bench rc=0 on the exported file) and was held out
only by unsloth-zoo #1103, which merged this morning.

It does not go into the per-PR kernel, which is what its UNWIRED note
promised. That sentence was written without the number that decides it: the
leg's own DONE record is 1323.0s, and at 12.73GB peak it admits no co-tenant,
so it wants a card to itself for 22 minutes. The per-PR kernel has one block
of slack, gpu1 idle for 776.3s while Studio holds gpu0, and 1323 does not fit
in 776. Wiring it there would add roughly 580s to a 2101.8s makespan, which
is the trade multi_gpu was already refused for at a fifth the cost.

Nightly is where that coverage is free, and it serialises there for the same
reason it does not fit here. The note now carries the measurement and what
would unblock the per-PR slot.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-01T02:55:47.511955Z beae233 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c39d2c54ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# it stops a future second kernel prefetching a model it will never
# load -- which would be pure network cost, on a lane whose entire
# justification is that it is free.
prefetch_repos = () if args.no_prefetch else PREFETCH_REPOS,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict prefetching to the selected legs

When build_kernel.py is invoked with --legs and prefetching remains enabled, this unconditionally embeds the complete wired PREFETCH_REPOS list rather than deriving repositories from names. For example, a --legs grpo,multi_gpu,latest_compile run downloads the roughly 12.5 GB gpt-oss checkpoint plus the vision/default models even though none of those legs loads them, while it does not prefetch the selected Gemma or GRPO checkpoint. This wastes substantial network, cache disk, and CPU during an intentionally narrowed run and can extend or destabilize the paid GPU session; pass only repositories required by the selected legs.

Useful? React with 👍 / 👎.

Comment on lines +2781 to +2784
"--image-generation",
dest = "image_generation",
action = "store_true",
default = False,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Expose image generation through a hardware workflow

This assertion is disabled by default, but neither committed hardware workflow provides a way to enable it: the standalone Studio workflow constructs ARGS only from steps/models/UI at .github/workflows/kaggle-t4-studio-gpu-ci.yml:389-398, and the merged notebook workflow hardcodes --studio-args "--max-steps 8" at .github/workflows/kaggle-t4-notebook-ci.yml:925-926. Consequently normal runs and workflow dispatches always skip the newly added end-to-end image test, despite the comment saying a dispatch can request it; wire an input or enable the flag in an appropriate scheduled leg.

Useful? React with 👍 / 👎.

Comment on lines +1974 to +1977
_, status_body = self.studio.get("/api/inference/images/status")
status = status_body if isinstance(status_body, dict) else {}
if status.get("loaded"):
break

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Wait for the requested diffusion model to become active

When --studio-home already contains a loaded diffusion pipeline and this asynchronous request replaces it, /api/inference/images/status deliberately continues reporting the old pipeline as loaded until the new download commits. This loop therefore exits immediately on the stale model without checking repo_id or waiting for load-progress to reach ready, and the subsequent generation can pass using the previous checkpoint while claiming args.image_model was exercised. Require the active status to identify the requested model and the in-flight load to finish before generating.

Useful? React with 👍 / 👎.

Comment on lines +578 to +580
ggufs = gguf_export_record.get("ggufs") or []
if ggufs and llama_dir:
gguf_run_record = run_gguf(ggufs[0]["path"], llama_dir)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exercise the vision projector in the GGUF check

For vision_fla_compile, this selects only the largest exported GGUF and runs a text-only llama.cpp benchmark/completion against it. Neither export_failures() nor this call requires the vision mmproj sidecar to exist, and the runner never supplies a projector or an image, so an export that drops or corrupts the projector still passes while the leg claims a vision GGUF with a usable sidecar. The separate vision inference uses the in-memory Transformers model before conversion and therefore cannot validate the exported projector; require the sidecar and drive the exported pair with an image.

Useful? React with 👍 / 👎.

…assume them

Three review findings, all three real.

The prefetch size walk followed the snapshot symlinks into blobs/ and counted
the same bytes again under the blob's own name. Reproduced against a synthetic
cache: 6000 bytes reported for 3000 on disk, exactly the 2x already measured on
kernel unsloth-probe-prefetch-verify-9568-7a0bdd, where gpt-oss came back as
25109731082 bytes for a ~12.5 GB checkpoint and 407 MB/s was really ~203. That
rate is what the second-wave ordering and the makespan argument rest on. Now
lstat, skipping links, deduplicated by inode so a filesystem without symlinks
that hardlinks instead is also counted once.

Pointing --chat-model at the MTP repo was a request, not a result: if the
companion is missing, llama.cpp was built without MTP, or the drafter is
downgraded for VRAM, the main GGUF loads and generates and every assertion stays
green while the path the repo was chosen for never runs. spec_drafter_kind now
has to be mtp, with spec_fallback_reason and llama_cpp_supports_mtp recorded so
the report names WHICH fallback happened. Scoped to an MTP model, since a plain
GGUF not doing MTP is correct behaviour there.

The compaction control accepted any HTTP 400 as proof of the default overflow
policy, while its own failure text promised code=context_length_exceeded.
openai_error_body always emits the key and leaves it None for an unclassified
failure, so a validation error satisfied it. Both are now required in one
condition, so neither can pass while the other is wrong.

12 mutations caught across the three guards, including reverting the walk to
os.stat, dropping the inode dedupe, recording the MTP fallback as a note rather
than a failure, making the MTP rule unconditional, and checking the refusal code
in a separate branch from the status.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 1, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 1, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 1, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a7a85c0c19

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +200 to +202
if LORA_B_MARKER in name.lower():
tensors += 1
total += float(param.detach().abs().sum())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Track vision-tower adapter updates separately

When gradients stop reaching the vision tower but the language-side LoRA still trains, this aggregate sum becomes nonzero and the leg passes: vision_lora_evidence() proves only that vision modules were attached, while image inference can still succeed through the frozen base vision tower. Split the before/after evidence by tower and require at least one vision-side LoRA B tensor to change so finetune_vision_layers=True is actually exercised.

Useful? React with 👍 / 👎.

Comment on lines +202 to +203
biggest = ggufs[0]
if biggest["mb"] <= 1.0:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate the accepted GGUF rather than the largest file

When an export leaves multiple GGUFs, the size and usability checks can apply to a different artifact from the quantization check: a large F16 file makes biggest valid, any separate file whose name contains the accepted quantization satisfies the later search, and the caller runs ggufs[0]. Thus a truncated or unusable requested-quantization artifact can accompany a runnable wrong-quantization file and still pass; select an accepted artifact first, then require that same file to be nontrivial and execute it.

Useful? React with 👍 / 👎.

pre-commit-ci Bot and others added 2 commits September 1, 2026 02:31
Carries the measurement from ci/kaggle-studio-concurrent (e1873c1) onto this
branch, which is the one landing, and updates it where that note is now stale.

Two things changed since this note was last written and they point in opposite
directions.

The reward saturation fix is confirmed on hardware, twice, on two accounts:
reward3-045dba and crashax-b-27d9e3 both recorded non-zero reward_std on every
step with frac_reward_zero_std 0.0 throughout. Under the old
min(len, 200) / 200.0 every completion at the observed lengths scored exactly
1.0 and every group tied. That blocker is closed, and the note claiming a full
pass had never been observed is withdrawn.

The crash rate got worse. This note said one in four, from a four-session window
that happened to open on three clean runs. Four more sessions, run in parallel
across two accounts, produced three more crashes. Pooled, it is nine sessions
and four illegal memory accesses: 44%. Peak was 13.39-13.40GB of 14.56 in all
nine, crashed and clean alike, so memory does not separate them, and it vanishes
under --cuda-launch-blocking. It survives both the flashinfer uninstall and
UNSLOTH_VLLM_NO_FLASHINFER=1.

One sentence from the original commit is deliberately NOT carried. It ends "a
nightly kernel is where this belongs, and that scheduling does not exist yet",
which was true on that branch and is false on this one: this branch built the
nightly, and kaggle-t4-notebook-ci.yml dispatches 'grpo,multi_gpu' on the
schedule. The note now says where the leg actually runs rather than asking for
something it already has.

tests/kaggle: 872 passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: beae23374b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# dispatches that name different slots genuinely run side by side.
# Everything that is not a dispatch has an empty input and lands in slot
# 1, which is exactly the old behaviour for pushes and pull requests.
group: kaggle-t4-account-notebook-${{ inputs.slot || '1' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Share the second slot with the Studio workflow

When a slot-2 dispatch overlaps a slot-1 notebook run and the standalone .github/workflows/kaggle-t4-studio-gpu-ci.yml job, the three jobs occupy distinct concurrency groups (kaggle-t4-account-notebook-1, kaggle-t4-account-notebook-2, and kaggle-t4-account-studio). Both workflows state that the Kaggle account permits only two concurrent sessions, so simultaneous gates can pass before any session becomes visible and then race a third kernel push into the capacity limit. Coordinate notebook slot 2 with the Studio semaphore, or otherwise enforce the limit across all workflows using the account.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit 40f452e into main Sep 1, 2026
20 checks passed
@danielhanchen
danielhanchen deleted the ci/kaggle-latest-compile branch September 1, 2026 05:45
danielhanchen added a commit that referenced this pull request Sep 1, 2026
#9700 landed the SLOTTED concurrency group (two dispatcher-chosen slots, because
one group cannot express "at most two" and a second PENDING run cancels the
first rather than queueing). This branch keyed the same group on the chosen
account.

Both are kept, because they answer different halves of one cap: the slot bounds
a single account to its two sessions, and the account is what makes a second
account add capacity at all rather than queueing behind the first. The group is
now account + notebook + slot, which is 2 accounts x 2 slots and still Kaggle's
two per account.

Also carries main's `single_device` placement into the fetch-timer branch of
run_t4_smoke.py rather than choosing between them: the timer is this work's
point and `device_map={"": 0}` is what stops the multi_gpu leg loading a sharded
model that cannot train.

tests/kaggle: 902 passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants