Market surveillance on Lambda using NVIDIA NIM

• 14 min read
Real-time market surveillance with NVIDIA NIMs (FSI)

Financial markets generate millions of order events per day. Hidden inside that stream are manipulation patterns (spoofing, layering, quote stuffing) that cost market participants money and expose firms to regulatory risk. Catching them fast is the hard part. Spoofing patterns that aren't flagged within seconds of occurring are too late to act on. Processing millions of order events fast enough to matter is a GPU problem.

In this post, we'll walk through an end-to-end market surveillance pipeline we built on Lambda NVIDIA H100 Tensor Core GPU and NVIDIA Blackwell GPU instances using NVIDIA NIM. The pipeline detects anomalies in real NASDAQ Limit Order Book (LOB) data using two complementary approaches: a supervised cuML Random Forest and the unsupervised NVIDIA Kumo Anomaly (formerly NV-Tesseract AD-Diffusion), and automatically generates formal compliance alerts via NVIDIA Nemotron™-3-Super-120B. On Blackwell, we also showcase Nemotron-3-Ultra-550B, a 550B-parameter model that runs on 2x Blackwell GPUs in NVFP4. All inference runs locally on Lambda hardware with no data leaving the cluster.

The dataset: LOBSTER real NASDAQ market data

We used LOBSTER market data: reconstructed Level 2 order book snapshots for AAPL, AMZN, and MSFT from a single trading day (June 21, 2012), taken from LOBSTER’s free public sample dataset. LOBSTER is useful for anomaly detection because it labels the event type of every order action: new submissions (type 1), cancellations (types 2–3), and executions (types 4–5). That level of detail lets us derive manipulation indicators directly from the data, without synthetic labeling. We computed features and rule-based labels for all three stocks. The model results below use MSFT, the most active of the three (595,800 events).

Stock Events Anomaly rate
AAPL 301,587 2.00% (270 spoofing + 5,771 layering)
AMZN 155,935 3.18% (79 spoofing + 4,882 layering)
MSFT 595,800 0.36% (2,012 spoofing + 108 layering)
Total 1,053,322 1.25% (13,122 anomalies)

The pipeline

The full model implementation pipeline runs in seven steps, all GPU-accelerated on Lambda hardware:

Step Component What it does
1. Data loading cuDF (RAPIDS) Load 1M+ LOB events onto GPU memory
2. Feature engineering cuDF (RAPIDS) Compute 8 microstructure features on GPU
3. Anomaly labeling LOBSTER event types Identify known spoofing and layering patterns via fixed thresholds
4. Supervised detection cuML Random Forest GPU classifier trained on rule-based labels
5. Unsupervised detection: Kumo Anomaly NIM Kumo Anomaly NIM Time-series foundation model, finds novel anomalies
6. Compliance alerts Nemotron-3-Super-120B NIM Generates formal one-paragraph compliance alerts
7. Blackwell showcase Nemotron-3-Ultra-550B NIM 550B/55B active MoE, NVFP4 Blackwell-only

Step 1: GPU-accelerated feature engineering with RAPIDS

The raw LOBSTER files contain bid/ask prices and sizes at five price levels, plus event-type metadata.

A raw LOBSTER message file:

time,event_type,order_id,size,price,direction
34200.000177389,1,65000,100,30990,1
34200.000177389,3,64996,100,31010,-1
34200.001243521,4,65001,200,31000,1
34200.001891003,2,64998,50,30995,1

A corresponding order book snapshot at five price levels:

ask_price_1  ask_size_1  bid_price_1  bid_size_1  ask_price_2  ask_size_2  bid_price_2  bid_size_2  ...
31010        200         30990        100         31020        150         30980        300
31005        100         30990        150         31020        150         30975        200

Event types (LOBSTER encoding):

  1. New limit order submission
  2. Partial cancellation
  3. Full cancellation
  4. Execution against a visible limit order
  5. Execution against a hidden limit order

Cancellation events (types 2 and 3) make LOBSTER particularly valuable for manipulation detection; they let us compute cancel_rate and cancel_to_trade directly from the data, rather than inferring them indirectly.

We used RAPIDS cuDF to compute 8 microstructure features directly on GPU, processing 1M+ events without ever leaving GPU memory:

df['mid_price']       = (df['ask_price_1'] + df['bid_price_1']) / 2
df['spread']          = df['ask_price_1'] - df['bid_price_1']
df['order_imbalance'] = (df['bid_size_1'] - df['ask_size_1']) / \
                        (df['bid_size_1'] + df['ask_size_1'] + 1e-8)

bid_vol = sum(df[f'bid_size_{i}'] for i in range(1, 6))
ask_vol = sum(df[f'ask_size_{i}'] for i in range(1, 6))
df['vol_imbalance_5'] = (bid_vol - ask_vol) / (bid_vol + ask_vol + 1e-8)

df['mid_return']      = df['mid_price'].diff().fillna(0)
df['spread_vol']      = df['spread'].rolling(20).std().fillna(0)
df['is_cancel']       = ((df['event_type'] == 2) |
                         (df['event_type'] == 3)).astype('int32')

df['cancel_rate']     = df['is_cancel'].rolling(50).mean().fillna(0)
df['cancel_to_trade'] = (cancel_sum / (trade_sum + 1e-8)).clip(upper=100)

Each feature maps directly to a known manipulation signature:

  • order_imbalance and vol_imbalance_5: spoofers create artificial buy or sell pressure at the top of the book (and deeper levels) to move price before canceling
  • cancel_rate and cancel_to_trade: the defining behavioral signature of both spoofing (high cancel rate) and layering (high cancel-to-trade ratio); events with cancel_to_trade of 100 (the cap, meaning 100 or more cancels per trade) appear regularly in flagged events
  • spread_vol, mid_return, spread, mid_price: contextual features that give the models the surrounding market conditions to judge whether anomalous order flow is truly unusual or just normal volatility

The feature engineering loop runs per-stock (AAPL, AMZN, MSFT separately) so rolling-window calculations don't bleed across different instruments. All three stocks are then concatenated into a single GPU dataframe for downstream processing.

Note: Code snippets are simplified for readability. Some helper functions and intermediate variables are omitted. The full notebooks are available on request.

Step 2: Rule-based labels

Before training any model, we generated ground-truth labels using fixed thresholds derived directly from the LOBSTER event types:

# Spoofing: large imbalance + high cancel rate
gdf_features['spoofing'] = (
    (gdf_features['cancel_rate'] > 0.6) &
    (gdf_features['order_imbalance'].abs() > 0.8)
).astype('int32')

# Layering: high cancel-to-trade ratio + volume imbalance across 5 levels
gdf_features['layering'] = (
    (gdf_features['cancel_to_trade'] > 10) &
    (gdf_features['vol_imbalance_5'].abs() > 0.7)
).astype('int32')

gdf_features['anomaly'] = (
    gdf_features['spoofing'] + gdf_features['layering'] * 2
).clip(upper=2)

These labels serve two purposes: they train the supervised Random Forest and act as a comparison baseline for what Kumo Anomaly independently catches. The rules are fixed-threshold logic. The Random Forest is a separate model trained to learn those patterns and generalize them.

Step 3: Supervised detection (cuML Random Forest)

The Random Forest is trained on the rule-based labels to learn whether it can generalize the threshold logic across a wider test set:

from cuml.ensemble import RandomForestClassifier
from cuml.model_selection import train_test_split

X = gdf_msft[feature_cols].astype('float32')
y = gdf_msft['anomaly'].astype('int32')
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

clf = RandomForestClassifier(n_estimators=100, max_depth=8, random_state=42)
clf.fit(X_train, y_train)

Results on the MSFT test set (119,160 rows):

Metric H100 B200
Precision 0.962 0.964
Recall 0.915 0.980
F1 0.938 0.972
Training time 1.00s 1.04s
Inference time 0.040s (2.99M ev/s) 0.037s (3.22M ev/s)

B200's higher recall (0.980 vs 0.915) is significant; in a compliance context, false negatives carry regulatory risk. Both instances ran RAPIDS on dedicated GPUs isolated from the NIM containers (NVIDIA CUDA™_VISIBLE_DEVICES set to free GPUs on both instances) to ensure a fair comparison.

Step 4: Unsupervised detection (Kumo Anomaly NIM)

This is where the pipeline goes beyond what rules alone can find.

Kumo Anomaly is a time-series foundation model for multivariate anomaly detection. It uses a diffusion-based architecture trained on a broad distribution of time-series patterns, scoring each event by its mean absolute error (MAE) from expected behavior. No labels required, entirely unsupervised.

We deployed it as a self-hosted NIM container on a single GPU:

# H100
docker run -d --name nv-tesseract --gpus "device=3" -p 8000:8000 \
  -e NGC_API_KEY=$NGC_API_KEY \
  -v ~/.cache/nim:/opt/nim/.cache \
  nvcr.io/nim/nvidia/nv-tesseract:ad-diffusion-1.1.0

# B200
docker run -d --name nv-tesseract --gpus "device=5" -p 8000:8000 \
  -e NGC_API_KEY=$NGC_API_KEY \
  -v ~/.cache/nim:/opt/nim/.cache \
  nvcr.io/nim/nvidia/nv-tesseract:ad-diffusion-1.1.0

The inference call sends a window of LOB feature vectors via the /v2/detect-anomalies REST endpoint:

payload = [{"ts": float(row['time']),
            **{col: float(row[col]) for col in feature_cols}}
           for _, row in df_window.iterrows()]

response = requests.post("http://localhost:8000/v2/detect-anomalies", json=payload)

At 100k events, sending the full payload in a single request times out on the server side; Kumo Anomaly’s diffusion sampling has a fixed compute cost per batch. We chunked into 5,000-row batches:

CHUNK_SIZE = 5000  # identical on H100 and B200

for i in range(0, len(df_window), CHUNK_SIZE):
    chunk = df_window.iloc[i:i+CHUNK_SIZE]
    chunk_results = call_tesseract_chunk(chunk)
    all_results.extend(chunk_results)

Results for two surveillance modes:

2k window (real-time mode)

Metric H100 B200 Delta
Time 21.25s 15.18s -6.07s (-28.6%)
Flagged events 72 (3.6%) 72 (3.6%) 0
Kumo Anomaly only (novel) 68 70 +2
Rule-based labels only 63 65 +2
Top MAE score 1.5245 1.3974 -0.1271 (-8.3%)

100k window (batch scale mode)

Metric H100 B200 Delta
Time 1,093s 734s -359s (-32.8%)
Throughput 91 events/sec 136 events/sec +45 (+49.5%)
Flagged events 4,567 (4.6%) 4,459 (4.5%) -108 (-2.4%)
Kumo Anomaly only (novel) 4,506 4,414 -92
Rule-based labels only 438 454 +16
Top MAE score 1.6852 1.7460 +0.0608 (+3.6%)

The most important number: 4,506 events on H100 that the rules didn’t flag, all candidates for review. Kumo Anomaly identified these as statistically anomalous without any knowledge of spoofing or layering, based purely on distributional deviations in the microstructure features.

A note on the detection overlap rows: "both flagged" events are those where Kumo Anomaly and the rule-based labels independently agreed. "Kumo Anomaly only" are novel anomalies with no matching rule signature. "Rules only" are known patterns Kumo Anomaly didn't score as anomalous. The low overlap (2–4 events out of 2,000 in the real-time window) confirms the two detection methods are complementary; they are largely catching different things.

Blackwell has 49% higher throughput and is 33% faster on the 100k batch (734s vs 1,093s).

Top five highest-scoring events from the 100k window (H100):

Rank   MAE     Mid Price   Order Imbalance   Cancel Rate
1      1.6852  $30.9800    -0.0269            34.00%
2      1.6739  $31.0050     0.8000            46.00%
3      1.6506  $30.8150     0.7772            48.00%
4      1.6192  $30.9850    -0.7750            50.00%
5      1.6147  $31.0800     0.1781            54.00%

Step 5: Compliance alert generation (Nemotron-3-Super-120B NIM)

Flagged events from Kumo Anomaly and the Random Forest are passed to Nemotron-3-Super-120B, NVIDIA's hybrid LatentMoE model (Mamba-2 + MoE + Attention, 120B total / 12B active parameters), to generate formal compliance alerts.

On H100, the NIM auto-selects FP8 on 4 GPUs. On Blackwell, it runs the same 120B model in NVFP4 (NVIDIA Blackwell-native) on half the GPUs:

# H100 — FP8, auto-selected on NVIDIA Hopper™, 4 GPUs
docker run -d --name nemotron-super --gpus '"device=4,5,6,7"' -p 8003:8000 \
  --shm-size=16g --ipc=host \
  -e NGC_API_KEY=$NGC_API_KEY \
  -v ~/.cache/nim:/opt/nim/.cache \
  nvcr.io/nim/nvidia/nemotron-3-super-120b-a12b:latest

# B200 — NVFP4, Blackwell-native, 2 GPUs
docker run -d --name nemotron-super --gpus '"device=3,4"' -p 8003:8000 \
  -e NGC_API_KEY=$NGC_API_KEY \
  -v ~/.cache/nim:/opt/nim/.cache \
  nvcr.io/nim/nvidia/nemotron-3-super-120b-a12b:latest

Each detected anomaly's numeric indicators are interpolated into a structured prompt:

prompt = f"""You are a financial markets compliance officer writing a surveillance alert.
A statistical anomaly was detected in the MSFT limit order book by NVIDIA NV-Tesseract AD-Diffusion.
Anomaly characteristics:
- Anomaly score (MAE): {row['tesseract_mae']:.4f} (higher = more anomalous)
- Mid price: ${row['mid_price']:.4f}
- Order imbalance: {row['order_imbalance']:.4f} (range -1 to 1)
- Cancel rate: {row['cancel_rate']:.2%}
- Volume imbalance (5 levels): {row['vol_imbalance_5']:.4f}
- Spread: ${row['spread']:.6f}
Write a concise one-paragraph compliance alert. Include anomaly score, key indicators, recommended action."""

response = requests.post("http://localhost:8003/v1/chat/completions", json={
    "model": "NVIDIA/nemotron-3-super-120b-a12b",
    "messages": [{"role": "user", "content": prompt}],
    "max_tokens": 200,
    "temperature": 0.3,
    "chat_template_kwargs": {"thinking": False}  # reasoning OFF
})

Sample outputs

H100, FP8, Alert 4 (MAE 1.6192, order imbalance -0.7750, strong sell pressure):

Compliance alert. The NVIDIA Kumo Anomaly model has detected a statistical anomaly in the MSFT limit order book, with an anomaly score (MAE) of 1.6192, indicating significant deviation from normal microstructure. Key indicators include a pronounced order imbalance of −0.7750 (strong sell pressure), a volume imbalance of −0.4010 across the top five levels, a 50% cancellation rate suggesting rapid order turnover, and a tight $0.01 spread. Recommended action: initiate immediate manual review of MSFT trading activity, verify for potential manipulative behavior or erroneous order flow, and consider temporary heightened surveillance or trading restrictions pending further investigation.

Blackwell, NVFP4, Alert 4 (MAE 1.6719, order imbalance 0.1640, slight buy pressure):

Surveillance alert. A statistical anomaly has been flagged in the MSFT limit-order book by the NVIDIA Kumo Anomaly model, with an MAE-based anomaly score of 1.6719. Key indicators include a mid-price of $30.70, an order imbalance of 0.1640, a high cancel rate of 40.00%, a volume imbalance of 0.0526 across the top five levels, and a tight spread of $0.02. Given the elevated cancel rate and pronounced order imbalance, which may signal potential manipulative quoting or latency-arbitrage activity, immediate escalation is recommended.

Step 6: Concurrent throughput

Sequential alert generation (one request, wait, next request) doesn't reflect production reality. During volatile market conditions, dozens of anomalies may be flagged simultaneously, requiring burst alert generation. We tested concurrent throughput using Python's asyncio + aiohttp to fire batches of 100 requests at three concurrency levels, identically on both instances:

async def run_concurrent_batch(rows, concurrency):
    connector = aiohttp.TCPConnector(limit=concurrency)

    async with aiohttp.ClientSession(connector=connector) as session:
        semaphore = asyncio.Semaphore(concurrency)

        async def bounded_call(row):
            async with semaphore:
                return await generate_alert_async(session, row)

        latencies = await asyncio.gather(
            *[bounded_call(r) for _, r in rows.iterrows()]
        )

    return latencies
Concurrency H100 (FP8) Blackwell (NVFP4) Blackwell advantage
10 1.91 alerts/sec 5.86 alerts/sec 3.1x
25 3.84 alerts/sec 9.64 alerts/sec 2.5x
100 10.19 alerts/sec 29.03 alerts/sec 2.9x

The c=100 result (29.03 vs 10.19 alerts/sec) is the most meaningful production-scale comparison.

Sequential warm latency tells a similar story: 0.95s on Blackwell vs 1.73s on H100, 45% faster, on half the GPU count.

Step 7 (Blackwell only): Nemotron-3-Ultra-550B-A55B

Only one model in this stack runs on B200: Nemotron-3-Ultra-550B-A55B. It ships in NVFP4, a Blackwell-only format, so it can’t run on H100. On 2 Blackwell GPUs, it used about 172GB per GPU in our runs (measured with nvidia-smi):

docker run -d --name nemotron-ultra --gpus '"device=6,7"' -p 8004:8000 \
  -e NGC_API_KEY=$NGC_API_KEY \
  -e VLLM_USE_FLASHINFER_MOE_FP8=1 \
  -e VLLM_USE_FLASHINFER_MOE_FP4=1 \
  -e NIM_PASSTHROUGH_ARGS="--kv-cache-dtype nvfp4 --mamba-ssm-cache-dtype float16 \
    --enable-mamba-cache-stochastic-rounding \
    --mamba-cache-philox-rounds 5 --max-num-seqs 64" \
  -v ~/.cache/nim:/opt/nim/.cache \
  nvcr.io/nim/nvidia/nemotron-3-ultra-550b-a55b:latest
Metric Nemotron-Super-120B Nemotron-Ultra-550B
Total parameters 120B 550B
Active parameters (MoE) 12B 55B
Precision FP8 (H100) / NVFP4 (B200) NVFP4 (B200 only)
GPUs on Blackwell 2 Blackwell GPUs 2 Blackwell GPUs
Runs on H100 Yes (4 GPUs) No
Context window 262k tokens 1M tokens
Mean alert latency (Blackwell) 0.95s 1.87s

Ultra-550B is ~2x slower than Super-120B per alert on the same 2 Blackwell GPUs; this is expected given 4.6x more active parameters. The 1M-token context window opens up longer-horizon market pattern analysis that Super-120B's 262k context can't address.

H100 vs Blackwell: the full picture

Step H100 Blackwell Delta
Kumo Anomaly 2k rows (real-time) 21.25s 15.18s Blackwell 29% faster
Kumo Anomaly 100k rows (batch) 1,093s (91 ev/sec) 734s (136 ev/sec) Blackwell 33% faster / 49% higher throughput
RF training 1.00s 1.04s ~same
RF inference 0.040s (2.99M ev/sec) 0.037s (3.22M ev/sec) Blackwell 8% faster
NIM warm latency 1.73s/alert 0.95s/alert Blackwell 45% faster
NIM peak throughput (c=10) 1.91 alerts/sec 5.86 alerts/sec Blackwell 3.1x higher
NIM peak throughput (c=25) 3.84 alerts/sec 9.64 alerts/sec Blackwell 2.5x higher
NIM peak throughput (c=100) 10.19 alerts/sec 29.03 alerts/sec Blackwell 2.9x higher
Ultra-550B N/A 1.87s/alert Blackwell only
GPUs for Nemotron-Super 4x H100 2 Blackwell GPUs Blackwell 2x efficient

The headline: running Nemotron-Super on half the GPUs, Blackwell delivers 2.9x peak alert throughput and 45% faster warm inference. Kumo Anomaly throughput is also 49% higher.

Data residency: why this architecture matters for FSI

Every request in this pipeline is a local HTTP call to a container running on the same Lambda instance:

LOBSTER data → cuDF (GPU) → Kumo Anomaly NIM → Nemotron NIM → Alert
                             localhost:8000      localhost:8003

No trading data reaches an external API endpoint. No model weights are hosted remotely. For FSI firms subject to data sovereignty requirements or internal data residency policies (a common requirement), this is a meaningful architectural advantage over cloud-hosted inference endpoints.

Environment

H100 instance: Driver 580.105.08, CUDA 13.0, Python 3.10, PyTorch 2.5.1+cu121, RAPIDS 26.02 stable -cu12

Blackwell instance: Driver 580.126.20, CUDA 13.0, Python 3.12, PyTorch nightly cu130, RAPIDS 26.04 nightly -cu13

NIM containers require an NGC API key. Kumo Anomaly requires separate access approval via your NVIDIA contact. Nemotron-Ultra-550B requires an NVIDIA AI Enterprise (NVAIE) trial (90-day trial available).

GPU allocation:

GPU H100 Blackwell
GPU 0,1,2 Free (RAPIDS) Free (RAPIDS)
GPU 3 Kumo Anomaly (port 8000) Nemotron-Super (port 8003)
GPU 4 Nemotron-Super (port 8003) Nemotron-Super (port 8003)
GPU 5 Nemotron-Super (port 8003) Kumo Anomaly (port 8000)
GPU 6,7 Nemotron-Super (port 8003) Nemotron-Ultra (port 8004)

What's next

The models in this post ran on MSFT order data from a single trading day. Natural extensions include real-time streaming ingestion (rather than batch LOBSTER files), multi-stock concurrent surveillance, and prompt refinement for specific regulatory frameworks (MiFID II, FINRA Rule 5210). The concurrent throughput benchmark also opens up a natural conversation about how alert generation scales as surveillance coverage expands, and where Blackwell’s larger VRAM headroom compounds the advantage at higher concurrency.

Want to build this pipeline yourself? Talk to our team. We’ll walk through the full setup and notebooks.