Concrete
WebsiteLibrariesProducts & ServicesDevelopersSupport
2.6
2.6
  • Welcome
  • Get Started
    • What is Concrete?
    • Installation
    • Quick start
    • Compatibility
    • Terminology
  • Core features
    • Overview
    • Table lookups
    • Bit extraction
    • Rounding
    • Truncating
    • Floating points
    • Comparisons
    • Min/Max operations
    • Bitwise operations
    • Common tips
    • Extensions
    • Tagging
  • Compilation
    • Composition
    • Compression
    • Reuse arguments
    • Multi precision
    • Multi parameters
    • Modules
    • Decorator
    • Direct circuits
  • Execution / Analysis
    • Simulation
    • Progressbar
    • Statistics
    • Formatting and drawing
    • Debug
  • Guides
    • Configure
    • Manage keys
    • Deploy
  • Tutorials
    • See all tutorials
    • Part I: Concrete - FHE compiler
    • Part II: The Architecture of Concrete
  • References
    • API
  • Explanations
    • Compiler workflow
    • Frontend fusing
    • Compiler backend
      • Adding a new backend
    • Optimizer
    • MLIR FHE dialects
      • FHELinalg dialect
      • FHE dialect
      • TFHE dialect
      • Concrete dialect
      • Tracing dialect
      • Runtime dialect
      • SDFG dialect
    • Security
    • Call FHE circuits from other languages
    • Project layout
  • Developers
    • Contributing
    • Release note
    • Feature request
    • Bug report
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

Was this helpful?

Export as PDF
  1. Guides

Configure

Concrete can be customized using Configurations:

from concrete import fhe
import numpy as np

configuration = fhe.Configuration(p_error=0.01, dataflow_parallelize=True)

@fhe.compiler({"x": "encrypted"})
def f(x):
    return x + 42

inputset = range(10)
circuit = f.compile(inputset, configuration=configuration)

You can overwrite individual options as kwargs to the compile method:

from concrete import fhe
import numpy as np

@fhe.compiler({"x": "encrypted"})
def f(x):
    return x + 42

inputset = range(10)
circuit = f.compile(inputset, p_error=0.01, dataflow_parallelize=True)

Or you can combine both:

from concrete import fhe
import numpy as np

configuration = fhe.Configuration(p_error=0.01)

@fhe.compiler({"x": "encrypted"})
def f(x):
    return x + 42

inputset = range(10)
circuit = f.compile(inputset, configuration=configuration, loop_parallelize=True)

Additional kwargs to compile functions take higher precedence. So if you set the option in both configuration and compile methods, the value in the compile method will be used.

Options

  • show_graph: Optional[bool] = None

    • Print computation graph during compilation. True means always print, False means never print, None means print depending on verbose configuration below.

  • show_mlir: Optional[bool] = None

    • Print MLIR during compilation. True means always print, False means never print, None means print depending on verbose configuration below.

  • show_optimizer: Optional[bool] = None

    • Print optimizer output during compilation. True means always print, False means never print, None means print depending on verbose configuration below.

  • show_statistics: Optional[bool] = None

    • Print circuit statistics during compilation. True means always print, False means never print, None means print depending on verbose configuration below.

  • verbose: bool = False

    • Print details related to compilation.

  • dump_artifacts_on_unexpected_failures: bool = True

    • Export debugging artifacts automatically on compilation failures.

  • auto_adjust_rounders: bool = False

    • Adjust rounders automatically.

  • p_error: Optional[float] = None

  • global_p_error: Optional[float] = None

  • single_precision: bool = False

    • Use single precision for the whole circuit.

  • parameter_selection_strategy: (fhe.ParameterSelectionStrategy) = fhe.ParameterSelectionStrategy.MULTI

    • Set how cryptographic parameters are selected.

  • multi_parameter_strategy: fhe.MultiParameterStrategy = fhe.MultiParameterStrategy.PRECISION

    • Set the level of circuit partionning when using fhe.ParameterSelectionStrategy.MULTI.

    • PRECISION: all TLU with same input precision have their own parameters.

  • loop_parallelize: bool = True

    • Enable loop parallelization in the compiler.

  • dataflow_parallelize: bool = False

    • Enable dataflow parallelization in the compiler.

  • auto_parallelize: bool = False

    • Enable auto parallelization in the compiler.

  • enable_unsafe_features: bool = False

    • Enable unsafe features.

  • use_insecure_key_cache: bool = False (Unsafe)

    • Use the insecure key cache.

  • insecure_key_cache_location: Optional[Union[Path, str]] = None

    • Location of insecure key cache.

  • show_progress: bool = False,

    • Display a progress bar during circuit execution

  • progress_title: str = "",

    • Title of the progress bar

  • progress_tag: Union[bool, int] = False,

    • How many nested tag elements to display with the progress bar. True means all tag elements and False disables the display. 2 will display elmt1.elmt2

  • fhe_simulation: bool = False

    • Enable FHE simulation. Can be enabled later using circuit.enable_fhe_simulation().

  • fhe_execution: bool = True

    • Enable FHE execution. Can be enabled later using circuit.enable_fhe_execution().

  • compiler_debug_mode: bool = False,

    • Enable/disable debug mode of the compiler. This can show a lot of information, including passes and pattern rewrites.

  • compiler_verbose_mode: bool = False,

    • Enable/disable verbose mode of the compiler. This mainly shows logs from the compiler, and is less verbose than the debug mode.

  • comparison_strategy_preference: Optional[Union[ComparisonStrategy, str, List[Union[ComparisonStrategy, str]]]] = None

  • bitwise_strategy_preference: Optional[Union[BitwiseStrategy, str, List[Union[BitwiseStrategy, str]]]] = None

  • shifts_with_promotion: bool = True,

  • composable: bool = False,

    • Specify that the function must be composable with itself.

  • relu_on_bits_threshold: int = 7,

  • relu_on_bits_chunk_size: int = 3,

  • if_then_else_chunk_size: int = 3

    • Chunk size to use when converting fhe.if_then_else extension.

  • rounding_exactness : Exactness = fhe.Exactness.EXACT

    • Set default exactness mode for the rounding operation:

    • EXACT: threshold for rounding up or down is exactly centered between upper and lower value,

    • APPROXIMATE: faster but threshold for rounding up or down is approximately centered with pseudo-random shift.

  • approximate_rounding_config : ApproximateRoundingConfig = fhe.ApproximateRoundingConfig():

    • to enable exact cliping,

    • or/and approximate clipping which make overflow protection faster.

  • optimize_tlu_based_on_measured_bounds : bool = False

    • Enables TLU optimizations based on measured bounds.

    • Not enabled by default as it could result in unexpected overflows during runtime.

  • enable_tlu_fusing : bool = True

    • Enables TLU fusing to reduce the number of table lookups.

  • print_tlu_fusing : bool = False

    • Enables printing TLU fusing to see which table lookups are fused.

  • compress_evaluation_keys: bool = False,

    • This specifies that serialization takes the compressed form of evaluation keys.

  • compress_input_ciphertexts: bool = False,

    • This specifies that serialization takes the compressed form of input ciphertexts.

PreviousDebugNextManage keys

Last updated 1 year ago

Was this helpful?

Error probability for individual table lookups. If set, all table lookups will have the probability of a non-exact result smaller than the set value. See to learn more.

Global error probability for the whole circuit. If set, the whole circuit will have the probability of a non-exact result smaller than the set value. See to learn more.

PRECISION_AND_NORM2: all TLU with same input precision and output have their own parameters.

Specify preference for comparison strategies, can be a single strategy or an ordered list of strategies. See to learn more.

Specify preference for bitwise strategies, can be a single strategy or an ordered list of strategies. See to learn more.

Enable promotions in encrypted shifts instead of casting in runtime. See to learn more.

Bit-width to start implementing the ReLU extension with .

Chunk size of the ReLU extension when implementation is used.

Precise and more complete behavior is described in .

Provide more fine control on :

norm2
Comparisons
Bitwise
fhe.bits
fhe.bits
fhe.rounding_bit_pattern
Bitwise#Shifts
Exactness
Exactness
approximate rounding