Skip to content

Conversation

@yjw258
Copy link
Contributor

@yjw258 yjw258 commented Oct 23, 2025

Use beam search kernel to select candidates in beam search kernel, and add a launch parameter enable_beam_search_kernel to control this behavior.

Performance Results

20251024180253689

@yjw258 yjw258 force-pushed the features/beam_search_npu branch from 8303520 to 3ef9f6b Compare October 23, 2025 04:28
torch::cat({batched_fwd_inputs.acc_logprob,
batched_fwd_inputs.micro_inputs[i].acc_logprob},
-1);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider using std::vector<torch::Tensor> acc_logprob_vec; and torch::stack(acc_logprob_vec); for better performance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.


std::unique_ptr<Sampler> sampler_;

std::unique_ptr<BeamSearcher> beam_searcher_;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move it to LLMWorkerImpl since beam searcher is only worked for llm.

@yjw258 yjw258 force-pushed the features/beam_search_npu branch from 3ef9f6b to f9654c4 Compare October 24, 2025 08:47
@yjw258 yjw258 requested a review from RobbieLeung October 24, 2025 08:56
Copy link
Collaborator

@RobbieLeung RobbieLeung left a comment

Choose a reason for hiding this comment

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

LGTM

@liutongxuan liutongxuan merged commit 8bbe6f6 into jd-opensource:main Oct 24, 2025
5 of 6 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.

3 participants