Comments (4)
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.
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.
![1690888094402](https://private-user-images.githubusercontent.com/127387074/257496207-1a6a0835-0beb-42f9-af88-4df8e445d650.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk5MzgzNjEsIm5iZiI6MTcxOTkzODA2MSwicGF0aCI6Ii8xMjczODcwNzQvMjU3NDk2MjA3LTFhNmEwODM1LTBiZWItNDJmOS1hZjg4LTRkZjhlNDQ1ZDY1MC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzAyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcwMlQxNjM0MjFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mNGUzODg3N2Q1MGJkOWFkNDk5MmE1ZTU4NWJhNTFmNDFkYzNiZTNiNzNjNjkxN2E3M2YyMTBmNGE2NzE5ZmVmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.jC9iDgaBDK_Wnf3yJICGVdoH4Wqg9WL-JSaNI99RfJ4)
from concrete-ml.
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)
- Add a fhe or concrete-ml as a tag in HF compiled models HOT 2
- Test Hugging Face Endpoints on Azure HOT 2
- RuntimeError: Can't compile: Cannot find crypto parameters HOT 1
- Can not install concrete-ml on Linux system HOT 7
- ValueError: Please either set all three 'ordered_module_input_names', 'ordered_module_output_names' and 'quant_layers_dict' or none of them. HOT 4
- Feature Request: Add support for embedding layers HOT 4
- [Question] How exactly the HybridFHE functions HOT 1
- [Question] FHE inference over a single image time HOT 2
- installation error HOT 7
- [Question] Discord link in explanation HOT 2
- High accuracy variance during the training with SGDClassifier HOT 1
- Feature Request : Implement LogSoftmax, Softmax, ReduceMax HOT 3
- Performance Issues HOT 1
- Two consecutive Unsqueeze operations in QAT model throws error at compilation time HOT 2
- LLVM symbolizer error with LogisticRegression example HOT 15
- [Question] What HE algorithm is used? HOT 6
- [Question] AssertionError: Values must be float if value_is_float is set to True, got int64: [1] HOT 3
- AssertionError: Values must be float if value_is_float is set to True, got int64: [[[[102 14 188 ... 85 205 46] HOT 3
- RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! HOT 7
- Python 3.12 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from concrete-ml.