ml-explore / ml-explore/mlx-examples
How to get the logits in mlx-lm?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
I'm interested in adding mlx-lm as a provider in Backtrack Sampler.
I generate one token at a time, apply my own temperature, and handle the selection of the next token in my own code. Therefore, I need to retrieve the logits from mlx-lm rather than pass it a custom sampler.
I have some changes in a branch, fwiw, but they currently don't work because I handle log probabilities (logprobs) instead of logits, as I'm using the utils.stream_generate function. I don't necessarily need to use stream_generate; I used it because I saw it here.
Is there a way to get the logits in mlx-lm?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the mlx-lm utils.stream_generate entry point and the linked Backtrack Sampler feature branch. Trace how log probabilities are produced and determine whether the integration can retrieve logits for one-token-at-a-time selection; done means the provider can apply its own temperature and choose the next token from logits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100