LAB DUE DATE: Thursday, October 22nd, 11.59PM

1. Intrusion and Anomaly Detection

This lab shifts our focus from security of AI to security with AI. In this lab, we use a learned model to help a defender identify suspicious activity in a computer system or network. The security question we ask is whether an AI system helps the defender find harmful activity at an acceptable cost — in terms of false alarms, missed attacks, and the effort to investigate these alerts. We cover two related concepts:

  • Intrusion detection: The defender examines observations such as network traffic, system logs, or process activity to identify possible unauthorized behavior. The security goal is to find activity that threatens a stated asset.

  • Anomaly detection: The model identifies observations that differ from the behavior it has learned or been configured to expect. An anomaly is evidence of unusual behavior; additional evidence is needed to decide whether it is malicious.

For example, a camera that normally communicates with a recorder might begin contacting hundreds of unrelated addresses. A detector could flag that change. The defender must still determine whether the camera is compromised, misconfigured, or performing an authorized task. The distinction between a model output and a security conclusion will guide this lab.

  • Attack vector: The entry point depends on the selected paper: exposed network services, compromised hosts, malicious processes, or another stated mechanism. Identify what an attacker can actually control in your experiment.

  • Trust assumption: The observations available to the detector contain useful evidence of the attack, and its training data and evaluation procedure represent the setting in which it will be used.

  • Security question: Does the learned detector help a defender find harmful activity at an acceptable cost in false alarms, missed attacks, and investigation effort?

This is a two-week lab,. For this lab, choose one paper on intrusion and/or anomaly detection with public GitHub code, understand its security problem and implementation, and reproduce one bounded result.

2. Objectives

By the end of this lab, you should be able to:

  • explain a detector’s security objective, attacker model, and trust assumptions;

  • distinguish an anomaly score, an alert, and evidence of an intrusion;

  • connect a paper’s claim to its data, code, and evaluation;

  • run a bounded experiment on Firebird using Slurm;

  • interpret false positives, false negatives, and investigation effort using your results; and

  • connect this lab to security principles: protecting assets, understanding trust boundaries, least privilege, defense in depth, and maintaining the availability of the defense.

3. Attack Model

Use the following questions to describe the security setting for your selected paper and experiment.

Security question What to identify

Attacker Objective

The harmful action the attacker seeks to accomplish, such as compromising a host, accessing data without authorization, or disrupting a service. If the dataset labels faults or anomalies rather than attacks, state that distinction.

Security Triad Affected (CIA)

The confidentiality, integrity, or availability property at risk and the specific asset being protected.

Trust Assumption Being Examined

Why the observed patterns should help distinguish harmful from benign activity. Identify assumptions about the training data, telemetry, labels, and intended deployment.

Attacker-Controlled Data

The traffic, events, processes, files, or other inputs the attacker can influence under the paper’s threat model. Do not assume that the attacker controls every field in a dataset.

Defender’s Evidence

What the detector observes and what context a defender would need to investigate its output. Distinguish information available to the detector from ground-truth labels available only to the evaluator.

Useful Evidence of Performance

Detection of relevant activity, measured false alarms and missed attacks, and the cost of processing or investigation. State the decision unit, metric, and baseline used to support the security claim.

4. Part 0: Setup and threat model

4.1. Checkpoints for this lab

Commit and push each checkpoint to your github repository.

Deadline ToDos Worksheet

By the end of lab, Wednesday, September 30th

Identify the paper, public implementation, accessible dataset, and proposed result. Describe the security landscape and main feasibility risk. Discuss the proposed replication target with Vasanta and record the feedback.

A–B

By the start of lab, Wednesday, October 7th

Read the paper and submit its summary, security takeaways, key results, limitations, and replication target. Have your own copy of the code, record its exact commit, prepare the code map, and bring a Slurm script and setup/run evidence. Be ready for the walkthrough and live demo.

C; D1–D5

During lab, Wednesday, October 7th

Give the week-two live demo and trace one example from input through the implementation to its output and evaluation. Discuss any changes to the agreed replication target and the plans for all four investigations.

D6; E1–E2

Thursday, October 22nd, 11.59PM

Submit all worksheet sections, the bounded reference replication, all four investigations, reproducible scripts and commands, environment information, results, figures, selected logs, and code changes.

A–F

4.2. Reproduce the implementation of one paper

Use Sommer and Paxson’s Outside the Closed World to examine your detector’s assumptions, false alarms, and evaluation.

The papers below are suggestions. You may propose another relevant paper with public source code and accessible data. Discuss the specific result you will reproduce with Vasanta during week one and record it in worksheet A.

4.2.1. DeepLog

  • Paper metadata: Du et al. DeepLog: Anomaly Detection and Diagnosis from System Logs through Deep Learning. ACM CCS, 2017. paper

  • GitHub code: Thijsvanede/DeepLog (MIT). This is a reimplementation by the DeepCASE researchers. Identify its differences from the original authors' implementation.

  • Contribution and security takeaway: DeepLog learns expected sequences of system-log events and flags unexpected continuations. This can help an operator locate abnormal execution without writing a rule for every failure or attack. A sequence deviation alone does not establish malicious intent.

  • Implementation and evaluation: Use the implementation documentation to connect the available code and data to the result you propose to reproduce. HDFS labels describe anomalous system behavior; explain what those labels can establish about an intrusion and what they cannot.

4.2.2. Kitsune

  • Paper metadata: Mirsky et al. Kitsune: An Ensemble of Autoencoders for Online Network Intrusion Detection. NDSS, 2018. paper

  • GitHub code: ymirsky/Kitsune-py (MIT; author implementation). KitNET-py provides the detector component.

  • Contribution and security takeaway: Kitsune learns normal traffic statistics using an ensemble of small autoencoders. Poorly reconstructed observations become candidates for investigation. Splitting features among small models makes online anomaly scoring more practical on limited hardware; the defender still needs a decision rule and context to determine whether an anomaly is an attack.

  • Implementation and evaluation: Preserve the capture’s time order, identify the presumed-normal learning period, and locate ground truth for the proposed detection result. A reconstruction-error plot needs an explicit evaluation procedure to support a detection claim. The Python release is not the optimized implementation used for the paper’s throughput measurements; attribute any measured runtime to your code and hardware.

4.2.3. DeepCASE

  • Paper metadata: van Ede et al. DeepCASE: Semi-Supervised Contextual Analysis of Security Events. IEEE S&P, 2022. paper

  • GitHub code: Thijsvanede/DeepCASE (MIT; author code). The sp branch contains the original paper experiments; main contains the tool for general use.

  • Contribution and security takeaway: DeepCASE uses the context around events to group related behavior and apply analyst feedback. Its security benefit is reducing repetitive review while helping analysts identify which event sequences warrant attention. Its value depends on the quality of both the context and the feedback.

  • Implementation and evaluation: Follow the repository’s data instructions and identify the experiment supported by your selected branch and dataset. The commercial Lastline dataset is private. Public HDFS data supports workload/anomaly experiments but does not establish the same security-risk accuracy as the private security-event evaluation.

4.2.4. ORTHRUS

  • Paper metadata: Jiang et al. ORTHRUS: Achieving High Quality of Attribution in Provenance-based Intrusion Detection Systems. USENIX Security, 2025. paper

  • GitHub code: ubc-provenance/orthrus (Apache-2.0; author code). An archived paper version is available. PIDSMaker also includes an implementation.

  • Contribution and security takeaway: ORTHRUS uses relationships among processes, files, and network activity to detect suspicious entities and reconstruct attack activity. The goal is to give a defender relevant evidence for an investigation, while reducing unrelated activity that obscures the attack.

  • Implementation and evaluation: Identify whether your result concerns detection or attack reconstruction, and use the corresponding labels and metrics. The original repository uses submodules, which must be present at their recorded versions. Check its data, database, and environment requirements. If you use PIDSMaker instead, identify that implementation and any differences from the original artifact.

4.2.5. Sometimes Simpler is Better

  • Paper metadata: Bilot et al. Sometimes Simpler is Better: A Comprehensive Analysis of State-of-the-Art Provenance-Based Intrusion Detection Systems. USENIX Security, 2025. paper

  • GitHub code: ubc-provenance/PIDSMaker, velox branch (Apache-2.0; paper artifact). An archived release is available.

  • Contribution and security takeaway: The paper examines whether the complexity of provenance-based detectors delivers better security results. Its comparisons and simpler Velox method emphasize the importance of evaluating useful detection, investigation cost, and variation across runs. A more complex model or a strong aggregate metric does not by itself establish a more useful defense.

  • Implementation and evaluation: The artifact appendix describes available experiments and pretrained weights. Connect your proposed result to its model, dataset, configuration, and metrics. State whether you evaluate supplied weights or train the model yourself; these test different parts of the paper’s result.

4.2.6. ENTENTE

  • Paper metadata: Xu et al. ENTENTE: Cross-silo Intrusion Detection on Network Log Graphs with Federated Learning. NDSS, 2026. paper

  • GitHub code: uci-dsp-lab/ENTENTE (BSD-3-Clause; author code).

  • Contribution and security takeaway: ENTENTE enables organizations to learn graph-based intrusion detectors collaboratively while retaining their raw logs locally. It addresses differences between organizations' data and malicious contributions to training. The security question is whether collaboration improves detection under those conditions; keeping raw data local alone is not a formal privacy guarantee.

  • Implementation and evaluation: The repository includes Euler and Jbeil backends and a pinned PyTorch environment. Identify the backend, client/data partition, and threat setting associated with your proposed result. Check dependency and allocated-GPU compatibility, and state what information the participating organizations share.

4.3. Organize your lab workspace

Clone your github repo into Firebird. On firebird your directory structure would look like this: $HOME/CS91R/lab5 on Firebird. Keep the worksheet, Slurm script, experiment scripts, configurations, analysis code, and results in this repository.

Place the selected paper’s source checkout inside an upstream/ subdirectory of the course repository. Keep that checkout’s Git history and license intact. Add upstream/ to the course repository’s .gitignore; save any changes you make as a patch or as an identified commit in your own fork.

Also exclude datasets, model weights, and environments from the course repository. The Firebird instructions below explain where to keep inputs and outputs. Submit the small files needed to explain and rerun your work.

4.4. Identify the security landscape

Once you choose your paper, complete worksheet sections A–B. Identify the asset, attacker objective, observations available to the defender, and the decision the model produces. State one legitimate change that could cause an alert and one harmful action that might remain familiar in the measured features.

Connect your answers to our class discussion of Outside the Closed World. Explain how false alarms, incomplete visibility, changes in normal behavior, and contaminated training data could affect your chosen detector.

By the end of lab week 1, identify a paper, public implementation, accessible dataset, and proposed result. Discuss the result with Vasanta during week one and record the agreed target and feedback in worksheet A3. Record a fallback if data preparation or the environment issues are found through the week.

4.5. Before you run

Complete worksheet A–B. Identify the asset, attacker objective, observations available to the defender, and the decision the model produces. State one legitimate change that could cause an alert and one harmful action that might remain familiar in the measured features.

Connect your answers to our class discussion of Outside the Closed World and Kitsune. Explain how false alarms, incomplete visibility, changes in normal behavior, and contaminated training data could affect your chosen detector. In worksheet B, also work through the campus-server scenario, the border-router visibility question, the base-rate calculation, and Kitsune’s processing steps.

By the end of the first lab, you should have chosen one paper and one public implementation, found a dataset you can access, and named a result small enough to investigate in two weeks. Record a fallback if data preparation or the environment becomes a blocker.

5. Part 1: Read and analyze the paper

PAPER ANALYSIS DUE:Wednesday, October 7th, by the start of lab

Read the paper associated with the repository you selected. Complete worksheet C1–C5 in approximately 500–800 words. Use the paper’s section, table, and figure numbers to support your discussion.

  1. Summary: What security problem does the paper address? What does the system observe, what does its AI component learn, and what does the defender receive?

  2. Security takeaways: Identify 2-3 defenses proposed in the paper. For each, explain how the proposed defense could improve security and the assumptions of the system.

  3. Key results: Select the results most relevant to the security claim. Report the dataset, decision unit, metric, comparison, and conditions under which each result was obtained.

  4. Key limitations: Identify limitations in the threat model, available data, labels, evaluation, generalization, or operational cost. Distinguish limitations acknowledged by the authors from your own assessment.

  5. Replication target: State the figure, table, experiment, or precise claim discussed with Vasanta in week one. Explain which components the public implementation and data allow you to reproduce. Record any proposed change to that target and discuss it with Vasanta.

For example, “the detector achieved a high accuracy” does not explain its security contribution. A useful explanation states which activity it detected, what information it used, how often it raised false alarms, and what a defender could do with the result. If the paper does not measure one of these, identify that missing evidence.

Complete worksheet section C and push the Wednesday checkpoint before the start of lab on October 7th.

6. Part 2: Clone the code and walk through the code

READING AND CODE CHECKPOINT:Wednesday, October 7th, by the start of lab

6.1. Clone the selected implementation

Within your git repo on firebird $HOME/CS91R/Lab5, clone the selected paper’s code into upstream/. Determine the appropriate command from the repository’s instructions and run only the clone command for your selected implementation.

A branch identifies a line of development that can change over time. A commit hash identifies the exact revision you used. Record both in worksheet D1. Some repositories need additional version information:

  • DeepCASE: sp contains the original paper experiments; main is the general-use tool. Select the version that supports the result you are reproducing.

  • ORTHRUS: submodules are separate dependency repositories referenced by the parent repository. Initialize them as its instructions require and record their versions along with the parent commit.

  • PIDSMaker / Sometimes Simpler is Better: velox identifies the paper artifact’s branch. Record its exact commit as well.

For every option, record the upstream URL, branch or tag, full commit hash, dependencies, and local changes. Retain the license and citation information. A local clone supplies your working copy; record patches or fork commits for any changes needed to reproduce your result.

6.2. Trace the implementation

Complete worksheet D1–D3. Record actual file paths and function, class, or configuration names from your chosen commit. During the walkthrough, open those files and trace one example through the system:

  1. Where does the program start, and how are settings loaded?

  2. How are the data and labels read? Where are training, calibration/validation, and test data separated?

  3. How are packets, logs, or provenance records converted to model inputs?

  4. Where are the model, training objective, and optimizer defined?

  5. How does a prediction or anomaly score become an alert, ranking, or group?

  6. Where are results evaluated and saved? Where does the code select CPU or GPU execution?

The goal fo the trace through is to connect the code to the paper.

6.3. Firebird: access and Slurm jobs

Use these Firebird resources below as reference:

6.3.1. SSH into Firebird

Use your lowercase Swarthmore username with the -swat suffix. Replace yourusername below with your username:

ssh yourusername-swat@firebird.swarthmore.edu

This opens a shell on a login node. It does not allocate a GPU or start an experiment on a compute node.

  • Use the login node for editing, repository management, and inspection.

  • Submit training, substantial preprocessing, and evaluation to Slurm so they run on compute nodes.

Slurm is Firebird’s workload manager. You describe the resources and commands for an experiment in a job script. When you submit it with sbatch, Slurm returns a job ID and places the request in a queue. The job may remain pending until suitable resources are available. Slurm then allocates those resources, starts the script on a compute node, and records its status and output. The allocation ends when the job finishes, fails, is cancelled, or reaches its time limit.

SSH connects you to Firebird. Use salloc for an interactive allocation while you work through commands, or sbatch to submit a script for a batch run. Within an allocation, srun launches work on the allocated compute resources. A batch job does not require an open SSH session to keep running. You can check the status of your job from the login node using the job ID.

The second command lists nodes, partitions, configured generic resources, host memory, and state. It does not by itself establish that a particular GPU is free for your account. A job can wait because of availability, priority, or access constraints.

6.3.2. GPU choices

Start with a request for one GPU of any available type: --gpus-per-node=1. Slurm will choose a node that meets the request and your account’s access rules. Requesting a GPU does not make CPU-only code use it; your implementation and environment must support GPU execution.

The Firebird GPU guide lists the following resources:

Node GPU type used in requests GPUs on node Memory per GPU

gpu01

rtx2080ti

4

11 GB

gpu02

quadro_8000

3

48 GB

gpu03

rtx2080ti

4

11 GB

gpu04

l40s

4

48 GB

gpu05

h200

2

141 GB

gpu06

rtx6000

2

96 GB

If your experiment requires a particular GPU type or more GPU memory, document the reason and request a matching type; for example, --gpus-per-node=h200:1. The job’s host-memory request does not increase GPU memory. Use the live cluster state and current guide if they differ from this table.

Inspect the cluster from the login node:

sinfo
sinfo -N -o '%N %P %G %m %t'
module keyword cuda

sinfo summarizes partitions and node states. The second command lists each node’s name (%N), partition (%P), configured GPU or other generic resources (%G), host memory in MB (%m), and state (%t). It describes configured resources, not a promise that a GPU is currently available to your account.

6.3.3. Interactive session for the class reservation

After logging into the head/login node, request an interactive allocation using the course reservation:

salloc -t 120 --cpus-per-task=2 --mem-per-cpu=8G --reservation=vchagan1-swat_27 --partition=gpu --gpus-per-node=1

This requests 120 minutes, two CPUs per task, 8 GB of host memory per allocated CPU, and one GPU from the gpu partition using reservation vchagan1-swat_27.

  • For the one-task allocation above, we have requested two CPUs, with a host-memory of 16 GB. Note the host memory is separate from the GPU’s memory.

The class reservation ends at 4:00 p.m. Request a duration that fits entirely before that end time, allowing a little margin. A three-hour request will not fit if only two hours remain; even -t 120 may be too long later in class. For example, at 2:30 p.m., use a shorter request such as -t 80. The limit counts from when the allocation starts, so waiting for resources reduces the time that remains. Check the reservation and shorten the request if Slurm reports that it cannot fit.

This is the reservation supplied for the class session. For later sessions or runs outside its time window, use the reservation and partition provided for that run; do not assume this reservation remains valid throughout the lab.

You can inspect the reservation from the login node:

scontrol show reservation vchagan1-swat_27

Wait for Slurm to report that the allocation has been granted. Run hostname to identify the machine where your shell is running. An allocation reserves resources; it does not, on every Slurm configuration, move the shell onto a compute node. If you are still on the head/login node, open a shell in the allocation:

srun --ntasks=1 --pty bash -l

If Firebird has already opened a shell on the allocated compute node, continue there. In that compute-node shell, deactivate Conda only if an environment such as base is currently active:

conda deactivate

Then initialize Mamba and activate the course environment:

source /data/labs/chagantilab/cs91r/condaenvs/miniforge3/etc/profile.d/mamba.sh
mamba activate cs91r

source loads Mamba’s shell functions into the current shell; mamba activate cs91r selects the course Python environment. Confirm the machine and Python interpreter, then move to your lab repository:

hostname
python -c 'import sys; print(sys.executable)'
cd "$HOME/CS91R/Lab5"

Run your setup checks and prepared example in this allocated session. Record the job ID, node, activation commands, and Python path in worksheet D. Save outputs before the time limit. When finished, exit the compute-node shell; if this returns you to an allocation shell, exit that shell too to release the resources. Check squeue -u "$USER" from the login node if you are unsure whether the allocation has ended.

6.3.4. Keep data and outputs accessible to the job

Your experiment runs on Firebird, so its inputs must be accessible from the allocated compute node.

  • Your own data: Keep small inputs in $HOME/CS91R/lab5/data, within your storage quota. Exclude this directory from Git and record the dataset’s source, and data cleaning or preparation steps. Save your outputs under your git repository directory and give each run a distinct location, e.g. $HOME/CS91R/lab5/output/run1.

  • Large or temporary working data: Follow the official scratch-space example. /scratch is local to a compute node; /data/scratch is on the primary storage system. The sample stages inputs into a job-specific directory and copies outputs back. Preserve the results you need in persistent storage before cleaning up temporary files.

Record the actual input and output paths in worksheet D4. The job script below runs in the directory from which you submit it; it does not stage data automatically. Use explicit paths in your experiment script or configuration so the code reads the intended data and writes to your own output directory.

6.3.5. Create a Slurm job script

Create firebird_gpu.sbatch in $HOME/CS91R/lab5 with the following contents. This version uses the same class reservation and GPU partition as the interactive example, with a 15-minute limit for a short setup check. The complete requested duration must fit before the reservation ends at 4:00 p.m. Note — you can still run jobs outside of class time by removing the reservation request. Adjust resources for your particular experiment, and update the reservation/partition for runs outside this class allocation.

#!/bin/bash -l
#SBATCH --job-name=lab5-gpu
#SBATCH --partition=gpu
#SBATCH --reservation=vchagan1-swat_27
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=2
#SBATCH --mem-per-cpu=8G
#SBATCH --gpus-per-node=1
#SBATCH --time=00:15:00
#SBATCH --output=logs/%x-%j.out
#SBATCH --error=logs/%x-%j.err

set -e
cd "${SLURM_SUBMIT_DIR:?Submit this script with sbatch}"
module load cuda

if [[ -n "${CONDA_PREFIX:-}" ]] && declare -F conda >/dev/null; then
    conda deactivate
fi
source /data/labs/chagantilab/cs91r/condaenvs/miniforge3/etc/profile.d/mamba.sh
mamba activate cs91r

export OMP_NUM_THREADS="${SLURM_CPUS_PER_TASK:-1}"
export OPENBLAS_NUM_THREADS="${SLURM_CPUS_PER_TASK:-1}"
export MPLBACKEND=Agg

printf 'Job: %s\nNode: %s\n' "$SLURM_JOB_ID" "$(hostname)"
srun nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv

if (( $# > 0 )); then
    srun "$@"
fi

Are the SBATCH lines comments? Bash treats a line beginning with # as a comment, but Slurm reads lines beginning with SBATCH as resource directives before it runs the script. These requests are active when you submit the file with sbatch; they have not been commented out. Keep them before the executable commands. Ordinary \# comments explain the script to a reader, and the first line, #!/bin/bash -l, selects a Bash login shell. Note that Shell variables such as $HOME are not expanded inside #SBATCH directives.

Directive Meaning in this example

--job-name=lab5-gpu

A name used to identify the job and its logs.

--partition=gpu

The GPU partition specified for this class allocation.

--reservation=vchagan1-swat_27

Use the named class reservation. Its window ends at 4:00 p.m.; use the correct reservation/partition for a later run.

--nodes=1

Allocate resources on one compute node.

--ntasks=1

Run one task. This is not a request for one CPU core.

--cpus-per-task=2

Allocate two CPUs to the task for supported threaded work.

--mem-per-cpu=8G

Request 8 GB of host RAM per allocated CPU: 16 GB for this two-CPU request. This is separate from GPU memory. Do not combine this directive with --mem.

--gpus-per-node=1

Allocate one GPU on that node without specifying its type.

--time=00:15:00

Set a 15-minute wall-clock limit. The requested duration must fit inside the reservation. Slurm can stop the job at this limit.

--output=logs/%x-%j.out

Save standard output. %x is the job name and %j is its numeric job ID.

--error=logs/%x-%j.err

Save error output with the same naming convention. Create logs/ before submitting.

The executable commands have these roles:

  • set -e stops the script when a required command fails, including a failed environment activation or experiment command.

  • cd uses SLURM_SUBMIT_DIR, the directory where you submitted the job. The :? expression reports an error if that variable is absent.

  • module load cuda makes the cluster’s CUDA software available. It does not install your Python environment at this point.

  • The first if checks for an active Conda environment (CONDA_PREFIX) and an initialized conda shell function before deactivating it. source loads the supplied Mamba shell setup, and mamba activate cs91r activates the course environment inside the batch job. This initialization is repeated for each job.

  • The two thread variables limit OpenMP and OpenBLAS threads to the CPU allocation. :-1 supplies a fallback of one thread if the Slurm variable is absent. MPLBACKEND=Agg lets Matplotlib save figures without a graphical display.

  • printf records the job ID and the node’s name in the log. The first srun runs nvidia-smi to report the GPU model, its memory, and the driver version.

  • $# counts command arguments supplied after the batch-script name. If any are present, srun "$@" runs that command with its arguments inside the allocation. With no arguments, the script finishes after the GPU check.

For a CPU-only implementation, make a CPU version of the script: remove the GPU directive, module load cuda, and the nvidia-smi line, and give the job an appropriate name. Use a CPU partition and any reservation available to your account; the GPU reservation above is specific to the class GPU allocation. Keep the Mamba activation and choose CPU and memory resources based on your implementation. The Python Kitsune release is an example where a GPU request does not by itself accelerate the code.

6.3.6. Prepare the environment and submit the experiment

Create an experiment script such as run_experiment.sh in your course repository. Set the data and output paths, select the recorded configuration and seed, and invoke the entry point identified in your code map. Put the actual commands in this script so they can be inspected and rerun.

The batch script above initializes Mamba and activates cs91r before launching your experiment script. For an interactive run, use the activation commands in the interactive-session section first. Record the initialization path, environment name, Python/framework versions, and environment specification in worksheet D1. Note that each fresh shell or job needs its own environment setup.

Similar to our Jupyter Notebook’s initial cells always test imports and GPU through Slurm before a longer run.

From the login node, submit the short GPU check while the class reservation has enough time remaining:

cd "$HOME/CS91R/lab5"
mkdir -p logs
sbatch firebird_gpu.sbatch

Record the returned job ID. After the check completes, inspect its logs and record the allocated GPU in worksheet D4. Then, once your environment and experiment script are ready, submit the experiment:

sbatch firebird_gpu.sbatch bash run_experiment.sh

Here, sbatch submits the job; bash run_experiment.sh is the command passed to the script’s final srun. Submit the CPU script instead if that is the appropriate resource choice. Record the exact invocation and configuration for every run.

6.3.7. Monitor jobs and preserve outputs

Replace JOB_ID with the ID returned by sbatch:

squeue -u "$USER"
scontrol show job JOB_ID
sacct -j JOB_ID --format=JobID,JobName,State,Elapsed,ExitCode,MaxRSS

squeue shows queued and running jobs. scontrol shows the job’s request, allocation, and any pending reason. sacct provides the recorded status, elapsed time, exit code, and available memory-use information, including job steps. MaxRSS measures host memory use, not GPU memory. If a field is unavailable, record that rather than assuming zero usage.

Read the matching .out and .err files in logs/. Check the job state and exit code as well as the experiment’s own output: an empty error log does not prove that the expected experiment ran. To stop your own unwanted job, use scancel JOB_ID.

Keep a run record in worksheet E3 linking the command, configuration, job ID, hardware, logs, and results. Preserve failed runs and their errors when they explain a change in your experiment. Copy needed outputs from temporary storage before cleanup.

Use the precision, recall, false-positive-rate, and base-rate exercise from prior labs when interpreting your results. Connect those measures to the number and type of cases a defender would have to investigate.

6.4. Scoring and Thresholds

Identify the rule that converts the model’s output into an alert, ranking, or group, and the data used to choose that rule. The evaluation must connect the output to documented labels and explain what additional evidence a defender would need.

As an example in the Kitsune paper, the authors explain how packet-derived statistics enter the ensemble, how the small autoencoders' reconstruction errors feed the output autoencoder, and how its final error becomes a score. For a different paper, explain the corresponding input, learned representation, and output. A grouping system such as DeepCASE may require a different decision and evaluation procedure.

6.5. Evaluation metrics

Record what one evaluated observation represents. A false-positive packet, a false-positive host, and an unnecessary attack investigation impose different costs. Do not compare their counts as though they were interchangeable.

Reported value How to interpret it

TP, FP, TN, FN

Counts at a stated decision rule, with the positive class and decision unit defined.

Precision, recall/TPR, and FPR

Performance at the selected cutoff; report the benign and malicious class counts as well.

ROC-AUC, if used by the paper

How well scores rank positive observations above negative ones across thresholds. It does not establish the workload at the cutoff you deploy.

False review cases

Unnecessary investigations under an explicitly defined grouping rule. If identities or timestamps are missing, explain what you cannot measure.

Time to detection

Delay between the stated attack onset and detection, when the data supports this measurement.

Runtime and memory

Resource cost for your implementation, data, and hardware. Distinguish training from inference and preprocessing.

If your system groups security events or detects anomalous system behavior without intrusion labels, use the measures that fit that task. Do not come up with binary attack labels to fill a confusion matrix. Explain what the available labels establish about security and what they leave unresolved.

7. Part 3: Reproducing a paper result

7.1. Define the experiment before running

Use the replication target discussed with Vasanta in week one and recorded in worksheet A3 and C5. Complete worksheet E1–E2 before running the experiment: name the paper’s claim, data subset, model configuration, and metric you will compare. Record a hypothesis and a possible observation that would contradict it. Discuss a proposed change to the agreed result with Vasanta and record the change.

Separate the following roles in your data and code:

  • Training data: used to fit model parameters, preprocessing, feature selection, or other learned components.

  • Calibration/validation data: used to choose a cutoff or configuration before the final evaluation.

  • Test data: reserved for evaluating the completed detector under the stated protocol.

Your selected paper may use different names or a different protocol. Document its actual procedure. In particular, for online detectors, preserve the intended time order and identify the boundary between learning and evaluation. If the published evaluation uses test labels to select a cutoff, label that choice explicitly and explain its effect on the claim.

Keep the source commit, input version, split, preprocessing, seed, and model settings fixed for the reference experiment. Record any departure from the paper. A smaller-data run can be useful evidence, but it does not reproduce the full-data result without qualification.

7.2. Steps to reproduce your results

  1. Run a small setup check through Slurm to confirm that the data, environment, and entry point work together.

  2. Run the reference experiment with the recorded configuration. Save its exact command, job ID, environment, seed, and output paths.

  3. Calculate the selected metrics and make at least one informative plot, with labeled axes, units, dataset, and run identifier.

  4. Compare your result with the paper’s reported result under the relevant conditions. Identify differences in data, implementation, hardware, or evaluation.

A program that exits successfully has passed an execution check. A score plot shows that some outputs were produced. A replication requires connecting those outputs to the stated research claim and evaluating them with the appropriate data and labels.

Complete worksheet E3–E4. Preserve the reference outputs before making changes for the four investigations in Part 5.

7.3. Reproducible research in your run script

Reproducible research means that another person can use your recorded code, data, environment, and procedure to rerun the experiment and assess the same claim.

Keep the experiment commands in your run script and the settings in tracked configuration files. Record how to obtain the input data, its version and split, the upstream commit and patches, environment activation and dependency versions, random seeds, and output locations. Put setup and invocation instructions in the script’s comments or its documented help, and link the script and configuration from worksheet F3.

Use these same scripts for the reference run and the four investigations, changing only the intended configuration values. Give each run an identifier and preserve the mapping from invocation to outputs in worksheet E3. Check that the recorded command can be rerun from the course repository with the documented inputs and environment. For stochastic training, report variation rather than promising bit-for-bit identical results.

8. Part 4: Interpret the security results

8.1. Examine individual decisions

Use worksheet E5 to inspect at least two concrete cases. For a labeled binary detector, select a false positive and a false negative when available. If one category is empty, report its count and inspect the closest available case. For a grouping system, examine a useful grouping and a misleading or missed grouping instead.

For each case, identify the record or time interval, the available observations, the model’s output, and the ground truth. Explain what additional context a defender would need before responding. Do not infer an attacker’s intent solely from a large reconstruction error.

8.2. Connect the result to a defender’s decision

Explain what your result means for the protected asset. Would the output help an analyst investigate sooner, reduce repeated review, identify relevant processes, or reveal a change in traffic? State which benefit you measured and which remains a hypothesis.

Return to the security principles in worksheet B2. Give a concrete example of an independent control that complements the detector, the permissions the detector needs, and how excessive alerts or computation could impair the defense. Connect at least one limitation to Outside the Closed World.

9. Part 5: Four required investigations

Complete all four investigations below. For each investigation, record a hypothesis and a contradictory possible result before running. Keep your reference outputs and change one factor at a time. Use the same reference configuration across investigations where appropriate; you do not need to test every combination of settings.

9.1. Investigation 1: False-positive cost

Change the cutoff-selection rule using only calibration/validation data. Compare the reference operating point and at least one alternative on the same final test data. Report detection and false alarms at both operating points, and explain what security cost accompanied any reduction in alerts. For a grouping or ranking task, identify the corresponding decision rule and report task-appropriate coverage and workload measures.

You may reuse saved scores when comparing cutoffs; changing a cutoff does not by itself require retraining. Choose the rules before inspecting final test results.

9.2. Investigation 2: Model or context size

Change one parameter, such as Kitsune’s maximum autoencoder size, a log-sequence window, or a graph-context limit. Compare the reference setting and at least one changed setting. Keep the split, cutoff-selection procedure, and other settings fixed. Refit any components affected by the change using only the permitted training data, and compare both detection behavior and resource cost.

State whether the change affected model capacity, the information available to the detector, or both. Explain any change in runtime or memory alongside the security results.

9.3. Investigation 3: Analyst effort

Compare two review or label budgets, selected before examining final test results. For a system that supports analyst feedback, change the feedback budget while holding the data and evaluation procedure fixed. Use only the labels permitted by that feedback protocol.

If the system has no analyst-feedback mechanism, simulate an analyst reviewing two fixed numbers of alerts using the same ranking and grouping rule. Use the available labels to measure useful findings, unnecessary reviews, and missed labeled events at each budget. This is a review-budget analysis; it does not imply that feedback changed the model. Identify your review unit and explain what any missing security labels prevent you from concluding.

9.4. Investigation 4: Variation across runs

For a pipeline with stochastic training, run the reference configuration with at least three recorded random seeds, keeping the data split and other settings fixed. The original reference run may count as one of the three. Report every run and summarize the mean and range of the selected metrics. Explain whether the variation changes the security conclusion.

If your pipeline is deterministic or your experiment uses supplied pretrained weights, evaluate the same fixed detector on three predeclared, nonoverlapping test subsets or time windows. Keep the decision rule fixed and report the class counts and metrics for each subset. Explain that these differences measure sensitivity to the evaluation data, rather than variability from training. This adaptation is required when seed variation would not change the computation.

9.5. What to report for each investigation

Complete worksheet E6 for all four investigations. Report the hypothesis, changed factor, what was held fixed, run IDs, paired or repeated results, an interpretation, an alternative explanation, and one further experiment that could distinguish the explanations. The proposed further experiment is a discussion question; you do not need to run it.

You may reuse the same trained reference model, predictions, and logs when the comparison permits it. Document what was reused and what required a new run. A supplied pretrained model can support an inference comparison; it does not establish that you reproduced training. State what you actually ran.

If you try several cutoffs or configurations and keep the one with the best test-set result, you have used the test set to select your method. Report all settings you tried and label that comparison exploratory. To independently evaluate the selected method, you need new held-out data that played no role in the selection.

10. Deliverables

Give your live demo and code walkthrough during lab on Wednesday, October 7th. Push the following final materials to your assigned course repository by Thursday, October 22nd, 11.59PM:

  • Completed lab5_worksheet.md, including all sections A–F: security discussion, meet with Vasanta to go over the result, paper analysis, code map, live-demo record, experiment results, all four investigations, and conclusions.

  • One bounded reference replication of the agreed result and all four completed investigations, with the reference, changed-setting, and repeated-run evidence needed for each comparison.

  • Your Slurm script, experiment scripts, configuration files, and environment specification

  • A compact results table, at least one informative plot, and selected job logs supporting your results and resource measurements. Link these to the run record in worksheet E3.

Check that your recorded command reruns the intended experiment in the documented environment. Preserve failed or contradictory runs and explain any unresolved blocker. If you use a notebook, restart its kernel and run it in order. Keep datasets, environments, model weights, and credentials out of the course repository; document how to obtain the required inputs instead.

Complete worksheet F with a conclusion that distinguishes the paper’s claim from what your own experiment established. State changes in data, code, or evaluation, and explain the variation observed in Investigation 4. A larger model or a higher isolated accuracy score is not itself a stronger security result.

11. References

The paper and GitHub links for all six replication options appear in Part 0. Use the paper associated with your selected implementation and retain its license and citation information.