haowu1234/signal-dsl-dataset
收藏资源简介:
--- license: apache-2.0 task_categories: - text-generation - text2text-generation language: - en - zh tags: - dsl - domain-specific-language - code-generation - routing - llm-routing - signal-router - synthetic pretty_name: Signal DSL Dataset size_categories: - 100K<n<1M --- # Signal DSL Dataset A synthetic dataset for training models to generate **Signal DSL** (Domain-Specific Language) configurations from natural language descriptions. ## Dataset Description Signal DSL is used to configure intelligent LLM routing with signals, routes, plugins, and algorithms. This dataset contains: | Split | Samples | Description | |-------|---------|-------------| | **stage1_syntax_pt** | 18000 | Pure DSL for syntax pre-training | | **stage2_sft** | 102087 | NL→DSL pairs for instruction following | | **stage3_dpo** | 52532 | Preference pairs for DPO training | | **eval_benchmark** | 200 | Held-out evaluation set | ## Signal DSL Overview ### Core Components 1. **SIGNAL**: Define detection signals (keyword, domain, embedding, etc.) 2. **ROUTE**: Conditional routing rules based on signals 3. **PLUGIN**: Add capabilities (RAG, cache, memory, etc.) 4. **ALGORITHM**: Ranking/selection algorithms 5. **BACKEND**: External service configurations ### Example DSL ```dsl SIGNAL keyword code_keywords { keywords: ["code", "programming", "debug", "function"] threshold: 0.8 } SIGNAL domain code_domain { description: "Code and programming related queries" } ROUTE code_route (description = "Route code queries to specialist") { PRIORITY 100 WHEN keyword("code_keywords") OR domain("code_domain") MODEL "deepseek-coder" ( reasoning = true, temperature = 0.1 ) } ``` ## Data Format ### Stage 1: Syntax Pre-training (Completion) ```json { "id": "dsl_001", "dsl": "SIGNAL keyword kw_1 { keywords: [\"urgent\"] }", "complexity": "L1" } ``` ### Stage 2: SFT (Instruction-Input-Output) ```json { "id": "sft_001", "instruction": "Convert the following natural language description into Signal DSL configuration.", "input": "Create a route that sends math questions to GPT-4", "output": "SIGNAL domain math { ... } ROUTE math_route { ... }", "style": "en_formal", "complexity": "L2" } ``` ### Stage 3: DPO (Preference Pairs) ```json { "id": "dpo_001", "prompt": "Generate a valid Signal DSL configuration.", "chosen": "SIGNAL keyword kw { keywords: [\"test\"] }", "rejected": "SIGNAL keyword kw { keywords: [\"test\" }", "mutation_type": "syntax_error", "mutation_category": "missing_bracket" } ``` ## Complexity Levels | Level | Description | Signals | Routes | Plugins | |-------|-------------|---------|--------|---------| | L1 | Simple | 1-2 | 1 | 0 | | L2 | Basic | 2-3 | 1-2 | 0-1 | | L3 | Medium | 3-5 | 2-3 | 1-2 | | L4 | Complex | 5-8 | 3-5 | 2-4 | | L5 | Expert | 8+ | 5+ | 4+ | ## Usage ```python from datasets import load_dataset # Load all splits dataset = load_dataset("haowu1234/signal-dsl-dataset") # Load specific split sft_data = load_dataset("haowu1234/signal-dsl-dataset", split="stage2_sft") # Iterate through samples for sample in sft_data: print(f"Input: {sample['input']}") print(f"Output: {sample['output']}") ``` ## Training with this Dataset This dataset is designed for 3-stage training: 1. **Stage 1 (Syntax PT)**: Train language model on pure DSL to learn syntax 2. **Stage 2 (SFT)**: Fine-tune on NL→DSL pairs for instruction following 3. **Stage 3 (DPO)**: Preference optimization to prefer correct over incorrect DSL ## Generation Process Data was generated using: - **CFG Random Walk**: Grammar-based generation ensuring syntactic correctness - **Template Expansion**: Schema-aware field value generation - **Negative Sampling**: Systematic mutation for preference pairs - **NL Paraphrasing**: Multiple linguistic styles (formal/casual, EN/ZH) ## Citation ```bibtex @dataset{signal-dsl-dataset, author = {Signal Router Team}, title = {Signal DSL Dataset: Synthetic Training Data for DSL Generation}, year = {2025}, publisher = {Hugging Face}, url = {https://huggingface.co/datasets/haowu1234/signal-dsl-dataset} } ``` ## License Apache 2.0 - See LICENSE for details.
# Signal DSL 数据集 > 许可证:Apache-2.0 > 任务类别:文本生成、文本到文本生成 > 支持语言:英语、中文 > 标签:DSL(领域特定语言,Domain-Specific Language)、代码生成、路由、大语言模型路由、信号路由器、合成数据集 > 数据集规模:10万 < 样本数量 < 100万 本数据集为合成数据集,用于训练模型从自然语言描述生成**Signal DSL(领域特定语言,Domain-Specific Language)**配置。 ## 数据集概览 Signal DSL 用于通过信号、路由、插件与算法配置智能大语言模型(Large Language Model,LLM)路由。本数据集包含以下拆分: | 拆分名称 | 样本数量 | 描述 | |---------|---------|-------------| | **stage1_syntax_pt** | 18000 | 用于语法预训练的纯DSL代码 | | **stage2_sft** | 102087 | 自然语言→DSL配对样本(用于指令遵循) | | **stage3_dpo** | 52532 | 偏好配对样本(用于DPO训练) | | **eval_benchmark** | 200 | 预留评估集 | ## Signal DSL 概述 ### 核心组件 1. **SIGNAL**:定义检测信号(关键词、领域、嵌入等) 2. **ROUTE**:基于信号的条件路由规则 3. **PLUGIN**:扩展功能(检索增强生成RAG、缓存、记忆等) 4. **ALGORITHM**:排序/选择算法 5. **BACKEND**:外部服务配置 ### 示例DSL代码 dsl SIGNAL keyword code_keywords { keywords: ["code", "programming", "debug", "function"] threshold: 0.8 } SIGNAL domain code_domain { description: "Code and programming related queries" } ROUTE code_route (description = "Route code queries to specialist") { PRIORITY 100 WHEN keyword("code_keywords") OR domain("code_domain") MODEL "deepseek-coder" ( reasoning = true, temperature = 0.1 ) } ## 数据格式 ### 阶段1:语法预训练(补全任务) json { "id": "dsl_001", "dsl": "SIGNAL keyword kw_1 { keywords: ["urgent"] }", "complexity": "L1" } ### 阶段2:监督微调(SFT) json { "id": "sft_001", "instruction": "Convert the following natural language description into Signal DSL configuration.", "input": "Create a route that sends math questions to GPT-4", "output": "SIGNAL domain math { ... } ROUTE math_route { ... }", "style": "en_formal", "complexity": "L2" } ### 阶段3:直接偏好优化(DPO) json { "id": "dpo_001", "prompt": "Generate a valid Signal DSL configuration.", "chosen": "SIGNAL keyword kw { keywords: ["test"] }", "rejected": "SIGNAL keyword kw { keywords: ["test" }", "mutation_type": "syntax_error", "mutation_category": "missing_bracket" } ## 复杂度等级 | 等级 | 描述 | 信号数量 | 路由数量 | 插件数量 | |-------|-------------|---------|--------|---------| | L1 | 简单 | 1-2 | 1 | 0 | | L2 | 基础 | 2-3 | 1-2 | 0-1 | | L3 | 中等 | 3-5 | 2-3 | 1-2 | | L4 | 复杂 | 5-8 | 3-5 | 2-4 | | L5 | 专家级 | 8+ | 5+ | 4+ | ## 使用方法 python from datasets import load_dataset # 加载所有数据集拆分 dataset = load_dataset("haowu1234/signal-dsl-dataset") # 加载指定拆分 sft_data = load_dataset("haowu1234/signal-dsl-dataset", split="stage2_sft") # 遍历样本 for sample in sft_data: print(f"输入:{sample['input']}") print(f"输出:{sample['output']}") ## 基于本数据集的训练流程 本数据集专为三阶段训练设计: 1. **阶段1(语法预训练)**:在纯DSL代码上训练语言模型,使其掌握DSL语法规范 2. **阶段2(监督微调SFT)**:在自然语言→DSL配对样本上微调模型,使其具备指令遵循能力 3. **阶段3(直接偏好优化DPO)**:通过偏好对齐训练,使模型偏好正确的DSL代码而非错误代码 ## 数据生成流程 本数据集通过以下方式生成: - **CFG随机游走**:基于上下文无关文法的生成方式,确保生成内容的句法正确性 - **模板扩展**:基于模式感知的字段值生成方法 - **负采样**:系统性生成变异样本以构建偏好配对数据集 - **自然语言释义**:覆盖多种语言风格(正式/非正式,英语/中文) ## 引用 bibtex @dataset{signal-dsl-dataset, author = {Signal Router Team}, title = {Signal DSL Dataset: Synthetic Training Data for DSL Generation}, year = {2025}, publisher = {Hugging Face}, url = {https://huggingface.co/datasets/haowu1234/signal-dsl-dataset} } ## 许可证 Apache 2.0协议——详情请参阅 LICENSE 文件。



