Concrete vs TFHE-rs

What is the relation between Concrete and TFHE-rs? Also, are there python bindings for TFHE-rs?

There is a post stating the below. Does this mean they are both different?

TFHE-rs vs Concrete 

Until now, all of Zama’s FHE products were under a single name, “Concrete”. This included both our FHE library and FHE compiler, creating confusion for our users and customers. To avoid any further issues, we have decided to do a major refactoring and now have two distinct products:

TFHE-rs is now Zama’s FHE library, replacing the original Rust Concrete library (the main Concrete repository on Github) as well as Concrete-Core. Use TFHE-rs if you need full control over the FHE circuit execution. Please note that you should avoid using the original Concrete Rust library and start using TFHE-rs instead.
Concrete itself will be exclusively centered around Zama’s compiler, Concrete-Numpy and Concrete-ML being built on top of it. Use Concrete if you want optimal performance for a given circuit. The new version of Concrete will be released in April. You can safely continue using Concrete-Numpy and Concrete-ML, as their APIs won’t materially change when Concrete v2 is released in the coming months.

Hello @agol

Today TFHE-rs is the crypto library where we implement FHE operators and low level cyrptographic primitives, Concrete, our homomorphic circuit compiler, uses it as a backend.

Then other product can use Concrete, for example our privacy preserving library Concrete-ML uses Concrete under the hood to compile circuits to efficient versions.

also @agol we don’t have python bindings, we do have a C API for the HL API, it may not be complete though

@IceTDrinker Can I use Concrete to access TFHE-rs unchecked API on shortint and query the noiselevel? For example, can I do the following (or equivalent) in Concrete?

(I have another piece of software in Python that needs to use TFHE-rs unchecked API. Ideally, Python bindings would be good. But I am open to other suggestions that will let me access unchecked API.)

use tfhe::shortint::prelude::*;

fn main() {
    // We generate a set of client/server keys
    let (client_key, server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2_KS_PBS);

    let msg1 = 1;
    let msg2 = 0;

    let modulus = client_key.parameters.message_modulus().0;

    // We use the client key to encrypt two messages:
    let ct_1 = client_key.encrypt(msg1);
    let ct_2 = client_key.encrypt(msg2);
    let mut ct_3 = server_key.add(&ct_1, &ct_2);
    // We use the server public key to execute an integer circuit:
    let mut i = 0;
    while i < 3000 {
      ct_3 = server_key.add(&ct_3, &ct_1);
      i+=1;
    }
    let x = ct_3.noise_level().get();
    println!("Noise level: {x}");
    assert_eq!(ct_3.noise_level(), NoiseLevel::ZERO);
    // We use the client key to decrypt the output of the circuit:
    let output = client_key.decrypt(&ct_3);
  
}

I have been trying to experiment with simulation mode in concrete for overflow detection, but ideally I want to query the underlying noiselevel. Not sure if there is a way to do this.

hello @agol

I don’t think you would be able to do that directly I believe, though concrete is working on bridging encrypted data from the python circuits to rust, I’ll ask them to give you more info

1 Like

Hello @agol

If you are trying to move things between Concrete and TFHE-rs, then you can check this guide, and these two examples here, and here.