PracHub
QuestionsLearningGuidesInterview Prep
|Home/System Design/Two Sigma

Design and Scale Quantitative Optimization Workflows

Last updated: Aug 5, 2026

Quick Overview

Explain a tax-loss harvesting optimizer and a multi-period asset-location backtest from both research and engineering perspectives. Cover objective tradeoffs, point-in-time correctness, validation, data lineage, and execution architecture for roughly thirty thousand optimizer runs.

  • medium
  • Two Sigma
  • System Design
  • Software Engineer

Design and Scale Quantitative Optimization Workflows

Company: Two Sigma

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

You are discussing two quantitative systems: a tax-loss harvesting optimizer and a multi-period asset-location backtest. Explain the mathematical model, the backtest methodology, and the execution architecture deeply enough that an interviewer can distinguish research choices from engineering choices. ### Constraints & Assumptions - Treat tax rates, holding-period rules, wash-sale windows, eligible accounts, and trading limits as explicit inputs rather than universal constants. - Distinguish measurements from estimates. State the actual data volume, solver runtime, historical coverage, and hardware only if they are known. - The backtest may require roughly 30,000 optimizer runs, but the runtime distribution and shared-input size must be measured before choosing a parallelization strategy. - Preserve point-in-time information in the research design so that later knowledge cannot enter an earlier simulated decision. ### Clarifying Questions to Ask - Is the optimizer minimizing current taxes only, or balancing taxes against risk, tracking error, transaction cost, and expected return? - Which tax jurisdictions, account types, lot-selection rules, and wash-sale interactions are in scope? - Is the backtest a historical replay, a Monte Carlo study, or both, and what decision is it intended to support? - Are optimizer paths independent after initialization, or do they share mutable portfolio state between periods? - What accuracy, reproducibility, runtime, and infrastructure-cost requirements determine whether a distributed design is justified? ### Part 1 — Formulate the Tax-Loss Harvesting Optimizer Describe how tax regions, tax lots, short- versus long-term gains, wash-sale restrictions, and trade decisions enter the model. Explain where binary variables and Big-M constraints arise, why the formulation may be a mixed-integer quadratic program, and how branch-and-bound and its continuous relaxation are used. Assess whether a relaxed solution can safely reduce the binary search space. Compare a single-period formulation with one that can wait for a holding period to become long-term. ```hint Separate economics from solver mechanics First define the decisions, accounting identities, and objective terms. Then identify which rules create discrete choices and how the solver treats them. ``` #### What This Part Should Cover - Decision variables, objective terms, and the source of nonlinearity or integrality - Tax-lot timing and wash-sale constraints across relevant accounts and periods - Big-M calibration, relaxation quality, and optimality versus heuristic trade-offs - The additional state and uncertainty introduced by a multi-period horizon ### Part 2 — Design the Backtest Explain when to use historical paths, Monte Carlo paths, or both. Choose a rebalancing cadence and evaluation metrics, justify the historical window and data sources, and explain how you prevent stale, missing, revised, or future data from biasing the result. ```hint Match evidence to the decision The right path generator, cadence, and metric depend on whether the study evaluates after-tax wealth, risk, implementation cost, robustness, or another decision criterion. ``` #### What This Part Should Cover - Path construction and the assumptions each path type preserves or breaks - Rebalancing logic, transaction effects, and after-tax performance metrics - Point-in-time data, corporate actions, missing observations, and reproducibility - Sensitivity analysis across market regimes and modeling assumptions ### Part 3 — Execute About 30,000 Optimizer Runs Design the execution plan for tens of thousands of path-level optimizations. Decide whether to use one machine or several, whether a machine per path would help, how to share common inputs, and how serialization, scheduling, solver startup, and result aggregation affect throughput. Explain how you would measure per-path runtime, profile the bottleneck, and choose the next enhancement. ```hint Optimize the measured critical path Break total wall time into input preparation, transfer, queueing, solver work, and result reduction before selecting a concurrency model. ``` #### What This Part Should Cover - Task granularity, bounded concurrency, load balancing, and failure isolation - Shared immutable inputs, transfer volume, process startup, and memory pressure - Runtime distributions, profiling evidence, deterministic seeds, and resumability - A reasoned comparison of vertical optimization and horizontal distribution ### Part 4 — Explain Your Role Fit State whether your strongest contribution is closer to software engineering, quantitative research, or the boundary between them. Support the answer with evidence about the work you personally own and explain which part of the optimization-to-production lifecycle you most want to handle. ```hint Use an evidence-backed position Choose a point on the spectrum, then connect it to concrete decisions you can explain in depth rather than presenting equal interest in everything. ``` #### What This Part Should Cover - A clear position rather than an unqualified claim of being equally strong everywhere - Evidence of ownership in engineering, optimization research, or both - Awareness of the different standards for research validity and production reliability - A credible account of where the candidate can contribute immediately and grow next ### What a Strong Answer Covers Across all parts, connect the financial objective, mathematical formulation, data assumptions, execution plan, and personal ownership. Mark which claims are measured, which are modeled, and which remain hypotheses to test. ### Follow-up Questions - How would you detect that a tighter Big-M formulation materially improved solver performance without changing the feasible set? - What evidence would persuade you that Monte Carlo paths add value beyond historical replay for this decision? - If a few paths dominate wall time, how would you separate difficult optimization instances from infrastructure skew? - Which approximation would you consider first if the exact multi-period optimizer could not meet the runtime target?

Quick Answer: Explain a tax-loss harvesting optimizer and a multi-period asset-location backtest from both research and engineering perspectives. Cover objective tradeoffs, point-in-time correctness, validation, data lineage, and execution architecture for roughly thirty thousand optimizer runs.

|Home/System Design/Two Sigma

Design and Scale Quantitative Optimization Workflows

Two Sigma logo
Two Sigma
Jul 31, 2026, 12:00 AM
mediumSoftware EngineerTechnical ScreenSystem Design
0
0

You are discussing two quantitative systems: a tax-loss harvesting optimizer and a multi-period asset-location backtest. Explain the mathematical model, the backtest methodology, and the execution architecture deeply enough that an interviewer can distinguish research choices from engineering choices.

Constraints & Assumptions

  • Treat tax rates, holding-period rules, wash-sale windows, eligible accounts, and trading limits as explicit inputs rather than universal constants.
  • Distinguish measurements from estimates. State the actual data volume, solver runtime, historical coverage, and hardware only if they are known.
  • The backtest may require roughly 30,000 optimizer runs, but the runtime distribution and shared-input size must be measured before choosing a parallelization strategy.
  • Preserve point-in-time information in the research design so that later knowledge cannot enter an earlier simulated decision.

Clarifying Questions to Ask Guidance

  • Is the optimizer minimizing current taxes only, or balancing taxes against risk, tracking error, transaction cost, and expected return?
  • Which tax jurisdictions, account types, lot-selection rules, and wash-sale interactions are in scope?
  • Is the backtest a historical replay, a Monte Carlo study, or both, and what decision is it intended to support?
  • Are optimizer paths independent after initialization, or do they share mutable portfolio state between periods?
  • What accuracy, reproducibility, runtime, and infrastructure-cost requirements determine whether a distributed design is justified?

Part 1 — Formulate the Tax-Loss Harvesting Optimizer

Describe how tax regions, tax lots, short- versus long-term gains, wash-sale restrictions, and trade decisions enter the model. Explain where binary variables and Big-M constraints arise, why the formulation may be a mixed-integer quadratic program, and how branch-and-bound and its continuous relaxation are used. Assess whether a relaxed solution can safely reduce the binary search space. Compare a single-period formulation with one that can wait for a holding period to become long-term.

What This Part Should Cover Guidance

  • Decision variables, objective terms, and the source of nonlinearity or integrality
  • Tax-lot timing and wash-sale constraints across relevant accounts and periods
  • Big-M calibration, relaxation quality, and optimality versus heuristic trade-offs
  • The additional state and uncertainty introduced by a multi-period horizon

Part 2 — Design the Backtest

Explain when to use historical paths, Monte Carlo paths, or both. Choose a rebalancing cadence and evaluation metrics, justify the historical window and data sources, and explain how you prevent stale, missing, revised, or future data from biasing the result.

What This Part Should Cover Guidance

  • Path construction and the assumptions each path type preserves or breaks
  • Rebalancing logic, transaction effects, and after-tax performance metrics
  • Point-in-time data, corporate actions, missing observations, and reproducibility
  • Sensitivity analysis across market regimes and modeling assumptions

Part 3 — Execute About 30,000 Optimizer Runs

Design the execution plan for tens of thousands of path-level optimizations. Decide whether to use one machine or several, whether a machine per path would help, how to share common inputs, and how serialization, scheduling, solver startup, and result aggregation affect throughput. Explain how you would measure per-path runtime, profile the bottleneck, and choose the next enhancement.

What This Part Should Cover Guidance

  • Task granularity, bounded concurrency, load balancing, and failure isolation
  • Shared immutable inputs, transfer volume, process startup, and memory pressure
  • Runtime distributions, profiling evidence, deterministic seeds, and resumability
  • A reasoned comparison of vertical optimization and horizontal distribution

Part 4 — Explain Your Role Fit

State whether your strongest contribution is closer to software engineering, quantitative research, or the boundary between them. Support the answer with evidence about the work you personally own and explain which part of the optimization-to-production lifecycle you most want to handle.

What This Part Should Cover Guidance

  • A clear position rather than an unqualified claim of being equally strong everywhere
  • Evidence of ownership in engineering, optimization research, or both
  • Awareness of the different standards for research validity and production reliability
  • A credible account of where the candidate can contribute immediately and grow next

What a Strong Answer Covers Guidance

Across all parts, connect the financial objective, mathematical formulation, data assumptions, execution plan, and personal ownership. Mark which claims are measured, which are modeled, and which remain hypotheses to test.

Follow-up Questions Guidance

  • How would you detect that a tighter Big-M formulation materially improved solver performance without changing the feasible set?
  • What evidence would persuade you that Monte Carlo paths add value beyond historical replay for this decision?
  • If a few paths dominate wall time, how would you separate difficult optimization instances from infrastructure skew?
  • Which approximation would you consider first if the exact multi-period optimizer could not meet the runtime target?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Two Sigma•More Software Engineer•Two Sigma Software Engineer•Two Sigma System Design•Software Engineer System Design

Your design canvas — auto-saved

PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.