Encrypted sentiment, encrypted in your browser

This page encrypts your text in the browser with CKKS (Microsoft SEAL as WebAssembly). Only the ciphertext goes to the server. The server runs a two-layer neural network on it and cannot read the text or the result.

boring movie fast delivery dirty hotel relaxing place

The browser makes the CKKS keys. This takes a few seconds.

What left the browser (the last request)

No request yet.

Open the browser developer tools, tab "Network", to see the same request.

Word list

The network knows these words.

Your browser · secret key

status
waiting for a text

Server · weights, no secret key

status
waiting for a ciphertext

How it works

Data flow of the browser FHE demo The browser makes CKKS keys and sends only the evaluation keys to the server. For each text, the browser encrypts a bag-of-words vector. The server runs layer 1, the square activation and layer 2 on the ciphertext and sends back an encrypted result. Only the browser decrypts it. Your browser fhe.js + node-seal (WebAssembly) · secret key Server server.mjs · weights, no secret key ONCE, AT PAGE LOAD 1 · Make CKKS keys secret, relin and 12 rotation keys 2 · Store the evaluation keys relin + rotation keys only eval keys · ≈ 20 MB FOR EACH TEXT 3 · Text → bag-of-words x 215 words (0 / 1) 4 · Encrypt x in one ciphertext one word per slot, max. 4096 E(x) · ≈ 275 KB 5 · Layer 1: E(z) = E(x) · W1 + b1 16 × (ct × pt + 12 rotations) 6 · Activation: E(h) = E(z)² 16 × (ct × ct, relinearize) 7 · Layer 2: E(y) = E(h) · W2 + b2 16 × ct × pt, then add E(y) · ≈ 154 KB server: ≈ 1.2 s 8 · Decrypt E(y) slot 0 and slot 1 = 2 logits 9 · Softmax → label negative / positive
Blue arrows carry only ciphertexts or evaluation keys. Evaluation keys let the server compute, but not decrypt. The text, the vector x and the result exist as plaintext only in this browser tab.