This repository contains the code and experiments for Work Package 2 (WP2) of an Engineering Doctorate (EngD) research project at Eindhoven University of Technology (TU/e), in collaboration with Woonbedrijf.
The goal is to generate human-like synthetic Dutch Facebook comments in response to housing association posts, using fine-tuned large language models. Generated comments are evaluated against a hand-labelled test set on three qualitative authenticity dimensions: sentiment, intent, and relatedness to the post.
Three instruction-tuned language models are the primary focus:
| Model | Type |
|---|---|
Llama-3.2-3B-Instruct |
Instruction-tuned |
Gemma-4B-IT |
Instruction-tuned |
Fietje-2.7-IT |
Instruction-tuned (Dutch) |
Experimental:
Qwen-4B(base chat model) is additionally instruction fine-tuned as an exploratory baseline outside the main comparison.
No fine-tuning. A Dutch tenant persona is prompted with 3 real comment examples, the post, and a word-count range sampled from the empirical length distribution of the training set. Establishes the upper bound achievable without parameter updates.
LoRA fine-tuning with CLM loss. The system prompt explicitly states three evaluation criteria (sentiment, intent, relatedness). A 4-category length label derived from real comment word counts is injected at train and inference time:
zeer kort ≤5 · kort ≤12 · gemiddeld ≤25 · lang >25
Identical setup to Approach 2, but with auxiliary loss heads added at training time:
where $\mathcal{L}{sent}$, $\mathcal{L}{intent}$ are cross-entropy and
All approaches evaluated on a held-out test set of 208 hand-labelled comments across three dimensions:
| Dimension | Metric |
|---|---|
| Sentiment | JS Divergence |
| Intent | JS Divergence |
| Relatedness | JS Divergence |
Target threshold: JS Distance < 0.15.
| Total | Train | Val | Test |
|---|---|---|---|
| 3,594 | 2,875 | 719 | 208 |
WP2_Simulation_Tool/
│
├── Few Shot Prompt/
│ ├── llama/ # Few-shot generation code for Llama
│ ├── gemma/ # Few-shot generation code for Gemma
│ └── fietje/ # Few-shot generation code for Fietje
│
├── Fine_Tune_LLAMA/
│ ├── code/ # Fine-tuning + generation scripts
│ ├── objective/ # Results: sentiment, intent, relatedness plots (Approach 2)
│ └── multiloss/ # Results: sentiment, intent, relatedness plots (Approach 3)
│
├── Fine Tune gemma/
│ ├── code/
│ ├── objective/
│ └── multiloss/
│
├── Fine_tune_fietje/
│ ├── code/
│ ├── objective/
│ └── multiloss/
│
├── Fine_tune_qwen/ # Experimental: Qwen-4B base chat model, instruction fine-tuned
│
├── Generation and Evaluation/ # Shared generation + evaluation pipeline
├── analysis/ # JS Divergence tables and cross-model comparison outputs
├── data/ # Raw and processed data (excluded from repo)
├── templates/ # Prompt templates
├── utils/ # Shared utility functions
│
├── .gitignore
└── README.md
pip install -r requirements.txtCreate a .env file with your HuggingFace token:
HF_TOKEN=your_token_here
This work is part of an EngD thesis in the Built Environment department at TU/e, applying NLP to tenant engagement and energy transition communication in Dutch social housing.