← Figma Interview Insights

Figma·Machine Learning Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Mar 2026

Summary

Got a system design question for an ML Engineer role at Figma that was way more software-architecture-heavy than I expected. The whole thing centered on building undo/redo semantics for a layer editor, which felt more like a backend infra problem than anything ML-adjacent.

Questions Asked (1)

Q1

Design a batch operation primitive for a layer/document editor where multiple mutations can be grouped together and treated as a single atomic unit for undo. How do you structure the operation log, handle nested batches, and deal with partial failures within a batch?

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

Spent the first few minutes just making sure I understood what 'atomic undo' actually meant here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a design that uses a command pattern with a composite command for batches. Explain how to structure the operation log as a tree to handle nesting, and discuss strategies for atomicity and partial failures, including rollback and error handling.

Pro tip: Emphasize that the design should be extensible and maintainable, and consider performance implications of undo/redo in a collaborative editing environment. Mention that you would validate the design with edge cases like nested batches and concurrent edits.

1. Clarify Requirements

Ask about the editor's architecture, expected batch sizes, nesting depth, and whether operations are reversible. Confirm if partial failures should abort the entire batch or allow partial application.

2. Design Operation Log Structure

Propose a tree-based log where each node represents an operation or a batch. Batches contain child operations, enabling nesting. Each node has an apply and revert method.

3. Handle Nested Batches

Use a stack to track active batches. When a nested batch starts, push onto the stack; when it ends, pop and merge into parent. Ensure undo/redo treats the outermost batch as a single unit.

4. Manage Partial Failures

Implement a two-phase commit: first validate all operations, then apply. If any operation fails during apply, rollback all previously applied operations in the batch. Alternatively, use compensating actions.

5. Discuss Trade-offs and Optimizations

Compare eager vs lazy validation, memory overhead of storing inverse operations, and performance of deep nesting. Mention potential optimizations like operation compression or checkpointing.

Key Points to Mention

  • Command pattern with composite commands for batches
  • Tree-based operation log to support nesting
  • Two-phase commit or compensating transactions for atomicity
  • Stack-based management of nested batches
  • Rollback mechanism using inverse operations
  • Performance considerations for large batches and deep nesting

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.