联邦学习同态
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 工程开发
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需手动接入
- 是否需要外部接口密钥
- 需要 · Vendor-specific
- 兼容的系统
- macOS · Linux · Windows
- 运行环境要求
- Node.js · Python >=3.8
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 读取环境变量
- 网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Federated Learning Homomorphic
## Skill Profile
*(Select at least one profile to enable specific modules)*
- [ ] **DevOps**
- [x] **Backend**
- [ ] **Frontend**
- [ ] **AI-RAG**
- [ ] **Security Critical**
## Overview
This skill covers the implementation of privacy-preserving machine learning techniques that enable training models on distributed, sensitive data without exposing raw data. It includes Federated Learning for distributed training, Homomorphic Encryption for computation on encrypted data, and Secure Multi-Party Computation (SMPC) for collaborative computation.
## Why This Matters
- **Data Privacy**: Enables ML on sensitive data without privacy violations
- **Regulatory Compliance**: Meets GDPR, HIPAA, and other data protection regulations
- **Collaborative Learning**: Multiple organizations can collaborate without sharing data
---
## Core Concepts & Rules
### 1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
### 2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
## Inputs / Outputs / Contracts
* **Inputs**:
- Local datasets on client devices (never transmitted to server)
- Model architecture and hyperparameters
- Privacy budget parameters (epsilon, delta)
- Client selection criteria and participation requirements
* **Entry Conditions**:
- TensorFlow Federated or PySyft installed
- HE library (SEAL/TenSEAL) configured
- Client devices with local data available
- Secure communication channels established (TLS 1.3)
* **Outputs**:
- Trained global model
- Client participation metrics and contribution tracking
- Privacy loss accounting reports
- Model performance evaluation on test data
* **Artifacts Required (Deliverables)**:
- Federated training configuration
- Client-side training scripts
- Server aggregation logic
- Privacy audit reports
* **Acceptance Evidence**:
- Model achieves target accuracy without exposing raw data
- Privacy budget not exceeded
- Client contributions properly tracked
- Communication overhead within acceptable limits
* **Success Criteria**:
- Model accuracy within 5% of centralized training baseline
- Privacy budget epsilon < 1.0 for DP-SGD
- Communication overhead < 10x centralized training
- Training completes within 2x centralized training time
## Skill Composition
* **Depends on**: [model-serving-inference](../../78-inference-model-serving/high-performance-inference/SKILL.md), [mlflow-patterns](../../77-mlops-data-engineering/mlflow-patterns/SKILL.md)
* **Compatible with**: [drift-detection-retraining](../../77-mlops-data-engineering/drift-detection-retraining/SKILL.md), [pii-policy-enforcement](../../70-data-platform-governance/pii-policy-enforcement/SKILL.md)
* **Conflicts with**: None
* **Related Skills**: [llm-security-redteaming](../../61-ai-production/llm-security-redteaming/SKILL.md)
---
## Quick Start / Implementation Example
1. Review requirements and constraints
2. Set up development environment
3. Implement core functionality following patterns
4. Write tests for critical paths
5. Run tests and fix issues
6. Document any deviations or decisions
```python
# Example implementation following best practices
def example_function():
# Your implementation here
pass
```
## Assumptions / Constraints / Non-goals
* **Assumptions**:
- Development environment is properly configured
- Required dependencies are available
- Team has basic understanding of domain
* **Constraints**:
- Must follow existing codebase conventions
- Time and resource limitations
- Compatibility requirements
* **Non-goals**:
- This skill does not cover edge cases outside scope
- Not a replacement for formal training
## Compatibility & Prerequisites
* **Supported Versions**:
- Python 3.8+
- Node.js 16+
- Modern browsers (Chrome, Firefox, Safari, Edge)
* **Required AI Tools**:
- Code editor (VS Code recommended)
- Testing framework appropriate for language
- Version control (Git)
* **Dependencies**:
- Language-specific package manager
- Build tools
- Testing libraries
* **Environment Setup**:
- `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)
## Test Scenario Matrix (QA Strategy)
| Type | Focus Area | Required Scenarios / Mocks |
| :--- | :--- | :--- |
| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |
| **E2E** | User Journey | Critical user flows to test |
| **Performance** | Latency / Load | Benchmark requirements |
| **Security** | Vuln / Auth | SAST/DAST or dependency audit |
| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
## Technical Guardrails & Security Threat Model
### 1. Security & Privacy (Threat Model)
* **Top Threats**: Injection attacks, authentication bypass, data exposure
- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII
- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager
- [ ] **Authorization**: Validate user permissions before state changes
### 2. Performance & Resources
- [ ] **Execution Efficiency**: Consider time complexity for algorithms
- [ ] **Memory Management**: Use streams/pagination for large data
- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks
### 3. Architecture & Scalability
- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection
- [ ] **Modularity**: Decouple logic from UI/Frameworks
### 4. Observability & Reliability
- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`
- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`
- [ ] **Error Handling**: Standardized error codes, no bare except
- [ ] **Observability Artifacts**:
- **Log Fields**: timestamp, level, message, request_id
- **Metrics**: request_count, error_count, response_time
- **Dashboards/Alerts**: High Error Rate > 5%
## Agent Directives & Error Recovery
*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*
- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.
- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.
- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.
## Definition of Done (DoD) Checklist
- [ ] Tests passed + coverage met
- [ ] Lint/Typecheck passed
- [ ] Logging/Metrics/Trace implemented
- [ ] Security checks passed
- [ ] Documentation/Changelog updated
- [ ] Accessibility/Performance requirements met (if frontend)
## Anti-patterns / Pitfalls
* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries
* ⚠️ **Watch out for**: Common symptoms and quick fixes
* 💡 **Instead**: Use proper error handling, pagination, and logging
## Reference Links & Examples
* Internal documentation and examples
* Official documentation and best practices
* Community resources and discussions
## Versioning & Changelog
* **Version**: 1.0.0
* **Changelog**:
- 2026-02-22: Initial version with complete template structure
---
> Source: [AmnadTaowsoam/CerebraSkills](https://github.com/AmnadTaowsoam/CerebraSkills) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->
章节与文件索引
按说明文件中的顺序排列。
技能简介
概述
为什么这很重要
1. 核心原则
2. 实施指南
文件/命令 -> .env.example · API_KEY · DATABASE_URL · request_id · error_rate · latency · queue_depth
内容校验值 -> a3091778a30a
当前原文的自动摘译,尚未人工审校。
技能简介
(至少选择一个配置文件以启用特定模块) [ ] DevOps [x] 后端 [ ] 前端 [ ] AI-RAG
概述
这项技能涵盖了隐私保护机器学习技术的实施,这些技术可以在分布式敏感数据上训练模型,而无需暴露原始数据。它包括用于分布式训练的联邦学习、用于加密数据计算的同态加密以及用于协作计算的安全多方计算(SMPC)。
为什么这很重要
数据隐私:在敏感数据上启用机器学习,而不会侵犯隐私监管合规性:符合 GDPR、HIPAA 和其他数据保护法规协作学习:多个组织可以在不共享数据的情况下进行协作
1. 核心原则
遵循既定的模式和惯例 保持代码库的一致性 记录决策和权衡
2. 实施指南
从最简单可行的解决方案开始 根据反馈和需求进行迭代 在部署之前进行彻底测试