Skip to content

Validate DPO on Qwen3.5-9B-Base LoRA - #21

Merged
micahtyong merged 13 commits into
mainfrom
validate-dpo-lora
Oct 4, 2026
Merged

micahtyong merged 13 commits into
mainfrom
validate-dpo-lora

Conversation

@micahtyong

@micahtyong micahtyong commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

DPO works on Spindle today through the Tinker SDK's forward_backward_custom, using the existing qwen35-9b-lora-16k deployment. No new deployment config or wrapper is needed: the stock tinker-cookbook DPO recipe runs unchanged with base_url pointed at a Spindle server.

Validation. The cookbook DPO recipe covers reference-sampler publication, compute_logprobs, forward_backward_custom, and optim_step. With the cookbook settings (HHH, Qwen3.5-9B-Base, rank 32, β 0.1, batch 256) at lr 1e-4 for 10 steps:

Metric Step 0 Step 9
dpo_loss 0.6939 0.6795
accuracy 0.480 0.557
margin −0.0011 0.0502

The command and results are in docs/lora_validation.md, and the run is on W&B.

Fixes found while deploying from scratch:

  • spindle deploy failed on macOS because socket.TCP_KEEPIDLE doesn't exist there. It now falls back to TCP_KEEPALIVE, the macOS name for the same option.
  • The README generated API keys without the tml- prefix, which the Tinker SDK rejects. It now generates tml- keys.

Testing:

  • pytest tests/inference passes on macOS.
  • The cookbook DPO recipe ran end to end against a fresh qwen35-9b-lora-16k deployment with tinker 0.24.1.

🤖 Generated with Claude Code

micahtyong and others added 6 commits October 2, 2026 16:36
Runs the tinker-cookbook DPO recipe (forward_backward_custom + compute_logprobs
reference) against a Spindle deployment and compares the final step with the
cookbook README's Tinker numbers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
spindle deploy imports spindle.inference.sampling locally, and macOS has no
socket.TCP_KEEPIDLE, so the frontend deploy failed with AttributeError.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Tinker SDK rejects API keys without the tml- prefix, so keys generated
with the previous command fail at ServiceClient creation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@micahtyong
micahtyong requested a review from kailash109 October 3, 2026 06:09
micahtyong and others added 6 commits October 4, 2026 14:42
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spindle works as a drop-in Tinker backend URL, so the validation uses the
cookbook's DPO recipe directly instead of a wrapper script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@micahtyong

Copy link
Copy Markdown
Collaborator Author

Versions used for the DPO validation run in docs/lora_validation.md:

  • Client: tinker==0.24.1 and tinker-cookbook at c8ed9c7, Python 3.12. Cookbook main requires tinker>=0.30.1, which Spindle doesn't support yet, so the run pinned an older cookbook commit.
  • Server: Spindle at this branch, qwen35-9b-lora-16k config.

The docs show the plain cookbook command, which works once Spindle supports tinker 0.30. Until then, run it with:

uv run --python 3.12 --with "tinker>=0.24,<0.25" \
  --with "tinker-cookbook @ git+https://github.com/thinking-machines-lab/tinker-cookbook.git@c8ed9c764b59161391156f980102d82f05014765" \
  python -m tinker_cookbook.recipes.preference.dpo.train \
  base_url=$TINKER_BASE_URL model_name=Qwen/Qwen3.5-9B-Base dataset=hhh \
  renderer_name=role_colon learning_rate=1e-4 dpo_beta=0.1 max_steps=10 \
  log_path=/tmp/dpo-hhh-experiment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@micahtyong
micahtyong merged commit 48b4eb5 into main Oct 4, 2026
2 checks passed
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