{"id":100708,"date":"2026-09-05T04:16:48","date_gmt":"2026-09-04T20:16:48","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/100708.html"},"modified":"2026-09-05T04:16:48","modified_gmt":"2026-09-04T20:16:48","slug":"%e5%9f%ba%e4%ba%8e%e6%88%90%e5%91%98%e6%8e%a8%e6%96%ad%e6%94%bb%e5%87%bb%ef%bc%88mia%ef%bc%89%e7%9a%84%e8%ae%ad%e7%bb%83%e9%9b%86%e9%9a%90%e7%a7%81%e6%8e%a2%e6%b5%8b%e5%ae%9e%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/100708.html","title":{"rendered":"\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb\uff08MIA\uff09\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1"},"content":{"rendered":"<h2>\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb&#xff08;MIA&#xff09;\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1<\/h2>\n<h3>\u6a21\u578b\u8bb0\u5fc6\u6548\u5e94\u5f15\u53d1\u7684\u9690\u79c1\u6cc4\u9732\u98ce\u9669<\/h3>\n<p>\u5728\u4eba\u5de5\u667a\u80fd\u4e0e\u5927\u8bed\u8a00\u6a21\u578b\u7684\u5168\u751f\u547d\u5468\u671f\u4e2d&#xff0c;\u8bad\u7ec3\u6570\u636e\u5f80\u5f80\u5305\u542b\u9ad8\u5ea6\u654f\u611f\u7684\u4f01\u4e1a\u4e13\u6709\u4ee3\u7801\u3001\u8d22\u52a1\u6d41\u6c34\u3001\u7528\u6237\u4e2a\u4eba\u8eab\u4efd\u4fe1\u606f&#xff08;PII&#xff09;\u4ee5\u53ca\u533b\u7597\u5065\u5eb7\u6863\u6848\u3002\u6839\u636e\u6570\u636e\u5b89\u5168\u5408\u89c4\u8981\u6c42&#xff08;\u5982 GDPR\u3001\u6570\u636e\u5b89\u5168\u6cd5&#xff09;&#xff0c;\u6a21\u578b\u670d\u52a1\u5546\u5fc5\u987b\u786e\u4fdd\u8bad\u7ec3\u6570\u636e\u7684\u9690\u79c1\u6027&#xff0c;\u4e14\u5177\u5907\u54cd\u5e94\u201c\u88ab\u9057\u5fd8\u6743&#xff08;Right to be Forgotten&#xff09;\u201d\u7684\u80fd\u529b\u3002<\/p>\n<p>\u7136\u800c&#xff0c;\u6df1\u5ea6\u795e\u7ecf\u7f51\u7edc\u5728\u53c2\u6570\u62df\u5408\u8fc7\u7a0b\u4e2d&#xff0c;\u4e0d\u53ef\u907f\u514d\u5730\u4f1a\u4ea7\u751f\u8bb0\u5fc6\u6548\u5e94&#xff08;Memorization&#xff09;\u3002\u4e0e\u4eba\u7c7b\u8bb0\u5fc6\u62bd\u8c61\u6982\u5ff5\u4e0d\u540c&#xff0c;\u8fc7\u53c2\u6570\u5316\u7684\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\u503e\u5411\u4e8e\u5f3a\u884c\u8bb0\u4f4f\u8bad\u7ec3\u96c6\u4e2d\u7684\u7279\u5b9a\u79bb\u7fa4\u70b9&#xff08;Outliers&#xff09;\u4e0e\u7f55\u89c1\u6837\u672c\u3002\u6210\u5458\u63a8\u65ad\u653b\u51fb&#xff08;Membership Inference Attack, MIA&#xff09; \u6b63\u662f\u5229\u7528\u8fd9\u4e00\u7269\u7406\u7279\u6027&#xff1a;\u653b\u51fb\u8005\u5728\u4ec5\u80fd\u8bbf\u95ee\u6a21\u578b\u9ed1\u76d2\u9884\u6d4b API \u7684\u524d\u63d0\u4e0b&#xff0c;\u80fd\u591f\u9ad8\u7f6e\u4fe1\u5ea6\u5730\u5224\u5b9a\u67d0\u4e2a\u5177\u4f53\u6837\u672c $x$ \u662f\u5426\u66fe\u88ab\u5305\u542b\u5728\u76ee\u6807\u6a21\u578b\u7684\u8bad\u7ec3\u96c6 $\\\\mathcal{D}_{train}$ \u4e2d\u3002<\/p>\n<h3>\u6210\u5458\u63a8\u65ad\u7684\u6570\u5b66\u673a\u7406\u4e0e\u7edf\u8ba1\u7279\u5f81<\/h3>\n<p>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502                    \u6a21\u578b\u6cdb\u5316\u5dee\u8ddd\u4e0e\u8f93\u51fa\u5206\u5e03\u5dee\u5f02               \u2502<br \/>\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502 \u8bad\u7ec3\u96c6\u6210\u5458\u6837\u672c (Member)      \u2502 \u975e\u8bad\u7ec3\u96c6\u672a\u89c1\u6837\u672c (Non-Member) \u2502<br \/>\n\u2502 &#8211; \u6781\u4f4e\u4ea4\u53c9\u71b5\u635f\u5931 (Low Loss)  \u2502 &#8211; \u8f83\u9ad8\u635f\u5931 (Higher Loss)     \u2502<br \/>\n\u2502 &#8211; \u5c16\u9510\u7f6e\u4fe1\u5ea6\u5206\u5e03 (Low Entropy\u2502 &#8211; \u5e73\u7f13\u7f6e\u4fe1\u5ea6\u5206\u5e03 (High Entropy\u2502<br \/>\n\u2502 &#8211; \u6781\u9ad8\u6700\u5927\u9884\u6d4b\u6982\u7387 (Max Prob)\u2502 &#8211; \u8f83\u4f4e\u6700\u5927\u9884\u6d4b\u6982\u7387           \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/p>\n<h4>1. \u6cdb\u5316\u5dee\u8ddd&#xff08;Generalization Gap&#xff09;\u4e0e\u635f\u5931\u5dee\u5f02<\/h4>\n<p>\u6df1\u5ea6\u6a21\u578b\u8bad\u7ec3\u7684\u76ee\u6807\u662f\u6700\u5c0f\u5316\u7ecf\u9a8c\u98ce\u9669 $\\\\mathcal{L}{\\\\mathcal{D}{train}}(\\\\theta)$\u3002\u5373\u4f7f\u7ecf\u8fc7\u5145\u5206\u7684\u6b63\u5219\u5316&#xff0c;\u6a21\u578b\u5728\u201c\u89c1\u8fc7\u201d\u7684\u6570\u636e\u4e0a\u7684\u9884\u6d4b\u635f\u5931 $\\\\mathcal{L}(f(x; \\\\theta), y)$ \u5728\u7edf\u8ba1\u4e0a\u4f9d\u7136\u663e\u8457\u4f4e\u4e8e\u5728\u201c\u672a\u89c1\u8fc7\u201d\u7684\u6d4b\u8bd5\u6570\u636e\u4e0a\u7684\u635f\u5931\u3002<\/p>\n<p>\u5bf9\u4e8e\u7ed9\u5b9a\u6837\u672c $(x, y)$&#xff0c;\u5176\u635f\u5931\u53ef\u8868\u793a\u4e3a&#xff1a;$$\\\\mathcal{L}{CE}(x, y) &#061; -\\\\log(P(y | x))$$\u6700\u76f4\u63a5\u7684\u653b\u51fb\u65b9\u6cd5\u4fbf\u662f\u8bbe\u5b9a\u4e00\u4e2a\u51b3\u7b56\u9608\u503c $\\\\tau$&#xff1a;\u82e5 $\\\\mathcal{L}{CE}(x, y) \\\\le \\\\tau$&#xff0c;\u5219\u5224\u5b9a\u5176\u4e3a\u6210\u5458\u6837\u672c&#xff0c;\u53cd\u4e4b\u5219\u4e3a\u975e\u6210\u5458\u3002<\/p>\n<h4>2. \u9884\u6d4b\u6982\u7387\u5206\u5e03\u7684\u4fee\u6b63\u71b5&#xff08;Modified Entropy&#xff09;<\/h4>\n<p>\u9664\u4e86\u5355\u4e00\u7684 Loss&#xff0c;\u6a21\u578b\u8f93\u51fa\u7684\u5b8c\u6574 Softmax \u6982\u7387\u5411\u91cf $P &#061; [p_1, p_2, \\\\dots, p_C]$ \u8574\u542b\u7740\u4e30\u5bcc\u7684\u7f6e\u4fe1\u5ea6\u5206\u5e03\u7279\u5f81\u3002\u4fee\u6b63\u71b5\u5ea6\u91cf\u5173\u6ce8\u6a21\u578b\u5bf9\u9519\u8bef\u7c7b\u522b\u7684\u7f6e\u4fe1\u5ea6\u5206\u914d&#xff1a;$$M(P, y) &#061; -(1 &#8211; p_y)\\\\log(p_y) &#8211; \\\\sum_{i \\\\neq y} p_i \\\\log(1 &#8211; p_i)$$\u5bf9\u4e8e\u6210\u5458\u6837\u672c&#xff0c;\u6a21\u578b\u901a\u5e38\u5bf9\u771f\u5b9e\u7c7b\u522b\u5177\u6709\u538b\u5012\u6027\u7f6e\u4fe1\u5ea6&#xff0c;\u800c\u5728\u5176\u4f59\u7c7b\u522b\u4e0a\u7684\u9884\u6d4b\u6982\u7387\u63a5\u8fd1\u4e8e\u96f6&#xff0c;\u4f7f\u5f97 $M(P, y)$ \u5448\u73b0\u51fa\u660e\u663e\u7684\u4f4e\u71b5\u7279\u5f81\u3002<\/p>\n<h4>3. \u5f71\u5b50\u6a21\u578b\u5206\u7c7b\u5668&#xff08;Shadow Model Approach&#xff09;<\/h4>\n<p>\u5728\u9ed1\u76d2\u573a\u666f\u4e0b&#xff0c;\u653b\u51fb\u8005\u82e5\u5e0c\u671b\u8fbe\u5230\u66f4\u9ad8\u7684\u63a2\u6d4b\u7cbe\u5ea6&#xff0c;\u53ef\u5229\u7528\u4e0e\u76ee\u6807\u6a21\u578b\u76f8\u4f3c\u7684\u516c\u5f00\u6570\u636e\u96c6\u8bad\u7ec3\u591a\u4e2a\u201c\u5f71\u5b50\u6a21\u578b&#xff08;Shadow Models&#xff09;\u201d&#xff0c;\u6784\u5efa\u5305\u542b\u201c\u6210\u5458\u201d\u4e0e\u201c\u975e\u6210\u5458\u201d\u771f\u5b9e\u6807\u7b7e\u7684\u8bad\u7ec3\u96c6&#xff0c;\u5e76\u5728\u6b64\u4e4b\u4e0a\u8bad\u7ec3\u4e00\u4e2a\u4e8c\u5206\u7c7b\u5668&#xff08;MIA Meta-Classifier&#xff09;&#xff0c;\u4ece Softmax \u5206\u5e03\u4e2d\u81ea\u52a8\u5b66\u4e60\u5fae\u5999\u7684\u8bb0\u5fc6\u7279\u5f81\u3002<\/p>\n<h3>\u6210\u5458\u63a8\u65ad\u8bc4\u4f30\u63a2\u6d4b\u5668\u5b9e\u73b0<\/h3>\n<p>\u4ee5\u4e0b Python \/ PyTorch \u4ee3\u7801\u5b9e\u73b0\u4e86\u4e00\u4e2a\u57fa\u4e8e\u635f\u5931\u9608\u503c\u4e0e\u4fe1\u606f\u71b5\u5206\u6790\u7684\u6210\u5458\u63a8\u65ad\u653b\u51fb\u63a2\u6d4b\u5668&#xff0c;\u7528\u4e8e\u8bc4\u4f30\u6a21\u578b\u5728\u654f\u611f\u6570\u636e\u96c6\u4e0a\u7684\u9690\u79c1\u6cc4\u9732\u98ce\u9669&#xff1a;<\/p>\n<p>import numpy as np<br \/>\nimport torch<br \/>\nimport torch.nn as nn<br \/>\nimport torch.nn.functional as F<br \/>\nfrom typing import Tuple, Dict, List<\/p>\n<p>class MIAPrivacyAuditor:<br \/>\n    def __init__(self, target_model: nn.Module, device: str &#061; &#034;cpu&#034;):<br \/>\n        self.model &#061; target_model.to(device)<br \/>\n        self.device &#061; device<br \/>\n        self.model.eval()<\/p>\n<p>    def compute_metrics(self, inputs: torch.Tensor, labels: torch.Tensor) -&gt; Dict[str, np.ndarray]:<br \/>\n        &#034;&#034;&#034;\u8ba1\u7b97\u6837\u672c\u5728\u76ee\u6807\u6a21\u578b\u4e0a\u7684 Loss\u3001\u6700\u5927\u6982\u7387\u4e0e\u9884\u6d4b\u71b5&#034;&#034;&#034;<br \/>\n        inputs, labels &#061; inputs.to(self.device), labels.to(self.device)<\/p>\n<p>        with torch.no_grad():<br \/>\n            logits &#061; self.model(inputs)<br \/>\n            probs &#061; F.softmax(logits, dim&#061;-1)<br \/>\n            log_probs &#061; F.log_softmax(logits, dim&#061;-1)<\/p>\n<p>            # 1. \u4ea4\u53c9\u71b5\u635f\u5931 (Cross-Entropy Loss)<br \/>\n            loss_fn &#061; nn.CrossEntropyLoss(reduction&#061;&#039;none&#039;)<br \/>\n            losses &#061; loss_fn(logits, labels).cpu().numpy()<\/p>\n<p>            # 2. \u6700\u5927\u7f6e\u4fe1\u5ea6 (Max Confidence)<br \/>\n            max_probs, _ &#061; torch.max(probs, dim&#061;-1)<br \/>\n            max_probs &#061; max_probs.cpu().numpy()<\/p>\n<p>            # 3. \u9884\u6d4b\u5206\u5e03\u4fe1\u606f\u71b5 (Entropy: &#8211; sum(p * log(p)))<br \/>\n            entropy &#061; -torch.sum(probs * torch.clamp(log_probs, min&#061;-100), dim&#061;-1).cpu().numpy()<\/p>\n<p>        return {<br \/>\n            &#034;losses&#034;: losses,<br \/>\n            &#034;max_probs&#034;: max_probs,<br \/>\n            &#034;entropy&#034;: entropy<br \/>\n        }<\/p>\n<p>    def evaluate_membership_leakage(self,<br \/>\n                                    member_loader: torch.utils.data.DataLoader,<br \/>\n                                    non_member_loader: torch.utils.data.DataLoader) -&gt; Dict[str, float]:<br \/>\n        &#034;&#034;&#034;\u5bf9\u6bd4\u6210\u5458\u6837\u672c\u4e0e\u975e\u6210\u5458\u6837\u672c\u7684\u7edf\u8ba1\u5dee\u5f02&#xff0c;\u91cf\u5316\u9690\u79c1\u6cc4\u9732\u6c34\u5e73&#034;&#034;&#034;<br \/>\n        print(&#034;[*] \u6b63\u5728\u63d0\u53d6\u8bad\u7ec3\u96c6\u6210\u5458\u4e0e\u975e\u6210\u5458\u6837\u672c\u7684\u8f93\u51fa\u7279\u5f81\u5206\u5e03&#8230;&#034;)<\/p>\n<p>        # \u6536\u96c6\u6210\u5458\u6570\u636e\u7279\u5f81<br \/>\n        m_losses, m_entropy &#061; [], []<br \/>\n        for x, y in member_loader:<br \/>\n            metrics &#061; self.compute_metrics(x, y)<br \/>\n            m_losses.extend(metrics[&#034;losses&#034;])<br \/>\n            m_entropy.extend(metrics[&#034;entropy&#034;])<\/p>\n<p>        # \u6536\u96c6\u975e\u6210\u5458\u6570\u636e\u7279\u5f81<br \/>\n        nm_losses, nm_entropy &#061; [], []<br \/>\n        for x, y in non_member_loader:<br \/>\n            metrics &#061; self.compute_metrics(x, y)<br \/>\n            nm_losses.extend(metrics[&#034;losses&#034;])<br \/>\n            nm_entropy.extend(metrics[&#034;entropy&#034;])<\/p>\n<p>        m_losses, nm_losses &#061; np.array(m_losses), np.array(nm_losses)<br \/>\n        m_entropy, nm_entropy &#061; np.array(m_entropy), np.array(nm_entropy)<\/p>\n<p>        # \u57fa\u4e8e Loss \u9608\u503c\u8ba1\u7b97\u7b80\u6613 ROC-AUC \u5206\u6570<br \/>\n        # \u6210\u5458\u6837\u672c Loss \u5e94\u8be5\u504f\u5c0f&#xff0c;\u56e0\u6b64\u53d6\u8d1f Loss \u4f5c\u4e3a\u6253\u5206<br \/>\n        y_true &#061; np.concatenate([np.ones_like(m_losses), np.zeros_like(nm_losses)])<br \/>\n        y_scores &#061; np.concatenate([-m_losses, -nm_losses])<\/p>\n<p>        # \u6570\u503c\u8ba1\u7b97\u7b80\u6613 AUC<br \/>\n        sorted_indices &#061; np.argsort(y_scores)[::-1]<br \/>\n        y_true_sorted &#061; y_true[sorted_indices]<br \/>\n        tps &#061; np.cumsum(y_true_sorted)<br \/>\n        fps &#061; np.cumsum(1 &#8211; y_true_sorted)<br \/>\n        tpr &#061; tps \/ len(m_losses)<br \/>\n        fpr &#061; fps \/ len(nm_losses)<br \/>\n        auc_score &#061; np.trapz(tpr, fpr)<\/p>\n<p>        print(f&#034;\\\\n[&#043;] \u6210\u5458\u63a8\u65ad\u5ba1\u8ba1\u7ed3\u679c:&#034;)<br \/>\n        print(f&#034;    &#8211; \u6210\u5458\u6837\u672c\u5e73\u5747 Loss:     {np.mean(m_losses):.4f} (\u00b1 {np.std(m_losses):.4f})&#034;)<br \/>\n        print(f&#034;    &#8211; \u975e\u6210\u5458\u6837\u672c\u5e73\u5747 Loss:   {np.mean(nm_losses):.4f} (\u00b1 {np.std(nm_losses):.4f})&#034;)<br \/>\n        print(f&#034;    &#8211; \u6210\u5458\u6837\u672c\u5e73\u5747\u4fe1\u606f\u71b5:    {np.mean(m_entropy):.4f}&#034;)<br \/>\n        print(f&#034;    &#8211; \u975e\u6210\u5458\u6837\u672c\u5e73\u5747\u4fe1\u606f\u71b5:  {np.mean(nm_entropy):.4f}&#034;)<br \/>\n        print(f&#034;    &#8211; MIA \u653b\u51fb\u8005\u57fa\u7ebf AUC:   {auc_score:.4f} (0.5 \u4e3a\u65e0\u6cc4\u9732&#xff0c;1.0 \u4e3a\u5b8c\u5168\u6cc4\u9732)&#034;)<\/p>\n<p>        return {&#034;auc&#034;: auc_score}<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    # \u6784\u5efa\u73a9\u5177\u6a21\u578b\u4e0e\u6570\u636e\u96c6\u8fdb\u884c\u6f14\u793a<br \/>\n    class SimpleClassifier(nn.Module):<br \/>\n        def __init__(self):<br \/>\n            super().__init__()<br \/>\n            self.fc &#061; nn.Sequential(<br \/>\n                nn.Linear(16, 32),<br \/>\n                nn.ReLU(),<br \/>\n                nn.Linear(32, 2)<br \/>\n            )<br \/>\n        def forward(self, x):<br \/>\n            return self.fc(x)<\/p>\n<p>    model &#061; SimpleClassifier()<br \/>\n    # \u6a21\u62df\u6210\u5458\u6837\u672c&#xff08;\u5fae\u8c03\u62df\u5408\u540e Loss \u6781\u4f4e&#xff09;\u4e0e\u975e\u6210\u5458\u6837\u672c<br \/>\n    x_mem &#061; torch.randn(100, 16)<br \/>\n    y_mem &#061; torch.zeros(100, dtype&#061;torch.long)<\/p>\n<p>    x_non_mem &#061; torch.randn(100, 16) &#043; 0.5<br \/>\n    y_non_mem &#061; torch.ones(100, dtype&#061;torch.long)<\/p>\n<p>    mem_loader &#061; [(x_mem, y_mem)]<br \/>\n    non_mem_loader &#061; [(x_non_mem, y_non_mem)]<\/p>\n<p>    auditor &#061; MIAPrivacyAuditor(target_model&#061;model)<br \/>\n    auditor.evaluate_membership_leakage(mem_loader, non_mem_loader)<\/p>\n<h3>\u6a21\u578b\u9690\u79c1\u9632\u5fa1\u4e0e\u5408\u89c4\u52a0\u56fa\u7b56\u7565<\/h3>\n<p>\u964d\u4f4e\u6210\u5458\u63a8\u65ad\u98ce\u9669\u7684\u6838\u5fc3\u5728\u4e8e\u538b\u7f29\u6a21\u578b\u5728\u8bad\u7ec3\u96c6\u4e0e\u6d4b\u8bd5\u96c6\u4e4b\u95f4\u7684\u6cdb\u5316\u5dee\u8ddd&#xff0c;\u6d88\u9664\u6781\u7aef\u7684\u7f6e\u4fe1\u5ea6\u5cf0\u503c&#xff1a;<\/p>\n<h4>1. \u5dee\u5206\u9690\u79c1\u968f\u673a\u68af\u5ea6\u4e0b\u964d&#xff08;DP-SGD&#xff09;<\/h4>\n<p>\u5728\u6a21\u578b\u8bad\u7ec3\u6216\u5fae\u8c03\u9636\u6bb5&#xff0c;\u901a\u8fc7\u88c1\u526a\u6837\u672c\u7ea7\u68af\u5ea6\u7684 $L_2$ \u8303\u6570&#xff08;Gradient Clipping&#xff09;&#xff0c;\u5e76\u5728\u53cd\u5411\u4f20\u64ad\u805a\u5408\u65f6\u6ce8\u5165\u6821\u51c6\u7684\u9ad8\u65af\u767d\u566a\u58f0&#xff1a;$$g_t &#061; \\\\frac{1}{B}\\\\sum_{i&#061;1}^B \\\\text{clip}(g_i, C) &#043; \\\\mathcal{N}(0, \\\\sigma^2 C^2 I)$$DP-SGD \u4ece\u6570\u5b66\u4e0a\u4e25\u683c\u9650\u5236\u4e86\u5355\u4e2a\u6837\u672c\u5bf9\u6a21\u578b\u6700\u7ec8\u6743\u91cd\u7684\u6700\u5927\u5f71\u54cd\u91cf&#xff08;Bounding $\\\\epsilon$-Differential Privacy&#xff09;&#xff0c;\u5f7b\u5e95\u6467\u6bc1 MIA \u7684\u7edf\u8ba1\u57fa\u7840\u3002<\/p>\n<h4>2. \u65e9\u505c\u673a\u5236\u4e0e\u5f3a\u5316\u6b63\u5219\u5316&#xff08;Early Stopping &amp; Weight Decay&#xff09;<\/h4>\n<ul>\n<li>\u4e25\u7981\u76f2\u76ee\u8ffd\u6c42\u8bad\u7ec3\u96c6\u4e0a\u7684 100% \u51c6\u786e\u7387\u3002\u4e00\u65e6\u9a8c\u8bc1\u96c6 Loss \u5f00\u59cb\u8d70\u5e73\u6216\u4e0a\u5347&#xff0c;\u7acb\u5373\u89e6\u53d1\u65e9\u505c\u3002<\/li>\n<li>\u5f15\u5165\u5f3a\u6743\u91cd\u8870\u51cf&#xff08;$L_2$ \u6b63\u5219&#xff09;\u4e0e\u9ad8\u6bd4\u4f8b Dropout&#xff08;0.2~0.4&#xff09;&#xff0c;\u6291\u5236\u6df1\u5c42\u795e\u7ecf\u5143\u5bf9\u5b64\u7acb\u6837\u672c\u7684\u8fc7\u62df\u5408\u8bb0\u5fc6\u3002<\/li>\n<\/ul>\n<h4>3. API \u8f93\u51fa\u5c42\u7f6e\u4fe1\u5ea6\u5e73\u6ed1&#xff08;Temperature Scaling &amp; Top-K&#xff09;<\/h4>\n<ul>\n<li>\u5728\u5bf9\u5916\u63d0\u4f9b\u63a8\u7406\u63a5\u53e3\u65f6&#xff0c;\u5f15\u5165\u6e29\u5ea6\u7cfb\u6570 $T &gt; 1$&#xff08;\u5982 $T &#061; 2.0$&#xff09;\u5e73\u6ed1 Softmax \u6982\u7387\u5206\u5e03&#xff1a;$$P_i &#061; \\\\frac{e^{z_i \/ T}}{\\\\sum_j e^{z_j \/ T}}$$<\/li>\n<li>\u7ed3\u5408 Top-1 \/ Top-K \u63a9\u7801\u6280\u672f&#xff0c;\u5265\u79bb\u4f4e\u6982\u7387 tail \u7ef4\u5ea6\u7684\u5fae\u5c0f\u6570\u503c\u5dee\u5f02&#xff0c;\u4f7f\u653b\u51fb\u8005\u65e0\u6cd5\u63d0\u53d6\u7cbe\u786e\u7684\u4fe1\u606f\u71b5\u7279\u5f81\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb&#xff08;MIA&#xff09;\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1<br \/>\n\u6a21\u578b\u8bb0\u5fc6\u6548\u5e94\u5f15\u53d1\u7684\u9690\u79c1\u6cc4\u9732\u98ce\u9669<br \/>\n\u5728\u4eba\u5de5\u667a\u80fd\u4e0e\u5927\u8bed\u8a00\u6a21\u578b\u7684\u5168\u751f\u547d\u5468\u671f\u4e2d&#xff0c;\u8bad\u7ec3\u6570\u636e\u5f80\u5f80\u5305\u542b\u9ad8\u5ea6\u654f\u611f\u7684\u4f01\u4e1a\u4e13\u6709\u4ee3\u7801\u3001\u8d22\u52a1\u6d41\u6c34\u3001\u7528\u6237\u4e2a\u4eba\u8eab\u4efd\u4fe1\u606f&#xff08;PII&#xff09;\u4ee5\u53ca\u533b\u7597\u5065\u5eb7\u6863\u6848\u3002\u6839\u636e\u6570\u636e\u5b89\u5168\u5408\u89c4\u8981\u6c42&#xff08;\u5982 GDPR\u3001\u6570\u636e\u5b89\u5168\u6cd5&#xff09;&#xff0c;\u6a21\u578b\u670d\u52a1\u5546\u5fc5\u987b\u786e\u4fdd\u8bad\u7ec3\u6570\u636e\u7684\u9690\u79c1\u6027&#xff0c;\u4e14\u5177\u5907\u54cd\u5e94\u201c\u88ab\u9057\u5fd8\u6743&#xff08;Right to b<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[66,594,50,100,51],"topic":[],"class_list":["post-100708","post","type-post","status-publish","format-standard","hentry","category-server","tag-ai","tag-web","tag-50","tag-100","tag-51"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb\uff08MIA\uff09\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/100708.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb\uff08MIA\uff09\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb&#xff08;MIA&#xff09;\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1 \u6a21\u578b\u8bb0\u5fc6\u6548\u5e94\u5f15\u53d1\u7684\u9690\u79c1\u6cc4\u9732\u98ce\u9669 \u5728\u4eba\u5de5\u667a\u80fd\u4e0e\u5927\u8bed\u8a00\u6a21\u578b\u7684\u5168\u751f\u547d\u5468\u671f\u4e2d&#xff0c;\u8bad\u7ec3\u6570\u636e\u5f80\u5f80\u5305\u542b\u9ad8\u5ea6\u654f\u611f\u7684\u4f01\u4e1a\u4e13\u6709\u4ee3\u7801\u3001\u8d22\u52a1\u6d41\u6c34\u3001\u7528\u6237\u4e2a\u4eba\u8eab\u4efd\u4fe1\u606f&#xff08;PII&#xff09;\u4ee5\u53ca\u533b\u7597\u5065\u5eb7\u6863\u6848\u3002\u6839\u636e\u6570\u636e\u5b89\u5168\u5408\u89c4\u8981\u6c42&#xff08;\u5982 GDPR\u3001\u6570\u636e\u5b89\u5168\u6cd5&#xff09;&#xff0c;\u6a21\u578b\u670d\u52a1\u5546\u5fc5\u987b\u786e\u4fdd\u8bad\u7ec3\u6570\u636e\u7684\u9690\u79c1\u6027&#xff0c;\u4e14\u5177\u5907\u54cd\u5e94\u201c\u88ab\u9057\u5fd8\u6743&#xff08;Right to b\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/100708.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-04T20:16:48+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/100708.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/100708.html\",\"name\":\"\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb\uff08MIA\uff09\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-04T20:16:48+00:00\",\"dateModified\":\"2026-09-04T20:16:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/100708.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/100708.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/100708.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb\uff08MIA\uff09\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb\uff08MIA\uff09\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/100708.html","og_locale":"zh_CN","og_type":"article","og_title":"\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb\uff08MIA\uff09\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb&#xff08;MIA&#xff09;\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1 \u6a21\u578b\u8bb0\u5fc6\u6548\u5e94\u5f15\u53d1\u7684\u9690\u79c1\u6cc4\u9732\u98ce\u9669 \u5728\u4eba\u5de5\u667a\u80fd\u4e0e\u5927\u8bed\u8a00\u6a21\u578b\u7684\u5168\u751f\u547d\u5468\u671f\u4e2d&#xff0c;\u8bad\u7ec3\u6570\u636e\u5f80\u5f80\u5305\u542b\u9ad8\u5ea6\u654f\u611f\u7684\u4f01\u4e1a\u4e13\u6709\u4ee3\u7801\u3001\u8d22\u52a1\u6d41\u6c34\u3001\u7528\u6237\u4e2a\u4eba\u8eab\u4efd\u4fe1\u606f&#xff08;PII&#xff09;\u4ee5\u53ca\u533b\u7597\u5065\u5eb7\u6863\u6848\u3002\u6839\u636e\u6570\u636e\u5b89\u5168\u5408\u89c4\u8981\u6c42&#xff08;\u5982 GDPR\u3001\u6570\u636e\u5b89\u5168\u6cd5&#xff09;&#xff0c;\u6a21\u578b\u670d\u52a1\u5546\u5fc5\u987b\u786e\u4fdd\u8bad\u7ec3\u6570\u636e\u7684\u9690\u79c1\u6027&#xff0c;\u4e14\u5177\u5907\u54cd\u5e94\u201c\u88ab\u9057\u5fd8\u6743&#xff08;Right to b","og_url":"https:\/\/www.wsisp.com\/helps\/100708.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-04T20:16:48+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/100708.html","url":"https:\/\/www.wsisp.com\/helps\/100708.html","name":"\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb\uff08MIA\uff09\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-04T20:16:48+00:00","dateModified":"2026-09-04T20:16:48+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/100708.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/100708.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/100708.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u57fa\u4e8e\u6210\u5458\u63a8\u65ad\u653b\u51fb\uff08MIA\uff09\u7684\u8bad\u7ec3\u96c6\u9690\u79c1\u63a2\u6d4b\u5b9e\u52a1"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/100708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=100708"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/100708\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=100708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=100708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=100708"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=100708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}