Visualization for NLP and LLMs

DS-GA 3001 - Fall 2026

Claudio Silva

NYU Center for Data Science

2026-11-03

NLP and Large Language Models

Today’s Agenda

  1. Natural Language Processing (NLP) basics
    • Tasks and challenges
    • Analysis and representation
    • General resources
    • Sparse and dense text representation
    • Neural Network recap.
  2. Visualization for NLP
    • General Text Visualization
    • Model agnostic explanation
    • Recurrent Neural Network (RNN) Visualization
    • Transformers (LLM) Visualization

NLP basics: Tasks and challenges

NLP basics: Tasks and challenges

NLP basics: Tasks and challenges

Table 1: NLP can be divided into tasks related to acquisition, analysis, representation, etc.
acquisition structure meaning representation
sound wave phonetics/phonology semantics bag-of-words
text corpus morphology pragmatics n-gram
syntax discourse word2vec
… … … …

NLP basics: Tasks and challenges

Word & Morphosyntactic Level

  • Named entity recognition
  • Parts-of-speech tagging
  • Dependency parsing
  • Grammatical error correction
  • Word sense disambiguation
  • Coreference resolution

Document & Semantic Level

  • Text summarization
  • Question answering
  • Machine translation
  • Sentiment analysis
  • Topic modeling
  • Dialogue systems

NLP basics: Analysis and representation

  1. Lexical and morphological analysis
    • Finite-state morphological parsers
  2. Syntactic recognition and representation
    • Shallow parser or chunker
    • Context-free Grammar
  3. Morphosyntactic analysis
    • Part-of-Speech (POS) tagging
  4. Representing Meaning
    • First-order logic
    • Semantic Network
    • Conceptual Dependency Diagram
    • Frame-based approach

NLP basics: Analysis and representation

  1. Lexical and morphological analysis
    • Finite-state morphological parsers
  2. Syntactic recognition and representation
    • Shallow parser or chunker
    • Context-free Grammar
  3. Morphosyntactic analysis
    • Part-of-Speech (POS) tagging
  4. Representing Meaning
    • First-order logic
    • Semantic Network
    • Conceptual Dependency Diagram
    • Frame-based approach

NLP basics: Analysis and representation

  1. Lexical and morphological analysis
    • Finite-state morphological parsers
  2. Syntactic recognition and representation
    • Shallow parser or chunker
    • Context-free Grammar
  3. Morphosyntactic analysis
    • Part-of-Speech (POS) tagging
  4. Representing Meaning
    • First-order logic
    • Semantic Network
    • Conceptual Dependency Diagram
    • Frame-based approach

NLP basics: Analysis and representation

  1. Lexical and morphological analysis
    • Finite-state morphological parsers
  2. Syntactic recognition and representation
    • Shallow parser or chunker
    • Context-free Grammar
  3. Morphosyntactic analysis
    • Part-of-Speech (POS) tagging
  4. Representing Meaning
    • First-order logic
    • Semantic Network
    • Conceptual Dependency Diagram
    • Frame-based approach

NLP basics: General resources

  1. Lexicon: list of stems and affixes (prefix or suffix), together with basic information about them
  2. Thesaurus: list of words and their synonyms from a specific domain
  3. Treebank: list of words labeled with syntactic (POS-tagging) trees
  4. Prop(osition) bank: sentences annotated with semantic roles related to verbs
  5. FrameNet: sentences annotated with semantic roles related to frames of words
  6. Ontology: hierarchy of concepts related to a domain

NLP basics: Sparse and dense text representation

  1. Sparse embeddings
    1. One-hot encoding
    2. Bag-of-Words (BoW)
    3. Term Frequency-Inverse Document Frequency (TF-IDF)
  2. Dense embeddings

NLP basics: Sparse and dense text representation

  1. Sparse embeddings
    1. One-hot encoding
    2. Bag-of-Words (BoW)
    3. Term Frequency-Inverse Document Frequency (TF-IDF)
  2. Dense embeddings

NLP basics: Sparse and dense text representation

  1. Sparse embeddings
    1. One-hot encoding
    2. Bag-of-Words (BoW)
    3. Term Frequency-Inverse Document Frequency (TF-IDF)
  2. Dense embeddings

NLP basics: Sparse and dense text representation

  1. Sparse embeddings
    1. One-hot encoding
    2. Bag-of-Words (BoW)
    3. Term Frequency-Inverse Document Frequency (TF-IDF)
  2. Dense embeddings

NLP basics: Neural Network recap.

MLP

NLP basics: Neural Network recap.

MLP

RNN

NLP basics: Neural Network recap.

  • Replaces recurrence with self-attention
  • All tokens are processed in parallel
  • Basis of BERT, GPT and today’s LLMs

Transformer

NLP basics: Neural Network recap.

Transformer

Scaled dot-product attention

NLP basics: Neural Network recap.

Multi-head self-attention

Today’s Agenda

  1. Natural Language Processing (NLP) basics
    • Tasks and challenges
    • Analysis and representation
    • General resources
    • Sparse and dense text representation
    • Neural Network recap.
  2. Visualization for NLP
    • General Text Visualization
    • Model agnostic explanation
    • Recurrent Neural Network (RNN) Visualization
    • Transformers (LLM) Visualization

Visualization for NLP: General Text Visualization

  1. Exploring and Visualizing Variation in Language Resources
  2. Termite: Visualization Techniques for Assessing Textual Topic Models
  3. Scattertext: a Browser-Based Tool for Visualizing how Corpora Differ

Visualization for NLP: General Text Visualization

Scattertext: every term is a point, placed by how often each corpus uses it.

Visualization for NLP: Model agnostic explanation

  1. Seq2seq-Vis: A Visual Debugging Tool for Sequence-to-Sequence Models
  2. ActiVis: Visual Exploration of Industry-Scale Deep Neural Network Models
  3. iSEA: An Interactive Pipeline for Semantic Error Analysis of NLP Models

Visualization for NLP: Model agnostic explanation

iSEA finds subpopulations of text where the model makes errors, as editable rules.

Visualization for NLP: RNN Visualization

  1. Understanding Hidden Memories of Recurrent Neural Networks
  2. RNNbow: Visualizing Learning Via Backpropagation Gradients in RNNs
  3. LSTMVis: A Tool for Visual Analysis of Hidden State Dynamics in Recurrent Neural Networks

Visualization for NLP: RNN Visualization

LSTMVis: select a phrase, find every place in the corpus where the hidden state behaves the same way.

Visualization for NLP: LLM Visualization

Visualization for NLP: LLM Visualization

SANVis: the attention of every layer and head, in three coordinated views.

Visualization for NLP: LLM Visualization

Dodrio: is a head attending to syntax, to semantics, or to both?

Visualization for NLP: LLM Visualization

AttentionViz: project queries and keys into one space and look at the shapes.

Visualization for NLP: LLM Visualization

On the Biology of a Large Language Model: attribution graphs trace the internal steps behind an answer.

Does Claude plan its rhymes?

Mental math

Visualization for NLP: LLM Visualization

On the Biology of a Large Language Model: faithfulness and multi-step reasoning.

Are Claude’s explanations always faithful?

Multi-step reasoning

Visualization for NLP: LLM Visualization

On the Biology of a Large Language Model: hallucinations come from a circuit that misfires.

Visualization for NLP: LLM Visualization

POEM: visual analytics for improving prompts, not the model.

Summary: NLP Foundations

Key Takeaways:

  1. Even if human language is convoluted, we can still build advanced NLP systems that achieve good results.
  2. These systems are difficult to explain and interpret.
  3. Dense representations have much more information than sparse ones, such as the meaning, position, and relations between tokens.
  4. In a transformer, Q and K spaces are the mechanisms for selection (interpretable via patterns of relevance), while V space is the content being selected (abstract, combined, and thus harder to ground linguistically on its own).