Each year we host around half-a-dozen interns (stagiaires), for periods of two to six months. These young men and women are usually studying or have just finished studying for undergraduate or Master’s degrees, and are eager to gain experience in the blockchain industry. Each has a unique story to tell about their individual interest in this technology.
In this blogpost, we will ask three questions of one of our current interns: Tianchi Yu (and a couple of questions of his mentors at Nomadic Labs).
Tianchi — so happy to have you with us! We hope you’re having a wonderful and educational period with Nomadic Labs. We’d love to hear a bit about you and your activities chez nous …
My name is Tianchi YU. I have been studying in the Master Program on Cyber-Physical Systems at the École Polytechnique since September 2020. From March 2020 to August 2020 I studied in the Computer Science Department at EPFL, and from September 2018 to February 2020 I studied in the Ingénieur Program at ISAE-SUPAERO in Toulouse. Before that, I did the Engineering Bachelor Program at Southeast University in China.
2. Tell us more about your internship: main subject, who is your mentor, what you have learned and especially, what surprised you the most within these months?
The Tezos blockchain has a high-level bytecode smart contract language called Michelson. Michelson programs consume gas, which is an abstract resource designed to bound smart contract computation and thus (amongst other things) incentivize efficient use of on-chain computation. My internship at Nomadic labs is to optimize Michelson programs to consume the least gas possible, i.e. to do their jobs while consuming minimal on-chain resources.
Specifically we are studying superoptimization (finding global program optimizations which might be missed by a smaller and simpler search for local optimizations). We’re aiming for an AI-based method to find the optimal bytecode in a fully blackbox way (i.e. without user intervention).
My mentors are Richard Bonichon and Yann Régis-Gianas. They have been very dedicated and supportive.
Over the past few months I’ve gained a deeper understanding of Tezos in general, the Michelson language in particular, and I’ve learned about OCaml and advanced skills in research and development as practiced in a real day-to-day industrial setting. I am impressed by the scalable and robust structure of the Tezos ecosystem; by the efficient, continuous contributions of programmers at Nomadic Labs; and by the exceptional competence and dedication of the teams that work behind the scenes to develop Tezos. In short, for me this internship is a holistic experience: I’ve learned about programming, how to be a programmer, how to be a teacher, and how a top-quality open-source community-driven industrial project can (and should!) be run. It’s really been an inspiration for me.
3. Why did you choose to become a part of the blockchain ecosystem and Nomadic labs? What are your plans after completing this internship?
I have always been curious about how blockchains work and I am eager to be one part of the contributions to it. There are many interesting topics to explore. For example: optimization, consensus, verification, and also security. Functional programming is a very skillful and interesting approach, and this led me to Tezos and Nomadic Labs.
After this internship, I plan to complete my last year of the Ingénieur Program. After that I plan to focus on Computer Science and Optimization, hopefully as a programmer or researcher. I hope that I will have the chance to get a PhD or do more industrial research.
This internship topic is quite involved and can have many ramifications, so our main goal is to guide Tianchi to get a minimal viable prototype (MVP) for an AI-driven superoptimizer. This includes weekly debrief meetings, answering his questions, and in general steering him towards programming a first prototype while listening to his inputs.
Code optimization is a critical component of practical compilers. For smart contracts and Michelson bytecode, optimization saves not only time but also crypto-fees through lower gas consumption.
Normal compilers balance speed of code generation against speed of the code generated. But for smart contracts, on-chain computation is so much more valuable than off-chain computation, that almost absolute priority can be given to optimizing bytecode. This seems an excellent application for superoptimization, since (to simplify only slightly) its job is to exhaustively search for the absolute most efficient code possible.
Tianchi’s work is an initial and interesting step towards achieving this in the Tezos ecosystem, with a way to optimize smart contracts a posteriori in a compiler-agnostic manner.