This folder contains the full pipeline for the first experiment in the paper: Probing with Classifier
The workflow is controlled by one config file:
configs/classifier.yaml
Each entry script reads only its own config section (classifier_data, combine_label, classifier_train, correctness_eval, statistic_baseline).
- Generate classifier data (
.npz) and LLM judgment prompts (*_judge.jsonl). - Call external LLM API (not included in this repo) on
*_judge.jsonl. - Merge LLM labels (
Correctness,Logicality) back into.npz. - Train classifiers for different targets.
- Evaluate
Correctness/Logicalityclassifiers. - Compute statistic baselines.
Edit config first:
vim configs/classifier.yamlScript:
bash scripts/run_classifier_data.sh configs/classifier.yamlWhat it produces:
*.npzwith fields such aslatents,hints,step_lengths,begin_token_ids,correctness,logicality*_judge.jsonlprompts for LLM-based correctness/logicality labeling
Optional override example:
bash scripts/run_classifier_data.sh configs/classifier.yaml \
--set checkpoint_name=gsm8k-385k_Qwen2.5-0.5b_spar-10.pt \
--set input_file=data/gsm8k_385K_valid.json \
--set output_file=classifier_data/gsm8k_385K_valid_classifier_dataInput:
- the
*_judge.jsonlfile from Step 1
Expected API output JSONL (at least):
idresponse(or a custom response field)
Command:
PYTHONPATH=. python classifier/combine_label.py --config configs/classifier.yamlIf your response text field is not response, set the response_key manually:
PYTHONPATH=. python classifier/combine_label.py --config configs/classifier.yaml --set response_key=contentScript:
PROC=<num_gpus> bash scripts/run_classifier_train.sh configs/classifier.yamlYou can set different inputs and targets by changing classifier_train.task:
inputs:
Trhints
targets:
lentokencorrectnesslogicality
Notes:
- For
step lengthandfirst token ppl, training loss is used directly as the main evaluation signal. - For
correctnessandlogicality, run Step 5 evaluation.
Script:
bash scripts/run_correctness_eval.sh configs/classifier.yamlThis reports accuracy for both correctness and logicality classifiers.
Command:
PYTHONPATH=. python classifier/statistic_baseline.py --config configs/classifier.yamlThis reports baselines for all four labels:
- step length (mean/std)
- first token ppl (entropy/perplexity)
- correctness (positive ratio)
- logicality (positive ratio, when enabled)