tensorflow / tensorflow/quantum

[Performance] Boost tfq.convert_to_tensor speed

Open
#336 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/performance good first issue help wanted kind/feature-request skill-level/intermediate
Dominant language
Python
Stars
2.2k
Forks
665
PR merge metrics
No merged PRs in 30d

Description

Currently tfq.convert_to_tensor uses just one core and makes use of Cirq serialization protocols. They are pretty slow for large circuits. A quick benchmark shows that more than 95% of all time spent computing in tfq.convert_to_tensor is spent in the cirq serialization logic and the protobuf SerializeToString function. Since it's unlikely we can speed either of those up quickly, perhaps we should look into parallelization of tfq.convert_to_tensor ?

Contributor guide

Open the contributing guide

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 at the tfq.convert_to_tensor entry point and trace its Cirq serialization and protobuf SerializeToString work. Use the existing benchmark described in the issue to measure the current single-core behavior; done means a parallelized implementation improves conversion speed for large circuits without changing its output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, machine-learning, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.