@@ -433,36 +433,47 @@ You don't have to call the field "label", and it's okay if this field isn't
433433present in the * dataset* - as long as it's something that the model will
434434recognize and use as the target to derive gradients.
435435
436- ### Sequence salience
436+ ## Sequence salience
437437
438- Sequence salience generalizes the salience methods mentioned above to
439- text-to-text generative models and explains the impact of the preceding tokens
440- on the generated tokens. Currently, we support sequence salience computation for
441- various OSS modeling frameworks, including KerasNLP and Hugging Face
442- Transformers.
438+ Sequence salience generalizes token-based salience to text-to-text models,
439+ allowing you to explain the impact of the prompt tokens on parts of the model
440+ output.
443441
444- Sequence salience in the LIT UI provides multiple options for analysis,
445- including:
442+ LIT has a general-purpose sequence salience visualization designed for
443+ left-to-right ("causal") language models. Currently, this works out-of-the-box
444+ with
445+ [ GPT-2 models] ( https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/lm_salience_demo.py )
446+ and with the new Gemma LMs via
447+ [ this Colab] ( https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/gemma/docs/lit_gemma.ipynb ) .
446448
447- * running the salience methods on the text from the dataset (target) or from
448- the model (response).
449- * computing the sequence salience through [ Gradient Norm] ( #gradient-norm ) or
450- [ Gradient-dot-Input] ( #gradient-dot-input ) .
451- * selecting different granularity levels for salience analysis, from the
452- smallest possible level of tokens, to more interpretable larger spans, such
453- as words, sentences, lines, or paragraphs.
449+ ![ Sequence salience - sequence selection] ( ./images/components/sequence-salience-1.png ) {w=650px align=center}
454450
455- (a) Options for sequence salience. | (b) Sequence salience visualization.
456- -------------------------------------------------------------------------------------------------- | ------------------------------------
457- ![ Sequence salience selections] ( ./images/components/sequence-salience-selections.png ) {w=650px align=center} | ![ Sequence salience vis] ( ./images/components/sequence-salience-vis.png ) {w=650px align=center}
451+ ![ Sequence salience - visualization] ( ./images/components/sequence-salience-2.png ) {w=650px align=center}
458452
453+ The UI supports multiple options for analysis, including:
459454
460- ** Code:**
455+ * Select from pre-defined target sequences, or explain generations from the
456+ model.
457+ * Different salience methods, including [ Gradient Norm] ( #gradient-norm ) and
458+ [ Gradient-dot-Input] ( #gradient-dot-input ) .
459+ * Multiple granularity levels for analysis, from individual sub-word tokens up
460+ to words, sentences, lines, or paragraphs. Quickly switch between different
461+ views to refine your analysis to different parts of a prompt.
462+ * Display density options to enable working with longer sequences, such as
463+ document text, few-shot eaxmples, or chain-of-thought prompts.
461464
462- * Demo: [ ` lm_salience_demo.py ` ] ( https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/lm_salience_demo.py )
463- * KerasNLP model wrappers: [ ` instrumented_keras_lms.py ` ] ( https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/models/instrumented_keras_lms.py )
464- * Transformers model wrappers: [ ` pretrained_lms.py ` ] ( https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/models/pretrained_lms.py )
465+ For a walkthrough of how to use sequence salience to debug LLMs, check out the
466+ Responsible Generative AI Toolkit at
467+ https://ai.google.dev/responsible/model_behavior .
468+
469+ ** Code:**
465470
471+ * Demo:
472+ [ ` lm_salience_demo.py ` ] ( https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/lm_salience_demo.py )
473+ * KerasNLP model wrappers:
474+ [ ` instrumented_keras_lms.py ` ] ( https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/models/instrumented_keras_lms.py )
475+ * Transformers model wrappers:
476+ [ ` pretrained_lms.py ` ] ( https://github.com/PAIR-code/lit/blob/main/lit_nlp/examples/models/pretrained_lms.py )
466477
467478## Salience Clustering
468479
0 commit comments