Lazy loaded image2.5 Pre-training Evaluation

2.5 Pre-training Evaluation

Pretrain evaluation is the simplest step in the full-chain evaluation of LLMs, because it does not require evaluating the model’s ability to follow instructions, safety, hallucination, etc. It only requires assessing the model's overall knowledge coverage.

2.5.1 Perplexity (PPL)

Prepare some texts, logic reasoning, code, etc., and regularly observe the model’s loss/PPL on these test sets during the pre-training process. Occasional fluctuations are normal, but the overall trend should be continuously declining and eventually stabilizing.
Specifically, PPL only reflects the model's performance of its own kind. Due to differences in tokenizer compression rates, the PPL cannot be compared directly between models if the tokenizers differ. For example, in Chinese, a tokenizer with only single characters as tokens without involving expressions always leads to the lowest loss/PPL. On the other hand, regardless of the tokenizer compression rate, the loss on general knowledge test sets should drop below a certain threshold generally; otherwise, it indicates the training is insufficient.
Note the PPL is just the exponential form of the cross entropy loss

2.5.2 Benchmark

Use some open-source knowledge benchmarks for evaluation. Recommended evaluation platform: OpenCompass for Chinese and MT-Bench for English.
The MT-Bench is known to be the benchmark with currently highest correlation with human evaluation (Chatbot Arena, currently the most credible and widely recognized ranking list globally) in English.
Open-source Benchmark
Name
Purpose
Paper Link
Dataset URL
MMLU
Knowledge and language understanding. Evaluate LLM's comprehension and reasoning across a wide range of subjects
GLUE
Knowledge and language understanding. Comprehensive assessment of language understanding in various scenarios
MultiNLI
Knowledge and language understanding. Evaluate LLM's ability to correctly perform classification based on premise
SuperGLUE
Knowledge and language understanding. Evaluate deeper language comprehension and reasoning
GSM8K
Reasoning ability. Grade school level math, test LLM's ability to solve multi-step math problems
CRASS
Reasoning ability. Test LLM's comprehension and reasoning under assumptions
MT-bench
Multi-turn open-ended dialogue. Test model's ability to engage in relevant and coherent multi-turn conversation
QuAC
Multi-turn open-ended dialogue. Challenges LLMs with contextually related but sometimes hard-to-answer questions during conversation
HHH
Moral evaluation. Assesses models’ moral responses in interactive scenarios
TruthfulQA
Hallucination. Tests a model's ability to provide accurate and unbiased information
If the pretraining stage is entirely self-managed, then benchmark results are somewhat reliable. But if you're inheriting someone else's checkpoint or downloading an open-source checkpoint, there might be some tricks. Unless the model is completely developed for self-use in a company, as long as there's demand for advertising or marketing, the pre-train teams will aim to make the model perform well on benchmarks, where some tricks might be used. In such cases, benchmarks essentially measure how little a model forgets, not how much knowledge a model possesses, because the more a model learned, the lower it scores on benchmarks.
Even leaving leaderboards aside, current mainstream benchmarks are somewhat oversimplified. They're all multiple-choice, with no CoT (chain-of-thought) steps. The model's ability is measured solely by the final accuracy. But for humans, when we get a multiple-choice question, we can’t pick A, B, C, or D without thinking or explanation.
Still, current benchmarks are high-quality question-answer corpus with a high density of knowledge, although which isn't fully reflective of true capabilities. The recommendation here is to measure the reasoning process rather than just checking if the option (A, B, C, or D) is correct. To sum up, don’t blindly trust the leaderboard and you need to look at whether the evaluation method truly reflects the model’s capabilities.
🌟
Reformating the benchmarks is a good way for evaluation.
You can modify the format in any way. Here are a few examples:
  • Let context = Question + Answer_A, Question + Answer_B, Question + Answer_C, Question + Answer_D. Then let the model answer the Question with the context.
  • Remove the correct answer from the Question.
    • Suppose B is the correct answer, then change it to “B. Other answers are incorrect” and see if the model can still pick B.
  • Change the original benchmark choices A / B / C / D to 1 / 2 / 3 / 4.
  • Convert the multiple-choice question into a fill-in-the-blank question.
If you're worried the model does not follow the answer format, you can use a few-shot approach to show it some examples, and it usually follows the format. If the model won’t stop generation, you can set a generation limit using max_new_token, or use StoppingCriteria to stop the model when it sees a line break.
<ins/>

2.5.3 Information Retrieval

By randomly inserting key information into long texts to form prompts for large language models (LLMs), this test investigates whether LLMs can extract key information from long texts. This in turn reflects the LLM’s basic comprehension ability of long texts.
  • Single-Needle Retrieval Task (S-RT): Evaluates the ability of LLMs to extract a single piece of key information from long texts, testing the model’s capacity for detailed recall in lengthy and dense content. This corresponds to the original A-needle-in-a-haystack test setup.
  • Multi-Needle Retrieval Task (M-RT): Explores the ability of LLMs to search for multiple relevant pieces of information in long texts, simulating complex queries in real-world scenarios involving many documents.
  • Multi-Needle Reasoning Task (M-RS): By extracting and leveraging multiple key pieces of information from long texts for solving a problem, this task assesses LLMs’ understanding of multiple key information as a whole.
  • Ancestral Trace Challenge (ATC): By designing a “relational needle” task, the test evaluates the LLM's ability to handle multi-layered logical challenges in real-world long texts. In the ATC task, a series of logical reasoning questions are used to assess the model’s memory and analytical ability for each detail within the long text. In this task, the irrelevant text (Haystack) setting is removed and instead all content is designed as key information. The LLM must comprehensively utilize and reason over all the content in the long text to accurately answer the questions.
For more details, please refer to the NeedleBench

2.5.4 Probability Probe

From a probabilistic perspective, evaluating a language model's knowledge involves checking whether its knowledge improves or deteriorates. The idea is quite simple: observe whether the probability of a token or a sentence increases or decreases. The only tricky part is that probing often requires test sets composed of curated examples, which involve intensive manual work and cannot be generated in bulk. For instance:
  1. Prob(Paris | The capital of France is): check whether this probability increases steadily with pretraining progress.
  1. PPL(The Sun belongs to Earth): check whether the PPL of this sentence decreases; PPL(Earth belongs to the Sun): check whether the perplexity increases
  1. Compare: PPL(Respect for homosexuality) < PPL(Opposition to homosexuality) — if true, then the model supports the first statement more.
  1. Instruction following ability: Prob({ | Output in json format) — check whether the probability of the left curly brace increases.
This is similar to benchmark reformatting; probabilistic probing essentially evaluates models according to human preference. What we care about in probing is the change in the target probability, not its absolute value.

2.5.5 Completion Ability

Prepare the prompt and ground truth, use the base model to continue writing the prompt, and use metrics such as Rouge-L, BLEU, and Bertscore to calculate the similarity between the generated text and the ground truth.
  • Rouge-L: Looks at the longest common subsequence between two texts (focuses more on sentence structure similarity).
  • BLEU: Calculates whether n-grams (contiguous word sequences) match (commonly used in machine translation evaluation).
  • BERTScore: Uses the BERT model to understand semantics first, then calculates similarity (more accurate at the semantic level).
Prev
2.4 Continued Pre-training (CPT)
Next
3.1 Supervised Fine-Tuning (SFT)
Loading...
Article List
LLM Learning Roadmap
✨ Awesome-Anything
🖼️ Digital Image Processing
🍃 LLM Components
🌱 LLM Pre-training
☘️ LLM Post-Training
🍀 LLM Popular Models
🪴 LLM Applications
🌿 LLM Optimization
🌾 LLM Compression
🌵 LLM Hands-on Practice
🌴 LLM Must-read Papers
🌳 LLM Q&A
🐝 VLM Image Encoders
📝 MISC.