IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo module

toppminp

Functions​

  • ​merge: Merge two sorted subarrays into one sorted array.
  • ​merge_sort_recursive: Recursive merge sort implementation.
  • ​min_p_sampling: Naive CPU implementation of Min-P sampling for token selection. This function applies temperature scaling, softmax, a merge sort, and then samples tokens based on the calculated probability threshold (Min-P).
  • ​sort_buf_descending: Sort each batch separately in descending order using parallel merge sort.
  • ​top_p_sampling: Naive CPU implementation of Top-P sampling for token selection. This function applies temperature scaling, softmax, a merge sort, and then samples tokens based on the cumulative probability mass (Top-P).