CC Safety Net
코딩 에이전트 CLI 안전층으로 실행 전 파괴적 git·파일시스템 명령과 비밀 파일 접근을 차단
LatticaAI는 GPU 가속 전동형 동형암호로 암호화된 데이터에서 직접 연산하고, 32,412배 빠르게 수행합니다
LatticaAI enables computation directly on encrypted data using GPU-accelerated Fully Homomorphic Encryption. 32,412x faster encrypted compute.
보안PythonGitHub @Lattica-ai온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기A tool for developers and researchers to design FHE pipelines and execute them on cloud-based GPUs
README 전체를 불러오는 중입니다.
README 전문 보기 ↗Build, deploy, and serve fully homomorphic encryption (FHE) models on the Lattica platform, from a PyTorch-style pipeline definition to an encrypted inference endpoint.
Your data is encrypted before it leaves the client and stays encrypted throughout inference. The server computes on ciphertext and never sees the plaintext input, the plaintext output, or your secret key.
Inference runs on cloud-hosted GPU accelerators, which can significantly reduce latency versus many CPU-only FHE setups. You also avoid managing custom CUDA kernel compilation yourself.
This repository contains three Python packages:
| Package | Role |
|---|---|
lattica-build | Define a homomorphic computation graph, bind weights, plan FHE parameters, and emit a deployable artifact. Runs entirely locally. |
lattica-studio | Deploy and compile that artifact on the platform, then manage models, workers, and query tokens. |
lattica-query | Generate keys, encrypt inputs, execute encrypted queries, and decrypt results locally. |
Both require Python 3.11+.
┌─────────────────────────┐
│ lattica-build │ define pipeline + FHE params
│ (local) │ → artifact.zip
└────────────┬────────────┘
│
▼
┌─────────────────────────┐
│ lattica-studio │ deploy → compile → start GPU worker
│ (control plane API) │ → model_id, query token
└────────────┬────────────┘
│
▼
┌─────────────────────────┐
│ lattica-query │ keygen, encrypt, query, decrypt
│ (client, holds the SK) │ → plaintext result
└─────────────────────────┘
The secret key never leaves the client. Only the evaluation key and ciphertexts are sent to the server.
pip install lattica-studio
This pulls in lattica-build (pipeline construction) and lattica-query
(client-side encryption and querying) as dependencies.
To work from a checkout of this repository:
pip install -e ./lattica_build_src
pip install -e ./lattica_query_src
pip install -e ./lattica_studio_src
No account needed for this step. Build the packaged MNIST example:
lattica-build --pipeline-module lattica_build.examples.advanced.mnist_fc --out mnist.zip
On success the command writes mnist.zip and prints a JSON summary listing
hom_pipeline.json and hom_pipeline.safetensors.
Add --print_graph to inspect the computation graph, or point at your own file:
lattica-build my_pipeline.py --out my_pipeline.zip
Any pipeline module or file just needs to expose two callables:
def build_pipeline() -> HomomorphicPipeline: ...
def build_params() -> HomParams: ...
The remaining steps need a Lattica account license key. Set it once:
export LATTICA_LICENSE_KEY="..."
import os
import torch
from lattica_build import build
from lattica_build.examples.advanced import mnist_fc
from lattica_query import QueryClient
from lattica_studio import LatticaStudio
x = torch.zeros(mnist_fc.INPUT_SHAPE)
# Build locally, then deploy and compile on the platform.
mnist = mnist_fc.Pipeline()
artifact = build(
mnist.build_pipeline(),
mnist.build_params(),
"mnist.zip",
)
with LatticaStudio(os.environ["LATTICA_LICENSE_KEY"]) as studio:
model_id = studio.deploy(artifact, "my-mnist-model")
# A GPU worker must be running to serve encrypted queries.
with studio.workers.running(model_id, stop_on_exit=True):
token = studio.tokens.create(model_id, name="my-mnist-model", save=True)
with QueryClient(token) as client:
# Generates FHE keys and uploads the evaluation key.
# The secret key never leaves this machine.
sk = client.keys.ensure()
# x is a plain torch tensor shaped like the pipeline's input.
result = client.query.encrypted(x, key=sk)
print(result.argmax(dim=-1))
studio.deploy_pipeline(...) combines the build and deploy steps if you don't
need the artifact on disk:
model_id = studio.deploy_pipeline(
mnist.build_pipeline(),
mnist.build_params(),
"my-mnist-model",
)
Deploying under a name that already exists redeploys into that model rather than creating a duplicate. Active workers are stopped and the model is recompiled.
A complete, runnable version of the flow above lives in
lattica_studio_src/lattica_studio/example.py.
If you just want to inspect resources in a printable table, use the helper script:
cd lattica_studio_src
python -m lattica_studio.list_and_display models
python -m lattica_studio.list_and_display workers
python -m lattica_studio.list_and_display tokens
python -m lattica_studio.list_and_display all
It uses LATTICA_LICENSE_KEY by default (or pass --license-key ...).
Worker runtime is billed while a worker is up, so keep workers running only as
long as you are actually serving queries. The
studio.workers.running(model_id, stop_on_exit=True) context manager stops the
worker on exit, including when the block raises.
Two things to keep in mind while iterating:
studio.models.get_id_by_name(...) and reuse a saved token with
studio.tokens.load(...).LatticaStudio exposes deployment directly and groups everything else by
resource.
Deployment
studio.deploy(artifact, model_name, instance_type=..., num_devices=1)
studio.deploy_pipeline(
pipeline,
params,
model_name,
instance_type=...,
num_devices=1,
display_graph=False,
)
Both register (or reuse) the model, upload the artifact, and block until
compilation finishes, raising CompilationError or CompilationTimeoutError
if it doesn't.
studio.models
studio.models.list() # → list[Model]
studio.models.get_by_id(model_id) # → Model
studio.models.find_by_name(name) # → Model | None
studio.models.get_by_name(name) # → Model
studio.models.update(model_id, ...) # name, description, visibility, instance_type, ...
studio.models.activate(model_id)
studio.models.deactivate(model_id)
studio.models.set_visibility(model_id, visibility)
studio.models.display(studio.models.list()) # printable table
studio.workers
studio.workers.running(model_id, stop_on_exit=True) # context manager (preferred)
studio.workers.get_or_start(model_id) # reuse a ready worker, else start one
studio.workers.start(model_id) # blocks until ready
studio.workers.active(model_id)
studio.workers.stop(model_id=..., session_id=...)
studio.workers.list_sessions(model_id=..., from_date=..., to_date=...)
studio.tokens
studio.tokens.create(model_id, name=None, save=False) # save=True caches it locally
studio.tokens.load() # newest cached token
studio.tokens.load(name) # newest cached token with this name
studio.tokens.get(token) # → TokenInfo
studio.tokens.list(status=..., model_id=...)
studio.tokens.assign(token_id, model_id)
studio.tokens.unassign(token_id, model_id)
studio.tokens.update(token_id, name=..., note=..., status=...)
studio.tokens.delete(token_id)
studio.account / studio.finance
studio.account.get()
studio.account.update(company_name=..., contact_name=..., email=..., phone_number=...)
studio.finance.get_credits()
studio.finance.list_transactions()
Pass an InstanceType to deploy,
deploy_pipeline, or models.update:
from lattica_studio import InstanceType
studio.deploy(artifact, "my-model", instance_type=InstanceType.G7E_2XLARGE)
| Instance type | Compute class |
|---|---|
G4DN_XLARGE | GPU |
G7E_2XLARGE | GPU (default) |
num_devices defaults to 1 and is fixed when a model is created. Redeploying
an existing model name with a different value raises ValueError; use a new
model name to change the device count.
Studio-specific failures derive from LatticaStudioError. Shared credential,
HTTP, protocol, and storage failures derive from LatticaClientError:
from lattica_query import LatticaClientError
from lattica_studio import LatticaStudioError
Individual subclasses such as CompilationError and WorkerStartupTimeoutError
are exported by lattica_studio when you want to handle a specific failure.
lattica_build_src/ # lattica-build package
lattica_build/
base_classes/ # HomomorphicPipeline, HomOp, tracing, graph printing
operators/ # FHE, polynomial, shape, comparison, composite ops
params/ # FHE parameter planning, level/scale budgeting
examples/ # runnable pipeline definitions
build.py # build() API and lattica-build CLI
lattica_studio_src/ # lattica-studio package
lattica_studio/
studio.py # LatticaStudio entry point
deployment.py # deploy / compile orchestration
resources/ # models, workers, tokens, account, finance
types.py # Model, Worker, TokenInfo, InstanceType
exceptions.py
example.py # end-to-end reference script
Deeper documentation lives alongside the code:
| Topic | Doc |
|---|---|
| Runnable pipeline examples | examples/README.md |
| Pipeline API and data binding | base_classes/README.md |
| Operator composition model | operators/README.md |
| FHE level and scale planning | params/README.md |
CompilationError right after deploy. The pipeline built locally but the
backend rejected it. The exception message includes the backend's compilation
error. Check FHE parameter budgets first, see
params/README.md.
WorkerStartupTimeoutError. A worker on a running box is ready in roughly 20
seconds; a new box can take up to 30 minutes, which is how long start waits by
default. On timeout the worker is stopped and its credits come back; retry, or set
studio.workers.start(model_id, timeout=...).
Queries fail after a redeploy. Changing the pipeline invalidates the key context. Create a fresh token and regenerate keys.
ResourceNotFoundError from get_by_name. The model name doesn't exist
on this account. List what's there with
studio.models.display(studio.models.list()).
Each package is distributed under the license in its own directory:
Please read the applicable license before use.
Copyright © LatticaAI Inc. All rights reserved.