专栏名称: GitHubStore
分享有意思的开源项目
目录
相关文章推荐
北京经信局  ·  2025全球数字经济大会首设欧洲分会场!3月 ... ·  19 小时前  
北京经信局  ·  2025全球数字经济大会首设欧洲分会场!3月 ... ·  19 小时前  
易简财经  ·  DeepSeek带飞阿里股价,阿里人连夜看豪宅 ·  昨天  
构力科技PKPM BIMBase  ·  央企担当 | ... ·  3 天前  
构力科技PKPM BIMBase  ·  央企担当 | ... ·  3 天前  
51好读  ›  专栏  ›  GitHubStore

MarkLLM:给LLM生成的文字添加水印

GitHubStore  · 公众号  ·  · 2024-05-21 15:38

正文

项目简介


MarkLLM 是一个开源工具包,旨在促进大型语言模型 (LLMs) 中水印技术的研究和应用。随着大型语言模型 (LLMs) 的使用不断扩展,确保机器生成文本的真实性和来源变得至关重要。MarkLLM 简化了水印技术的访问、理解和评估,使研究人员和更广泛的社区都可以使用它。

MarkLLM的主要特点

  • 实现框架:MarkLLM为各种LLM水印算法的实现提供了一个统一的、可扩展的平台。它目前支持来自两个著名家族的九种特定算法,促进了水印技术的集成和扩展。


    框架设计


    目前支持的算法:

    Algorithm Name Family Link
    KGW KGW Family [2301.10226] A Watermark for Large Language Models (arxiv.org)
    Unigram KGW Family [2306.17439] Provable Robust Watermarking for AI-Generated Text (arxiv.org)
    SWEET KGW Family [2305.15060] Who Wrote this Code? Watermarking for Code Generation (arxiv.org)
    UPV KGW Family [2307.16230] An Unforgeable Publicly Verifiable Watermark for Large Language Models (arxiv.org)
    EWD KGW Family [2403.13485] An Entropy-based Text Watermarking Detection Method (arxiv.org)
    SIR KGW Family [2310.06356] A Semantic Invariant Robust Watermark for Large Language Models (arxiv.org)
    X-SIR KGW Family [2402.14007] Can Watermarks Survive Translation? On the Cross-lingual Consistency of Text Watermark for Large Language Models (arxiv.org)
    EXP Christ Family https://www.scottaaronson.com/talks/watermark.ppt
    EXP-Edit Christ Family [2307.15593] Robust Distortion-free Watermarks for Language Models (arxiv.org)


  • 可视化解决方案:该工具包包括自定义可视化工具,可以清晰、深入地了解不同水印算法在各种场景下的运行方式。这些可视化有助于揭开算法机制的神秘面纱,使用户更容易理解它们。

  • 评估模块:MarkLLM 拥有 12 种评估工具,涵盖可检测性、稳健性和对文本质量的影响,以其评估水印技术的综合方法脱颖而出。它还具有可定制的自动化评估管道,可满足不同的需求和场景,增强工具包的实用性。


工具

  • Pipelines:

    • 水印检测管道:WatermarkedTextDetectionPipeline、UnwatermarkedTextDetectionPipeline

    • 文本质量管道:DirectTextQualityAnalysisPipeline、ReferencedTextQualityAnalysisPipeline、ExternalDiscriminatorTextQualityAnalysisPipeline

    • 水印检测成功率计算器:FundamentalSuccessRateCalculator、DynamicThresholdSuccessRateCalculator

    • 文本编辑器:WordDeletion、SynonymSubstitution、ContextAwareSynonymSubstitution、GPTParaphraser、DipperParaphraser

    • 文本质量分析器:PPLCalculator、LogDiversityAnalyzer、BLEUCalculator、PassOrNotJudger、GPTDiscriminator


仓库内容

下面是 MarkLLM 项目的目录结构,它将其三个核心功能封装在 watermark/ 、 visualize/ 和 evaluation/ 目录中。为了方便用户理解并展示工具包的易用性,我们提供了各种测试用例。测试代码可以在 test/ 目录中找到。

MarkLLM/├── config/                     # Configuration files for various watermark algorithms│   ├── EWD.json               │   ├── EXPEdit.json           │   ├── EXP.json               │   ├── KGW.json               │   ├── SIR.json                │   ├── SWEET.json             │   ├── Unigram.json            │   ├── UPV.json               │   └── XSIR.json               ├── dataset/                    # Datasets used in the project│   ├── c4/│   ├── human_eval/│   └── wmt16_de_en/├── evaluation/                 # Evaluation module of MarkLLM, including tools and pipelines│   ├── dataset.py              # Script for handling dataset operations within evaluations│   ├── examples/               # Scripts for automated evaluations using pipelines│   │   ├── assess_detectability.py  │   │   ├── assess_quality.py        │   │   └── assess_robustness.py     │   ├── pipelines/              # Pipelines for structured evaluation processes│   │   ├── detection.py        │   │   └── quality_analysis.py │   └── tools/                  # Evaluation tools│       ├── success_rate_calculator.py  │       ├── text_editor.py              │       └── text_quality_analyzer.py   ├── exceptions/                 # Custom exception definitions for error handling│   └── exceptions.py├── font/                       # Fonts needed for visualization purposes├── MarkLLM_demo.ipynb          # Juypter Notebook├── test/                       # Test cases and examples for user testing│   ├── test_method.py          │   ├── test_pipeline.py        │   └── test_visualize.py       ├── utils/                      # Helper classes and functions supporting various operations│   ├── openai_utils.py         │   ├── transformers_config.py │   └── utils.py                






请到「今天看啥」查看全文


推荐文章