Skip to content

Conversation

@ruivieira
Copy link

This PR implements log probabilities support in llm-d-inference-sim enabling compatibility with evaluation frameworks and other API clients that require token-level probability.

API Coverage

  • /v1/completions: logprobs parameter with TextLogprobs response structure
  • /v1/chat/completions: logprobs boolean + top_logprobs integer with ChatLogprobs response structure
  • Response format matching vLLM/OpenAI

Refer to #213
Replaces #215

Copy link
Collaborator

@mayabar mayabar left a comment

Choose a reason for hiding this comment

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

@ruivieira I added some in-place comments
In addition, please add logprobs support for requests with streaming=true (sendStreamingResponse), please take into consideration comments in PR #215 relevant to streaming (don't pass/use request in streaming.go).

Please add tests for the simulator with logprobs:
completions and chat completions requests with logprobs with and without streaming, and check the response

@@ -0,0 +1,150 @@
/*
Copy link
Collaborator

Choose a reason for hiding this comment

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

please move this file to common

Copy link
Author

Choose a reason for hiding this comment

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

Implemented in e98ded1

Since there are some cross-package imports, I've opted to call the types from common (common.ChatLogprobs) into openaiserverapi rather than the other way around. Please let me know if you prefer the other way around, or another refactor.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The dependency between openaiserverapi and common was in the wrong direction. Ira fixed this in PR #224
Now it will be possible to move the logprobs_utils to common.

feat: Add streaming support
chore: Add probability checks
refactor: Use GetLogprobs unified interface
refactor: Move to common package. Add decreasing probability common method.
refactor: Use logprobData struct in createCompletionResponse

Signed-off-by: Rui Vieira <[email protected]>
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