Skip to content

How to get the perplexity of the sequence #48

Closed

Description

@NeonBohdan

This project is crasy fast
But can it be applied not only to generate text but also to score it too

Is there is the way to measure the perplexity or naturalnes of the sequence, for example of a question-answer pair

Activity

  1. NeonBohdan commented on Jul 5, 2023

    @NeonBohdan
    Author

    Here is the PR that adds perplexity test over input prompt
    ggml-org/ggml#184

  2. NeonBohdan commented on Jul 10, 2023

    @NeonBohdan
    Author

    And here one more example
    ggml-org/llama.cpp#270

  3. marella commented on Jul 16, 2023

    @marella
    Owner

    I haven't done it myself but it should be possible to compute it using the low-level APIs llm.eval() and llm.logits.

    tokens = llm.tokenize(sentence)
    
    all_logits = []
    for token in tokens:
        llm.eval([token])
        all_logits.append(list(llm.logits))
    
    # `all_logits` can be used to compute the log probabilities of tokens.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions