Views
No views yet
1git clone https://github.com/DataScienceUIBK/WikiHint.git
2cd WikiHint1import json
2
3with open("./WikiHint/training.json", "r") as f:
4 training_data = json.load(f)
5
6with open("./WikiHint/test.json", "r") as f:
7 test_data = json.load(f)
8
9print(f"Training set: {len(training_data)} questions")
10print(f"Test set: {len(test_data)} questions")
HintRank for Hint RankingHintRank module is designed to automatically rank hints based on their helpfulness using BERT-based models.pip install transformers torch numpy scipyHintRank directory and import the hint_rank module:1from HintRank.hint_rank import HintRank
2
3# Initialize the HintRank model
4ranker = HintRank()1question = "What is the capital of Austria?"
2answer = "Vienna"
3hints = [
4 "Mozart and Beethoven once lived here.",
5 "It is a big city in Europe.",
6 "Austria’s largest city."
7]
8
9# Pairwise Comparison Example
10better_hint_answer_aware = ranker.pairwise_compare(question, hints[1], hints[2], answer)
11better_hint_answer_agnostic = ranker.pairwise_compare(question, hints[0], hints[1])
12
13print(f"Answer-Aware: Hint {2 if better_hint_answer_aware == 1 else 3} is better than Hint {3 if better_hint_answer_aware == 0 else 2}.")
14print(f"Answer-Agnostic: Hint {1 if better_hint_answer_agnostic == 1 else 2} is better than Hint {2 if better_hint_answer_agnostic == 0 else 1}.")1print("\nAnswer-Aware Ranked Hints:")
2ranked_hints_answer_aware = ranker.listwise_compare(question, hints, answer)
3for i, (hint, _) in enumerate(ranked_hints_answer_aware):
4 print(f"Rank {i + 1}: {hint}")
5
6print("\nAnswer-Agnostic Ranked Hints:")
7ranked_hints_answer_agnostic = ranker.listwise_compare(question, hints)
8for i, (hint, _) in enumerate(ranked_hints_answer_agnostic):
9 print(f"Rank {i + 1}: {hint}")Pairwise Hint Comparison
Answer-Aware: Hint 3 is better than Hint 2.
Answer-Agnostic: Hint 2 is better than Hint 1.
Listwise Hint Ranking
Answer-Aware Ranked Hints:
Rank 1: Austria’s largest city.
Rank 2: Mozart and Beethoven once lived here.
Rank 3: It is a big city in Europe.
Answer-Agnostic Ranked Hints:
Rank 1: It is a big city in Europe.
Rank 2: Austria’s largest city.
Rank 3: Mozart and Beethoven once lived here.| Dataset | Subset | Relevance | Readability | Convergence | Familiarity | Length | Answer Leakage (Avg.) | Answer Leakage (Max.) |
|---|---|---|---|---|---|---|---|---|
| TriviaHG | Entire | 0.95 | 0.71 | 0.57 | 0.77 | 20.82 | 0.23 | 0.44 |
| WikiHint | Entire | 0.98 | 0.72 | 0.73 | 0.75 | 17.82 | 0.24 | 0.49 |
| TriviaHG | Train | 0.95 | 0.73 | 0.57 | 0.75 | 21.19 | 0.22 | 0.44 |
| WikiHint | Train | 0.98 | 0.71 | 0.74 | 0.76 | 17.77 | 0.24 | 0.49 |
| TriviaHG | Test | 0.95 | 0.73 | 0.60 | 0.77 | 20.97 | 0.23 | 0.44 |
| WikiHint | Test | 0.98 | 0.83 | 0.72 | 0.73 | 18.32 | 0.24 | 0.47 |
| Model | Config | Use Answer? | Rel | Read | Conv (LLaMA-8B) | Conv (LLaMA-70B) | Fam | Len | AnsLkg (Avg.) | AnsLkg (Max.) |
|---|---|---|---|---|---|---|---|---|---|---|
| GPT-4 | Vanilla | ✅ | 0.91 | 1.00 | 0.14 | 0.48 | 0.84 | 26.36 | 0.23 | 0.51 |
| GPT-4 | Vanilla | ❌ | 0.92 | 1.10 | 0.12 | 0.47 | 0.81 | 26.93 | 0.24 | 0.52 |
| LLaMA-3.1-405b | Vanilla | ✅ | 0.94 | 1.49 | 0.11 | 0.47 | 0.76 | 41.81 | 0.23 | 0.50 |
| LLaMA-3.1-405b | Vanilla | ❌ | 0.92 | 1.53 | 0.10 | 0.45 | 0.78 | 50.91 | 0.23 | 0.50 |
| LLaMA-3.1-70b | FTwA | ✅ | 0.88 | 1.50 | 0.09 | 0.42 | 0.84 | 43.69 | 0.22 | 0.48 |
| LLaMA-3.1-70b | Vanilla | ✅ | 0.86 | 1.53 | 0.05 | 0.42 | 0.80 | 45.51 | 0.23 | 0.50 |
| LLaMA-3.1-70b | FTwoA | ❌ | 0.86 | 1.50 | 0.08 | 0.38 | 0.80 | 51.07 | 0.22 | 0.51 |
| LLaMA-3.1-70b | Vanilla | ❌ | 0.87 | 1.56 | 0.06 | 0.38 | 0.76 | 53.24 | 0.22 | 0.50 |
| LLaMA-3.1-8b | FTwA | ✅ | 0.78 | 1.63 | 0.05 | 0.37 | 0.79 | 50.33 | 0.22 | 0.52 |
| LLaMA-3.1-8b | Vanilla | ✅ | 0.81 | 1.72 | 0.05 | 0.32 | 0.80 | 54.38 | 0.22 | 0.50 |
| LLaMA-3.1-8b | FTwoA | ❌ | 0.76 | 1.70 | 0.03 | 0.32 | 0.80 | 55.02 | 0.22 | 0.51 |
| LLaMA-3.1-8b | Vanilla | ❌ | 0.78 | 1.76 | 0.04 | 0.30 | 0.83 | 52.99 | 0.22 | 0.50 |
1@article{mozafari2025wikihinthumanannotateddatasethint,
2 title={WikiHint: A Human-Annotated Dataset for Hint Ranking and Generation},
3 author={Jamshid Mozafari and Florian Gerhold and Adam Jatowt},
4 year={2025},
5 eprint={2412.01626},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 doi={10.48550/arXiv.2412.01626},
9}