Now: NMPC crowd navigation for HARP's Unitree G1

Harvey Phan

I build navigation and control software for humanoid robots, and I measure what it can't do yet.

CS at Stanford. Software Engineer Lead for the Human Perception & Social Interaction Team at HARP, Stanford Student Robotics, and software engineer at POSH (YC W22) and Stanford AUV.

“I don't have dreams. I have goals.”

Harvey Specter, Suits, S3E6
  • Robot path
  • LiDAR track
  • Goal
Recorded run, replayed. A native MuJoCo Unitree G1 on HARP's GR00T walking policy, steered by my NMPC filter through a building with seven moving pedestrians. It reached the goal with zero contacts in 64.7 s. The controller sees only its LiDAR tracks; walls are cut away to 0.9 m for visibility, and playback runs at 2.5×.

Where I've worked, studied, and competed

Work

What each project set out to do, what I built, what was measured, and the main limit, stated plainly.

“Winners don't make excuses when the other side plays the game.”

Harvey Specter, Suits, S1E7

HARP, Stanford Student Robotics

Predictive crowd navigation for a humanoid robot

Software Engineer Lead, Human Perception & Social Interaction Team, Oct. 2026 to present

HARP, the Humanoid Athletic Robotics Project at Stanford Student Robotics, is building a Unitree G1 humanoid that can work in human spaces, walking naturally, getting around obstacles, finding people, and approaching them. Every command reaches the motors through HARP's safety harness and runs in MuJoCo first; walking comes from NVIDIA's GR00T locomotion policy.

My part. I lead navigation for the Human Perception & Social Interaction Team. My current work is a predictive avoidance layer between the route planner and the walking policy. It turns raw LiDAR into tracked, forecast obstacles, then uses a nonlinear model predictive controller (NMPC) to choose the G1's body-frame velocity request five times a second. Before this I built the team's waypoint routes, manual takeover, odometry route recorder, and speed and turn ramping.

Claim
A sampled-and-refined NMPC can steer a walking G1 through moving, non-yielding pedestrians without contact, using only its own LiDAR tracks and never simulator ground truth.
Result
7 of 7 native G1 crowd trials with zero contacts across adversarial and mixed crowds, static pillars, and 1.5× pedestrian flow, up from 2 of 5 before the least-intrusion fallback. 115 local tests pass.

Limit Simulation with synthetic crowds only; the Foxy, Nav2, and HIM integration and real hardware are not yet validated. In the newer building world, mixed crowds reach the goal on some seeds, and adversarial crowds still cause contacts.

Control rate
5 Hz, 0.15 s planning deadline
Horizon
4 s, three velocity blocks
Control
Body-frame forward, lateral, and yaw rate
Solver
Sampled candidates refined by SLSQP
Forecast
Constant velocity, bounded uncertainty
Robot
Unitree G1, 29 DoF, GR00T walker

How the controller decides

LiDAR point cloud in Body-frame velocity request out, to the GR00T walker
  1. Perceive

    Motion-compensated LiDAR, floor and self filtering, voxel clusters

    stamped TF

  2. Track

    Joint Hungarian assignment, merged-return splitting, occlusion memory

    2.5 s coasting

  3. Forecast

    Constant-velocity motion with bounded uncertainty; no assumed cooperation

    4 s horizon

  4. Optimize

    Three velocity blocks, nonlinear rollout with delay and gains, sampled then SLSQP-refined

    NMPC

  5. Certify

    Swept-disc checks with a braking tail; least-intrusion fallback when nothing is clear

    hard body margin

  6. Command

    First request only, then replan; zero on stale input or a missed deadline

    5 Hz, 0.15 s

The predictive avoidance layer runs between Nav2's route and the walking policy. Each stage hands the next a smaller, more decided picture of the hallway.

Scrub the recorded run

Time
22.6 s of 66.4 s
Planner
Evade: passing on a new heading
Distance to goal
6.13 m
  • Follow: route request already clear 7×
  • Evade: passing on a new heading 24×
  • Yield: slowing near the route 13×
  • Blocked: no certifiably clear motion 6×

Outcome: goal reached, 0 contacts, 64.7 s, 0.18 m from the goal, longest standstill 2.05 s.

The same recorded run as the video, seen from above. Lines show where each pedestrian walked; the robot's path is colored by what the planner was doing. Counts are mode changes over the run. Data: native G1 trial, building world, mixed crowd, seed 3.

Pfizer

Document intelligence for pharmaceutical supply chains

AI Engineer Apprentice, Jun. to Sep. 2026, public continuation 2026

Pharmaceutical supply chains run on vendor paperwork, scanned files whose fields must be read, checked, and routed to the right team. The project asked how far an OCR, retrieval, and LLM pipeline can automate that intake, and where it breaks.

My part. As an AI Engineer Apprentice at Pfizer, I built the end-to-end Python and Docker pipeline, benchmarked OCR and LLM choices, reviewed outputs by hand to diagnose failures, and delivered a demo interface and a technical report with deployment recommendations. I then built a public continuation on real MHRA recall and defect notices, focused on keeping every extracted date traceable to its source.

Claim
A three-stage pipeline (OCR, retrieval, classification) can route pharmaceutical vendor files, and a source-linked review workspace can keep ambiguous dates visible instead of guessing.
Result
50+ vendor files processed; 4 OCR/LLM approaches compared across 6 chunking configurations; 100+ outputs reviewed. The public continuation covers 742 source-linked date cells from 60 MHRA notices in 5 languages.

Limit The Pfizer code and data are internal. The public continuation is a historical snapshot, and its original-PDF OCR was measured on only 3 PDFs.

Hanoi University of Science and Technology

Cross-subject EEG state classification

Machine Learning Researcher, 2024 prototype; public benchmark 2026

Classifying mental or physiological state from EEG is a core brain-computer interface problem, and the hard part is generalizing to new people. Windows from the same person are correlated, so a random split leaks subjects into the test set and inflates accuracy. This project keeps participants separate from feature extraction to final evaluation, on PhysioNet's 109-subject EEG Motor Movement/Imagery dataset.

My part. I started the work in 2024 as a single-channel hardware and machine learning prototype at Hanoi University of Science and Technology, with guidance from Professor Trinh Van Chien. I later rebuilt it as a reproducible multichannel benchmark with verified acquisition, 512 spectral features, participant-grouped model selection, a sealed holdout, and versioned model artifacts.

Claim
Spectral features separate eyes-open from eyes-closed EEG recordings in participants the model never saw during training or selection.
Result
79.9% balanced accuracy on 22 unseen participants (95% CI 72.7 to 86.2), against 50.0% for a majority-class baseline.

Limit Offline evaluation within one dataset. Baseline run order is fixed, so condition and run effects are confounded.

Independent project

Hourly taxi demand forecasting for New York City

Sole developer, 2026

Demand forecasts decide where vehicles should be before riders ask for them. This project forecasts yellow-taxi pickups for every NYC Taxi Zone one hour ahead. At the start of hour t it may use only observations through hour t − 1, and evaluation walks forward in time so no model ever sees its own future.

My part. I built it end to end. That covers acquisition and source hashing for 23.3 million trips, past-only feature engineering, gradient-boosted and baseline models, walk-forward evaluation with matched-control ablations, a FastAPI inference prototype, and a TypeScript map explorer that runs from a committed snapshot.

Claim
A boosting model on past-only features forecasts hourly pickups per zone better than a weekly baseline.
Result
MAE 3.693 vs 5.104 (27.65% lower) over 559,370 zone-hours of walk-forward validation.

Limit Boosting is worse on sparse-zone MAE in every month, and no live data feed exists.

Research

Two co-authored papers and an international modeling competition. These ones do play the odds.

“I don't play the odds. I play the man.”

Harvey Specter, Suits, S2E6

Hanoi National University of Education

On Balancing Numbers by the Matrix Method

Luu Ba Thang and Phan Hoang Lam

The question. A balancing number n satisfies 1 + 2 + … + (n − 1) = (n + 1) + … + (n + r) for some r, and the sequence obeys B(n) = 6B(n − 1) − B(n − 2). Fibonacci and Lucas numbers have classic matrix representations, the Q-matrix among them; this paper builds the analogue for balancing numbers.

What it shows. Defines a balancing B-matrix and proves by induction that its powers generate the sequence. Determinant, eigenvalue, and diagonalization arguments give a Binet-like closed form and recurrence identities; Euclidean-algorithm reasoning gives divisibility results, including gcd(B(m), B(n)) = B(gcd(m, n)).

Published in
HNUE Journal of Science: Natural Science
Issue
Vol. 70, Issue 4, pp. 3 to 10, 2025
Role
Co-author, with Luu Ba Thang

The method

Encode the recurrence in a 2 × 2 matrix whose powers carry the sequence. Then each tool of linear algebra, the determinant, matrix multiplication, and eigenvalues, turns into an identity about balancing numbers.

  1. Definition

    1+2+⋯+(n−1)  =  (n+1)+⋯+(n+r)1 + 2 + \cdots + (n-1) \;=\; (n+1) + \cdots + (n+r)
    1+2+⋯+(n−1)=(n+1)+⋯+(n+r)\begin{aligned} &1 + 2 + \cdots + (n-1) \\ &\quad = (n+1) + \cdots + (n+r) \end{aligned}

    A positive integer n is a balancing number when some r makes the two sums equal.

  2. Recurrence

    B0=0,B1=1,Bn+1=6Bn−Bn−1B_0 = 0, \qquad B_1 = 1, \qquad B_{n+1} = 6B_n - B_{n-1}
    B0=0,B1=1,Bn+1=6Bn−Bn−1\begin{aligned} &B_0 = 0, \quad B_1 = 1, \\ &B_{n+1} = 6B_n - B_{n-1} \end{aligned}

    Balancing numbers satisfy a second-order linear recurrence, like the Fibonacci and Pell numbers.

  3. The B-matrix

    B=(61−10),Bn=(Bn+1Bn−Bn−Bn−1)B = \begin{pmatrix} 6 & 1 \\ -1 & 0 \end{pmatrix}, \qquad B^{n} = \begin{pmatrix} B_{n+1} & B_{n} \\ -B_{n} & -B_{n-1} \end{pmatrix}
    B=(61−10),Bn=(Bn+1Bn−Bn−Bn−1)\begin{aligned} &B = \begin{pmatrix} 6 & 1 \\ -1 & 0 \end{pmatrix}, \\[4pt] &B^{n} = \begin{pmatrix} B_{n+1} & B_{n} \\ -B_{n} & -B_{n-1} \end{pmatrix} \end{aligned}

    Theorem 2.1: powers of B carry the sequence. Proved by induction: multiply the k-th power by B and apply the recurrence.

  4. Determinant

    det⁡Bn=(det⁡B)n=1    ⟹    Bn2−Bn+1Bn−1=1\det B^{n} = (\det B)^{n} = 1 \;\;\Longrightarrow\;\; B_{n}^{2} - B_{n+1}B_{n-1} = 1
    det⁡Bn=(det⁡B)n=1⟹  Bn2−Bn+1Bn−1=1\begin{aligned} &\det B^{n} = (\det B)^{n} = 1 \\ &\Longrightarrow\; B_{n}^{2} - B_{n+1}B_{n-1} = 1 \end{aligned}

    Taking determinants of both sides gives a Cassini-type identity.

  5. Addition

    Bm+n=BmBn    ⟹    Bm+n=Bm+1Bn−BmBn−1B^{m+n} = B^{m}B^{n} \;\;\Longrightarrow\;\; B_{m+n} = B_{m+1}B_{n} - B_{m}B_{n-1}
    Bm+n=BmBn⟹  Bm+n=Bm+1Bn−BmBn−1\begin{aligned} &B^{m+n} = B^{m}B^{n} \\ &\Longrightarrow\; B_{m+n} = B_{m+1}B_{n} - B_{m}B_{n-1} \end{aligned}

    Comparing entries of a product of powers gives an addition formula.

  6. Eigenvalues

    det⁡(B−λI)=λ2−6λ+1=0    ⟹    λ1,2=3±22\det(B - \lambda I) = \lambda^{2} - 6\lambda + 1 = 0 \;\;\Longrightarrow\;\; \lambda_{1,2} = 3 \pm 2\sqrt{2}
    λ2−6λ+1=0⟹  λ1,2=3±22\begin{aligned} &\lambda^{2} - 6\lambda + 1 = 0 \\ &\Longrightarrow\; \lambda_{1,2} = 3 \pm 2\sqrt{2} \end{aligned}

    B has two distinct real eigenvalues, so it diagonalizes.

  7. Closed form

    Bn=λ1 n−λ2 nλ1−λ2=(3+22)n−(3−22)n42B_{n} = \frac{\lambda_1^{\,n} - \lambda_2^{\,n}}{\lambda_1 - \lambda_2} = \frac{(3+2\sqrt{2})^{n} - (3-2\sqrt{2})^{n}}{4\sqrt{2}}
    Bn=λ1 n−λ2 nλ1−λ2Bn=(3+22)n−(3−22)n42\begin{aligned} &B_{n} = \frac{\lambda_1^{\,n} - \lambda_2^{\,n}}{\lambda_1 - \lambda_2} \\[4pt] &\phantom{B_n} = \frac{(3+2\sqrt{2})^{n} - (3-2\sqrt{2})^{n}}{4\sqrt{2}} \end{aligned}

    Writing the matrix power through its eigen-decomposition gives a Binet-like formula.

  8. Divisibility

    gcd⁡(Bm,Bn)=Bgcd⁡(m, n)\gcd(B_{m}, B_{n}) = B_{\gcd(m,\,n)}

    The addition formula and the Euclidean algorithm reduce a gcd of balancing numbers to a gcd of their indices.

Journal of Basic and Applied Research International

AI-Based Forecasting of Macroeconomic Indicators: Empirical Evidence from Deep Learning Models for Inflation, GDP and Unemployment

Nguyen Quang Dat, Phan Hoang Lam, Le Duy Quang, Vu Thi Thuy, Nguyen Thi Thanh Ha, and Do Duy Nhat

The question. Do deep sequence models beat classical econometrics at forecasting inflation, GDP growth, and unemployment? The study tests both families on quarterly U.S. and Vietnam data from 2000 to 2024, 100 quarters per country, with financial and sentiment covariates.

What it shows. ARIMA, VAR, and BVAR are compared with LSTM, GRU, TCN, Transformer, and a hybrid VAR-LSTM under time-aware validation, scored by RMSE, MAE, directional accuracy, Theil’s U, and Diebold-Mariano tests. The hybrid led with RMSE 0.58 and 74.0% directional accuracy, held up over 8- and 12-quarter horizons and 2020 to 2024 backtests, and SHAP attribution points to oil prices, exchange rates, and M2 as the main drivers.

Published in
Journal of Basic and Applied Research International
Issue
Vol. 31, Issue 6, pp. 163 to 171, 2025
Role
Co-author, second of six authors
DOI
10.56557/jobari/2025/v31i610064

COMAP and NeoUnion, international

International Mathematical Modeling Challenge (IM²C)

The challenge. The IM²C, cosponsored by COMAP and the NeoUnion ESC Organization, gives high-school teams of up to four students five consecutive days to model an open real-world problem and defend the model in a written report. Each country sends at most two teams to international judging.

Our work. I competed for Hanoi-Amsterdam High School for the Gifted, representing Vietnam, in 2024 and 2025. Our modeling included a binary integer program for multi-round scheduling, with assignment variables and capacity, availability, time-conflict, and participation constraints, a weighted objective balancing unmet demand, utilization, and fair access, and scenario and sensitivity analysis on demand, capacity, and penalty weights.

Honorable Mention at the 10th (2024) and 11th (2025) annual challenges.

Team
Hanoi-Amsterdam High School for the Gifted
Representing
Vietnam
Result
Honorable Mention, 2024 and 2025
Organizers
COMAP and NeoUnion ESC Organization
  • IM²C 2025 Certificate of Achievement, Honorable Mention, Hanoi-Amsterdam High School for the Gifted, representing Vietnam.

    11th annual IM²C, Honorable Mention

    Phan Hoang Lam, Pham Dang Nguyen, Hoang Minh Tung, Le Dao Khoi Minh

    Certificate (PDF)

  • IM²C 2024 Certificate of Achievement, Honorable Mention, Hanoi-Amsterdam High School for the Gifted, representing Vietnam.

    10th annual IM²C, Honorable Mention

    Phan Hoang Lam, Hoang Nam Khanh, Pham Dang Nguyen, Nguyen Minh Tri; advisor Nguyen Trung Hieu

    Certificate (PDF)

Experience

Teams and organizations, most recent first.

“Loyalty is a two-way street.”

Harvey Specter, Suits, S3E1
  1. Humanoid Athletic Robotics Project (HARP)

    Software Engineer Lead, Human Perception & Social Interaction Team

    Stanford Student Robotics' humanoid program, building on the Unitree G1

    Predictive crowd navigation (NMPC), waypoint routes, manual takeover, motion smoothing

    Oct. 2026 to present

  2. POSH (YC W22)

    Software Engineer

    AI infrastructure, modeling, time series

    Sep. 2026 to present

  3. Stanford Autonomous Underwater Vehicle

    Software Engineer

    Stanford's autonomous underwater vehicle team

    Sep. 2026 to present

  4. Pfizer

    AI Engineer Apprentice

    Pharmaceutical document processing: OCR, retrieval, and classification pipeline

    Jun. to Sep. 2026

  5. Brown University

    Machine Learning Researcher

    CNN-based soil texture analysis, mentored by MSc. Leonard Gleyzer

    Jun. to Oct. 2025

  6. Hanoi National University of Education

    Mathematics Researcher

    Balancing numbers by the matrix method, with Luu Ba Thang

    Jan. to Aug. 2025

  7. Hanoi University of Science and Technology

    Machine Learning Researcher

    EEG state classification, guided by Prof. Trinh Van Chien

    Jun. to Aug. 2024

People I've met

Leaders in product and venture I have had the chance to meet.

“First impressions last. If you start behind the eight ball, you'll never get in front.”

Harvey Specter, Suits, S1E3

Education and honors

“You want to lose small, I want to win big.”

Harvey Specter, Suits, S2E5

Education

  • Stanford University B.S. in Computer Science, class of 2030
  • Hanoi-Amsterdam High School for the Gifted Mathematics Specialized Class; Valedictorian, Hanoi City Entrance Examination; 2026

Honors and scores

  • Bronze Medal, Vietnam National Student Mathematics Olympiad
  • Second Prize, Hanoi Mathematics Olympiad
  • Honorable Mention, International Mathematical Modeling Challenge, 2024 and 2025
  • SAT 1550 (800 Math)
  • IELTS 8.0
  • AP 5s: Calculus BC, Computer Science A, Macroeconomics

Tools

  • Languages Python, C/C++, Java, SQL, R, TypeScript
  • Robotics and control ROS 2, Nav2, MuJoCo, NMPC (SciPy SLSQP), multi-object tracking
  • ML and data PyTorch, scikit-learn, pandas, NumPy, SciPy
  • Systems Docker, Git, FastAPI