girhe.com · Research · Research portfolio, 4 pages Download PDF

Niranjan Girhe

Research Portfolio
M.S. in Computer Science (thesis option), Fall 2027

My research direction is compact, on-device AI that makes NPC behavior dynamic, from adaptive decisions to physics-driven responses, while keeping it responsive and believable. Across the two prototypes below, compact models made decisions in 15 to 61 ms and full dialogue turns took under 280 ms on one consumer PC. Speed was not the problem. Reliable behavior was.

1Physics-driven NPC reactions

Code on GitHub · Recorded clips
Two copies of the seated character facing the same falling box. On the left it braces upright and the box hits its head; on the right it curls forward and the box misses.
One falling box, two decisions. Bracing (left) gets hit on the head, and curling up (right) avoids it.
The standing character, hit on the right shoulder, stumbles toward a wall and reaches for the railing.
Hit on the right shoulder, it reaches for the railing.
The standing character raising both arms to cover its head.
A strong hit toward the head. It covers up.
What it is

A Unity character built from 15 physics-driven parts joined by motors, with no animation clips. When a box falls toward it or a ball is thrown at it, it must choose a reaction, such as bracing, dodging sideways or curling up, and how stiff its muscles should be.

Setup

Each event becomes one sentence, for example "A heavy object (about 12 kg) is falling toward the head, about 0.4 s until impact." I benchmarked Laya, a compact decision model, and the zero-shot classifier GLiClass, both without fine-tuning, on choosing the reaction within a 200 ms budget, with hand-written rules as a fallback. Each ran on the same 30 seeded events in two scenes.

Results
  • Decisions took 15 ms with GLiClass and 47 ms with Laya (median, on the GPU). Only 1 of 116 model decisions missed the 200 ms budget.
  • On the CPU, GLiClass took about 44 ms. Laya took about 1.8 s, too slow for the budget.
  • The limitation I found is that the off-the-shelf models repeated the same reactions. On the bench, Laya curled up and GLiClass dodged every time. Standing, their choices did not follow details such as object weight or impact point.
Hardware

Consumer PC with an NVIDIA RTX 4070 SUPER and an Intel Core i7.

Open question. How does learned control, for example through differentiable simulation, compare with compact decision models for choosing and shaping these reactions?

2Mira, an adaptive shopkeeper NPC

Code on GitHub · Playable version
What it is

Mira is a shopkeeper NPC who remembers how the player has treated her. GLiClass reads her history and the current game state, then scores each action the game supports and the price she charges. When its confidence is low, scripted rules and templates decide instead.

A small language model, Qwen3-0.6B or SmolLM2-1.7B, then turns the chosen action into a short line of dialogue. It cannot change her decision or her price. Everything runs locally.

Results
  • A GLiClass decision took 61 ms (median) on the CPU, or about 120 ms after a purchase, when the price is scored too.
  • Full dialogue turns took 276 ms with Qwen3-0.6B and 262 ms with SmolLM2-1.7B, fully on-device.
  • SmolLM2-1.7B wrote new lines in her voice. Qwen3-0.6B copied its prompt in 44 of 50 lines.
  • Hardware was an Intel Core i7-13700K with 32 GB RAM and an NVIDIA RTX 4070 SUPER, over one 50-turn game.
Mira's stall in the interactive figure. For a known thief, the NPC without memory says two coins, while the NPC with memory says three coins and remembers the thefts.
The rule-based Mira (the fallback path), playable online. For a known thief, the version without memory still charges two coins, while the version with memory charges three.

The failure that motivates my thesis

Mira welcomed players even after they had stolen from her. GLiClass picked "welcome" on all 50 turns, even after thefts and a hit, though it did raise her price. The system was fast enough, but its choices did not follow her memory. This gap between computational feasibility and behavioral reliability is what I want to study, starting with memory-grounded decisions.

Median time per turn, measured over one 50-turn game
Built-in rules + authored linesunder 1 ms
GLiClass + authored lines61 ms
GLiClass + Qwen3-0.6B276 ms
GLiClass + SmolLM2-1.7B262 ms
Decision (GLiClass or rules) Dialogue (language model). Scale runs from 0 to 300 ms.

3Earlier research

ThreadedPaws, a serious game for studying concurrency debugging

Lab page · GitHub · Project

2022 Mitacs Globalink research internship, SEER Lab, Ontario Tech University, with Prof. Jeremy Bradbury

ThreadedPaws is a Unity serious game for studying how computer science students debug concurrency. Players run a dog salon and order each stylist's actions so that shared tools and the cash register are used safely.

I designed levels that each isolate one bug type (starvation, deadlock, data race) and built an in-game tutorial so every participant starts from the same baseline. I also refactored the Unity (C#) code so new levels are easier to add. The lab used the game in a study with students.

Tutorial screen where a stylist explains starvation next to her action list
The in-game tutorial introducing starvation before the level that isolates it.
A salon level with drag-and-drop action blocks for a stylist and the appointment board
A level in play. Players drag get, return, read and write blocks into each stylist's plan.
A level where stylists wait on the shared cash register
A data race level. Stylists share the cash register while the plans run side by side.

Shetkari Mitra, farmer support and on-device soil analysis

Paper · App code · API code · Project

Led under Dr. Avinash Bhute, MIT Academy of Engineering, Pune

Shetkari Mitra began as a question-and-answer platform connecting farmers with agricultural experts through crop-specific forums. We evaluated it with 50 farmers, and it was published with me as first author in the Springer ICCDN 2021 proceedings.

I then built an on-device TensorFlow Lite CNN that classifies soil photos on budget Android phones, plus KNN classifiers for fertility and crop recommendations. The fertility classifier reached 97% accuracy on held-out test data. The project won the 2022 UNESCO India-Africa Hackathon.

Sample Shetkari Mitra soil health report for alluvial soil at 0 to 5 cm depth, with organic carbon, nitrogen, pH, CEC and overall fertility
Sample soil report, 0 to 5 cm depth, with example values.
Three app screens: an expert's reply to a farmer's query, government policies, and the forums list
An expert's reply to a farmer, policies and crop forums.

4Industry work

projectfleming.net · GitHub · Project

Shell, through Impactility, 2023 to 2026

I built and deployed BERT-based semantic search pipelines on CPU clusters (Databricks, MLflow) for an InnerSource code-discovery platform, which finds internal repositories by the meaning of a search rather than its exact words. Running on CPUs avoided costly GPU infrastructure. Repository vectors are computed ahead of time, so each search only encodes one short query. The core engine was later released as open source as Project Fleming. Getting transformer models to respond quickly on modest hardware is the same constraint I now face when running models next to a game engine.

Research direction

Thesis question

How can compact models running on the player's own device make NPC behavior dynamic, from adaptive decisions to physics-driven responses, while maintaining real-time performance and behavioral consistency?

My two prototypes show that compact models are already fast enough. They also show where they fall short. Off-the-shelf models repeated the same reactions, ignored object weight and impact point, and welcomed a player who had stolen from the shopkeeper. I want to study how to make these decisions follow memory and the details of each event, and to compare compact decision models with learned control, for example through differentiable simulation, with rules kept as a safety fallback.

Response latency

Time from a game event to the NPC's action, measured against a fixed budget such as 200 ms.

Behavioral consistency

Whether decisions follow the NPC's memory and the event's details, such as a past theft or an object's weight.

Adaptability

Whether behavior changes sensibly across repeated interactions with the same player.

Planned steps
  • Run compact decision models, small quantized language models and the existing rules in one prototype, and measure decision quality, response time, memory use and the effect on frame times.
  • Pass the NPC's relevant history and game state to the model, limit its choices to actions the game supports, and test whether a confidence threshold reliably tells the game when to fall back to a script.
  • Ask players to try adaptive and scripted versions over repeated sessions, and compare how believable, fair and enjoyable each one feels.

Contact