# armistice-ml/poetes-finetuning-mistral architecture

> Architecture diagram of the GitHub repository armistice-ml/poetes-finetuning-mistral, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/armistice-ml/poetes-finetuning-mistral
- Repository: https://github.com/armistice-ml/poetes-finetuning-mistral

## Overview

This repository documents an end-to-end workflow for adapting Mistral 7B to French nineteenth-century poetry: prepare and split poetry examples, fine-tune with QLoRA, evaluate the result, and generate prompted poems. The README is the only evidence for these relationships; notebook implementation details were not available for inspection. The training and validation datasets are present, while the trained adapters are hosted externally.

Main entry points: [`data/val.jsonl`](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/data/val.jsonl) (Validation examples), [`notebook.ipynb`](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb) (QLoRA training), [`data/train.jsonl`](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/data/train.jsonl) (Training examples)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_gutenberg["Gutenberg texts"]
  node_data_prep["Corpus preparation<br/>[notebook.ipynb]"]
  node_prompt_creation["Prompt creation<br/>[notebook.ipynb]"]
  node_train_split["Training examples<br/>[train.jsonl]"]
  node_val_split["Validation examples<br/>[val.jsonl]"]
end

subgraph group_training["Model adaptation"]
  node_base_model["Quantized Mistral"]
  node_qlora_training["QLoRA training<br/>[notebook.ipynb]"]
  node_adapters["LoRA adapters"]
end

subgraph group_evaluation["Evaluation"]
  node_perplexity["Perplexity evaluation<br/>[notebook.ipynb]"]
  node_generation_comparison["Generation comparison<br/>[notebook.ipynb]"]
  node_copy_check["Copy detection<br/>[notebook.ipynb]"]
  node_author_conditioning["Author conditioning<br/>[notebook.ipynb]"]
end

subgraph group_inference["Poem generation"]
  node_huggingface["Hugging Face"]
  node_poem_generation["Prompted generation<br/>[notebook.ipynb]"]
  node_generated_poem["Generated poem"]
end

node_author(("Prompt author"))

node_gutenberg -->|"provides texts"| node_data_prep
node_data_prep -->|"prepares excerpts"| node_prompt_creation
node_prompt_creation -->|"forms examples"| node_train_split
node_prompt_creation -->|"forms examples"| node_val_split
node_train_split -->|"trains on"| node_qlora_training
node_val_split -->|"validates on"| node_qlora_training
node_base_model -->|"provides weights"| node_qlora_training
node_qlora_training -->|"produces"| node_adapters
node_val_split -->|"scores"| node_perplexity
node_base_model -->|"baseline scores"| node_perplexity
node_adapters -->|"scores after tuning"| node_perplexity
node_train_split -->|"checks copied verses"| node_copy_check
node_val_split -->|"provides prompts"| node_generation_comparison
node_base_model -->|"generates baseline"| node_generation_comparison
node_adapters -->|"generates tuned poems"| node_generation_comparison
node_val_split -->|"tests author prompts"| node_author_conditioning
node_base_model -->|"scores prompts"| node_author_conditioning
node_author -->|"requests poem"| node_poem_generation
node_huggingface -->|"hosts"| node_adapters
node_base_model -->|"provides base"| node_poem_generation
node_adapters -->|"conditions generation"| node_poem_generation
node_poem_generation -->|"returns poem"| node_generated_poem

click node_data_prep "https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb"
click node_prompt_creation "https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb"
click node_train_split "https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/data/train.jsonl"
click node_val_split "https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/data/val.jsonl"
click node_qlora_training "https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb"
click node_perplexity "https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb"
click node_generation_comparison "https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb"
click node_copy_check "https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb"
click node_author_conditioning "https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb"
click node_poem_generation "https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gutenberg,node_data_prep,node_prompt_creation,node_train_split,node_val_split toneBlue
class node_base_model,node_qlora_training,node_adapters toneAmber
class node_perplexity,node_generation_comparison,node_copy_check,node_author_conditioning toneMint
class node_huggingface,node_poem_generation,node_generated_poem toneRose
class node_author toneIndigo
```

## Components

### Data preparation

- **Gutenberg texts**
- [Corpus preparation](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb): `notebook.ipynb`
- [Prompt creation](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb): `notebook.ipynb`
- [Training examples](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/data/train.jsonl): `data/train.jsonl`
- [Validation examples](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/data/val.jsonl): `data/val.jsonl`

### Model adaptation

- **Quantized Mistral**
- [QLoRA training](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb): `notebook.ipynb`
- **LoRA adapters**

### Evaluation

- [Perplexity evaluation](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb): `notebook.ipynb`
- [Generation comparison](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb): `notebook.ipynb`
- [Copy detection](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb): `notebook.ipynb`
- [Author conditioning](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb): `notebook.ipynb`

### Poem generation

- **Hugging Face**
- [Prompted generation](https://github.com/armistice-ml/poetes-finetuning-mistral/blob/main/notebook.ipynb): `notebook.ipynb`
- **Generated poem**

### Other components

- **Prompt author**

## Connections

- Gutenberg texts → Corpus preparation: provides texts (evidence: `README.md`)
- Corpus preparation → Prompt creation: prepares excerpts (evidence: `README.md`)
- Prompt creation → Training examples: forms examples (evidence: `README.md`)
- Prompt creation → Validation examples: forms examples (evidence: `README.md`)
- Training examples → QLoRA training: trains on (evidence: `README.md`)
- Validation examples → QLoRA training: validates on (evidence: `README.md`)
- Quantized Mistral → QLoRA training: provides weights (evidence: `README.md`)
- QLoRA training → LoRA adapters: produces (evidence: `README.md`)
- Validation examples → Perplexity evaluation: scores (evidence: `README.md`)
- Quantized Mistral → Perplexity evaluation: baseline scores (evidence: `README.md`)
- LoRA adapters → Perplexity evaluation: scores after tuning (evidence: `README.md`)
- Training examples → Copy detection: checks copied verses (evidence: `README.md`)
- Validation examples → Generation comparison: provides prompts (evidence: `README.md`)
- Quantized Mistral → Generation comparison: generates baseline (evidence: `README.md`)
- LoRA adapters → Generation comparison: generates tuned poems (evidence: `README.md`)
- Validation examples → Author conditioning: tests author prompts (evidence: `README.md`)
- Quantized Mistral → Author conditioning: scores prompts (evidence: `README.md`)
- Prompt author → Prompted generation: requests poem (evidence: `README.md`)
- Hugging Face → LoRA adapters: hosts (evidence: `README.md`)
- Quantized Mistral → Prompted generation: provides base (evidence: `README.md`)
- LoRA adapters → Prompted generation: conditions generation (evidence: `README.md`)
- Prompted generation → Generated poem: returns poem (evidence: `README.md`)
