PreTrainHOIAssistant
收藏资源简介:
HOI4 Vanilla Pretrain 数据集是从策略游戏《钢铁雄心IV》(Hearts of Iron IV)的原始游戏数据中提取的预训练语料库,旨在为大语言模型提供训练数据。数据集涵盖了游戏的核心内容,包括事件、国策树、理念、科技、国家/省份历史、本地化文本(10种语言)、Clausewitz引擎的模组文档,以及所有可下载内容(DLC)的相关数据。每个源实体都提供了三种不同的表示视图:原始的Clausewitz脚本(约70%)、解析后生成的规范JSON结构(约15%)以及模板生成的自然语言描述(约15%),这有助于模型学习游戏特定的领域特定语言、结构化表示以及与通用文本的关联。数据规模方面,数据集共包含10,316个文档,其中训练集9,773个,验证集543个。总字符数约3,860万,总单词数约298万。数据基于游戏版本1.19.1(Thunder at our Gates)提取。数据构成非常多样,按文档类型划分包含超过40种类型,按语言划分绝大多数为英文,其余包括法语、葡萄牙语(巴西)、德语、简体中文、波兰语、日语、西班牙语等少量文档,以及一个代码文档。按数据来源(DLC)划分,大部分数据来自游戏本体(vanilla),其余数据分布在超过30个不同的DLC包中。数据集在构建过程中进行了严格的三阶段去重处理,包括基于SHA-1的完全重复检测、基于抽象语法树(AST)结构哈希的逻辑重复检测,以及使用MinHash-LSH算法检测近似重复文档,确保了数据质量。数据集采用MIT许可证发布。
The HOI4 Vanilla Pretrain dataset is a pretraining corpus extracted from the raw game data of the strategy game Hearts of Iron IV, designed to provide training data for large language models. The dataset covers core game content, including events, national focus trees, ideas, technologies, country/province history, localization texts (10 languages), Clausewitz engine mod documentation, and all downloadable content (DLC) related data. A key feature is that each source entity provides three different representation views: original Clausewitz scripts (about 70%), parsed canonical JSON structures (about 15%), and template-generated natural language descriptions (about 15%), which helps models learn game-specific domain languages, structured representations, and associations with general text. In terms of data scale, the dataset contains 10,316 documents, with 9,773 in the training set and 543 in the validation set. The total character count is approximately 38.6 million, and the total word count is about 2.98 million. The data is based on game version 1.19.1 (Thunder at our Gates). The data composition is highly diverse. By document type, it includes over 40 types, with larger volumes in documentation (3,027), ai_strategy (1,047), generic (417), event (849), idea_group (115), etc. By language, the majority are English (10,147 documents), with the rest including small numbers of French, Portuguese (Brazil), German, Simplified Chinese, Polish, Japanese, Spanish documents, and one code document. By data source (DLC), most data comes from the base game (vanilla, 10,183 documents), with the rest distributed across over 30 different DLC packs. The dataset underwent strict three-stage deduplication during construction, including SHA-1-based exact duplicate detection, AST-based logical duplicate detection, and MinHash-LSH algorithm for approximate duplicate detection, ensuring data quality. The dataset is released under the MIT license.
数据集概述
数据集名称:HOI4 Vanilla Pretrain Dataset
描述:从游戏《钢铁雄心IV》(Hearts of Iron IV)原版游戏数据中提取的预训练语料库,适用于大型语言模型。数据集包含事件、焦点树、思想、科技、国家/地区历史、本地化(10种语言)、克劳塞维茨模组文档以及DLC内容。每个实体提供三种表示视图:原始克劳塞维茨脚本、规范JSON和模板化自然语言描述。
许可证:MIT
数据集规模:
- 文档总数:11,320(训练集10,751,验证集569)
- 总字符数:36,310,410
- 总词数:2,834,850
- 总令牌数(空白分词):2,834,850
- 游戏版本:1.19.1
- 数据集大小:36,325,723 字节
数据集特征
每个样本包含以下字段:
id:字符串,唯一标识符text:字符串,文本内容view:字符串,表示视图类型(raw、json、nl)source:结构体,包含以下子字段:file:字符串,源文件名doc_type:字符串,文档类型source_key:字符串,源键dlc:字符串,所属DLCgame_version:字符串,游戏版本
language:字符串,语言代码meta:结构体,包含以下子字段:n_chars:int64,字符数n_words:int64,词数n_tokens_word:int64,单词令牌数n_tokens_gpt2:int64,GPT-2令牌数n_tokens_cl100k:int64,cl100k令牌数n_bytes:int64,字节数mean_word_length:float64,平均词长symbol_to_word_ratio:float64,符号与词的比例duplicate_line_fraction:float64,重复行比例sha1:字符串,SHA-1哈希值ast_hash:字符串,AST结构哈希值extractor:字符串,提取器标识
数据集划分
- 训练集:10,751个样本
- 验证集:569个样本
数据集组成
按文档类型分布(Top 10):
| 文档类型 | 文档数 | 字符数 |
|---|---|---|
| documentation | 3,340 | 1,280,371 |
| ai_strategy | 1,319 | 1,701,124 |
| wiki | 1,230 | 812,562 |
| event | 850 | 598,054 |
| scripted_trigger | 764 | 334,945 |
| modifier | 747 | 438,739 |
| oob_template | 669 | 981,328 |
| state_history | 625 | 241,902 |
| decision | 581 | 427,624 |
| mio | 545 | 791,433 |
其他文档类型包括:country_history、country、faction、localization、focus_tree、misc_config、doctrine、special_project、idea_group、music_config、operation、game_rule、combat_tactic、scripted_loc、peace_conference、resistance、equipment、autonomous_state、scorer、scripted_gui、country_tag、state、technology、generic、opinion_modifier、balance_of_power、unit_leader、intelligence_agency、ability、general_history、raid、building、lua_code、tech_folder、resource、weather、ideology、terrain、on_action、difficulty、profile、wargoal。
按语言分布:
| 语言 | 文档数 | 字符数 |
|---|---|---|
| en(英语) | 13,298 | 35,787,727 |
| fr(法语) | 32 | 5,068 |
| pt-BR(巴西葡萄牙语) | 31 | 4,272 |
| zh-Hans(简体中文) | 21 | 3,126 |
| pl(波兰语) | 21 | 3,063 |
| ja(日语) | 21 | 2,834 |
| es(西班牙语) | 21 | 3,122 |
| de(德语) | 21 | 3,084 |
| code(代码) | 3 | 498,114 |
按来源(DLC)分布:主要来源为原版游戏(vanilla),其他来源包括多个DLC内容包。
表示视图
每个实体以三种形式呈现(根据文档ID确定性分配):
- raw(约70%):重新序列化的克劳塞维茨脚本,用于学习游戏领域特定语言
- json(约15%):解析后AST的规范JSON,结构化表示
- nl(约15%):模板化的自然语言描述,衔接通用文本
视图类型记录在每个样本的view字段中。
数据去重
文档经过三阶段去重处理:
- 精确SHA-1哈希:字节完全相同的文档
- AST结构哈希:逻辑相同但显示文本不同的文档
- MinHash-LSH(参数:num_perm=128, bands=16, rows=8, threshold=0.8):近似重复文档
- 阈值处召回率94.7%
- 不相似文档误报率0.1%
- 真实近似重复(Jaccard>=0.9)召回率99.99%
去重按语言隔离进行,翻译文本不会跨语言合并。
加载方式
python from datasets import load_dataset
从Hub加载
ds = load_dataset("hoi4-vanilla-pretrain")
从本地导出文件加载
ds = load_dataset("parquet", data_files={ "train": "data/train-.parquet", "validation": "data/validation-.parquet", })
引用格式
bibtex @misc{hoi4_vanilla_pretrain, title = {HOI4 Vanilla Pretrain Dataset}, year = {2026}, note = {Extracted from Hearts of Iron IV v1.19.1 (Thunder at our Gates)}, }





