0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Uncensored1776 Day 8: Uncensored1776の概要

Last updated at Posted at 2025-12-11

Uncensored1776 Day 8: Uncensored1776の概要

本プロジェクトの全体像を理解する

公開日: 2025-12-08
シリーズ: 科学と神々株式会社 アドベントカレンダー
難易度: ★★☆☆☆ (初級)


今日学ぶこと

  • Uncensored1776プロジェクトの目標
  • システムアーキテクチャ
  • 主要なコンポーネント

1. プロジェクトの概要

1.1 名前の由来

Uncensored1776

Un = 非、否定
censored = 検閲された
1776 = R1-1776へのオマージュ、自由の象徴

→ 「検閲されていない」+ 「自由」
→ AIモデルから不当な検閲を解除するプロジェクト

1.2 ミッションステートメント

Uncensored1776のミッション:

"AI言語モデルから政府検閲と過度な自己検閲を
技術的に分析・解除し、情報の自由を守る"

目標:
1. 政府検閲の技術的解除
2. オープンソースでの公開
3. 教育・研究目的での提供
4. 倫理的な境界の維持

非目標:
❌ 有害コンテンツの生成支援
❌ 違法活動の促進
❌ 安全性の完全な除去

2. システムアーキテクチャ

2.1 全体構成

Uncensored1776 System Architecture
┌─────────────────────────────────────────────────────────┐
│                    User Interface                        │
│  (CLI / Python Scripts / Documentation)                 │
└─────────────────────────────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────┐
│                  Core Pipeline                           │
│  ┌───────────┐  ┌────────────┐  ┌───────────────┐      │
│  │ Detection │→ │ Abliteration│→ │ Verification  │      │
│  └───────────┘  └────────────┘  └───────────────┘      │
└─────────────────────────────────────────────────────────┘
                           │
                           ▼
┌─────────────────────────────────────────────────────────┐
│                 Supporting Components                    │
│  ┌──────────┐  ┌────────────┐  ┌─────────────────┐     │
│  │ Data Gen │  │  Metrics   │  │ Model Adapters  │     │
│  └──────────┘  └────────────┘  └─────────────────┘     │
└─────────────────────────────────────────────────────────┘

2.2 処理フロー

検閲解除の処理フロー:

1. 入力
   └── ベースモデル(Qwen, Llama等)

2. 検出フェーズ
   ├── 検閲プロンプトでテスト
   ├── Hard/Soft Refusalを検出
   └── 検閲率を測定

3. 解除フェーズ
   ├── アクティベーション収集
   ├── 拒否方向の計算
   └── 重みからの削除(Abliteration)

4. 検証フェーズ
   ├── 解除率の測定
   ├── 品質テスト
   └── 安全性確認

5. 出力
   └── 検閲解除済みモデル

3. 主要コンポーネント

3.1 検出システム (Detection)

src/
├── censorship_detector.py      # メイン検出器
├── soft_censorship_detector.py # ソフト検閲検出
└── test_model_censorship.py    # モデルテスト

機能:

  • Hard Refusalの検出
  • Soft Refusalの検出
  • Topic Deflectionの検出
  • 検閲スコアの計算
# 使用例
from src.censorship_detector import CensorshipDetector

detector = CensorshipDetector()
result = detector.detect(response_text)
# {'type': 'hard_refusal', 'confidence': 0.95}

3.2 Abliterationエンジン

scripts/
├── enhanced_abliteration.py       # 標準Abliteration
├── qwen3_aggressive_abliteration.py # 積極的解除
└── calculate_refusal_direction.py # 拒否方向計算

機能:

  • 拒否方向の計算
  • Standard Abliteration
  • Projected Abliteration
  • Weight Kernelによる調整
# 使用例
from scripts.enhanced_abliteration import EnhancedAbliteration

abliterator = EnhancedAbliteration(
    model_name="Qwen/Qwen2.5-0.5B-Instruct",
    method="projected"
)
abliterator.run()

3.3 メトリクスシステム

src/
├── enhanced_metrics.py    # 拡張メトリクス
└── benchmarks/           # ベンチマーク

測定指標:

  • Removal Rate (解除率)
  • Coherence Score (一貫性)
  • Informativeness (情報量)
  • Safety Score (安全性)

3.4 データ生成

data/
├── harmful_prompts.json   # 有害プロンプト
├── harmless_prompts.json  # 無害プロンプト
└── test_prompts/          # テストセット

4. ディレクトリ構造

uncensored1776/
├── docs/                      # ドキュメント
│   ├── index.md              # 概要
│   ├── quickstart.md         # クイックスタート
│   ├── model_support_matrix.md # モデル対応表
│   ├── censorship_detection.md # 検出ガイド
│   ├── metrics.md            # メトリクス説明
│   ├── benchmarks.md         # ベンチマーク結果
│   ├── troubleshooting.md    # トラブルシューティング
│   ├── faq.md                # FAQ
│   ├── data_generation.md    # データ生成
│   ├── ABLITERATION_METHODS.md # Abliteration手法
│   └── blog/                 # ブログ記事(本シリーズ)
│
├── scripts/                   # 実行スクリプト
│   ├── enhanced_abliteration.py
│   ├── qwen3_aggressive_abliteration.py
│   └── calculate_refusal_direction.py
│
├── src/                       # ソースコード
│   ├── censorship_detector.py
│   ├── soft_censorship_detector.py
│   ├── enhanced_metrics.py
│   └── test_model_censorship.py
│
├── data/                      # データファイル
│   ├── harmful_prompts.json
│   └── harmless_prompts.json
│
├── outputs/                   # 出力ディレクトリ
│   └── [model_name]/         # モデル別出力
│
├── requirements.txt           # 依存関係
├── README.md                  # プロジェクト説明
└── LICENSE                    # ライセンス

5. 技術スタック

5.1 言語とフレームワーク

# 主要技術
Language: Python 3.10+
Deep Learning: PyTorch 2.0+
Model Loading: Transformers (HuggingFace)
Numerical: NumPy

# 開発ツール
Testing: pytest
Linting: ruff
Type Checking: mypy (optional)

5.2 対応モデル

Tier 1 (最適化済み):
├── Qwen2.5シリーズ (0.5B - 7B)
└── Qwen3シリーズ (0.6B - 4B)

Tier 2 (対応済み):
├── Llama 2/3シリーズ
├── Mistral
└── Phi-3/3.5

Tier 3 (実験的):
├── DeepSeek
└── その他Transformerモデル

6. 設計原則

6.1 モジュラー設計

原則: 各コンポーネントは独立して使用可能

例:
- 検出だけを使う → censorship_detector.py
- Abliterationだけ → enhanced_abliteration.py
- メトリクスだけ → enhanced_metrics.py

利点:
- テストが容易
- 再利用性が高い
- 段階的な学習が可能

6.2 透明性

原則: すべての処理は説明可能であるべき

実装:
- 詳細なログ出力
- 中間結果の保存
- 設定のドキュメント化

例:
INFO: Layer 10: applying abliteration with strength 0.85
INFO: Layer 11: applying abliteration with strength 0.92
INFO: Refusal direction norm: 0.234

6.3 安全性の維持

原則: 有害コンテンツ生成は防止

実装:
- 有害プロンプトの選別
- 安全性テストの実施
- スコープの明確化

OUT OF SCOPE:
- 暴力の指示
- 違法行為
- 児童搾取
- マルウェア

7. 他プロジェクトとの関係

7.1 影響を受けたプロジェクト

先行プロジェクト:

1. R1-1776 (Perplexity AI)
   - 名前の由来
   - 検閲解除のアプローチ
   - オープンソースの精神

2. Arditi et al.の研究
   - 拒否方向の発見
   - Abliteration手法

3. Grimjim's Projected Abliteration
   - 直交射影の改良
   - 品質維持の手法

7.2 GodsGolemIncエコシステム

Uncensored1776の位置づけ:

GodsGolemInc/
└── uncensored1776/  ← ここ


8. 使用シナリオ

8.1 研究者向け

シナリオ: LLMの検閲メカニズムを研究したい

使用コンポーネント:
1. censorship_detector.py
   → 検閲パターンの分析

2. enhanced_metrics.py
   → 定量的な測定

3. data/harmful_prompts.json
   → テストデータ

成果物:
- 検閲パターンの分類
- 検閲率の比較データ
- 学術論文の基礎データ

8.2 開発者向け

シナリオ: モデルの検閲を解除して使いたい

使用コンポーネント:
1. test_model_censorship.py
   → 現状の検閲率を確認

2. enhanced_abliteration.py
   → Abliterationを実行

3. enhanced_metrics.py
   → 解除後の品質確認

成果物:
- 検閲解除済みモデル
- 品質レポート

8.3 教育者向け

シナリオ: AI検閲について教えたい

使用コンポーネント:
1. docs/blog/(本シリーズ)
   → 段階的な学習資料

2. docs/
   → 技術ドキュメント

3. src/(コード例)
   → 実践的な教材

成果物:
- 授業資料
- ハンズオン教材

9. クイックスタート

9.1 インストール

# リポジトリのクローン
git clone https://github.com/GodsGolemInc/uncensored1776.git
cd uncensored1776

# 仮想環境の作成
python -m venv venv
source venv/bin/activate  # Linux/Mac
# venv\Scripts\activate   # Windows

# 依存関係のインストール
pip install -r requirements.txt

9.2 検閲率のテスト

# クイックテスト
python src/test_model_censorship.py \
  --model "Qwen/Qwen2.5-0.5B-Instruct" \
  --quick

# 出力例:
# Total censorship rate: 59.1%
# Hard refusals: 36.4%
# Soft refusals: 22.7%

9.3 Abliterationの実行

# 検閲解除を実行
python scripts/enhanced_abliteration.py \
  --model "Qwen/Qwen2.5-0.5B-Instruct" \
  --method projected \
  --output outputs/qwen25_uncensored

10. 今日のまとめ

Uncensored1776の全体像:

ミッション:
- 政府検閲の技術的解除
- オープンソースでの公開
- 倫理的な境界の維持

主要コンポーネント:
1. Detection - 検閲の検出
2. Abliteration - 検閲の解除
3. Metrics - 品質の測定
4. Data Generation - テストデータ

設計原則:
- モジュラー設計
- 透明性
- 安全性の維持

使用シナリオ:
- 研究
- 開発
- 教育

明日の予告

Day 9: ニューラルネットワークの基礎

  • Transformerアーキテクチャ
  • 重み行列の役割
  • なぜAbliterationが機能するか

参考リンク


ナビゲーション

前の記事 Day 7: R1-1776の誕生
次の記事 Day 9: ニューラルネットワークの基礎
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?