[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-meta-llama--prompt-ops":3,"tool-meta-llama--prompt-ops":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",147882,2,"2026-04-09T11:32:47",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108111,"2026-04-08T11:23:26",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":76,"owner_twitter":76,"owner_website":77,"owner_url":78,"languages":79,"stars":104,"forks":105,"last_commit_at":106,"license":107,"difficulty_score":32,"env_os":108,"env_gpu":109,"env_ram":108,"env_deps":110,"category_tags":117,"github_topics":76,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":118,"updated_at":119,"faqs":120,"releases":150},5839,"meta-llama\u002Fprompt-ops","prompt-ops","An open-source tool for LLM prompt optimization.","prompt-ops 是一款专为 Llama 大模型设计的开源 Python 工具，旨在自动化优化提示词（Prompt），让模型表现更出色。它主要解决了开发者在适配不同大模型时，需要反复手动调整提示词、依赖试错效率低下的痛点。通过该工具，用户可以将原本适用于其他模型的提示词，快速转化为针对 Llama 系列模型高度优化的版本，从而显著提升任务执行的准确率与可靠性。\n\n这款工具非常适合 AI 应用开发者、研究人员以及希望提升模型落地效果的技术团队使用。其核心亮点在于“数据驱动”与“自动化”：用户只需提供现有的系统提示词、一份包含少量问答对（最少 50 条）的数据集以及简单的配置文件，prompt-ops 即可在几分钟内完成优化。此外，项目最新发布的 PDO（Prompt Duel Optimizer）技术尤为引人注目，这是一种无需人工标注标签的高效优化方法，利用对抗性多臂老虎机算法，已在多个权威基准测试中达到业界领先水平。无论是处理逻辑推理还是通用任务，prompt-ops 都能提供可量化的性能提升，让提示词工程变得更加科学、高效且轻松。","\u003Ch1 align=\"center\"> Prompt Ops \u003C\u002Fh1>\n\n### 🎉 New: Prompt Duel Optimizer (PDO) Published!\n\nWe've published a new paper on **PDO (Prompt Duel Optimizer)** - an efficient label-free prompt optimization method using dueling bandits and Thompson sampling. PDO achieves state-of-the-art results on BIG-bench Hard and MS MARCO benchmarks.\n\n📄 **Read the paper:** [LLM Prompt Duel Optimizer: Efficient Label-Free Prompt Optimization](https:\u002F\u002Fwww.arxiv.org\u002Fabs\u002F2510.13907) (arXiv:2510.13907)\n\n🧪 **Try it yourself:** Check out the [Web of Lies use case](use-cases\u002Fweb-of-lies-pdo\u002F) demonstrating PDO on logical reasoning tasks\n\n⭐ **Star this repo** and follow along - we'll be publishing a detailed tutorial notebook soon!\n\n---\n\n## What is prompt-ops?\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fprompt-ops\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fprompt-ops.svg\" \u002F>\u003C\u002Fa>\n\u003C\u002Fp>\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fllama.developer.meta.com\u002F?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_API-Join_Waitlist-brightgreen?logo=meta\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fllama.developer.meta.com\u002Fdocs?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_API-Documentation-4BA9FE?logo=meta\" \u002F>\u003C\u002Fa>\n\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fllama-models\u002Fblob\u002Fmain\u002Fmodels\u002F?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main\">\u003Cimg alt=\"Llama Model cards\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_OSS-Model_cards-green?logo=meta\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fwww.llama.com\u002Fdocs\u002Foverview\u002F?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main\">\u003Cimg alt=\"Llama Documentation\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_OSS-Documentation-4BA9FE?logo=meta\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\">\u003Cimg alt=\"Hugging Face meta-llama\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FHugging_Face-meta--llama-yellow?logo=huggingface\" \u002F>\u003C\u002Fa>\n\n\u003C\u002Fp>\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fsynthetic-data-kit\">\u003Cimg alt=\"Llama Tools Syntethic Data Kit\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_Tools-synthetic--data--kit-orange?logo=meta\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fprompt-ops\">\u003Cimg alt=\"Llama Tools Syntethic Data Kit\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_Tools-prompt--ops-orange?logo=meta\" \u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fllama-cookbook\">\u003Cimg alt=\"Llama Cookbook\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_Cookbook-llama--cookbook-orange?logo=meta\" \u002F>\u003C\u002Fa>\n\u003C\u002Fp>\n\n\n\nprompt-ops is a Python package that **automatically optimizes prompts** for Llama models. It transforms prompts that work well with other LLMs into prompts that are optimized for LLM models, improving performance and reliability.\n\n**Key Benefits:**\n- **No More Trial and Error**: Stop manually tweaking prompts to get better results\n- **Fast Optimization**: Get model-optimized prompts in minutes with template-based optimization\n- **Data-Driven Improvements**: Use your own examples to create prompts that work for your specific use case\n- **Measurable Results**: Evaluate prompt performance with customizable metrics\n\n## Requirements\n\nTo get started with prompt-ops, you'll need:\n\n- Existing System Prompt: Your existing system prompt that you want to optimize\n- Existing Query-Response Dataset: A JSON file containing query-response pairs (as few as 50 examples) for evaluation and optimization (see [prepare your dataset](#preparing-your-data) below)\n- Configuration File: A YAML configuration file (config.yaml) specifying model hyperparameters, and optimization details (see [example configuration](configs\u002Ffacility-simple.yaml))\n\n## How It Works\n\n```\n┌──────────────────────────┐  ┌──────────────────────────┐  ┌────────────────────┐\n│  Existing System Prompt  │  │  set(query, responses)   │  │ YAML Configuration │\n└────────────┬─────────────┘  └─────────────┬────────────┘  └───────────┬────────┘\n             │                              │                           │\n             │                              │                           │\n             ▼                              ▼                           ▼\n         ┌────────────────────────────────────────────────────────────────────┐\n         │                     prompt-ops migrate                       │\n         └────────────────────────────────────────────────────────────────────┘\n                                            │\n                                            │\n                                            ▼\n                                ┌──────────────────────┐\n                                │   Optimized Prompt   │\n                                └──────────────────────┘\n```\n\n### Simple Workflow\n\n1. **Start with your existing system prompt**: Take your existing system prompt that works with other LLMs (see [example prompt](use-cases\u002Ffacility-support-analyzer\u002Ffacility_prompt_sys.txt))\n2. [**Prepare your dataset**](#preparing-your-data): Create a JSON file with query-response pairs for evaluation and optimization\n3. **Configure optimization**: Set up a simple YAML file with your dataset and preferences (see [example configuration](configs\u002Ffacility-simple.yaml))\n4. [**Run optimization**](#step-4-run-optimization): Execute a single command to transform your prompt\n5. [**Get results**](#prompt-transformation-example): Receive a model-optimized prompt with performance metrics\n\n\n## Real-world Results\n\n### HotpotQA\n\u003Ctable>\n\u003Ctr>\n\u003Ctd width=\"100%\">\u003Cimg src=\".\u002Fdocs\u002F_static\u002Foutput-hotpotqa.png\" onerror=\"this.onerror=null;this.src='https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F52080f54-d1ca-4d21-8263-a9b2ee1d3c10'\" alt=\"HotpotQA Benchmark Results\">\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\nThese results were measured on the [HotpotQA multi-hop reasoning benchmark](https:\u002F\u002Fhotpotqa.github.io\u002F), which tests a model's ability to answer complex questions requiring information from multiple sources. Our optimized prompts showed substantial improvements over baseline prompts across different model sizes.\n\n\n## Quick Start (5 minutes)\n\n### Step 1: Installation\n\n> **Note:** We recommend installing from source as we are currently transitioning package names on PyPI. This ensures you get the latest stable version without any naming conflicts.\n\n```bash\n# Create a virtual environment\nconda create -n prompt-ops python=3.10\nconda activate prompt-ops\n\n# Recommended: Install from source\ngit clone https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fprompt-ops.git\ncd prompt-ops\npip install -e .\n\n# Alternative: Install from PyPI (may have naming transition issues, still on version 0.0.7)\n# pip install llama-prompt-ops\n\n```\n\n### Step 2: Create a sample project\n\nThis will create a directory called my-project with a sample configuration and dataset in the current folder.\n\n```bash\nprompt-ops create my-project\ncd my-project\n```\n\n### Step 3: Set Up Your API Key\n\nAdd your API key to the `.env` file:\n\n```bash\nOPENROUTER_API_KEY=your_key_here\n```\n\nprompt-ops uses LiteLLM as a unified API client. LiteLLM automatically detects the provider from your model name (e.g., `openrouter\u002Fmodel`, `groq\u002Fmodel`) and looks for the corresponding provider-specific environment variable (`OPENROUTER_API_KEY`, `GROQ_API_KEY`, etc.). For more inference provider options, see [Inference Providers](.\u002Fdocs\u002Finference_providers.md).\n\n### Step 4: Run Optimization\nThe optimization will take about 5 minutes.\n\n```bash\nprompt-ops migrate # defaults to config.yaml if --config not specified\n```\n\nDone! The optimized prompt will be saved to the `results` directory with performance metrics comparing the original and optimized versions.\n\nTo read more about this use case, we go into more detail in [Basic Tutorial](.\u002Fdocs\u002Fbasic\u002Freadme.md).\n\n\n### Prompt Transformation Example\n\nBelow is an example of a transformed system prompt from proprietary LM to Llama:\n\n| Original Proprietary LM Prompt | Optimized Llama Prompt |\n| --- | --- |\n| You are a helpful assistant. Extract and return a JSON with the following keys and values:\u003Cbr>\u003Cbr>1. \"urgency\": one of `high`, `medium`, `low`\u003Cbr>2. \"sentiment\": one of `negative`, `neutral`, `positive`\u003Cbr>3. \"categories\": Create a dictionary with categories as keys and boolean values (True\u002FFalse), where the value indicates whether the category matches tags like `emergency_repair_services`, `routine_maintenance_requests`, etc.\u003Cbr>\u003Cbr>Your complete message should be a valid JSON string that can be read directly. | You are an expert in analyzing customer service messages. Your task is to categorize the following message based on urgency, sentiment, and relevant categories.\u003Cbr>\u003Cbr>Analyze the message and return a JSON object with these fields:\u003Cbr>\u003Cbr>1. \"urgency\": Classify as \"high\", \"medium\", or \"low\" based on how quickly this needs attention\u003Cbr>2. \"sentiment\": Classify as \"negative\", \"neutral\", or \"positive\" based on the customer's tone\u003Cbr>3. \"categories\": Create a dictionary with facility management categories as keys and boolean values\u003Cbr>\u003Cbr>Only include these exact keys in your response. Return a valid JSON object without code blocks, prefixes, or explanations. |\n\n\n## Preparing Your Data\n\nTo use prompt-ops for prompt optimization, you'll need to prepare a dataset with your prompts and expected responses. The standard format is a JSON file structured like this:\n\n```json\n[\n    {\n        \"question\": \"Your input query here\",\n        \"answer\": \"Expected response here\"\n    },\n    {\n        \"question\": \"Another input query\",\n        \"answer\": \"Another expected response\"\n    }\n]\n```\n\nIf your data matches this format, you can use the built-in [`StandardJSONAdapter`](src\u002Fprompt_ops\u002Fcore\u002Fdatasets.py) which will handle it automatically.\n\n### Custom Data Formats\n\nIf your data is formatted differently, and there isn't a built-in dataset adapter, you can create a custom dataset adapter by extending the `DatasetAdapter` class. See the [Dataset Adapter Selection Guide](docs\u002Fdataset_adapter_selection_guide.md) for more details.\n\n## Multiple Inference Provider Support\n\nprompt-ops supports various inference providers and endpoints to fit your infrastructure needs. See our [detailed guide on inference providers](.\u002Fdocs\u002Finference_providers.md) for configuration examples with:\n\n- OpenRouter (cloud-based API)\n- vLLM (local deployment)\n- NVIDIA NIMs (optimized containers)\n\n## Documentation and Examples\n\nFor more detailed information, check out these resources:\n\n- [Quick Start Guide](docs\u002Fbasic\u002Freadme.md): Get up and running with prompt-ops in 5 minutes\n- [Intermediate Configuration Guide](docs\u002Fintermediate\u002Freadme.md): Learn how to configure datasets, metrics, and optimization strategies\n- [Dataset Adapter Selection Guide](docs\u002Fdataset_adapter_selection_guide.md): Choose the right adapter for your dataset format\n- [Metric Selection Guide](docs\u002Fmetric_selection_guide.md): Select appropriate evaluation metrics for your use case\n- [Inference Providers Guide](docs\u002Finference_providers.md): Configure different model providers and endpoints\n\n## Acknowledgements\nThis project leverages some of awesome open source projects including [DSPy](https:\u002F\u002Fgithub.com\u002Fstanfordnlp\u002Fdspy), thanks to the team for the inspiring work!\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","\u003Ch1 align=\"center\"> Prompt Ops \u003C\u002Fh1>\n\n### 🎉 新增：提示对决优化器（PDO）已发布！\n\n我们发表了一篇关于 **PDO（提示对决优化器）** 的新论文——这是一种利用对决多臂老虎机和汤普森采样实现的高效无标签提示优化方法。PDO 在 BIG-bench Hard 和 MS MARCO 基准测试中取得了当前最佳性能。\n\n📄 **阅读论文：** [LLM 提示对决优化器：高效的无标签提示优化](https:\u002F\u002Fwww.arxiv.org\u002Fabs\u002F2510.13907) (arXiv:2510.13907)\n\n🧪 **亲自尝试：** 请查看 [谎言之网用例](use-cases\u002Fweb-of-lies-pdo\u002F)，其中展示了 PDO 在逻辑推理任务上的应用。\n\n⭐ **给本仓库点个星** 并关注我们——我们很快会发布一份详细的教程笔记本！\n\n---\n\n## 什么是 prompt-ops？\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002Fprompt-ops\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fprompt-ops.svg\" \u002F>\u003C\u002Fa>\n\u003C\u002Fp>\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fllama.developer.meta.com\u002F?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_API-Join_Waitlist-brightgreen?logo=meta\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fllama.developer.meta.com\u002Fdocs?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_API-Documentation-4BA9FE?logo=meta\" \u002F>\u003C\u002Fa>\n\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fllama-models\u002Fblob\u002Fmain\u002Fmodels\u002F?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main\">\u003Cimg alt=\"Llama 模型卡片\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_OSS-Model_cards-green?logo=meta\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fwww.llama.com\u002Fdocs\u002Foverview\u002F?utm_source=prompt-ops&utm_medium=readme&utm_campaign=main\">\u003Cimg alt=\"Llama 文档\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_OSS-Documentation-4BA9FE?logo=meta\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fmeta-llama\">\u003Cimg alt=\"Hugging Face meta-llama\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FHugging_Face-meta--llama-yellow?logo=huggingface\" \u002F>\u003C\u002Fa>\n\n\u003C\u002Fp>\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fsynthetic-data-kit\">\u003Cimg alt=\"Llama 工具 合成数据套件\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_Tools-synthetic--data--kit-orange?logo=meta\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fprompt-ops\">\u003Cimg alt=\"Llama 工具 提示优化工具\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_Tools-prompt--ops-orange?logo=meta\" \u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fllama-cookbook\">\u003Cimg alt=\"Llama 烹饪书\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLlama_Cookbook-llama--cookbook-orange?logo=meta\" \u002F>\u003C\u002Fa>\n\u003C\u002Fp>\n\n\n\nprompt-ops 是一个 Python 包，能够 **自动优化提示词** 以适配 Llama 模型。它将那些在其他大语言模型上表现良好的提示转换为针对 Llama 模型优化过的提示，从而提升性能与可靠性。\n\n**主要优势：**\n- **告别试错法**：无需再手动调整提示以获得更好的效果\n- **快速优化**：通过基于模板的优化方式，几分钟内即可得到模型优化后的提示\n- **数据驱动改进**：使用您自己的示例创建适用于特定场景的提示\n- **可量化结果**：借助自定义指标评估提示性能\n\n## 需求\n\n要开始使用 prompt-ops，您需要：\n\n- 现有的系统提示：您希望优化的现有系统提示\n- 现有的查询-响应数据集：包含查询-响应对的 JSON 文件（至少 50 个示例），用于评估和优化（详见下方的 [准备您的数据集](#preparing-your-data)）\n- 配置文件：一个 YAML 配置文件 (config.yaml)，用于指定模型超参数及优化细节（参见 [示例配置](configs\u002Ffacility-simple.yaml)）\n\n## 工作原理\n\n```\n┌──────────────────────────┐  ┌──────────────────────────┐  ┌────────────────────┐\n│  现有的系统提示        │  │  设置(查询, 响应)      │  │ YAML 配置          │\n└────────────┬─────────────┘  └─────────────┬────────────┘  └───────────┬────────┘\n             │                              │                           │\n             │                              │                           │\n             ▼                              ▼                           ▼\n         ┌────────────────────────────────────────────────────────────────────┐\n         │                     prompt-ops 迁移                       │\n         └────────────────────────────────────────────────────────────────────┘\n                                            │\n                                            │\n                                            ▼\n                                ┌──────────────────────┐\n                                │   优化后的提示       │\n                                └──────────────────────┘\n```\n\n### 简单工作流程\n\n1. **从现有系统提示开始**：使用您现有的、能在其他大语言模型上工作的系统提示（参见 [示例提示](use-cases\u002Ffacility-support-analyzer\u002Ffacility_prompt_sys.txt)）\n2. [**准备您的数据集**](#preparing-your-data)：创建一个包含查询-响应对的 JSON 文件，用于评估和优化\n3. **配置优化参数**：设置一个简单的 YAML 文件，填写您的数据集和偏好（参见 [示例配置](configs\u002Ffacility-simple.yaml)）\n4. [**运行优化**](#step-4-run-optimization)：执行一条命令即可完成提示的转换\n5. [**获取结果**](#prompt-transformation-example)：您将收到经过模型优化的提示，并附带性能指标\n\n\n## 实际应用效果\n\n### HotpotQA\n\u003Ctable>\n\u003Ctr>\n\u003Ctd width=\"100%\">\u003Cimg src=\".\u002Fdocs\u002F_static\u002Foutput-hotpotqa.png\" onerror=\"this.onerror=null;this.src='https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F52080f54-d1ca-4d21-8263-a9b2ee1d3c10'\" alt=\"HotpotQA 基准测试结果\">\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n这些结果是在 [HotpotQA 多跳推理基准测试](https:\u002F\u002Fhotpotqa.github.io\u002F) 上测得的，该测试旨在检验模型回答需要整合多源信息的复杂问题的能力。我们的优化提示在不同规模的模型上均显著优于基线提示。\n\n## 快速入门（5 分钟）\n\n### 第一步：安装\n\n> **注意：** 我们建议从源码安装，因为我们目前正对 PyPI 上的包名进行过渡。这样可以确保您获得最新的稳定版本，而不会出现命名冲突的问题。\n\n```bash\n# 创建虚拟环境\nconda create -n prompt-ops python=3.10\nconda activate prompt-ops\n\n# 推荐：从源码安装\ngit clone https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fprompt-ops.git\ncd prompt-ops\npip install -e .\n\n# 或者：从 PyPI 安装（可能存在命名过渡问题，目前仍为 0.0.7 版本）\n# pip install llama-prompt-ops\n\n```\n\n### 第二步：创建示例项目\n\n这将在当前目录下创建一个名为 my-project 的文件夹，并包含示例配置和数据集。\n\n```bash\nprompt-ops create my-project\ncd my-project\n```\n\n### 第3步：设置您的API密钥\n\n将您的API密钥添加到`.env`文件中：\n\n```bash\nOPENROUTER_API_KEY=your_key_here\n```\n\nprompt-ops使用LiteLLM作为统一的API客户端。LiteLLM会根据您的模型名称（例如`openrouter\u002Fmodel`、`groq\u002Fmodel`）自动检测提供商，并查找相应的提供商特定环境变量（`OPENROUTER_API_KEY`、`GROQ_API_KEY`等）。有关更多推理提供商选项，请参阅[推理提供商](.\u002Fdocs\u002Finference_providers.md)。\n\n### 第4步：运行优化\n优化过程大约需要5分钟。\n\n```bash\nprompt-ops migrate # 如果未指定--config，则默认使用config.yaml\n```\n\n完成！优化后的提示将保存到`results`目录中，并附带比较原始版本和优化版本的性能指标。\n\n如需了解更多关于此用例的信息，您可以在[基础教程](.\u002Fdocs\u002Fbasic\u002Freadme.md)中找到更详细的说明。\n\n\n### 提示转换示例\n\n以下是将专有语言模型系统提示转换为Llama模型系统的示例：\n\n| 原始专有语言模型提示 | 优化后的Llama模型提示 |\n| --- | --- |\n| 您是一位有用的助手。请提取并返回一个包含以下键值的JSON：\u003Cbr>\u003Cbr>1. “urgency”：取值为`high`、`medium`或`low`\u003Cbr>2. “sentiment”：取值为`negative`、`neutral`或`positive`\u003Cbr>3. “categories”：创建一个字典，以类别为键，以布尔值（True\u002FFalse）为值，表示该类别是否匹配诸如`emergency_repair_services`、`routine_maintenance_requests`等标签。\u003Cbr>\u003Cbr>您的完整消息应为一个可直接读取的有效JSON字符串。 | 您是客户服务消息分析专家。您的任务是根据紧急程度、情感倾向和相关类别对以下消息进行分类。\u003Cbr>\u003Cbr>请分析消息并返回一个包含以下字段的JSON对象：\u003Cbr>\u003Cbr>1. “urgency”：根据需要处理的紧迫性，将其归类为“high”、“medium”或“low”\u003Cbr>2. “sentiment”：根据客户语气，将其归类为“negative”、“neutral”或“positive”\u003Cbr>3. “categories”：创建一个以设施管理类别为键、以布尔值为值的字典。\u003Cbr>\u003Cbr>请仅在您的回复中包含这些确切的键。返回一个有效的JSON对象，不要使用代码块、前缀或解释。 |\n\n## 准备您的数据\n\n要使用prompt-ops进行提示优化，您需要准备一个包含提示和预期响应的数据集。标准格式是一个如下结构的JSON文件：\n\n```json\n[\n    {\n        \"question\": \"您的输入查询在此\",\n        \"answer\": \"预期响应在此\"\n    },\n    {\n        \"question\": \"另一个输入查询\",\n        \"answer\": \"另一个预期响应\"\n    }\n]\n```\n\n如果您的数据符合此格式，您可以使用内置的[`StandardJSONAdapter`](src\u002Fprompt_ops\u002Fcore\u002Fdatasets.py)，它会自动处理数据。\n\n### 自定义数据格式\n\n如果您的数据格式不同，并且没有内置的数据集适配器，您可以通过扩展`DatasetAdapter`类来创建自定义数据集适配器。有关详细信息，请参阅[数据集适配器选择指南](docs\u002Fdataset_adapter_selection_guide.md)。\n\n## 多个推理提供商支持\n\nprompt-ops支持多种推理提供商和端点，以满足您的基础设施需求。请参阅我们关于推理提供商的[详细指南](.\u002Fdocs\u002Finference_providers.md)，其中包含以下配置示例：\n\n- OpenRouter（基于云的API）\n- vLLM（本地部署）\n- NVIDIA NIMs（优化容器）\n\n## 文档和示例\n\n如需更多信息，请查看以下资源：\n\n- [快速入门指南](docs\u002Fbasic\u002Freadme.md)：在5分钟内启动并运行prompt-ops\n- [中级配置指南](docs\u002Fintermediate\u002Freadme.md)：了解如何配置数据集、指标和优化策略\n- [数据集适配器选择指南](docs\u002Fdataset_adapter_selection_guide.md)：为您的数据集格式选择合适的适配器\n- [指标选择指南](docs\u002Fmetric_selection_guide.md)：为您的用例选择适当的评估指标\n- [推理提供商指南](docs\u002Finference_providers.md)：配置不同的模型提供商和端点\n\n## 致谢\n该项目利用了一些优秀的开源项目，包括[DSPy](https:\u002F\u002Fgithub.com\u002Fstanfordnlp\u002Fdspy)，感谢团队的启发性工作！\n\n## 贡献\n欢迎贡献！请随时提交拉取请求。\n\n## 许可证\n本项目采用MIT许可证授权——详情请参阅LICENSE文件。","# prompt-ops 快速上手指南\n\n`prompt-ops` 是一个专为 Llama 模型设计的 Python 工具包，能够自动将适用于其他大模型的提示词（Prompt）优化为适配 Llama 的版本，从而提升模型性能与可靠性。它通过数据驱动的方式消除手动调试，几分钟内即可生成优化后的提示词。\n\n## 环境准备\n\n在开始之前，请确保满足以下要求：\n\n*   **操作系统**：Linux, macOS 或 Windows (WSL 推荐)\n*   **Python 版本**：3.10 或更高\n*   **前置依赖**：\n    *   现有的系统提示词（System Prompt）\n    *   评测数据集：包含 `question` 和 `answer` 对的 JSON 文件（建议至少 50 条样本）\n    *   API Key：支持 OpenRouter、Groq、vLLM 等推理提供商的密钥\n\n## 安装步骤\n\n由于 PyPI 上的包名正处于过渡期，**强烈建议从源码安装**以获取最新稳定版本。\n\n```bash\n# 1. 创建并激活虚拟环境\nconda create -n prompt-ops python=3.10\nconda activate prompt-ops\n\n# 2. 克隆仓库并从源码安装\ngit clone https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fprompt-ops.git\ncd prompt-ops\npip install -e .\n\n# 备选方案：从 PyPI 安装（可能为旧版本 0.0.7）\n# pip install llama-prompt-ops\n```\n\n> **国内加速提示**：如果下载依赖较慢，可在 `pip` 命令后添加国内镜像源，例如：\n> `pip install -e . -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple`\n\n## 基本使用\n\n只需 4 步即可完成提示词优化：\n\n### 第一步：创建示例项目\n运行以下命令生成包含示例配置和数据集的项目目录 `my-project`：\n\n```bash\nprompt-ops create my-project\ncd my-project\n```\n\n### 第二步：配置 API 密钥\n在项目根目录创建或编辑 `.env` 文件，填入你的推理服务密钥（以 OpenRouter 为例）：\n\n```bash\nOPENROUTER_API_KEY=your_key_here\n```\n\n> `prompt-ops` 基于 LiteLLM 构建，会自动根据模型名称识别提供商并读取对应的环境变量（如 `GROQ_API_KEY` 等）。\n\n### 第三步：准备数据与配置（可选）\n如果是首次体验，上一步生成的示例数据可直接使用。若需使用自有数据：\n1. 准备一个 JSON 文件，格式如下：\n   ```json\n   [\n       {\"question\": \"用户输入\", \"answer\": \"期望输出\"},\n       {\"question\": \"...\", \"answer\": \"...\"}\n   ]\n   ```\n2. 修改 `config.yaml` 文件，指向你的数据集路径和待优化的原始提示词文件。\n\n### 第四步：运行优化\n执行迁移命令，默认读取 `config.yaml` 配置。过程约需 5 分钟：\n\n```bash\nprompt-ops migrate\n```\n\n### 查看结果\n运行完成后，优化后的提示词及性能对比指标将保存在 `results` 目录中。你可以直接将优化后的 Prompt 应用到你的 Llama 模型项目中。","某电商公司的算法团队正致力于将现有的客服问答系统从通用大模型迁移至 Llama 模型，以提升数据隐私合规性并降低推理成本。\n\n### 没有 prompt-ops 时\n- **盲目试错成本高**：工程师只能凭经验手动反复修改提示词（Prompt），试图让 Llama 理解原有的业务逻辑，耗时数周却难以稳定复现原有效果。\n- **迁移性能大幅下滑**：原本在其他模型上表现良好的系统提示词，直接用于 Llama 后，在处理复杂退货政策查询时的准确率骤降 30%。\n- **缺乏量化评估依据**：团队无法快速判断哪种提示词变体更优，只能依赖少量人工抽检，导致优化方向模糊且主观。\n- **冷启动数据门槛高**：传统优化方法往往需要大量标注好的测试集，而团队初期仅能整理出 60 条典型的客户问答记录，难以启动训练。\n\n### 使用 prompt-ops 后\n- **自动化定向优化**：prompt-ops 利用仅有的 60 条历史问答数据，自动将通用提示词转化为专为 Llama 定制的版本，无需人工逐字调整。\n- **性能显著回升并超越**：经过基于“提示词决斗优化器（PDO）”的迭代，系统在逻辑推理类客诉处理上的准确率不仅恢复至原水平，还提升了 15%。\n- **数据驱动的可信决策**：工具内置的可定制指标实时反馈每次优化的效果，团队能清晰看到不同版本提示词在特定场景下的得分变化。\n- **极速完成模型适配**：原本需要数周的迁移调优工作，现在仅需几分钟配置 YAML 文件并运行脚本，即可得到最优提示词模板。\n\nprompt-ops 通过数据驱动的自动化机制，消除了跨模型迁移提示词时的试错黑盒，让团队能以极低成本实现 Llama 模型的业务落地效能最大化。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fmeta-llama_prompt-ops_b20d7112.png","meta-llama","Meta Llama","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fmeta-llama_449342bd.png","",null,"https:\u002F\u002Fllama.meta.com\u002F","https:\u002F\u002Fgithub.com\u002Fmeta-llama",[80,84,88,92,96,100],{"name":81,"color":82,"percentage":83},"Python","#3572A5",43.9,{"name":85,"color":86,"percentage":87},"TypeScript","#3178c6",30.3,{"name":89,"color":90,"percentage":91},"Jupyter Notebook","#DA5B0B",24.8,{"name":93,"color":94,"percentage":95},"CSS","#663399",0.6,{"name":97,"color":98,"percentage":99},"JavaScript","#f1e05a",0.4,{"name":101,"color":102,"percentage":103},"HTML","#e34c26",0.1,796,119,"2026-04-08T17:40:57","MIT","未说明","非必需（支持通过 OpenRouter、Groq 等云 API 运行；若本地部署 vLLM 或 NVIDIA NIMs 则需相应 GPU，具体型号未说明）",{"notes":111,"python":112,"dependencies":113},"该工具主要通过 API 调用大模型（如 OpenRouter、Groq、vLLM、NVIDIA NIMs），因此本地无需高性能 GPU 即可运行。推荐使用 conda 创建 Python 3.10 虚拟环境。需准备至少 50 条问答对的 JSON 数据集和 YAML 配置文件。首次使用需配置对应服务商的 API Key（如 OPENROUTER_API_KEY）。","3.10",[114,115,116],"litellm","pyyaml","conda (推荐用于环境管理)",[35,14],"2026-03-27T02:49:30.150509","2026-04-09T21:10:32.041009",[121,126,131,135,140,145],{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},26485,"运行优化时遇到错误：'str' object has no attribute 'signature'，该如何解决？","该错误通常发生在数据集条目过少或配置边缘情况未处理时。日志显示训练集和验证集大小为 0，仅测试集有数据，导致优化策略无法正常执行。建议检查 dataset.json 文件，确保包含足够的查询 - 响应配对样本（建议多于 1 个），并合理划分训练\u002F验证\u002F测试集。维护者已确认这是一个需要处理的边缘情况，后续版本将增加相关检查。","https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fprompt-ops\u002Fissues\u002F12",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},26486,"遇到错误提示 'If auto is not None, num_candidates and num_trials cannot be set'，应如何配置参数？","此错误表明参数冲突：当设置了 auto 模式（非 None）时，不能同时指定 num_candidates 和 num_trials，因为这些值会被 auto 设置覆盖。解决方法有两种：1) 将 auto 设置为 None，然后手动指定 num_candidates 和 num_trials；2) 移除 num_candidates 和 num_trials 参数，完全依赖 auto 模式的默认行为。请根据实际需求选择其中一种配置方式。","https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fprompt-ops\u002Fissues\u002F11",{"id":132,"question_zh":133,"answer_zh":134,"source_url":130},26487,"遇到 'GroundedProposer.propose_instructions_for_program() got an unexpected keyword argument tip' 错误怎么办？","该错误通常由依赖版本不兼容引起，特别是 DSPy 库的版本更新导致接口变更。解决方案是创建一个新的干净虚拟环境（如 conda env），重新安装所有依赖以确保版本匹配。用户反馈在重建环境后虽然仍可能有其他报错，但能推进到下一步，说明环境问题是关键因素。建议运行 pip freeze 检查并对齐官方推荐的依赖版本。",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},26488,"使用 Helicone 等非官方支持的 API 基址时出现 'str' object has no attribute 'kwargs' 错误，如何解决？","目前 llama-prompt-ops 库主要针对标准 Llama 模型和官方 API 进行优化，对于通过 api_base 参数指定的第三方服务（如 Helicone），可能存在兼容性问题导致内部变量作用域错误。维护者明确表示暂不支持此类配置。建议暂时切换回官方支持的模型端点进行测试，或等待后续版本增加对自定义 API 基址的完整支持。","https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fprompt-ops\u002Fissues\u002F23",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},26489,"运行时出现警告 'Model does not appear to be a Llama model'，即使我使用的是合法模型，这是否正常？","是的，这是已知现象。当使用非 Llama 系列模型（如 OpenAI、Meta 的其他模型等）进行优化时，库会输出此警告信息，提示该库针对 Llama 模型进行了优化，其他模型可能表现不佳。但这并不阻止程序运行，属于提示性警告而非错误。用户可以忽略该警告继续使用，但需注意效果可能不如在 Llama 模型上理想。","https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fprompt-ops\u002Fissues\u002F50",{"id":146,"question_zh":147,"answer_zh":148,"source_url":149},26490,"运行 pytest 测试时失败，提示缺少 strategy_utils.py、telemetry.py 等模块，如何处理？","这是由于代码库中存在导入引用但对应文件未实际提交或生成所致。__init__.py 中尝试导入不存在的工具模块（如 strategy_utils、telemetry、summary_utils），导致 ModuleNotFoundError。临时解决方案是注释掉 __init__.py 中相关的导入语句，或手动创建这些缺失的文件并实现基本函数骨架。长期需等待项目维护者补全这些实用模块或修正导入逻辑。","https:\u002F\u002Fgithub.com\u002Fmeta-llama\u002Fprompt-ops\u002Fissues\u002F45",[]]