計算語言學與語言學理論

week 14 謝舒凱

上週回顧

  • Multimodal LLMs
  • Multimodal embeddings

本週內容

  • Evaluation of (M)-LLMs

Evaluation in NLP

NLP 三個核心: Data, Model and Task/Evaluation

到了LLM時代,評測變得更複雜

  • 數據 Data:
    • quality, quantity, diversity, and domain-specificity
  • 模型 Model:
    • architecture, size, and pretraining
  • 任務 Task/Evaluation:
    • benchmark, metric, and human evaluation

  1. https://arxiv.org/abs/2307.03109

Benchmark 基準測試

  • 目前常用於評估模型性能的一組標準化任務、數據和指標的測試組合。

  • 由三個主要成分組成: 標準化任務(Standardized Tasks)、指標(Metrics)、數據集(Datasets)。

  1. 標準化任務(Standardized Tasks):基準測試包含一組先定義好的任務,這些任務需有明確的輸入和期望的輸出。例如文本分類、問答等。

  2. 評測指標(Metrics):基準測試使用特定的性能指標來量化模型的表現。通常是基於模型的輸出和期望輸出之間的比較。

  3. 數據集(Datasets): 通常包含標記的樣本,用於訓練和測試模型。

任務

  • 分類
  • 摘要
  • 翻譯
  • 生成

生成有很多可能:結構、非結構或混合

形式

  • 選擇
  • 問答
  • 申論
  • 填空
  • 數值評分

數值評分也很多可能

評測方式還有很多討論與想像空間

  • LLMs 可以自己擔任評審嗎? (LLM as a Judge) 可以自評嗎?
  • LLMs 可以參加現場考試嗎?

評測指標

traditional NLP (and LLMs)

Classification Metrics

  • Accuracy 正確率

  • Precision 精確率

  • Recall 召回率

  • F1 score

Text Generation Metrics

  • BLEU (Bilingual Evaluation Understudy)
  • ROUGE (Recall-Oriented Understudy for Gisting Evaluation)
  • METEOR (Metric for Evaluation of Translation with Explicit ORdering)

ROUGE

  • measures the quality of the summary by counting the number of overlapping units such as n-grams, word sequences, and word pairs between the model-generated text and the reference texts.

  • variants: ROUGE-N: Focuses on n-grams (N-word phrases). ROUGE-1 and ROUGE-2 (unigrams and bigrams, respectively) are most common.

BLEU

  • a widely used metric for evaluating the quality of machine-translated text (Candidate) against reference translations (Reference).

  • calculated using a geometric mean of the n-gram precisions, multiplied by the brevity penalty (BP), pi​ is the precision for n-grams.

  • The range of BLEU score: It typically from 0 to 1, where 0 indicates no overlap between the translated text and the reference translations,

Question Answering Metrics

  • EM (Exact Match)
  • Mean Reciprocal Rank (MRR)

Summarization Metrics

  • ROUGE
  • BertScore

Specialized Metrics

  • Perplexity
  • Human Evaluation
  • Prompt-based Evaluation

實際練習

w14.colab

  • 在 LLM 時代,需要區分 LLM Task Evaluations 和 LLM Model Evaluations (overall macro performance vs use-case specific performance)


LLM Task Evaluations

or System Evaluations

  • 重點在 prompt/template 的設計 (i.e.,hold the LLM constant and change the prompt template.)

LLM Task Evaluation and Metrics

source

Task and Model Evaluation

幾個重點差異

Retrieval Metrics

  • Retrieval Augmented Generation (RAG):
    Are the retrieved documents and final answer relevant?...

LLMOp 角度

  • LLM observability is complete visibility into every layer of an LLM-based software system: the application, the prompt, and the response.

source

評測平台、架構與工具

promptbench

評測平台、架構與工具

評測平台、架構與工具

Weights and Biases (wandb)

  • Tracking and Developing LLMs: how to track, debug and visualize the training process of LLMs

評測平台、架構與工具

promptfoo

  • test your LLM app locally

其實評測是很跨學門的設計

  • 語言學的角度 (語音、言談、多模態、語言習得、)
  • 認知科學的角度 (人格、Theory of Mind (ToM)、)
  • 邏輯學的角度 (推理、論證、)
  • 社會科學的角度 (社會互動、政治、權力、偏見、...)
  • 遊戲的角度 (遊戲化、競賽、)
  • 藝術的角度 (文學、詩歌、音樂、)
  • 哲學的角度 (倫理、存在、真理、...)
  • 。。。。。。。

什麼是認知注意力

議題討論

倫理與安全

  • 偏見與立場(性別、政治、...
  • 事實查核
  • ...

LLM as Agent

Do LLMs Possess a Personality?

Making the MBTI Test an Amazing Evaluation for Large Language Models

  1. https://arxiv.org/abs/2307.16180

進階倫理問題

AI 應該全然誠實嗎?

法律問題

昨日的科幻小說,明日的現實

  • AI 有法律責任嗎?(要報稅?有著作權?有犯罪能力?)

  • 可以跟 AI 結婚嗎?

In-class Exercise

讓我們來設計一個評測任務 (model or task evaluation)

- Alignment and Calibration - Reinforcement Learning and LLMs

- Tracking and Developing LLMs

--- ## Alignment and Calibration - Reinforcement Learning and LLMs