Privacy on Beam is an end-to-end differential privacy solution built on Apache Beam. It is intended to be usable by all developers, regardless of their differential privacy expertise.
Internally, Privacy on Beam relies on the lower-level building blocks from the differential privacy library and combines them into an “out-of-the-box” solution that takes care of all the steps that are essential to differential privacy, including noise addition, partition selection, and contribution bounding. Thus, rather than using the lower-level differential privacy library, it is recommended to use Privacy on Beam, as it can reduce implementation mistakes.
Privacy on Beam is only available in Go at the moment.
Our codelab about computing private statistics with Privacy on Beam demonstrates how to use the library. Source code for the codelab is available in the codelab/ directory.
Full documentation of the API is available as godoc.
You can build Privacy on Beam with the “go” command. Building with Bazel might still work with Gazelle but is not officially supported.
For building Privacy on Beam with the “go” command, you can run the following:
go build -mod=mod ./...
This will build all the packages. -mod=mod is necessary for installing all the dependencies automatically. Otherwise, you'll be asked to install each dependency manually.
Similarly, you can run all the tests with:
go test -mod=mod ./...
If you wish to run the codelab, you can do so by:
cd codelab/main go run -mod=mod . -example=count -input_file=day_data.csv -output_stats_file=stats.csv -output_chart_file=chart.png
Change example to run other examples. See the codelab documentation for more information.
Both for go run and go test, if you already built the code with go build, you can omit -mod=mod.