⚖️ AI Regulation & Ethics

Right to Erasure

The right to request deletion of personal data

Detailed Explanation

The Right to Erasure (Right to be Forgotten) is the right of individuals to request the deletion of their personal data. It is set out in Article 17 of the GDPR, and Article 36 of the Korean Personal Information Protection Act guarantees a similar right. In the AI era, this right raises a new challenge: deletion from training data.

Grounds for an erasure request under Article 17 of the GDPR are as follows: after the purpose of collection has been fulfilled, when consent is withdrawn, when the right to object to processing is exercised, in cases of unlawful processing, and when erasure is required by a legal obligation. However, there are exceptions such as freedom of expression, legal obligations, and archiving in the public interest.

In the AI context, the technical implementation of the right to erasure is complex. This is because even if a specific individual's information is deleted from the training data, the influence of that information remains in the already trained model. Machine Unlearning technology is being researched to address this, but completely removing that influence remains a difficult challenge.

Practical approaches include retraining the model after deleting the data, documenting that the influence is negligible, or minimizing the exposure of personal information from the outset by applying Federated Learning or Differential Privacy.

Code Example

# 삭제권 요청 처리 시스템 예제
from dataclasses import dataclass, field
from datetime import datetime, timedelta
from typing import List, Dict, Optional
from enum import Enum

class DeletionStatus(Enum):
    PENDING = "pending"
    IN_PROGRESS = "in_progress"
    COMPLETED = "completed"
    REJECTED = "rejected"

class DeletionScope(Enum):
    RAW_DATA = "raw_data"           # 원본 데이터
    PROCESSED_DATA = "processed"     # 처리된 데이터
    TRAINING_DATA = "training"       # 학습 데이터
    MODEL_INFLUENCE = "model"        # 모델 영향

@dataclass
class DeletionRequest:
    """GDPR 제17조 삭제 요청"""
    request_id: str
    user_id: str
    requested_at: datetime
    reason: str
    scopes: List[DeletionScope]
    status: DeletionStatus = DeletionStatus.PENDING
    completed_at: Optional[datetime] = None
    affected_models: List[str] = field(default_factory=list)

class RightToErasureManager:
    """삭제권 관리 시스템"""

    GDPR_RESPONSE_DEADLINE_DAYS = 30

    def __init__(self):
        self.requests: Dict[str, DeletionRequest] = {}
        self.deletion_logs: List[Dict] = []

    def submit_deletion_request(self, user_id: str, reason: str,
                                  scopes: List[DeletionScope]) -> DeletionRequest:
        """삭제 요청 접수"""
        request_id = f"DEL-{datetime.now().strftime('%Y%m%d%H%M%S')}-{user_id[:4]}"

        request = DeletionRequest(
            request_id=request_id,
            user_id=user_id,
            requested_at=datetime.now(),
            reason=reason,
            scopes=scopes
        )

        self.requests[request_id] = request
        deadline = request.requested_at + timedelta(days=self.GDPR_RESPONSE_DEADLINE_DAYS)
        print(f"[삭제 요청 접수] ID: {request_id}, 처리 기한: {deadline.date()}")

        return request

    def process_deletion(self, request_id: str,
                          data_sources: Dict[str, 'DataSource']) -> Dict:
        """삭제 요청 처리"""
        request = self.requests.get(request_id)
        if not request:
            return {"error": "요청을 찾을 수 없습니다"}

        request.status = DeletionStatus.IN_PROGRESS
        deletion_report = {
            "request_id": request_id,
            "user_id": request.user_id,
            "deletions": []
        }

        for scope in request.scopes:
            if scope == DeletionScope.RAW_DATA:
                result = self._delete_raw_data(request.user_id, data_sources)
            elif scope == DeletionScope.TRAINING_DATA:
                result = self._delete_training_data(request.user_id, data_sources)
            elif scope == DeletionScope.MODEL_INFLUENCE:
                result = self._handle_model_impact(request.user_id)
            else:
                result = {"scope": scope.value, "status": "skipped"}

            deletion_report["deletions"].append(result)

        request.status = DeletionStatus.COMPLETED
        request.completed_at = datetime.now()

        self._log_deletion(deletion_report)
        return deletion_report

    def _delete_raw_data(self, user_id: str, data_sources: Dict) -> Dict:
        """원본 데이터 삭제"""
        deleted_from = []
        for source_name, source in data_sources.items():
            # 실제로는 각 데이터 소스에서 삭제 수행
            deleted_from.append(source_name)

        return {
            "scope": "raw_data",
            "status": "deleted",
            "sources": deleted_from,
            "timestamp": datetime.now().isoformat()
        }

    def _delete_training_data(self, user_id: str, data_sources: Dict) -> Dict:
        """학습 데이터에서 삭제"""
        # 데이터 계보를 통해 영향받는 데이터셋 식별
        affected_datasets = ["training_v1", "training_v2"]

        return {
            "scope": "training_data",
            "status": "deleted",
            "affected_datasets": affected_datasets,
            "requires_model_retrain": True,
            "timestamp": datetime.now().isoformat()
        }

    def _handle_model_impact(self, user_id: str) -> Dict:
        """모델 영향 처리 (Machine Unlearning 또는 재학습)"""
        # 영향받는 모델 식별
        affected_models = ["credit_model_v2", "fraud_detection_v1"]

        # 옵션 1: 재학습 예약
        # 옵션 2: Machine Unlearning 적용
        # 옵션 3: 영향 미미함 입증 문서화

        return {
            "scope": "model_influence",
            "status": "scheduled_retrain",
            "affected_models": affected_models,
            "action": "Model retrain scheduled for next training cycle",
            "impact_assessment": "User data represents <0.001% of training set",
            "timestamp": datetime.now().isoformat()
        }

    def _log_deletion(self, report: Dict):
        """삭제 이력 기록 (GDPR 입증용)"""
        self.deletion_logs.append({
            **report,
            "logged_at": datetime.now().isoformat()
        })

    def check_deadline_compliance(self, request_id: str) -> Dict:
        """GDPR 30일 기한 준수 여부 확인"""
        request = self.requests.get(request_id)
        if not request:
            return {"error": "요청을 찾을 수 없습니다"}

        deadline = request.requested_at + timedelta(days=self.GDPR_RESPONSE_DEADLINE_DAYS)
        now = datetime.now()

        if request.status == DeletionStatus.COMPLETED:
            days_taken = (request.completed_at - request.requested_at).days
            compliant = days_taken <= self.GDPR_RESPONSE_DEADLINE_DAYS
        else:
            days_remaining = (deadline - now).days
            compliant = days_remaining >= 0

        return {
            "request_id": request_id,
            "status": request.status.value,
            "deadline": deadline.isoformat(),
            "gdpr_compliant": compliant
        }

# 사용 예시
manager = RightToErasureManager()

# 삭제 요청 접수
request = manager.submit_deletion_request(
    user_id="user_12345",
    reason="동의 철회",
    scopes=[DeletionScope.RAW_DATA, DeletionScope.TRAINING_DATA, DeletionScope.MODEL_INFLUENCE]
)

# 삭제 처리
report = manager.process_deletion(request.request_id, data_sources={})

# 기한 준수 확인
compliance = manager.check_deadline_compliance(request.request_id)
print(f"GDPR 준수: {compliance['gdpr_compliant']}")

Practical Conversation

Legal team: We received a GDPR erasure request. How should we handle the AI training data?

Senior: You need to use data lineage to identify and delete all datasets that contain that user's data. The problem is the model that has already been trained.

ML engineer: Do we need to retrain the model too?

Senior: Ideally, yes, but if that data is less than 0.001% of the total, documenting that the influence is negligible is also an option. Decide in consultation with the legal team.

Interviewer: How can the right to erasure be implemented in AI models?

Candidate: There are three approaches. First, the most reliable method is retraining the model after deleting the data. Second, Machine Unlearning techniques can remove the influence of specific data, but they are still at the research stage. Third, applying Differential Privacy to lower the possibility of identifying individuals from the outset can minimize the impact of erasure requests.

Senior: There's no audit log in the deletion handling logic.

Junior: I already deleted it, so do I still need to leave a log?

Senior: Yes, the GDPR requires proof that an erasure request was handled. You need to record when the request was received and when processing was completed. Delete the actual data, but keep the processing-history metadata.

Take a mock interview on this topic → WIA SOOM AI Interview · Start for free

Cautions

Learn More