Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 962faaa

Browse files
iftenneyLIT team
authored andcommitted
Update docs for Gemma launch.
PiperOrigin-RevId: 609090874
1 parent 9bd3a60 commit 962faaa

7 files changed

Lines changed: 35 additions & 24 deletions

File tree

docs/demos/lm.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
<script>
33
window.location.replace("http://35.190.117.129/");
44
</script>
5-
</html>
5+
</html>

lit_nlp/components/umap_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_fit_transform(self):
3737
# Check that the _fitted flag has been flipped.
3838
self.assertTrue(umap_model._fitted)
3939

40-
# Check correctness of the output shape.
40+
# Check that the output shape is correct.
4141
output_np = np.array([o['z'] for o in outputs_list])
4242
shape = output_np.shape
4343
expected_shape = (n, 3)

website/sphinx_src/components.md

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -433,36 +433,47 @@ You don't have to call the field "label", and it's okay if this field isn't
433433
present in the *dataset* - as long as it's something that the model will
434434
recognize 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

673 KB
Loading
687 KB
Loading
Binary file not shown.
-79.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)