scroll-tech / scroll-tech/ceno

Support KoalaBear field as a faster alternative to BabyBear

Open
#1,305 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
153
Forks
43
Avg merge
3d 13h
Merged PRs (30d)
4

Description

Motivation

Ceno currently supports BabyBear as one of its small-prime finite fields (alongside Goldilocks).
KoalaBear is a recently proposed 31-bit prime field with prime
p = 2^31 - 2^24 + 1 that offers significant performance advantages over BabyBear
(p = 2^31 - 2^27 + 1).

Why KoalaBear is faster

  • Better hardware utilization: KoalaBear's prime 2^31 - 2^24 + 1 enables more efficient
    Montgomery/Barrett reduction on modern CPUs compared to BabyBear.
  • Faster multiplication: Benchmarks from Plonky3, SP1, and other ZK frameworks show KoalaBear
    field multiplication is measurably faster than BabyBear on x86-64 and ARM architectures.
  • Same security level: KoalaBear is also a 31-bit field with similar security and extension
    field properties (a degree-4 extension exists), so it is largely a drop-in replacement.
  • Ecosystem adoption: KoalaBear has been adopted by several leading ZK projects as a direct
    replacement for BabyBear (Plonky3, SP1, etc.).

Proposal

  1. Add KoalaBear support in ff_ext, providing a KoalaBearExt4 type analogous to the
    existing BabyBearExt4.
  2. Expose KoalaBear as a FieldType option in the CLI (--field koalabear), alongside
    babybear and goldilocks.
  3. Benchmark KoalaBear vs BabyBear within Ceno to quantify the speedup and guide users toward
    the faster option.
  4. Consider making KoalaBear the default field, or optionally deprecating BabyBear while
    retaining it for backwards compatibility.

References

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing BabyBearExt4 implementation in ff_ext and the FieldType handling for the CLI's --field option. Review the KoalaBear paper and the referenced Plonky3 implementation before deciding how the extension field and compatibility choices fit Ceno. Done means KoalaBear support, CLI exposure, and comparative benchmarks are available, with the default-field decision addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, cryptography, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.