Skip to content

Conversation

@tyler-griggs
Copy link
Member

Summary

Stage 3 of Tinker Sampling API implementation: Generator integration with opt-in feature flag.

Key changes:

  • Add use_tinker_sampling_api: false config option in generator config
  • When enabled, generator uses InferenceEngineClient.sample() instead of generate() in the agent loop
  • Add comprehensive tests for the Tinker API integration path

Bug fixes (from code review):

  • Fix critical sampling_params bug in Tinker path - now correctly uses current_sampling_params instead of empty dict
  • Add missing @pytest.mark.vllm marker to generator test

Tests:

  • test_tinker_api_integration.py - Tests type conversion and sample() integration
  • test_tinker_api_e2e.py - End-to-end tests simulating full API flow
  • test_skyrl_gym_generator.py::test_generator_with_tinker_sampling_api - Generator integration test

All 6 GPU tests pass locally.

Dependencies

Test plan

  • Run pytest tests/gpu/gpu_ci/test_tinker_api_integration.py -m "vllm" -v
  • Run pytest tests/gpu/gpu_ci/test_tinker_api_e2e.py -m "vllm" -v
  • Run pytest tests/gpu/gpu_ci/test_skyrl_gym_generator.py::test_generator_with_tinker_sampling_api -m "vllm" -v

Next steps (Stage 4)

  • Multi-engine load balancing for sample() (currently routes to engines[0] only)
  • Retry/pause semantics for production deployments
  • See TODO comment in inference_engine_client.py:175-178

🤖 Generated with Claude Code

tyler-griggs and others added 5 commits January 23, 2026 18:08
Add sample() method for generating multiple independent completions from a
single prompt. This provides token-in/token-out sampling semantics compatible
with Tinker's sampling API.

Changes:
- Add sample() to InferenceEngineInterface base class with default sequential
  implementation that calls generate() num_samples times
- Add sample() delegation to RayWrappedInferenceEngine
- Add sample() to InferenceEngineClient routing to first engine
- Add test_sample_api() integration test

This is Stage 1 of the Tinker Sampling API implementation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Stage 2 of Tinker Sampling API implementation:

skyrl-tx changes:
- Add SkyRLInferenceClient adapter that converts Tinker types to/from
  skyrl-train's InferenceEngineClient.sample()
- Add attach_skyrl_inference() helper for runtime integration

skyrl-train changes:
- Add test_tinker_api_integration.py with type conversion and sample tests
- Add test_tinker_api_e2e.py with end-to-end Tinker flow tests
- All 5 tests pass on 8xH200 GPUs

This enables skyrl-tx API server to route /api/v1/asample requests
to skyrl-train's inference engines via direct Python calls.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…Stage 3)

- Add use_tinker_sampling_api config flag to ppo_base_config.yaml (defaults to false)
- Add conditional in SkyRLGymGenerator.agent_loop() to use sample() when flag enabled
- Add test_generator_with_tinker_sampling_api test to verify Tinker API path

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes:
- Fix sampling_params bug: use current_sampling_params instead of empty dict
- Add @pytest.mark.vllm to test_generator_with_tinker_sampling_api
- Add TODO for Stage 4 multi-engine routing support in sample()

Refactoring:
- Refactor test_tinker_api_integration.py to import actual Tinker types from tx.tinker.types
- Refactor test_tinker_api_e2e.py to use actual SkyRLInferenceClient methods
- Tests now verify the real adapter code, not reimplemented duplicates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Revert tests to use lightweight duplicated types instead of importing
from tx.tinker.types, which pulls in many transitive dependencies
(sqlmodel, cloudpathlib, jax) that conflict with skyrl-train's env.

Tests now use a local TinkerAdapter class that mirrors the
SkyRLInferenceClient conversion logic to verify the integration
contract without requiring cross-module dependencies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants