Skip to content

Commit fbfa925

Browse files
committed
2 parents 3188ac6 + cd7fd17 commit fbfa925

10 files changed

Lines changed: 2831 additions & 50 deletions

File tree

Lines changed: 340 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,340 @@
1+
# Guidelines for Declaring the Use of Large Language Models in Project Reports
2+
3+
**Course:** Advanced Machine Learning (FYS5429/9429 University of Oslo)
4+
**Applies to:** All written project reports and submitted code. It applies to those of you who have opted for one project only and for the second project (only) for those of you who opted for two projects. It is not compulsory to include such a declaration, but we recommend doing so.
5+
6+
---
7+
8+
## 1. Preamble
9+
10+
Large language models (LLMs) such as ChatGPT, Claude, GitHub Copilot, Gemini, and similar tools are
11+
permitted and even encouraged in this course. They are powerful aids for writing code, exploring
12+
unfamiliar concepts, drafting text, and correcting language.
13+
14+
However, **using an LLM does not reduce your intellectual responsibility for what you submit.**
15+
Every result, derivation, code block, and argument in your report must be something you understand,
16+
can defend, and have verified. An LLM can hallucinate plausible-sounding but wrong equations,
17+
incorrect references, and subtly broken code. Catching and correcting such errors is itself part
18+
of the learning process and is your responsibility.
19+
20+
The declaration requirements below are designed to be:
21+
22+
- **lightweight** — a short, structured appendix, not an essay,
23+
- **specific** — tied to concrete tasks, not vague,
24+
- **honest** — a genuine record of how the tool shaped the work.
25+
26+
---
27+
28+
## 2. General Principles
29+
30+
**Principle 1 — Transparency.**
31+
Any significant use of an LLM must be declared. "Significant" means the LLM contributed content,
32+
logic, or structure that appears in the final submission, not merely that you consulted it for
33+
background reading you then independently summarised.
34+
35+
**Principle 2 — Ownership.**
36+
You are the author of your report. LLMs are tools, like a compiler, a spell-checker, or a
37+
textbook. Declaring their use is analogous to citing a reference — it does not diminish your
38+
authorship; concealing it does.
39+
40+
**Principle 3 — Verifiability.**
41+
Any code generated or substantially assisted by an LLM must be tested, understood, and commented
42+
by you. Any text written or heavily revised by an LLM must be read, understood, and endorsed by
43+
you. If you cannot explain a piece of code or a paragraph in your own words during a potential
44+
oral follow-up, it should not be in the report.
45+
46+
**Principle 4 — Scientific integrity.**
47+
Do not ask an LLM to fabricate results, invent references, or make up numerical values. If you
48+
use an LLM to help find references, verify every citation against the actual source before
49+
including it.
50+
51+
---
52+
53+
## 3. What Must Be Declared
54+
55+
The table below maps task types to the required level of declaration.
56+
57+
| Task | Declaration required? | Where to declare |
58+
|---|---|---|
59+
| Spell-checking / grammar correction | Yes (brief) | Appendix, one line |
60+
| Rephrasing for clarity (minor) | Yes (brief) | Appendix, one line |
61+
| Structural editing (reorganising sections, rewriting paragraphs) | Yes (detailed) | Appendix, per section |
62+
| Drafting an entire section from a prompt | Yes (detailed) | Appendix + inline note |
63+
| Generating a code skeleton or template | Yes | Code comment + Appendix |
64+
| Debugging code (LLM identified the bug) | Yes | Code comment |
65+
| Generating a complete function or class | Yes | Docstring + Appendix |
66+
| Explaining a concept you then summarised in your own words | No ||
67+
| Literature search (you verified all citations) | No ||
68+
| Brainstorming project ideas (you chose and developed them) | No ||
69+
70+
---
71+
72+
## 4. How to Declare: The LLM Appendix
73+
74+
Add a dedicated appendix section titled **"Appendix: Use of AI/LLM Tools"** at the end of your
75+
report (before the reference list, or after — be consistent). The appendix must contain the
76+
following subsections where applicable.
77+
78+
### 4.1 Tools Used
79+
80+
List every LLM tool used in the project.
81+
82+
**Template:**
83+
84+
```
85+
Tools used: [Tool name, version or access date, access method]
86+
87+
Example:
88+
- ChatGPT (GPT-4o, accessed via chat.openai.com, January–May 2026)
89+
- Claude (Claude Sonnet, accessed via claude.ai, February 2026)
90+
- GitHub Copilot (integrated in VS Code, throughout the project)
91+
```
92+
93+
### 4.2 Text Writing and Editing
94+
95+
For each section of the report, state the role the LLM played using one of the four
96+
**contribution levels** defined below.
97+
98+
**Contribution levels:**
99+
100+
| Level | Label | Meaning |
101+
|---|---|---|
102+
| 0 | None | No LLM assistance |
103+
| 1 | Language only | Spell-check, grammar, minor phrasing |
104+
| 2 | Editorial | LLM rewrote or restructured sentences/paragraphs; you supplied all ideas and checked the result |
105+
| 3 | Generative | LLM drafted substantial text from your prompts; you revised, verified, and took ownership |
106+
107+
**Template:**
108+
109+
```
110+
Section | LLM contribution level | Notes
111+
---------------------|------------------------|------------------------------
112+
Abstract | 1 | Grammar check only
113+
Introduction | 2 | Rephrased two paragraphs for clarity
114+
Theory / Methods | 0 | Written independently
115+
Results | 0 | Written independently
116+
Discussion | 2 | LLM suggested reorganisation of Sec. 4.2
117+
Conclusion | 1 | Minor language corrections
118+
```
119+
120+
If any section is Level 3, add a sentence describing what prompt(s) you used and what changes
121+
you made to the LLM output.
122+
123+
**Example (Level 3 note):**
124+
125+
> *Section 2.3 (Variational Autoencoder loss derivation):* I prompted Claude with "Explain the
126+
> ELBO derivation for a VAE at graduate level, assuming the reader knows KL divergence." The
127+
> output was used as a starting point; I rewrote the notation to match the rest of the report,
128+
> corrected a sign error in equation (7), and added the connection to our specific encoder
129+
> architecture.
130+
131+
### 4.3 Code Generation and Assistance
132+
133+
For each code file or notebook submitted, state the LLM's role using the levels below.
134+
135+
**Code contribution levels:**
136+
137+
| Level | Label | Meaning |
138+
|---|---|---|
139+
| 0 | None | No LLM assistance |
140+
| 1 | Debugging | LLM helped identify a bug; fix implemented by you |
141+
| 2 | Snippet | LLM provided a function, loop, or short block; you integrated and tested it |
142+
| 3 | Skeleton | LLM generated the overall structure of a script/class; you filled in domain-specific logic |
143+
| 4 | Substantial | LLM wrote the majority of a file; you adapted, tested, and commented it |
144+
145+
**Template:**
146+
147+
```
148+
File / notebook | LLM level | Description
149+
--------------------------|-----------|----------------------------------------------
150+
train.py | 2 | LLM provided the learning rate scheduler loop;
151+
| | tested and adapted for our NTK experiment
152+
autoencoder.ipynb | 3 | LLM generated class skeleton for ConvAE;
153+
| | encoder/decoder architecture designed by us
154+
utils/ntk_compute.py | 0 | Written independently
155+
results/plot_figures.py | 1 | LLM debugged an indexing error in the
156+
| | eigenvalue sorting routine
157+
```
158+
159+
Additionally, **every LLM-generated or LLM-assisted function must carry an inline comment** in
160+
the source code itself (see Section 5).
161+
162+
---
163+
164+
## 5. In-Code Documentation Standards
165+
166+
### 5.1 Function-level docstring tag
167+
168+
For any function where the LLM contributed at Level 2 or above, add a `LLM-assisted` tag to
169+
the docstring, stating the tool and a brief description of what it did.
170+
171+
**Python example:**
172+
173+
```python
174+
def compute_ntk_gram(model, X, device="cpu"):
175+
"""
176+
Compute the empirical Neural Tangent Kernel (NTK) Gram matrix
177+
for a given model and input data X.
178+
179+
Parameters
180+
----------
181+
model : torch.nn.Module
182+
The neural network (should be in eval mode).
183+
X : torch.Tensor, shape (N, d)
184+
Input data matrix.
185+
device : str
186+
Torch device string.
187+
188+
Returns
189+
-------
190+
K : torch.Tensor, shape (N, N)
191+
NTK Gram matrix.
192+
193+
LLM-assisted
194+
------------
195+
Tool: GitHub Copilot (March 2026)
196+
Role: Generated the Jacobian accumulation loop using torch.autograd.functional.jacobian.
197+
Modifications: Added batching over inputs to avoid OOM on GPU; verified output against
198+
finite-difference approximation on a two-layer network.
199+
"""
200+
...
201+
```
202+
203+
**Fortran example:**
204+
205+
```fortran
206+
! LLM-assisted: Claude (Feb 2026) suggested the recursive NTK kernel
207+
! evaluation structure. Loop bounds and array indexing corrected by author.
208+
! Verified against Python reference implementation.
209+
SUBROUTINE compute_ntk_kernel(X1, X2, depth, sigma_w, sigma_b, K_out)
210+
...
211+
END SUBROUTINE
212+
```
213+
214+
**C++ example:**
215+
216+
```cpp
217+
/**
218+
* Computes the NTK covariance kernel Sigma^{(L)} recursively.
219+
*
220+
* LLM-assisted: ChatGPT (GPT-4o, April 2026) generated the base
221+
* template for the recursive lambda evaluation. The Gaussian quadrature
222+
* integration was replaced by the author with a Gauss-Hermite scheme
223+
* appropriate for the activation function used.
224+
*/
225+
double compute_sigma(double x, double xp, int depth,
226+
double sigma_w, double sigma_b);
227+
```
228+
229+
### 5.2 Inline comments for specific LLM-generated blocks
230+
231+
For blocks shorter than a full function (e.g., a data-loading one-liner, a regex, a plotting
232+
snippet), add a short inline comment:
233+
234+
```python
235+
# LLM (Copilot): suggested this vectorised einsum formulation; verified correctness.
236+
K = torch.einsum('ij,kj->ik', J, J)
237+
```
238+
239+
### 5.3 Jupyter notebook cells
240+
241+
In Jupyter notebooks, add a Markdown cell immediately above any LLM-assisted code cell with a
242+
brief declaration:
243+
244+
```markdown
245+
> **LLM note:** The following cell was generated with Claude assistance (Level 3 skeleton).
246+
> The diffusion forward process loop was written by the LLM; the noise schedule and the
247+
> DDPM sampling loop were implemented independently.
248+
```
249+
250+
---
251+
252+
## 6. A Minimal Complete Example
253+
254+
Below is a self-contained example of how the LLM appendix might look in a real report.
255+
256+
---
257+
258+
### Appendix A: Use of AI/LLM Tools
259+
260+
**A.1 Tools used**
261+
262+
- Claude Sonnet (claude.ai, accessed February–May 2026)
263+
- GitHub Copilot (VS Code extension, throughout the project)
264+
265+
**A.2 Text contributions**
266+
267+
| Section | Level | Notes |
268+
|---|---|---|
269+
| Abstract | 1 | Grammar check |
270+
| 1. Introduction | 0 ||
271+
| 2. Theory | 2 | Section 2.4 (NTK recursion): LLM reformatted equations for readability |
272+
| 3. Methods | 0 ||
273+
| 4. Results | 0 ||
274+
| 5. Discussion | 2 | LLM suggested restructuring paragraph order in Sec. 5.2 |
275+
| 6. Conclusion | 1 | Minor grammar corrections |
276+
277+
*Level 2 note, Section 2.4:* I gave Claude the recursion from Jacot et al. (2018) and asked it
278+
to rewrite it in notation consistent with Section 2.1 of this report. I checked every equation
279+
against the original paper.
280+
281+
**A.3 Code contributions**
282+
283+
| File | Level | Description |
284+
|---|---|---|
285+
| `src/ntk.py` | 3 | Copilot generated Jacobian loop; NTK recursion and verification code written independently |
286+
| `src/train_vae.py` | 2 | Copilot autocompleted the KL annealing scheduler; adapted to our $\beta$-schedule |
287+
| `notebooks/results.ipynb` | 1 | Copilot debugged a matplotlib axis-label bug |
288+
| `src/utils.py` | 0 | Fully independent |
289+
290+
---
291+
292+
## 7. Frequently Asked Questions
293+
294+
**Q: I used an LLM to explain a concept in a textbook, then wrote the theory section myself. Do I need to declare this?**
295+
No. Using an LLM as an interactive textbook or tutor, when the final writing is entirely your
296+
own, is not different from reading Wikipedia or a review article. No declaration needed.
297+
298+
**Q: Copilot autocompletes almost everything I type. Must I declare every autocomplete?**
299+
No — single-line autocompletes of boilerplate (import statements, obvious variable names) need
300+
not be declared individually. Declare at Level 1 ("Copilot used throughout for autocompletion")
301+
in Section A.1. Any multi-line or logically non-trivial suggestion you accepted should be noted
302+
at the file level in the code table.
303+
304+
**Q: What if I used the LLM heavily and the contribution is genuinely hard to separate?**
305+
Be honest and say so. Write something like: "Substantial LLM assistance throughout; all code
306+
was tested, all derivations verified, all text read and understood by the author." This is
307+
acceptable — concealment is not.
308+
309+
**Q: Can I paste in LLM-generated code if I do not understand it?**
310+
No. Understanding what you submit is a core requirement. If you cannot explain a piece of code,
311+
do not submit it. Use the LLM output as a learning resource, then rewrite it yourself.
312+
313+
**Q: What happens if I do not declare LLM use?**
314+
Undeclared LLM use that is later identified will be treated as a violation of the University
315+
of Oslo's academic integrity policy, in the same way as plagiarism from any other source.
316+
317+
**Q: Does heavy LLM use lower my grade?**
318+
No, provided you demonstrate understanding. The grade reflects the quality of the science,
319+
the correctness of the implementation, the clarity of the analysis, and your ability to
320+
discuss the work. How you produced it matters less than what you produced and what you
321+
understand.
322+
323+
---
324+
325+
## 8. Summary Checklist
326+
327+
Before submitting your report, verify the following:
328+
329+
- [ ] Appendix section "Use of AI/LLM Tools" is present
330+
- [ ] All LLM tools used are listed with name and approximate dates
331+
- [ ] Every section of the report has a declared contribution level (0–3)
332+
- [ ] Level 3 sections have a brief prompt/modification note
333+
- [ ] All LLM-assisted functions have a `LLM-assisted` tag in their docstring
334+
- [ ] LLM-generated code blocks have inline comments
335+
- [ ] Jupyter notebooks have Markdown declaration cells above assisted code cells
336+
- [ ] All cited references have been verified against the actual source
337+
- [ ] You can explain every equation, result, and code block in your own words
338+
339+
---
340+

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ Analysis and Machine Learning, spanning from weekly plans to lecture
55
material and various reading assignments. The emphasis is on deep
66
learning algorithms, starting with the mathematics of neural networks
77
(NNs), moving on to convolutional NNs (CNNs) and recurrent NNs (RNNs),
8-
autoencoders, transformers, graph neural networks and other dimensionality reduction methods to finally
9-
discuss generative methods. These will include Boltzmann machines,
10-
variational autoencoders, generalized adversarial networks, diffusion methods and other.
11-
Reinforcement learning is another topic which can be covered if there is enough interest.
8+
autoencoders, transformers, graph neural networks and other
9+
dimensionality reduction methods to finally discuss generative
10+
methods. These will include Boltzmann machines, variational
11+
autoencoders, generalized adversarial networks, diffusion methods and
12+
other.
13+
1214

1315
![alt text](https://github.com/CompPhysics/AdvancedMachineLearning/blob/main/doc/images/image001.jpg?raw=true)
1416

@@ -42,7 +44,7 @@ Reinforcement learning is another topic which can be covered if there is enough
4244

4345

4446
### Reinforcement Learning
45-
- Basics of reinforcement learning (more to be added)
47+
- Basics of reinforcement learning will be covered by an upcoming course planned for spring 2027
4648

4749
### Physical Sciences (often just called Physics informed) informed machine learning
4850
- Basic set up of PINNs with discussion of projects
@@ -196,8 +198,10 @@ https://github.com/CompPhysics/AdvancedMachineLearning/blob/main/doc/pub/week1/i
196198
- Thursday May 14 is a public holiday in Norway, no lecture
197199

198200
## May 18-22: Discussion of projects
199-
- GANs, firs lecture, see slides from week 15 at https://github.com/CompPhysics/AdvancedMachineLearning/blob/main/doc/pub/week15/pdf/week15.pdf
200-
- Summary slides at https://github.com/CompPhysics/AdvancedMachineLearning/blob/main/doc/pub/week16/ipynb/week16.ipynb
201+
- GANs, first lecture
202+
- Summary slides at https://github.com/CompPhysics/AdvancedMachineLearning/blob/main/doc/pub/week16/pdf and jupyter-notebook https://github.com/CompPhysics/AdvancedMachineLearning/blob/main/doc/pub/week16/ipynb
203+
- Video of lecture at https://youtu.be/DPtSJyBzPPE
204+
- Whiteboard notes at https://github.com/CompPhysics/AdvancedMachineLearning/blob/main/doc/HandwrittenNotes/2026/Notesweek16.pdf
201205

202206

203207
## Recommended textbooks:
684 KB
Binary file not shown.

doc/pub/week15/.DS_Store

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)