Kalan Jarvis-Loewen

Kalan Jarvis-Loewen

Hi, I'm Kalan. I'm a second-year Computing and Mathematics student at Queen's, and I like building things from the ground up to see how they really work.

This is where I keep the projects I'm proudest of, and a bit about who I am. If you only have a minute, the résumé has the short version.

Or keep reading for the longer version.

About

I wrote my first program when I was nine and never really stopped. For years that meant websites. The first one I'd still show anyone is a Pokémon card marketplace I built in 2021, with listings, accounts and a Firebase backend. After that came a Manchester City chant collection, a volunteer-hour tracker for nonprofits, and eventually sites for paying clients.

Somewhere along the way I got more interested in what's underneath. Libraries are great until you want to know why something works, so a lot of my projects rebuild things by hand: a language model in nothing but NumPy, which took over a day to train; LoRA straight from the paper; a man-in-the-middle toolkit built from raw packets. It's slower, but it's the only way I've found to properly understand something.

Some of it comes straight from my own life. I've lifted for years, and body fat is one of the hardest numbers to know without a scan. Communities like r/guessmybf crowdsource it from photos, so I trained LeanAI on thousands of those posts to do the guessing instead.

I'm currently on the QMIND design team, researching whether CLIP's idea of a word matches what people can actually see, and I build websites for local businesses and cinematographers on the side.

Outside of code, I lift, play soccer and chess, and read. I also spend a fair amount of time on math and LeetCode. I split my time between Kingston and Vancouver.

Right now

  • Researching CLIP and human perception with QMIND
  • Second year of Computing and Mathematics at Queen's
  • Building client websites on the side
  • Looking for a summer 2027 internship

Projects 5

8 heads× 6tokens

LLM From Scratch

2025

A decoder-only transformer written without ML frameworks, with LoRA implemented by hand.

Python · NumPy · Next.js
Role
Solo
Architecture
6 blocks, 8 heads each
Framework
None. NumPy only
Final loss
0.66
Extras
LoRA, cosine LR decay

Overview

In this project I created an LLM (Large Language Model) from scratch, without the aid of libraries such as PyTorch or TensorFlow. Taking on such a challenge is important to my personal development as it allows me to understand LLMs in a practical, encompassing manner, in all of the complexity which modern libraries often take away. While getting the basic structure of the LLM was the most important task, this project allowed me to implement advanced methods such as LoRA (Low-Rank Adaptation) and learning rate decay (cosine, linear).

Problem

Libraries like PyTorch hide most of what's interesting about how a transformer learns. I wanted to write every piece myself, the forward pass and backpropagation included, so I'd understand the maths rather than the API.

Approach

While my model doesn't rely on libraries to take on the complexity of modern LLM logic, I was still able to implement a state of the art structure, particularly the self-attention head. Outlined in “Attention Is All You Need” (2017), self-attention is arguably the most important breakthrough in modern machine learning. I implemented a multi-headed self-attention structure, where each transformer had 8 self-attention heads.

Each transformer also had a simple hidden layer with non-linear activation (ReLU), two LayerNorms and a residual connection. Six of these transformers, along with the embedding and positional matrices, make up my from-scratch LLM.

Training loss falling from about 18 to 0.66
Base model training loss.

Outcome

The base model trained on the source code of Python's requests library, about 10,000 lines. Training took over 24 hours and reached a training cross-entropy loss of 0.66, which means that on average the model gives the correct next character a probability of about 0.52.

I didn't want to leave it as a notebook, so I built a Next.js interface backed by a Hugging Face Space. You can prompt the model, adjust temperature and generation length, and see its attention heatmap.

Next

Swap character-level tokens for a subword tokenizer, and train on a larger corpus to see how far the same architecture scales.

photo11 modelsbf %

LeanAI

2025

Body-fat estimation from physique photos, served by an ensemble of eleven image models.

PyTorch · FastAI · FastAPI · Docker · Next.js
Role
Solo
Task
Body-fat % regression
Models
11 CNN ensemble
Serving
Hugging Face, FastAPI
Accuracy
±2.0 pts MAE

Overview

LeanAI is a machine learning powered web app which helps anyone reach their fitness goals. Given a few physique photos and basic metrics (weight, height), LeanAI predicts body-fat percentage.

Problem

Accurate body-fat measurement usually means a DEXA scan or calipers, which most people don't have. Public photos paired with DEXA results barely exist, so I trained on what does: about 1,600 physique photos from r/guessmybf and r/bulkorcut, labelled with the community's estimates. GPT-3.5 Turbo filtered the comments down to serious guesses before averaging.

Approach

The core model is a PyTorch ensemble of 11 image regression models, among them ResNet-50, EfficientNet-B3, DenseNet-121, RegNetY-040, GhostNet and MaxViT-Tiny. Each was trained on public body-fat estimation data with varying augmentation, using FastAI to streamline training.

The ensemble runs behind a FastAPI server, containerized with Docker and hosted on Hugging Face. A Next.js frontend calls that API, so the heavy model code stays off the web server and predictions come back in real time.

Outcome

Each model was trained with MSE loss, then judged by mean absolute error on 316 held-out photos. The best single model, MobileNetV3, was off by 2.09 percentage points on average. Averaging all eleven brought that to 2.01, so a prediction of 15% is typically within about two points of the community's estimate.

Cropping every photo to the body with pose detection made the data more consistent, and after that every model's error stayed under 3 points.

Next

The labels are crowd estimates, not measurements. The next step is checking the model against a small set of photos with real DEXA results.

concreteabstract

Visibility Thresholds

2026

Optimizing images toward words to test whether CLIP holds concepts humans can actually see.

PyTorch · CLIP · CLIPDraw
Role
Design team
Model
CLIP ViT-B/32
Renderers
Pixel, CLIPDraw, hybrid
Evaluation
Four-choice human game
Results
In progress

Overview

A QMIND design-team project asking whether high CLIP similarity scores correspond to concepts people can actually recognize, and how that changes across image types: raw pixels, vector strokes, and a hybrid of the two.

Problem

CLIP gives high image–text scores even for abstract words like “justice”. Does it have a visual concept humans would recognize, or is it pattern-matching?

Approach

Optimize an image to maximize CLIP similarity to a word, across words from concrete to abstract. Humans then guess the word in a four-choice game, and we compare their accuracy with CLIP's confidence.

The stimuli are 150 nouns sampled at low, medium and high imageability from the Glasgow Norms, cleaned with concreteness ratings and word-frequency data. Each word is drawn three ways: pixel-based feature visualization; CLIPDraw, which optimizes 256 coloured Bézier strokes through a differentiable renderer; and a hybrid that refines the stroke drawings with bounded pixel detail.

A batch runner draws every word with the same settings and seed, so results don't depend on word order. The full list is about 15 GPU-hours, so it's split across the team's Colab accounts.

Outcome

We presented the MVP at Camp QMIND to sponsor and faculty judges. The word list and drawing pipeline are done; results are pending the human recognition study.

Next

Run the four-choice study and compare human accuracy with CLIP's confidence at each imageability level, to find where the two diverge.

victimgatewayattackerspoofed ARP

SYNapse

2025

A modular man-in-the-middle toolkit: ARP spoofing, DNS spoofing and packet manipulation.

Python · Scapy · NetfilterQueue
Role
Solo
Modes
spoof, mitm, dns_spoof
Platform
Linux, iptables
Version
0.1.0
Distribution
PyPI

Overview

SYNapse is an educational toolkit for hands-on experience with fundamental network security concepts. It moves beyond high-level frameworks to the direct crafting and manipulation of network packets, giving deep insight into how protocols like ARP, DNS and HTTP work, and how they can be subverted.

It is built with a modular architecture and intended for security researchers, students and network professionals in controlled lab environments.

Problem

ARP and DNS spoofing are easy to describe and hard to picture. I wanted to watch them happen at the packet level, so I built the tools myself instead of using an existing framework.

Approach

SYNapse is a Python command-line tool built on Scapy, with each attack as its own mode. spoof poisons the ARP caches of a target and its gateway, mitm adds live sniffing on top, and dns_spoof forges DNS responses for a chosen domain.

On Linux, iptables sends forwarded packets to NetfilterQueue, which hands them to Python to inspect, modify or drop before they continue.

Outcome

Version 0.1.0 has working ARP spoofing, man-in-the-middle and DNS spoofing modes, plus a sniffer with BPF filters. It's published on PyPI as synapse-toolkit, for use in labs on networks you're authorized to test.

Next

HTTP manipulation, automatic setup and teardown of the iptables rules, and support beyond Linux.

clientapimysql' OR 1=1 --

Build It, Break It

2025

A full-stack app with token auth, built and then broken with SQL injection.

Next.js · Express · MySQL · sqlmap
Role
Solo
Target
Next.js client, Express + MySQL API
Auth
Token based
Tool
sqlmap
Result
Full database access

Overview

This project was a way to understand full-stack security interactively. I first built a full-stack MySQL and Next.js application with token authentication and a REST API. Once it was running, my goal was to exploit it through basic vulnerabilities that were purposely left open.

Problem

None of my apps had ever been attacked. I wanted to see them the way an attacker does, so I built an ordinary full-stack app and then broke into it.

Approach

The app is a Next.js frontend and REST API over MySQL, with token-based authentication. Once it was running, I left some vulnerabilities in on purpose and attacked the login route from outside with sqlmap.

Outcome

Using sqlmap, I gained complete access to the database from the outside. At first the app was too secure for the tool to work: I had to remove the login route's parameter checking to let malicious input reach the database. The lesson was thoroughness in backend SQL code: always use a function that takes a query and parameters, never just a query.

Next

Try other attack classes on the same app, such as cross-site scripting and broken authentication, then patch each one and confirm the attack stops working.

Experience

  1. 2026 — Now

    Design Team Member at QMIND

    Research on the QMIND design team, testing whether CLIP's idea of a word matches what people can actually see.

    • Visibility Thresholds research: does CLIP hold visual concepts humans recognize?
    • Presented the MVP at Camp QMIND to sponsor and faculty judges
  2. 2025 — 2026

    Freelance Full-Stack Developer

    Websites for local businesses and creatives, built and deployed end to end.

    • Photography, videography, coaching and archive sites for local clients
    • Next.js on Vercel, serverless backends on Google Cloud and Firebase
    • Owned each build end to end: scope, design, deployment, DNS, SEO
  3. 2025 — 2029

    Bachelor of Computing and Mathematics (Honours) at Queen's University

    Computing and Mathematics (COMA) major.

Coursework

Winter 2027 · next term

  • MATH 281
    Introduction to Real Analysis
  • MATH 212
    Linear Algebra II
  • STAT 269
    Statistics and Probability II
  • CISC 235
    Data Structures
  • CISC 221
    Computer Architecture
  • CISC 223
    Software Specifications

Fall 2026 · in progress

  • CISC 203
    Discrete Structures II

    Sets, relations and functions, number theory, groups and combinatorics.

  • CISC 204
    Logic for Computing Science

    Proof systems for propositional and predicate logic, satisfiability, soundness and completeness.

  • MATH 221
    Vector Calculus

    Multiple integrals, vector fields, line and flux integrals, and the theorems of Green, Gauss and Stokes.

  • STAT 268
    Statistics and Probability I

    Random variables, distributions, expectation and moment-generating functions.

2025–26

  • CISC 124
    Introduction to Computing Science II

    Object-oriented programming in Java.

  • CISC 121
    Introduction to Computing Science I

    Programming in Python, with searching and sorting algorithms.

  • STAT 161
    Introduction to Data Science and Statistics

    Data analysis and statistics in Python and Jupyter.

  • CISC 102
    Discrete Structures I

Smaller things 13

Tools I use

Languages
Python, TypeScript, Java
ML
PyTorch, FastAI, NumPy, Pandas, scikit-learn
Backend
FastAPI, Node.js, Redis, Docker, MySQL, MongoDB
Frontend
Next.js, React, Tailwind CSS
Cloud
Google Cloud, Firebase, Vercel, Hugging Face

Contact

Email is the best way to reach me.