feat(ai): enhance orchestrator selection by incorporating latency #3043
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this pull request do? Explain your changes. (required)
This pull request, done in collaboration with @ad-astra-video, introduces latency consideration into the orchestrator selection process, addressing two key issues. Firstly, it resolves a minor bug where the algorithm consistently selected known orchestrators due to a condition that never evaluated to true (see this condition). Secondly, this change ensures that, once all orchestrators have been evaluated, the one with the fastest response time for a specific job is chosen. While the current method for calculating latency is somewhat basic, it sets the foundation for more sophisticated enhancements in the future.
Specific updates (required)
How did you test each of these updates (required)
Does this pull request close any open issues?
https://linear.app/livepeer-ai-spe/issue/LIV-302/selection-algorithm-sticks-to-known-sessions-after-one-has-been-found
Remarks
The latency calculation formula is a bit naive but it seems to work for the current piplines it howver might be needed to improved when schedulers or other pipeline tools are added.
Important
It's crucial to highlight that this action effectively suspends the stake-based selection formula once latencies for all nodes have been identified. To enhance the process, we could consider modifying the MinLSSelector to prioritize the fastest 30% and implement a weight-based selection algorithm accordingly.
Checklist:
make
runs successfully./test.sh
pass