Crypten is a PyTorch-based framework developed by Meta AI that enables secure multi-party computation (SMPC) for machine learning, allowing multiple parties to collaboratively train and evaluate models on encrypted data without exposing their private inputs. It integrates directly with the PyTorch ecosystem, letting developers write privacy-preserving ML code using familiar tensor operations while cryptographic protocols execute transparently under the hood.
Glossary
Crypten

What is Crypten?
A PyTorch-based framework developed by Meta AI for secure and privacy-preserving machine learning that implements secure multi-party computation primitives to allow training and inference on encrypted data.
Crypten implements secret sharing as its core primitive, splitting data into random shares distributed across parties so no single participant can reconstruct the original values. It supports secure stochastic gradient descent, private inference with common activation functions via the DReLU protocol, and provides both semi-honest and malicious security models. The framework is designed for researchers and engineers building collaborative analytics systems where data cannot be centralized due to regulatory or competitive constraints.
Key Features of Crypten
A PyTorch-based framework developed by Meta for secure and privacy-preserving machine learning that implements secure multi-party computation primitives to allow training and inference on encrypted data.
Native PyTorch Integration
Crypten is built directly on PyTorch, allowing machine learning practitioners to use familiar APIs and tensor operations. This design choice means developers can write secure computation code that looks and feels like standard PyTorch, significantly reducing the learning curve.
- CrypTensor objects mirror PyTorch tensors but store data as secret shares
- Supports automatic differentiation for secure training
- Compatible with existing PyTorch model architectures and data loaders
- Minimal code changes required to convert a standard model to an MPC-secure version
Secure Multi-Party Computation Backend
Crypten implements secret sharing as its core cryptographic primitive, distributing data across multiple parties so that no single party can reconstruct the original values. All computations—including addition, multiplication, and comparison—are performed on these shares.
- Uses additive secret sharing over a finite field for linear operations
- Implements Beaver triples for efficient secure multiplication
- Supports 2PC and 3PC configurations with semi-honest security
- Includes custom protocols for non-linear functions like ReLU, max pooling, and softmax
Secure Training and Inference
Crypten supports both encrypted training and encrypted inference on neural networks. During training, gradients are computed on secret-shared data and never revealed to any single party. During inference, the model weights themselves can be kept private.
- Secure SGD: Stochastic gradient descent operates entirely on encrypted shares
- Supports linear layers, convolutions, batch normalization, and dropout
- Implements secure DReLU (derivative of ReLU) for backpropagation
- Enables private model evaluation where neither the input nor the model is exposed
Arithmetic Secret Sharing
Crypten uses arithmetic secret sharing over a prime field, where a value x is split into random shares [x]_1 and [x]_2 such that x = [x]_1 + [x]_2 mod p. This enables linear operations to be performed locally without communication.
- Addition: Parties add their local shares independently—zero communication cost
- Multiplication: Requires one round of communication using pre-computed Beaver triples
- Comparison: Implements secure comparison protocols for ReLU and max pooling
- Shares are statistically indistinguishable from random values, providing information-theoretic privacy
Cryptographic Provider Abstraction
Crypten abstracts its cryptographic backend through a provider interface, allowing different MPC protocols to be plugged in without changing the high-level model code. This enables experimentation with various security-performance tradeoffs.
- Default provider uses semi-honest 2PC with arithmetic secret sharing
- TTP provider (Trusted Third Party) for debugging and development without crypto overhead
- Extensible design allows integration of 3PC honest-majority protocols
- Supports switching between providers for different stages of development and deployment
Frequently Asked Questions
Get clear, technically precise answers to the most common questions about Meta's Crypten framework for secure and privacy-preserving machine learning.
Crypten is a PyTorch-based framework developed by Meta AI Research for secure and privacy-preserving machine learning (PPML). It implements secure multi-party computation (MPC) primitives, allowing multiple parties to collaboratively train models and run inference on encrypted data without revealing their private inputs to one another. Crypten works by taking standard PyTorch tensors and operations and transparently executing them over secret-shared data. When a tensor is encrypted, its value is split into random shares distributed among the computing parties. All mathematical operations—addition, multiplication, comparison—are performed on these shares using cryptographic protocols, ensuring that no single party ever observes the underlying plaintext data. The framework is designed to feel native to PyTorch users, requiring minimal code changes to convert a standard training script into a privacy-preserving one.
Crypten Use Cases
Concrete scenarios where Crypten's secure multi-party computation primitives enable privacy-preserving machine learning across untrusted parties without exposing raw data.
Cross-Institutional Medical Research
Multiple hospitals collaboratively train a diagnostic model on private patient records without sharing identifiable health data. Each institution holds encrypted shares of its radiological images. Crypten's secure stochastic gradient descent computes weight updates on the combined dataset, allowing the model to learn from diverse patient populations while maintaining HIPAA compliance and data sovereignty. The final model achieves higher accuracy than any single-hospital baseline.
Financial Fraud Detection Consortium
Competing banks jointly train a fraud classifier on transaction graphs without revealing customer account details. Using Crypten's private set intersection and secure aggregation, institutions compute features like shared suspicious account linkages across their combined networks. The collaborative model detects money laundering rings spanning multiple banks that no single institution could identify alone, all while preserving bank secrecy regulations.
Secure Model IP Protection
A model vendor deploys a proprietary neural network for inference on a client's sensitive data without revealing the model weights. The vendor and client each hold secret shares of the model parameters. Crypten executes MPC-based inference using protocols like secure ReLU evaluation, delivering predictions to the client while the vendor learns nothing about the input data and the client learns nothing about the model architecture or weights.
Multi-Party Genomic Analysis
Research institutions perform secure GWAS across distributed genomic databases to identify genetic variants linked to rare diseases. Each institution secret-shares its genotype and phenotype data. Crypten computes statistical associations using secure matrix multiplication and logistic regression, revealing only the final aggregated p-values. This enables statistically powered studies on conditions requiring large cohorts without pooling sensitive DNA records.
Supply Chain Benchmarking
Competing manufacturers benchmark operational efficiency metrics without exposing proprietary production data. Each company secret-shares KPIs like defect rates, throughput, and energy consumption. Crypten computes industry-wide quartiles and averages using secure comparison and division protocols. Participants learn their relative ranking and aggregate benchmarks while individual company data remains cryptographically hidden from rivals.
Privacy-Preserving Ad Attribution
An advertiser and publisher jointly compute conversion rates without linking individual user identities across domains. The advertiser holds a list of purchasers; the publisher holds a list of ad viewers. Using Crypten's private set intersection cardinality, they learn how many users converted after seeing an ad without revealing which specific users overlap. This enables accurate ROI measurement while respecting GDPR and browser privacy constraints.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Crypten vs. Other Privacy-Preserving ML Frameworks
A feature-level comparison of Crypten against other prominent open-source frameworks for privacy-preserving machine learning and secure multi-party computation.
| Feature | Crypten | TF Encrypted | PySyft |
|---|---|---|---|
Primary Paradigm | Secure Multi-Party Computation (SMPC) | Homomorphic Encryption & SMPC | Federated Learning & Differential Privacy |
Native ML Framework Integration | PyTorch | TensorFlow | PyTorch / TensorFlow |
Supported MPC Protocols | Arithmetic Secret Sharing (3PC) | Garbled Circuits, Secret Sharing | SPDZ, Secure Aggregation |
Threat Model | Semi-honest | Semi-honest / Malicious | Semi-honest |
On-Device Encryption | |||
Private Training Support | |||
Private Inference Latency (Relative) | Low (Optimized for PyTorch) | Medium | High (Network-bound) |
Primary Maintainer | Meta (Facebook AI Research) | Dropout Labs / Cape Privacy | OpenMined |
Related Terms
Core primitives, protocols, and frameworks that underpin Crypten's secure multi-party computation capabilities for privacy-preserving machine learning.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us