Visualization for NLP and LLMs

CS-GY 9223 - Fall 2025

Claudio Silva

NYU Tandon School of Engineering

2025-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 syntatic (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: hierachy of concepts related to a domain

NLP basics: Sparse and dense text representation

  1. Sparse embeddings 1
    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
    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
    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
    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 - Jaokar, 2024

NLP basics: Neural Network recap.

NLP basics: Neural Network recap.

Transformer - Vaswani, 2017

NLP basics: Neural Network recap.

Transformer - Vaswani, 2017

NLP basics: Neural Network recap.

Transformer - Park, 2019

Today’s Agenda

  1. Natural Language Process (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

  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: 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

  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: 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

  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: LLM Visualization

  1. BertViz: A tool for visualizing multihead self-attention in the BERT model
  2. Sanvis: Visual analytics for understanding self-attention networks
  3. Attention flows: Analyzing and comparing attention mechanisms in language models
  4. Dodrio: Exploring transformer models with interactive visualization
  5. TopoBERT: Exploring the topology of fine-tuned word representations
  6. Attentionviz: A global view of transformer attention
  7. On the Biology of a Large Language Model
  8. POEM: Interactive Prompt Optimization for Enhancing Multimodal Reasoning of Large Language Models

Visualization for NLP: LLM Visualization

  1. Sanvis: Visual analytics for understanding self-attention networks

Visualization for NLP: LLM Visualization

  1. Dodrio: Exploring transformer models with interactive visualization

Visualization for NLP: LLM Visualization

  1. Attentionviz: A global view of transformer attention

Visualization for NLP: LLM Visualization

  1. On the Biology of a Large Language Model

Does Claude plan its rhymes?

Mental math

Visualization for NLP: LLM Visualization

  1. On the Biology of a Large Language Model

Are Claude’s explanations always faithful?

Multi-step reasoning

Visualization for NLP: LLM Visualization

  1. On the Biology of a Large Language Model

Hallucinations

Visualization for NLP: LLM Visualization

  1. POEM: Interactive Prompt Optimization for Enhancing Multimodal Reasoning of Large Language Models

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).