Skip to content

Adding two sequence-level and consistency-based uncertainty measures: Predictive Kernel Entropy and Spectral uncertainty#460

Open
nassimwalha wants to merge 3 commits into
IINemo:mainfrom
nassimwalha:nassim
Open

Adding two sequence-level and consistency-based uncertainty measures: Predictive Kernel Entropy and Spectral uncertainty#460
nassimwalha wants to merge 3 commits into
IINemo:mainfrom
nassimwalha:nassim

Conversation

@nassimwalha

Copy link
Copy Markdown

Both methods rely on the following stat calculators:

  • BlackboxSamplingGenerationCalculator or SamplingGenerationCalculator to generate multiple samples from the target llm for a single input query.
  • SampleSentenceEmbeddingsCalculator (newly created in this pull request), to compute sentence embeddings of the sampled answers using a SentenceTransformer model. The SentenceTransformer model is managed by the newly created SentenceEmbedder class in lm_polygraph.utils.sentence_embedder (implemented analogously to Dberta).

PKE computes pairwise kernel values of the embeeddings and then averages them out, SU creates an empirical kernel matrix out of the pairwise values, normalizes it and computes its Von Neumann Entropy.

PS: In the paper, SU comes with a decomposition into aleatoric and epistemic uncertainty using input clarifications. As this is not necessairly specific to SU and can be applied to any other sequence-level uncertainty method, implementing the decomposition will come in a future pull request.

Additional change: compatibility fixes of the class AutoModelForVision2Seq for transformers >= 5.0 (these were included in some parts of the repo already, but not everywhere)

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.

1 participant