Concrete ML
WebsiteLibrariesProducts & ServicesDevelopersSupport
0.2
0.2
  • What is Concrete ML?
  • Installing
    • Installing
  • How To
    • Scikit-learn
    • Torch
    • Compute with Quantized Functions
    • Use Concrete ML ONNX Support
    • Debug / Get Support / Submit Issues
  • Advanced examples
    • Advanced examples
  • Explanations
    • Philosophy of the Design
    • Quantization
    • Pruning
    • Virtual Lib
    • Resources
  • Developper How To
    • Set Up the Project
    • Set Up Docker
    • Document
    • Create a Release on GitHub
    • Contribute
  • Developper Explanations
    • Concrete Stack
    • Quantization
    • Using ONNX as IR for FHE Compilation
    • Hummingbird Usage
    • Skorch Usage
  • API
    • API
Powered by GitBook

Libraries

  • TFHE-rs
  • Concrete
  • Concrete ML
  • fhEVM

Developers

  • Blog
  • Documentation
  • Github
  • FHE resources

Company

  • About
  • Introduction to FHE
  • Media
  • Careers
On this page
  • What is the Virtual Lib?
  • What should it be used for?

Was this helpful?

Export as PDF
  1. Explanations

Virtual Lib

PreviousPruningNextResources

Last updated 2 years ago

Was this helpful?

What is the Virtual Lib?

The Virtual Lib in Concrete-ML is a prototype that provides drop-in replacements for Concrete-Numpy, Compiler and Circuit that allow users to simulate what would happen when converting a model to FHE without the current bit width constraint, or to more quickly simulate the behavior with 7 bits or less as there are no FHE computations.

In other words, you can use the compile functions from the Concrete-ML package by passing use_virtual_lib = True and using a CompilationConfiguration with enable_unsafe_features = True. You will then get a simulated circuit that allows you to use more than the current 7 bits of precision allowed by the Concrete stack. It is also a faster way to measure the potential FHE accuracy with 7 bits or less. It is something we used for the red/blue contours in the , as computing in FHE for the whole grid and all the classifiers would be very long.

What should it be used for?

The Virtual Lib can be useful when developing and iterating on an ML model implementation. For example, you can check that your model is compatible in terms of operands (all integers) with the Virtual Lib compilation. Then, you can check how many bits your ML model would require, which can give you hints as to how it should be modified if you want to compile it to an actual FHE Circuit (not a simulated one) that only supports 7 bits of integer precision.

The Virtual Lib, being pure Python and not requiring crypto key generation, can be much faster than the actual compilation and FHE execution, thus allowing for faster iterations, debugging and FHE simulation, regardless of the bit width used.

Classifier Comparison notebook