Skip to content

Develop a Fixed-point Arithmetic API Using Homomorphic Integers within TFHE-rs #142

@zaccherinij

Description

@zaccherinij

Overview

Fixed-point arithmetic is essential for many applications, but performing such operations efficiently in a Fully Homomorphic Encryption (FHE) setting remains a challenge. This bounty focuses on developing a fixed-point arithmetic API using homomorphic integers (tfhe::integer) within TFHE-rs, avoiding the use of WoPBS (Without Padding Programmable Bootstrapping) while ensuring correctness, efficiency, and precision.

The goal is to create an API similar in clarity and usability to the fixed crate but operating on encrypted data. The API should enable encrypted fixed-point arithmetic while leveraging homomorphic integer operations effectively.

What we expect

Participants must implement a fixed-point arithmetic API using homomorphic integers in TFHE-rs. The API should:

  • Mimic the features of the fixed crate;
  • Support common fixed-point arithmetic operations;
  • Offer configurable precision and scaling factors;
  • Avoid using WoPBS (Without Padding Programmable Bootstrapping);
  • Include unit tests to validate correctness and docstrings for usage;
  • The Homomorphic Types should be called FheFixed where the type in the fixed crate is itself called Fixed.

For parameters we expect:

  • A failure probability for operations lower than 2^-128;
  • A security level of at least 2^128.

You can use parameter sets already provided by the library.

Required features

Operations

  • Basic operations: Addition, subtraction, multiplication, and division.
  • Comparison operations: <, <=, >, >=, ==, !=.
  • Unary operations: Negation, absolute value, rounding functions (floor, ceil, trunc, round).
  • Square root (sqrt(x)).
  • Integer base-2 logarithm (ilog2(x)).
  • Configurable scaling factor for different fixed-point representations.
  • The implementation must include unit tests covering all arithmetic operations and edge cases.

Misc.

  • A README file must accompany the submission, explaining:
    • How to use the FHE implementation;
    • How to run the provided executable;
  • Use the noise-asserts feature;
  • If you are working on non-x86 CPUs, make sure that clippy runs by using a cross-compilation toolchain, using cargo +nightly clippy --target x86_64-unknown-linux-gnu -D warnings. More details here.

Benchmarking

All benchmarks will be conducted on an AWS hpc7a.96xlarge instance. When benchmarking, ensure that:

  • AVX512 is enabled by using the nightly-avx512 feature.
  • The implementation is compiled with a modern nightly toolchain.
  • We expect you to use criterion for the benchmarks and provide benchmarks for FheFixed<U16>, FheFixed<U32>, FheFixed<U64> with even integer and fractional part, meaning U16 will have 8 bits for the integer part and 8 bits for the fractional part. The benchmark name must follow this format: FheType::operation_snake_case

Judging criteria

  • Correctness: The implementation must produce mathematically accurate results following fixed-point arithmetic rules;
  • Performance: The solution should minimize computational overhead, optimizing for practical usage in TFHE-rs;
  • Precision Handling: The API should allow configurable precision levels, similar to the fixed crate;
  • Usability: The implementation should be well-structured and documented, with a clear API design and example usage;
  • Compliance: The implementation must use TFHE-rs and must not rely on WoPBS (Without Padding Programmable Bootstrapping);
  • Testing: The solution must include unit tests to verify correctness and edge cases, include extensive tests with trivial encryptions as inputs, and smaller tests with properly encrypted data. Inputs must be random.

Reward

🥇Best submission: up to €5,000.

To be considered best submission, a solution must be efficient, effective and demonstrate a deep understanding of the core problem. Alongside the technical correctness, it should also be submitted with a clean code, clear explanations and a complete documentation.

🥈Second-best submission: up to €3,000.

For a solution to be considered the second best submission, it should be both efficient and effective. The code should be neat and readable, while its documentation might not be as exhaustive as the best submission, it should cover the key aspects of the solution.

🥉Third-best submission: up to €2,000.

The third best submission is one that presents a solution that effectively tackles the challenge at hand, even if it may have certain areas of improvement in terms of efficiency or depth of understanding. Documentation should be present, covering the essential components of the solution.

Reward amounts are decided based on code quality, model accuracy scores and speed performance on a m6i.metal AWS server. When multiple solutions of comparable scope are submitted they are compared based on the accuracy metrics and computation times.

Related links and references

👉 Register

Step 1: Registration

Click here to register for the fhEVM Bounty. Fill out the registration form with your information. Once you fill out the form, you will receive a confirmation email with a link to the submission portal for when you are ready to submit your code.

Note

Check your spam folder in case you don't receive the confirmation email. If you haven't received it within 24 hour, please contact us by email at bounty@zama.ai.

Step 2: Work on the Challenge

Read through the Bounty details and requirements carefully. Use the provided resources and create your own GitHub repository to store your code.

If you have any questions durig your work, feel free to comment directly in the Bounty issue and our team will be happy to assist you.

Step 3: Submission

Once you have completed your work, upload your completed work to the submission portal using the link provided in the confirmation email.

Note

The deadline for submission is 18th May, 2025 (Midnight, Anywhere On Earth). Late submissions will not be considered.

We wish you the best of luck with the challenge!

✅ Support

  • Comment on this issue with any questions regarding this bounty.
  • Email for private questions: bounty@zama.ai
  • Join the Zama community channels here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🎯 BountyThis bounty is currently open📁 TFHE-rslibrary targeted: TFHE-rs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions