LLM Secure Inference
LLM-Inference ohne Secure-Execution kann Modelle und Daten kompromittieren — ohne Secure-Inference bleibt Inference ungeschützt. Vier Kontrollen: Secure Enclave Execution, TEE, Confidential Computing und Input/Output Validation.
Was ist LLM Secure Inference? Einfach erklärt
LLM Secure Inference schützt LLM-Inference durch Hardware-basierte Isolation: Secure Enclave Execution führt Inference in Intel SGX, AMD SEV oder ARM TrustZone aus mit Remote Attestation und Memory Encryption. Trusted Execution Environment (TEE) nutzt Cloud-Confidential-Computing wie AWS Nitro Enclaves oder Azure Confidential Computing mit VM-Level Isolation. Confidential Computing verwendet Homomorphic Encryption oder Secure Multi-Party Computation um auf verschlüsselten Daten zu rechnen ohne sie zu entschlüsseln. Input/Output Validation validiert und sanitisiert alle Inputs und Outputs im Secure Enclave um Angriffe zu verhindern.
↓ Springe zu Secure-Inference-Kontrollen
4 Secure-Inference-Kontrollen
Execute LLM inference in secure enclaves. Use Intel SGX, AMD SEV, or ARM TrustZone to protect model and data.
# Moltbot secure enclave execution:
secure_enclave:
enabled: true
# Enclave type:
enclave_type:
# Intel SGX: Software Guard Extensions
# AMD SEV: Secure Encrypted Virtualization
# ARM TrustZone: TrustZone technology
# Select: based on hardware availability
type: "intel_sgx"
# Enclave configuration:
configuration:
# Memory: enclave memory size
memory_size: "128MB"
# Threads: number of enclave threads
threads: 4
# Attestation: remote attestation required
attestation: true
# Model protection:
model_protection:
# Encrypt: model weights in enclave
# Decrypt: only in enclave
# Key: sealed in enclave
# Prevents: model extractionUse TEE for secure LLM inference. Ensure code and data integrity through hardware-based isolation.
# Moltbot TEE execution:
tee:
enabled: true
# TEE framework:
framework:
# Nitro Enclaves: AWS Nitro Enclaves
# Confidential Computing: Azure Confidential Computing
# Shielded VMs: GCP Shielded VMs
# Select: based on cloud provider
provider: "aws_nitro"
# TEE configuration:
configuration:
# CPU: vCPUs allocated to TEE
vcpus: 4
# Memory: memory allocated to TEE
memory: "8GB"
# Storage: encrypted storage for TEE
storage: "encrypted"
# Attestation:
attestation:
enabled: true
# Verify: TEE integrity before inference
# Use: remote attestation
# Validate: TEE identity, measurements
# Block: unattested TEEsUse confidential computing to protect data in use. Encrypt data during computation with homomorphic encryption or secure multi-party computation.
# Moltbot confidential computing:
confidential_computing:
enabled: true
# Homomorphic encryption:
homomorphic_encryption:
enabled: true
# Encrypt: input data before inference
# Compute: on encrypted data
# Decrypt: only output
# Use: FHE or PHE based on requirements
# Secure multi-party computation:
smpc:
enabled: true
# Split: input data across parties
# Compute: without revealing inputs
# Reveal: only final output
# Use: for collaborative inference
# Data protection:
data_protection:
# Protect: input data, model weights, output
# Encrypt: at rest and in use
# Key: secure key management
# Prevents: data leakageValidate all inputs and outputs in the secure enclave. Sanitise inputs to prevent attacks and validate outputs to ensure correctness.
# Moltbot input/output validation:
validation:
enabled: true
# Input validation:
input_validation:
enabled: true
# Validate: input format, size, content
# Sanitise: remove dangerous content
# Check: for prompt injection, malicious patterns
# Block: invalid or malicious inputs
# Output validation:
output_validation:
enabled: true
# Validate: output format, size, content
# Sanitise: remove dangerous content
# Check: for hallucinations, bias, PII
# Flag: suspicious outputs
# Validation logging:
logging:
enabled: true
# Log: all validation attempts
# Track: validation success/failure
# Audit: validation historyHäufige Fragen
What is the difference between secure enclaves and TEEs?
Secure enclaves (e.g., Intel SGX, AMD SEV, ARM TrustZone) are hardware-based isolated execution environments that protect code and data from the rest of the system. They provide memory encryption and remote attestation. Trusted Execution Environments (TEEs) are cloud-based confidential computing services (AWS Nitro Enclaves, Azure Confidential Computing, GCP Shielded VMs) that provide similar isolation at the virtual machine level. Both provide hardware-based isolation, but secure enclaves are CPU-level while TEEs are VM-level. Secure enclaves require specific hardware support, while TEEs are cloud-managed services.
How does confidential computing protect LLM inference?
Confidential computing protects data in use during LLM inference. Homomorphic encryption allows computation on encrypted data without decryption. The input data is encrypted, the model computes on the encrypted data, and only the output is decrypted. This ensures that the input data is never exposed to the model or the inference infrastructure. Secure multi-party computation (SMPC) splits input data across parties, computes without revealing inputs, and reveals only the final output. Both techniques provide strong privacy guarantees but are computationally expensive.
How does remote attestation work?
Remote attestation allows a verifier to confirm that a secure enclave or TEE is running genuine, unmodified code. The enclave/TEE generates a cryptographic attestation report that includes measurements of the code and data loaded into the enclave. The verifier validates the attestation report against expected values. If validation succeeds, the verifier knows the enclave is running the expected code in a secure environment. Remote attestation prevents attackers from running malicious code in the enclave or tampering with the enclave.
What are the performance implications of secure inference?
Secure inference using secure enclaves, TEEs, or confidential computing has performance overhead: 1) Enclave isolation adds latency due to context switches and memory encryption. 2) Homomorphic encryption is 100-1000x slower than plaintext computation. 3) SMPC adds communication overhead and computational cost. 4) Input/output validation adds latency. Optimisation strategies: 1) Use hardware-accelerated encryption. 2) Batch operations to amortise overhead. 3) Use PHE instead of FHE when possible. 4) Cache validation results. 5) Use hybrid approaches (partial decryption for intermediate steps).