Skip to content

Fix Harvey Gemma tool rollouts - #5

Draft
ShubyM wants to merge 12 commits into
feat/lab-rlfrom
agent/fix-harvey-gemma-tools
Draft

Fix Harvey Gemma tool rollouts#5
ShubyM wants to merge 12 commits into
feat/lab-rlfrom
agent/fix-harvey-gemma-tools

Conversation

@ShubyM

@ShubyM ShubyM commented Jul 10, 2026

Copy link
Copy Markdown
Owner

What changed

  • align the Harvey LAB environment with the stock harness prompt, canonical six tool names, sandbox behavior, and no-tool-call termination
  • remove the synthetic submit tool, the read_document rename, and duplicated output instructions
  • pin the corrected Gemma 4 canonical chat template from Hugging Face discussion chore(deps): bump aiohttp from 3.13.3 to 3.13.4 in /server gke-labs/open-rl#36
  • enable Gemma thinking for live tool rollouts and reconstruct the pre-opened thought channel when parsing post-tool continuations
  • validate task document directories before starting a sandbox
  • preserve stop IDs, top_p, and top_k through the torch FFT and LoRA sampling path

Why

The live tool schema disagreed with Harvey's prompt and teacher traces: the prompt taught read, while Open-RL exposed read_document. The environment also added a submit tool that stock Harvey does not define. Separately, the torch sampler discarded Gemma's stop and sampling controls, and the canonical thinking template can pre-open a thought channel in the prompt that must be reconstructed before parsing sampled continuation tokens.

Together these issues caused Gemma to claim documents were unavailable or to emit valid tool calls that the rollout parser rejected.

Impact

An exact BF16 google/gemma-4-E4B-it vLLM smoke run on a stock Harvey task now discovers the mounted documents and successfully executes the canonical read tool. The remaining incomplete-task behavior in that sample was model search strategy—it searched only for .docx and skipped an .xlsx—rather than environment access.

Validation

  • make test: 87 passed, 5 skipped
  • Ruff check and format checks passed for changed Python files
  • pre-commit Ruff hooks passed
  • live vLLM H100 smoke: glob found the mounted agreement and read returned its contents

The standalone Harvey test file was intentionally omitted from this commit.

ShubyM added 12 commits July 7, 2026 09:07
- make push-to-cluster (skaffold run): builds the working tree's images with
  content-addressed inputDigest tags, pushes to gcr.io/$GCP_PROJECT, and
  deploys the FFT time-slice manifests with built images substituted —
  including the OPEN_RL_WORKER_IMAGE env var (skaffold resourceSelector), so
  trainer/sampler pods launched after the deploy run the new server image.
  The wrapper waits for the gateway rollout and deletes stale worker pods.
- Gitignored local.mk (seeded from local.mk.example) for per-developer
  Makefile settings such as GCP_PROJECT.
- IMAGE_TAG for the manual build-images/push-images flow gains a content
  hash of uncommitted changes so dirty-tree pushes produce fresh tags.
- Manifests reference the canonical CI-published images
  (ghcr.io/gke-labs/open-rl/*) with the deployed tag pinned in one place;
  gitignored k8s/deploy/local overlay for per-developer manifest overrides.
- make clean-workers removes runtime-launched trainer/sampler pods.
compute_target_logprobs materialized the full [batch, seq, vocab] logits tensor
plus a second fp32 copy from log_softmax, both retained through backward on the
GPU holding the lm_head. For large-vocab models (Gemma ~256K) that activation is
the dominant term and OOMs the trainer.

Run the backbone for hidden states and project through the vocab in chunks,
reducing to logit[target] - logsumexp with per-chunk activation checkpointing, so
peak head activation is [chunk, vocab] instead of [batch*seq, vocab]. The
full-logits fallback (unknown backbone or OPEN_RL_FUSED_LOGPROB=0) now also uses
logit - logsumexp to drop the redundant fp32 log_softmax allocation.

Env knobs: OPEN_RL_FUSED_LOGPROB (default 1), OPEN_RL_LOGPROB_CHUNK (default 1024).

Verified numerically identical (values and gradients) to the original
log_softmax(...).gather path, including Gemma final-logit softcapping.
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