Giter VIP home page Giter VIP logo

Comments (4)

andrei-stoian-zama avatar andrei-stoian-zama commented on July 29, 2024

1690808205095 is independent of the actual bit precision limitation. May I know how to understand this sentence?What is actual bit precision limitation?

Since Concrete Python 2.0 the simulation itself requires that the circuit respect the bit-width constraint. This constraint is: all inputs and intermediary values in the function to be compiled must be <=16bit if and only if lookup tables are used or univariate functions. If there are no lookup tables or univariate functions, you can exceed 16b with an upper bound determined by the operation that you perform.

If you want to measure maximum bitwidth that the circuit would attain you can use "tracing" like this:

import numpy as np
from concrete import fhe

configuration = fhe.Configuration(
    enable_unsafe_features=True,
    use_insecure_key_cache=True,
    insecure_key_cache_location=".keys",
    single_precision=False,
    parameter_selection_strategy=fhe.ParameterSelectionStrategy.MULTI,
)

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

inputset = [
    (
        np.random.randint(0, 10, size=()),
        np.random.randint(0, 10, size=()),
    )
    for _ in range(100)
]
circuit = f.trace(inputset, configuration)

print(circuit.maximum_integer_bit_width())

from concrete-ml.

RomanBredehoft avatar RomanBredehoft commented on July 29, 2024

Just a quick note what @andrei-stoian-zama said above : the current Concrete-ML public version does not use Concrete Python 2.0 yet, but it will soon ! So currently, you might expect different constraints. For example, simulating circuits with 16 bits is possible, which is what is independent of the actual bit precision limitation was referring to. However, this won't be the case in the near future, so I would recommend you not to take this as granted 😉

from concrete-ml.

maxwellgodv avatar maxwellgodv commented on July 29, 2024
1690888094402 Can I measure maximum bitwidth like this? What are the current constraints?

from concrete-ml.

RomanBredehoft avatar RomanBredehoft commented on July 29, 2024

Yes this is indeed how to measure the maximum bit-width reached in the model ! You cannot execute a model in FHE if the model has a bit-width of 17 bits or more.

from concrete-ml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.