<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Johann Hagerer on Medium]]></title>
        <description><![CDATA[Stories by Johann Hagerer on Medium]]></description>
        <link>https://medium.com/@jhagerer?source=rss-1004faad4c7b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*52iAk2O-ljnRx-6-232jRA.jpeg</url>
            <title>Stories by Johann Hagerer on Medium</title>
            <link>https://medium.com/@jhagerer?source=rss-1004faad4c7b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 13:22:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jhagerer/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[LLM Coding Concepts: Static Typing, Structured Output, and AsyncIO]]></title>
            <link>https://medium.com/@jhagerer/llm-coding-concepts-static-typing-structured-output-and-asyncio-d37df3a9fea2?source=rss-1004faad4c7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d37df3a9fea2</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[agentic-workflow]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[workflow-automation]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Johann Hagerer]]></dc:creator>
            <pubDate>Sat, 06 Sep 2025 10:03:20 GMT</pubDate>
            <atom:updated>2025-11-14T08:40:30.523Z</atom:updated>
            <content:encoded><![CDATA[<h4>Coding concepts you need for writing LLM workflow automations in Python.</h4><p>Modern LLM applications require robust, type-safe code that can efficiently handle structured data and asynchronous operations. This article explores essential Python concepts that form the foundation of professional LLM development, from basic type annotations to advanced async patterns. Understanding these concepts is crucial for building reliable AI systems that can validate inputs, generate structured outputs, and scale effectively. Whether you’re creating tool-calling agents or processing large datasets, these patterns will help you write cleaner, more maintainable code.</p><h4>Table of Contents</h4><ul><li><a href="https://medium.com/@jhagerer/llm-coding-concepts-static-typing-structured-output-and-asyncio-d37df3a9fea2#7e1f">Type Annotations and static typing with mypy</a></li><li><a href="https://medium.com/@jhagerer/llm-coding-concepts-static-typing-structured-output-and-asyncio-d37df3a9fea2#72c7">LLM structured output with Pydantic and JSON schema</a></li><li><a href="https://medium.com/@jhagerer/llm-coding-concepts-static-typing-structured-output-and-asyncio-d37df3a9fea2#6cee">Asynchronous programming with AsyncIO</a></li><li><a href="https://medium.com/@jhagerer/llm-coding-concepts-static-typing-structured-output-and-asyncio-d37df3a9fea2#19cb">Create Pydantic BaseModels for Python Functions</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*QAguZjs5buT1-I3BkVi2pw.png" /><figcaption>Common design patterns for LLM agents and workflows that benefit from static typing, LLM structured output, and asynchronous programming. Taken from: <a href="https://shawhin.medium.com/llm-workflows-from-automation-to-ai-agents-a62f96a0f89a">LLM Workflows: From Automation to AI Agents | by Shaw Talebi | Medium</a></figcaption></figure><h3><strong>Type Annotations</strong></h3><p>Here’s how to define a basic function with type annotations for parameters and return value:</p><pre>def add_numbers(a: int, b: int) -&gt; int:<br>    return a + b</pre><p>You can use complex nested types like dictionaries containing lists for more sophisticated data structures:</p><pre>def process_data(data: dict[str, list[int]]) -&gt; dict[str, float]:<br>    return {key: sum(values) / len(values) for key, values in data.items()}</pre><p>The typing module provides advanced types like TypedDict for structured dictionaries and Literal for restricted string values:</p><pre>from typing import Any, Literal, TypedDict<br>class UserConfig(TypedDict):<br>    name: str<br>    age: int<br>    role: Literal[&quot;admin&quot;, &quot;user&quot;, &quot;guest&quot;]<br>def process_user(config: UserConfig, metadata: Any) -&gt; str:<br>    return f&quot;{config[&#39;name&#39;]} ({config[&#39;role&#39;]})&quot;</pre><p>You can run type checking using mypy directly on files or through pre-commit hooks:</p><pre>mypy &lt;filepath&gt;     # calls mypy on file<br>uv run pre-commit   # calls mypy and ruff in the project</pre><h4><strong>Structured LLM Outputs</strong></h4><p>Pydantic BaseModel classes provide data validation and parsing from JSON strings:</p><pre>from pydantic import BaseModel<br>class Person(BaseModel):<br>    name: str<br>    age: int<br>    email: str<br># Parsing<br>json_data = &#39;{&quot;name&quot;: &quot;Anna&quot;, &quot;age&quot;: 30, &quot;email&quot;: &quot;anna@example.com&quot;}&#39;<br>person = Person.model_validate_json(json_data)</pre><p>Pydantic models can generate JSON schemas for API documentation and validation:</p><pre>from pydantic import BaseModel<br>class Person(BaseModel):<br>    name: str<br>    age: int<br>    email: str<br># Generate schema<br>schema = Person.model_json_schema()<br>print(schema)<br># {&#39;type&#39;: &#39;object&#39;, &#39;properties&#39;: {&#39;name&#39;: {&#39;type&#39;: &#39;string&#39;}, ...}</pre><p>In order to guide the LLM on the extraction, you need to formulate promptsfor each field separately. In ontologies, you call these the competency questions:</p><pre>from pydantic import BaseModel, Field<br>class Person(BaseModel):<br>    &quot;&quot;&quot;A person is a human being with the denoted attributes.&quot;&quot;&quot;<br><br>    name: str = Field(..., description=&quot;Which is the name of the person?&quot;)<br>    age: int = Field(..., description=&quot;Which is the age of the person?&quot;)<br>    email: str = Field(..., description=&quot;Which is the email of the person?&quot;)<br><br># Generate schema<br>schema = Person.model_json_schema()<br>print(schema)<br># {&#39;type&#39;: &#39;object&#39;, &#39;properties&#39;: {&#39;name&#39;: {&#39;type&#39;: &#39;string&#39;}, ...}</pre><p>Snowflake Cortex Complete returns unstructured text when no schema is provided:</p><pre>import snowflake.cortex as cortex<br>response = cortex.Complete(<br>    model=&quot;llama3.1-8b&quot;,<br>    prompt=&quot;Describe a person named Max:&quot;,<br>    session=session<br>)<br>print(response)  # Unstructured text</pre><p>Adding a JSON schema to Snowflake Cortex Complete ensures structured, validated output:</p><pre>import snowflake.cortex as cortex<br>response = cortex.Complete(<br>    model=&quot;llama3.1-8b&quot;,<br>    prompt=&quot;Describe a person named Max:&quot;,<br>    json_schema=Person.model_json_schema(),<br>    session=session<br>)<br>person = Person.model_validate_json(response)</pre><h4><strong>Repository Structure</strong></h4><pre>project-name/<br>├── data/<br>│   ├── all_data.duckdb<br>│   ├── raw/<br>│   │   ├── document01.pdf<br>│   │   └── document02.pdf<br>│   ├── transformed/<br>│   │   ├── 01_extracted_texts.parquet<br>│   │   └── 02_texts_with_markup.parquet<br>├── llm_ops/<br>│   ├── helpers/<br>│   ├── steps/<br>│   │   ├── processing_step_1<br>│   │   │   ├── config.py<br>│   │   │   ├── base_model.py<br>│   │   │   └── run.py<br>│   │   └── processing_step_2 ....<br>│   └── workflows/<br>│      └── workflow_1<br>│         └── run.py<br>├── data_ops/<br>│   ├── helpers/<br>│   └── transformations/<br>│      ├── 01_extract_texts.py<br>│      └── 02_add_markup_to_texts.py<br>├── rest_api/<br>└── tests/</pre><p>You can either</p><h4><strong>Asyncio</strong></h4><p>Async functions are defined with the async keyword and must be awaited when called:</p><pre># sync function definition <br>def sync_function(x: int) -&gt; int:<br>    return x * 2<br><br># Async  function definition <br>async def async_function(x: int) -&gt; int:<br>    import asyncio<br>    await asyncio.sleep(0.1)<br>    return x * 2</pre><p>Async functions can be called from other async functions using await or from sync context using asyncio.run():</p><pre>async def main():<br>    # from an async function<br>    result = await async_function(5)<br>    print(result)<br><br># From normal sync context<br>if __name__ == &quot;__main__&quot;:<br>    import asyncio<br>    asyncio.run(main())</pre><p>You can call synchronous functions from async contexts using asyncio.to_thread() to avoid blocking:</p><pre>async def async_caller():<br>    # With asyncio.to_thread() for sync functions<br>    result1 = await asyncio.to_thread(sync_function, 5)<br>    return result1</pre><h3>Create Pydantic BaseModels for Python Functions</h3><p>Given that we have tool functions defined in Python which we want to make available to an LLM agent, we need to create the structured output information of the function signatures and parameter lists as Pydantic BaseModels and JSON Schemas. The following code should serve as a template for the respective conversion.</p><p>First we show the BaseModel of an add function and how its JSON schema looks like:</p><pre>from pydantic import BaseModel, Field, create_model, ConfigDict<br>import json<br><br>class add(BaseModel):<br>    &quot;&quot;&quot;Function add docstring.&quot;&quot;&quot;<br>    x: int<br>    y: int<br>json_schema_1 = add.model_json_schema()<br>print(json.dumps(json_schema_1, indent=2))</pre><pre>Output:<br>{<br>  &quot;description&quot;: &quot;Function add docstring.&quot;,<br>  &quot;properties&quot;: {<br>    &quot;x&quot;: {<br>      &quot;title&quot;: &quot;X&quot;,<br>      &quot;type&quot;: &quot;integer&quot;<br>    },<br>    &quot;y&quot;: {<br>      &quot;title&quot;: &quot;Y&quot;,<br>      &quot;type&quot;: &quot;integer&quot;<br>    }<br>  },<br>  &quot;required&quot;: [<br>    &quot;x&quot;,<br>    &quot;y&quot;<br>  ],<br>  &quot;title&quot;: &quot;add&quot;,<br>  &quot;type&quot;: &quot;object&quot;<br>}</pre><p>Now, we create actual implementations of the add function. Further, we implement a conversion from the function to an according dynamically created Pydantic BaseModel based on the function signature. We demonstrate that the JSON schema between the manually and dynamically generated BaseModels are identical.</p><pre>from typing import Callable, Union<br>import inspect<br><br>def add(x: int, y: int) -&gt; int:<br>    &quot;&quot;&quot;Function add docstring.&quot;&quot;&quot;<br>    return x + y<br><br>def subtract(x: int, y: int) -&gt; int:<br>    &quot;&quot;&quot;Function subtract docstring.&quot;&quot;&quot;<br>    return x - y<br><br>def get_basemodel_from_function(func: Callable) -&gt; type[BaseModel]:<br>    func_name = func.__name__<br>    docstr = inspect.getdoc(func)<br>    sig = inspect.signature(func)<br>    params = {param.name: (param.annotation, Field(...)) for param in sig.parameters.values()}<br>    Model = create_model(func_name, **params)<br>    Model.__doc__ = docstr<br>    return Model<br><br>FuncModel = get_basemodel_from_function(add)<br>json_schema_2 = FuncModel.model_json_schema()<br>assert json_schema_1 == json_schema_2<br># assert runs through successfully -&gt; JSON schemas are identical</pre><p>Eventually, we need a BaseModel which incorporates all tool calls, such that we can pass it to the LLM as structured output JSON schema:</p><pre>def create_tools(tools: list[Callable]) -&gt; type[BaseModel]:<br>    tool_models = tuple(get_basemodel_from_function(x) for x in tools)<br>    type_annotation = Union[tool_models]<br>    params = {&quot;tools&quot;: (type_annotation, Field(...))}<br>    config = ConfigDict(arbitrary_types_allowed=True)<br>    Model = create_model(&quot;ToolCalls&quot;, __config__=config, **params)<br>    return Model<br><br>ToolCalls = create_tools([add, subtract])<br>json_schema_3 = ToolCalls.model_json_schema()<br>print(json.dumps(json_schema_3, indent=2))</pre><pre>Output:<br><br>{<br>  &quot;$defs&quot;: {<br>    &quot;add&quot;: {<br>      &quot;description&quot;: &quot;Function add docstring.&quot;,<br>      &quot;properties&quot;: {<br>        &quot;x&quot;: {<br>          &quot;title&quot;: &quot;X&quot;,<br>          &quot;type&quot;: &quot;integer&quot;<br>        },<br>        &quot;y&quot;: {<br>          &quot;title&quot;: &quot;Y&quot;,<br>          &quot;type&quot;: &quot;integer&quot;<br>        }<br>      },<br>      &quot;required&quot;: [<br>        &quot;x&quot;,<br>        &quot;y&quot;<br>      ],<br>      &quot;title&quot;: &quot;add&quot;,<br>      &quot;type&quot;: &quot;object&quot;<br>    },<br>    &quot;subtract&quot;: {<br>      &quot;description&quot;: &quot;Function subtract docstring.&quot;,<br>      &quot;properties&quot;: {<br>        &quot;x&quot;: {<br>          &quot;title&quot;: &quot;X&quot;,<br>          &quot;type&quot;: &quot;integer&quot;<br>        },<br>        &quot;y&quot;: {<br>          &quot;title&quot;: &quot;Y&quot;,<br>          &quot;type&quot;: &quot;integer&quot;<br>        }<br>      },<br>      &quot;required&quot;: [<br>        &quot;x&quot;,<br>        &quot;y&quot;<br>      ],<br>      &quot;title&quot;: &quot;subtract&quot;,<br>      &quot;type&quot;: &quot;object&quot;<br>    }<br>  },<br>  &quot;properties&quot;: {<br>    &quot;tools&quot;: {<br>      &quot;anyOf&quot;: [<br>        {<br>          &quot;$ref&quot;: &quot;#/$defs/add&quot;<br>        },<br>        {<br>          &quot;$ref&quot;: &quot;#/$defs/subtract&quot;<br>        }<br>      ],<br>      &quot;title&quot;: &quot;Tools&quot;<br>    }<br>  },<br>  &quot;required&quot;: [<br>    &quot;tools&quot;<br>  ],<br>  &quot;title&quot;: &quot;ToolCalls&quot;,<br>  &quot;type&quot;: &quot;object&quot;<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d37df3a9fea2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Memory for LLM Agents]]></title>
            <link>https://medium.com/@jhagerer/memory-for-llm-agents-dcd514d5c2b3?source=rss-1004faad4c7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcd514d5c2b3</guid>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[llm-agent]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Johann Hagerer]]></dc:creator>
            <pubDate>Fri, 05 Sep 2025 23:04:51 GMT</pubDate>
            <atom:updated>2025-09-07T22:25:51.352Z</atom:updated>
            <content:encoded><![CDATA[<h3>Table of Contents</h3><ul><li><a href="https://medium.com/@jhagerer/memory-for-llm-agents-dcd514d5c2b3#5f4b">Short-Term vs. Long-Term Memory</a></li><li><a href="https://medium.com/@jhagerer/memory-for-llm-agents-dcd514d5c2b3#120f">Reflection</a></li><li><a href="https://medium.com/@jhagerer/memory-for-llm-agents-dcd514d5c2b3#3d77">How to Build LLM Long-Term Memory</a></li></ul><h3>Short-Term vs. Long-Term Memory</h3><p>There are two types of LLM memory: Short-term memory and long-term memory.</p><p>Short-term memory passes noteworthy information from prompt to prompt in an ongoing conversation.</p><p>Long-term memory holds information across sessions, e.g., about a user or about a workflow.</p><p>Source: <a href="https://www.bibsonomy.org/url/c05c01931ec4d0dece35a48a4b771edc">LangGraph Concepts — Memory</a></p><h3>Reflection</h3><p>Reflection is the ability of an LLM agent to review its own generated output, understand how it can improve itself, and correct its own prompts, contexts, and workflows. It means the LLMs ability to make changes to its own long-term memory.</p><p>See:</p><ul><li><a href="https://www.bibsonomy.org/url/b0912d845fafc3b01349160b4f53a9f2">LangChain Blog — Reflection Agents</a></li><li><a href="https://www.bibsonomy.org/bibtex/236ceeedebb8170e284902d7c6896844a/ghagerer">Reflexion: language agents with verbal reinforcement learning</a></li><li><a href="https://notebooklm.google.com/notebook/dcf7a443-a724-411c-91f5-26097e369de8/audio">AI podcast summary of the paper</a></li></ul><h3>How to Build LLM Long-Term Memory</h3><p>The simplest way is to provide a list of strings limited in length to the prompt at every step. The LLM can add new learnings to and thereby replace old ones from the list. That way it basically alters its own prompt. This is how it is done in the reflection paper.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*b1b7BbU2H14NjdbsJwJuOw.png" /><figcaption>Source: <a href="https://www.bibsonomy.org/url/c05c01931ec4d0dece35a48a4b771edc">LangGraph Concepts — Memory</a></figcaption></figure><p>A more sophisticated way is described in this paper:</p><p><a href="https://www.bibsonomy.org/bibtex/2a3f0d5b21f514eb03e08fe465f844efd/ghagerer">Generative Agents: Interactive Simulacra of Human Behavior.</a></p><p>This describes a recursive way to summarize, starting by generating a list of raw observations and clustering these to a shorter list of short topic descriptions. In the paper then this conforms to an actual human-like character, making an AI bot aware of its own daily habits, hobbies et cetera.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kqZrSmR9kTuRb-YQgj_u-Q.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcd514d5c2b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Knowledge Graph Creation Using LLMs]]></title>
            <link>https://medium.com/@jhagerer/knowledge-graphs-200d5c2cf243?source=rss-1004faad4c7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/200d5c2cf243</guid>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Johann Hagerer]]></dc:creator>
            <pubDate>Fri, 05 Sep 2025 22:51:59 GMT</pubDate>
            <atom:updated>2025-09-07T22:22:17.969Z</atom:updated>
            <content:encoded><![CDATA[<p>The following paper proposes how to construct a knowledge graph automatically by promoting LLMs. It mainly proposed a three step approach to extract (subject, entity, object) triplets, define relationships, and standardize relationships:</p><p><a href="https://www.bibsonomy.org/bibtex/2f69b1997ac5d5c6f424608316d701bea/ghagerer">Extract, Define, Canonicalize: An LLM-based Framework for Knowledge Graph Construction</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CMt9uE25iFwDa45UThz6_w.jpeg" /></figure><p>The challenge of automatically extracting structured knowledge from unstructured text has gained new momentum with the advent of large language models (LLMs). A recent paper, “Extract, Define, Canonicalize: An LLM-based Framework for Knowledge Graph Construction” by Zhang and Soh, proposes a systematic approach to building knowledge graphs that can scale to large schemas and work without predefined ontologies.</p><h3>The EDC Framework: Building Knowledge Graphs from Scratch</h3><p>The Extract-Define-Canonicalize (EDC) framework breaks down knowledge graph construction into three sequential phases, particularly effective when building a knowledge graph from scratch without a target schema:</p><h4>Phase 1: Extract — Open Information Extraction</h4><p>The first phase leverages LLMs to perform open information extraction, identifying and extracting relational triplets in the form of [Subject, Relation, Object] from input text. Unlike traditional approaches that require predefined schemas, this phase extracts facts freely without constraints.</p><p><strong>Example Input</strong>: “Alan Shepard was born on Nov 18, 1923 and selected by NASA in 1959. He was a member of the Apollo 14 crew.”</p><p><strong>Extracted Triplets</strong>:</p><ul><li>[‘Alan Shepard’, ‘bornOn’, ‘Nov 18, 1923’]</li><li>[‘Alan Shepard’, ‘participated’, ‘Apollo 14’]</li></ul><h4>Phase 2: Define — Schema Definition</h4><p>The second phase prompts LLMs to generate natural language definitions for each relationship and entity type discovered in the extraction phase. These definitions serve as semantic anchors for the canonicalization process.</p><p><strong>Example Definitions</strong>:</p><ul><li><em>bornOn</em>: “The subject entity was born on the date specified by the object entity”</li><li><em>participatedIn</em>: “The subject entity took part in the event or mission specified by the object entity”</li></ul><h4>Phase 3: Canonicalize — Self Canonicalization</h4><p>The final phase consolidates semantically similar schema components. Starting with an empty canonical schema, the system examines triplets and searches for consolidation candidates through vector similarity of the definitions, followed by LLM verification. Components that cannot be consolidated are added to expand the canonical schema.</p><p><strong>Result</strong>: The relationship ‘participated’ might be canonicalized to ‘mission’ based on semantic similarity and context verification, producing the final triplet [‘Alan Shepard’, ‘mission’, ‘Apollo 14’].</p><h3>An Alternative Approach: Map-Reduce Style Canonicalization</h3><p>While the EDC framework relies on embedding-based similarity search for canonicalization, an alternative approach uses a pure map-reduce paradigm with LLM-only canonicalization. This approach emphasizes quantity over quality in the initial extraction, then systematically reduces and normalizes the data through iterative LLM-based consolidation.</p><p>Here’s a complete implementation of the map-reduce approach using Pydantic models and structured prompts:</p><h4>Step 1: Raw Triple Extraction (Map Phase)</h4><pre>from pydantic import BaseModel, Field<br>from typing import List<br><br>class RawTriple(BaseModel):<br>    &quot;&quot;&quot;Represents a single, unnormalized fact extracted from text.&quot;&quot;&quot;<br>    subject: str = Field(..., description=&quot;The subject entity of the relationship.&quot;)<br>    relationship_phrase: str = Field(..., description=&quot;The natural language phrase describing the relationship.&quot;)<br>    object: str = Field(..., description=&quot;The object entity or value of the relationship.&quot;)<br>class ExtractionOutput(BaseModel):<br>    &quot;&quot;&quot;A container for all raw triples extracted from a single text document.&quot;&quot;&quot;<br>    triples: List[RawTriple]</pre><p><strong>LLM Prompt for Raw Extraction:</strong></p><pre>SYSTEM: You are a precision information extraction AI. Your task is to extract all potential relationships from the given text and represent them as (subject, relationship_phrase, object) triples. Be exhaustive and do not try to normalize or clean the entities or relationship phrases at this stage. Output the result in a JSON format that adheres to the provided Pydantic models.</pre><pre>USER:<br>Text to process:<br>&#39;&#39;&#39;<br>On August 5th, claim #V-9871 was filed by Dr. Eleanor Vance for her 2023 Honda CR-V. The incident, which occurred on Main Street, was witnessed by a Mr. John Montague. The vehicle was later taken to &#39;Reliable Auto Repair&#39; for an assessment. The initial damage estimate is $2,500.<br>&#39;&#39;&#39;</pre><pre>Please extract the triples.</pre><h4>Step 2: Entity Canonicalization (First Reduce Phase)</h4><pre>class CanonicalEntity(BaseModel):<br>    &quot;&quot;&quot;Represents a normalized, unique entity with a defined class.&quot;&quot;&quot;<br>    canonical_id: str = Field(..., description=&quot;A unique, machine-friendly identifier (e.g., Person_JohnMontague, Claim_V9871).&quot;)<br>    label: str = Field(..., description=&quot;The primary, human-readable name for the entity.&quot;)<br>    entity_class: str = Field(..., description=&quot;The assigned class for this entity (e.g., Person, Claim, Vehicle).&quot;)<br>    aliases: List[str] = Field(..., description=&quot;A list of all raw text mentions that map to this entity.&quot;)<br><br>class EntityNormalizationOutput(BaseModel):<br>    &quot;&quot;&quot;A container for the canonical entities derived from raw text mentions.&quot;&quot;&quot;<br>    canonical_entities: List[CanonicalEntity]</pre><p><strong>LLM Prompt for Entity Canonicalization:</strong></p><pre>SYSTEM: You are an expert data modeler AI. Your task is to analyze a list of raw entity mentions from text. You must group aliases, determine a canonical label for each group, and assign an appropriate entity class from the existing schema. If no suitable class exists, propose a new, concise PascalCase class name. Generate a unique, snake_case ID for each canonical entity. Output the result in a JSON format that adheres to the provided Pydantic models.</pre><pre>USER:<br>Existing Entity Classes (if any):<br>[&quot;Person&quot;, &quot;Vehicle&quot;, &quot;Organization&quot;, &quot;Location&quot;, &quot;MonetaryValue&quot;]</pre><pre>Raw Entity Mentions to Normalize:<br>[<br>    &quot;Dr. Eleanor Vance&quot;,<br>    &quot;Eleanor Vance&quot;, <br>    &quot;#V-9871&quot;,<br>    &quot;her 2023 Honda CR-V&quot;,<br>    &quot;a Mr. John Montague&quot;,<br>    &quot;John Montague&quot;,<br>    &quot;&#39;Reliable Auto Repair&#39;&quot;,<br>    &quot;Reliable Auto Repair Inc.&quot;,<br>    &quot;$2,500&quot;<br>]</pre><pre>Please normalize these entities.</pre><h4>Step 3: Relationship Canonicalization (Second Reduce Phase)</h4><pre>class CanonicalRelationship(BaseModel):<br>    &quot;&quot;&quot;Represents a normalized, unique relationship type in the schema.&quot;&quot;&quot;<br>    relationship_id: str = Field(..., description=&quot;A unique, machine-friendly identifier in camelCase (e.g., filedBy, witnessedBy).&quot;)<br>    label: str = Field(..., description=&quot;The primary, human-readable name for the relationship (e.g., &#39;Filed By&#39;).&quot;)<br>    aliases: List[str] = Field(..., description=&quot;A list of all raw relationship phrases that map to this type.&quot;)<br>    domain: str = Field(..., description=&quot;The class of the subject entity (e.g., &#39;Claim&#39;).&quot;)<br>    range: str = Field(..., description=&quot;The class of the object entity (e.g., &#39;Person&#39;).&quot;)<br><br>class RelationshipNormalizationOutput(BaseModel):<br>    &quot;&quot;&quot;A container for the canonical relationships derived from raw phrases.&quot;&quot;&quot;<br>    canonical_relationships: List[CanonicalRelationship]</pre><p><strong>LLM Prompt for Relationship Canonicalization:</strong></p><pre>SYSTEM: You are an expert ontology engineer AI. Your task is to analyze a list of raw relationship phrases and their contexts (the classes of the subject and object). You must group semantically similar phrases, determine a canonical label and a camelCase ID for each group, and define the relationship&#39;s domain (subject class) and range (object class) based on the provided entity schema. Output the result in a JSON format that adheres to the provided Pydantic models.</pre><pre>USER:<br>Available Entity Classes:<br>[&quot;Person&quot;, &quot;Claim&quot;, &quot;Vehicle&quot;, &quot;Organization&quot;, &quot;Location&quot;, &quot;MonetaryValue&quot;, &quot;DamageEstimate&quot;]</pre><pre>Raw Relationship Phrases and Contexts (Subject Class, Phrase, Object Class):<br>[<br>    (&quot;Claim&quot;, &quot;was filed by&quot;, &quot;Person&quot;),<br>    (&quot;Claim&quot;, &quot;submitted by&quot;, &quot;Person&quot;),<br>    (&quot;Incident&quot;, &quot;was witnessed by&quot;, &quot;Person&quot;),<br>    (&quot;Vehicle&quot;, &quot;taken to&quot;, &quot;Organization&quot;),<br>    (&quot;Vehicle&quot;, &quot;serviced at&quot;, &quot;Organization&quot;),<br>    (&quot;Claim&quot;, &quot;has damage estimate of&quot;, &quot;MonetaryValue&quot;),<br>    (&quot;Claim&quot;, &quot;estimated at&quot;, &quot;MonetaryValue&quot;)<br>]</pre><pre>Please normalize these relationships.</pre><h4>Processing Pipeline</h4><pre>async def process_text_to_knowledge_graph(text: str) -&gt; dict:<br>    &quot;&quot;&quot;Complete pipeline from raw text to canonical knowledge graph.&quot;&quot;&quot;<br>    <br>    # Step 1: Extract raw triples<br>    extraction_result = await llm_call(extraction_prompt, text)<br>    raw_triples = ExtractionOutput.parse_raw(extraction_result)<br>    <br>    # Collect all unique entity mentions<br>    entity_mentions = set()<br>    for triple in raw_triples.triples:<br>        entity_mentions.add(triple.subject)<br>        entity_mentions.add(triple.object)<br>    <br>    # Step 2: Canonicalize entities<br>    entity_result = await llm_call(entity_canonicalization_prompt, list(entity_mentions))<br>    canonical_entities = EntityNormalizationOutput.parse_raw(entity_result)<br>    <br>    # Collect relationship phrases with their contexts<br>    relationship_contexts = []<br>    for triple in raw_triples.triples:<br>        subject_class = get_entity_class(triple.subject, canonical_entities)<br>        object_class = get_entity_class(triple.object, canonical_entities)<br>        relationship_contexts.append((subject_class, triple.relationship_phrase, object_class))<br>    <br>    # Step 3: Canonicalize relationships<br>    relationship_result = await llm_call(relationship_canonicalization_prompt, relationship_contexts)<br>    canonical_relationships = RelationshipNormalizationOutput.parse_raw(relationship_result)<br>    <br>    return {<br>        &quot;entities&quot;: canonical_entities,<br>        &quot;relationships&quot;: canonical_relationships,<br>        &quot;raw_triples&quot;: raw_triples<br>    }</pre><h4>Key Advantages of This Approach</h4><ul><li><strong>No embedding dependency</strong>: Relies entirely on LLM reasoning rather than vector similarity</li><li><strong>Contextual awareness</strong>: The LLM can consider the full context of relationships rather than just semantic similarity</li><li><strong>Simplified pipeline</strong>: Reduces technical complexity by eliminating the need for embedding models and similarity thresholds</li><li><strong>Iterative refinement</strong>: Each step can be run multiple times with different examples to improve the schema</li></ul><h3>Comparison of Approaches</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97bab55ddc6ddc1cdd6a24527ad33e4f/href">https://medium.com/media/97bab55ddc6ddc1cdd6a24527ad33e4f/href</a></iframe><h3>Practical Considerations</h3><p>Both approaches offer distinct advantages for different use cases. The EDC framework provides a robust, scalable solution with its embedding-based similarity search, while the map-reduce alternative offers simplicity and relies purely on the sophisticated reasoning capabilities of modern LLMs.</p><p>The choice between approaches depends on factors such as available computational resources, required precision, and the complexity of the domain knowledge being extracted. As LLMs continue to improve, the pure LLM approach may become increasingly attractive due to its simplicity and the growing sophistication of language model reasoning capabilities.</p><p>The field of automated knowledge graph construction continues to evolve rapidly, with both approaches representing significant advances in making structured knowledge extraction more accessible and scalable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=200d5c2cf243" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What helps for Long COVID Fatigue?]]></title>
            <link>https://medium.com/@jhagerer/what-helps-for-long-covid-fatigue-97a4a8580362?source=rss-1004faad4c7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/97a4a8580362</guid>
            <category><![CDATA[long-covid-treatment]]></category>
            <category><![CDATA[long-covid-recovery]]></category>
            <category><![CDATA[coronavirus]]></category>
            <category><![CDATA[long-covid]]></category>
            <category><![CDATA[covid19]]></category>
            <dc:creator><![CDATA[Johann Hagerer]]></dc:creator>
            <pubDate>Sat, 10 May 2025 15:31:04 GMT</pubDate>
            <atom:updated>2025-11-02T11:31:51.491Z</atom:updated>
            <content:encoded><![CDATA[<h3>What Helps for Long COVID Fatigue?</h3><h4>How my wife gets back to normal</h4><p>End of December 2024 my wife was struck with long COVID. She used to have for 4 months fatigue, i.e., constant tiredness, PEM crashes, and exhaustion from only little physical or mental stress. For example, walking up the stairs just to the first floor would be close to impossible and she would be laying in bed for several days after that incident.</p><p>Today, she is working 6 hours demanding cognitive work (technical lead and IT manager) every day and she goes on 2km walks every day. She is also building up her own furniture in our new home. She is getting better at a velocity higher than ever before, whereas the healing progress I found to be stuck for the first 3 months, during which she used to supplement all sorts of vitamins and nutrients, particularly Vitamine D and Niacin.</p><p>This article is supposed to summarize the key findings of what helped her most and what I personally believe helps most long COVID patients as well.</p><p>Note: I am not a medical doctor. I am an academic and have a PhD degree in computer science, which enables me to read peer-reviewed scientific literature, which I am referring to in this very article. I am also a dedicated husband trying everything to get my wife back to normal.</p><h3>Endotheliitis and Micro Clots</h3><p>Check out the following interview with Prof. Pretorius, who coined the term “microclots”, which are blood particles blocking the fine-granular parts of the vascular system inhibiting the transport of oxygen in your lungs and brain. She is also highlighting the relevance of Nattokinase in breaking down these microclots at the end: <a href="https://www.technologynetworks.com/immunology/articles/how-long-covid-research-could-change-the-way-we-think-about-blood-microclots-393265">How Long COVID Research Could Change the Way We Think About Blood Microclots</a></p><p>In the following interview, Dr. Laubscher, a colleague and collaborator of Prof. Pretorius, is describing his successful Long Covid treatment of dual and triple platelet therapy against microclots, which essentially means taking two or three kinds of blood thinners at the same time (Clopidogrel, Aspirin, Apixaban): <a href="https://youtu.be/vWisaTFp4KI?si=xSEebicjheH40xwO">How to treat ‘microclots’ in long COVID</a></p><p>Dr. Leo Galland recommends the same drugs like Dr. Laubscher. Additionally, he is giving recommendations for natural and over-the-counter alternatives, i.e., Aspirin, Ginkgo Biloba, and Dan Shen. These you can get without prescription: <a href="https://youtu.be/h6rjlwKseZM?si=u3wu5yc87ukgIqc7">Understanding Long COVID</a></p><h3><strong>Neuroinflammation</strong></h3><p>One of the most debilitating symptoms of Long COVID is persistent &quot;brain fog.&quot; Growing evidence suggests this isn’t just fatigue; it’s an active process called neuroinflammation — chronic inflammation of the brain’s tissues.</p><p>​This inflammation disrupts the brain’s delicate chemical balance. It’s thought to interfere with how neurons (brain cells) manage glutamate, the most important &quot;on&quot; switch (or excitatory neurotransmitter) in your brain.</p><p>While glutamate is vital for learning and memory, too much of it becomes toxic. This &quot;excitotoxicity&quot; can damage neurons, leading directly to the cognitive slowdown and memory problems we call brain fog.<br>​So, how can we stop this? Researchers are now investigating a surprising class of drugs: GLP-1 agonists. You might know them as revolutionary diabetes and weight-loss drugs, but they also appear to have powerful anti-inflammatory effects. <br>​A prime example is tirzepatide (sold under the brand name Mounjaro), which is currently in clinical trials specifically for Long COVID. The theory is that these drugs can cross into the brain and help quiet the neuroinflammation. By calming this inflammation, they may help restore balance to the glutamate system, protecting neurons from further damage and potentially clearing the fog.</p><p>To further reduce neuroinflammation like that seen in Long COVID, SSRIs appear to be helpful through several key actions beyond just managing mood. Their most direct effect involves binding to a stress sensor inside cells (the Sigma-1 receptor), which shuts down the production of inflammatory chemicals at their source and helps calm the brain’s overactive immune cells (microglia), shifting them from an &quot;attack&quot; state to a &quot;repair&quot; state. Additionally, while inflammation often &quot;steals&quot; the building blocks needed to make serotonin (contributing to brain fog), SSRIs help by making the little remaining serotonin more efficient. Finally, SSRIs also make blood platelets &quot;less sticky,&quot; which may help reduce the microclots suspected of blocking brain blood flow in Long COVID.</p><h3>My Wife’s Daily Treatment Plan</h3><p>The following drugs are available without prescriptions:</p><ul><li>100mg Aspirin together with breakfast</li><li><a href="https://natugena.de/shop/neu/ProlyseZym.aspx">Bromelain &amp; Nattokinase</a> in the morning before breakfast and in the evening after dinner</li><li><a href="https://www.amazon.de/Healthy-Origins-Pycnogenol-Laborgepr%C3%BCft-Vegetarisch/dp/B09JGN2GQ5/ref=mp_s_a_1_15?adgrpid=76638705532&amp;dib=eyJ2IjoiMSJ9.M7u4mP8CiipFauWAvAWwp8-jbfr0tVcbEYO6m6s2Ku0LyY8w6uAhBCTfX5sRUrjcbHUg_JXmM2V6nH3FPA9pByhqNYj9JuT7GgUiC7Qxc9WisV00lXprowE3JMzLqt_qZe8uQuUoIgaSuR5U5TSfMJZjImY9d3z72JNtreTAvhn0xkyw1uuqzX1WUzD7zykrGn6wkSpO9TUoojqmeLSthw.E3WKLhkslwDCEN18tC9rqxbcu2_wwCe5L2djjr-hlVc&amp;dib_tag=se&amp;hvadid=353114307287&amp;hvdev=m&amp;hvexpln=0&amp;hvlocphy=9197602&amp;hvnetw=g&amp;hvocijid=2463731068692564594--&amp;hvqmt=e&amp;hvrand=2463731068692564594&amp;hvtargid=kwd-13568386&amp;hydadcr=26579_1786008&amp;keywords=pycnogenol&amp;mcid=0bbd4febafac3abd87bc9411dd57826a&amp;qid=1746890864&amp;sr=8-15">Pycnogenol</a> (<a href="https://pubmed.ncbi.nlm.nih.gov/34060731/">study</a>)</li><li>Tirzapetide 0.25mg (<a href="https://www.golighter.de/p/mounjaro">Mounjaro</a> via online prescription in EU) once per week</li><li>Escitalopram or alternatively St. John’s wort</li></ul><p>Note: Aspirin in the evenings and Gingko Biloba caused nausea and digestion problems. Aspirin in the morning together with breakfast is much better.</p><p>How to Test for Microclots?</p><p>Dr. Jäger in Bad Aibling (Germany) offers electromicroscopy tests:</p><p><a href="https://drbeatejaeger.com/">https://drbeatejaeger.com/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97a4a8580362" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evaluation Sheet for Student Research Projects]]></title>
            <link>https://medium.com/@jhagerer/evaluation-sheet-for-nlp-lab-course-6c468ef1f262?source=rss-1004faad4c7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c468ef1f262</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[thesis-writing]]></category>
            <category><![CDATA[university]]></category>
            <category><![CDATA[studying]]></category>
            <dc:creator><![CDATA[Johann Hagerer]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 20:41:55 GMT</pubDate>
            <atom:updated>2026-08-14T06:36:09.401Z</atom:updated>
            <content:encoded><![CDATA[<p>The following is a checklist for student research projects, such as, lab courses or theses, which I as a course supervisor use for grading. The more checkmarks you collect the better the grade obiously. In order to achieve many checkmarks “checked”, you might want to refer to my other blog articles.</p><h4>Report Appearance</h4><ul><li>✅<strong>/</strong>❌ The report has been submitted on schedule.</li><li>✅<strong>/</strong>❌ The report is written about the proposed topic.</li><li>✅<strong>/</strong>❌ The report has the minimum required number of pages (excluding appendix and bibliography).<br>- Master thesis: 60 pages (single column, <a href="https://sharelatex.tum.de/templates/tum-templates/tum-thesis-v2.0.0">template link</a>)<br>- Bachelor thesis: 40 pages (single column, <a href="https://sharelatex.tum.de/templates/tum-templates/tum-thesis-v2.0.0">template link</a>)<br>- Lab / IDP / guided research: 8 pages (double column, <a href="https://sharelatex.tum.de/templates/tum-templates/tum-article-v2.0.0">template link</a>)</li><li>✅<strong>/</strong>❌ The outline follows academic standards.<br>- <a href="https://medium.com/@jhagerer/about-proper-outlines-for-student-reports-and-theses-15710154af7f">How to Structure Student Theses and Reports</a></li><li>✅<strong>/</strong>❌ The citation format is consistent and the provided recommendations.<br>- <a href="https://medium.com/@jhagerer/dos-and-donts-for-student-theses-and-papers-in-general-1b41fcf3ef10">Dos and Don’ts for Student Theses (and Papers in General)</a></li><li>✅<strong>/</strong>❌ There are no two consecutive headings without text in between.</li><li>✅<strong>/</strong>❌ The abbreviations follow academic standards and best practices.<br>- <a href="https://medium.com/@jhagerer/dos-and-donts-for-student-theses-and-papers-in-general-1b41fcf3ef10">Dos and Don’ts for Student Theses (and Papers in General)</a></li><li>✅<strong>/</strong>❌ There are no text formatting issues.</li><li>✅<strong>/</strong>❌ All tables and figures from the main text excluding the appendix are referenced.</li><li>✅<strong>/</strong>❌ All tables and figures contain meaningful content.</li><li>✅<strong>/</strong>❌ All tables and figures are marked as such and have captions below.</li><li>✅<strong>/</strong>❌ All tables and figures are readable.</li><li>✅<strong>/</strong>❌ All tables and figures are placed at the top of pages as far as feasible.</li><li>✅<strong>/</strong>❌ In case of a two-columnar layout: All tables and figures are placed symmetrical as far as feasible.</li><li>✅<strong>/</strong>❌ All figures are in vector format where possible.</li><li>✅<strong>/</strong>❌ All figures depicting scores which are not well-known should describe in the caption if higher or smaller is better.</li><li>✅<strong>/</strong>❌ All tables containing metrics should describe for each metric if higher is better, e.g. by using up-arrows for higher-is-better or down-arrows for lower-is-better.</li><li>✅<strong>/</strong>❌ In all diagrams, all axes are labeled and have units.</li><li>✅<strong>/</strong>❌ All diagrams and tables have a sufficient large font size for readability.</li><li>✅<strong>/</strong>❌ The amount of tables and figures do not hurt the readibility of the actual text in the report.</li><li>✅<strong>/</strong>❌ Unnecessary tables and figures are moved to the appendix part behind the actualy report and references. Tables and figures are unnecessary when they are redundant at least to some degree.</li><li>✅<strong>/</strong>❌ The spelling and grammatical errors are kept within reasonable limits.</li><li>✅<strong>/</strong>❌ Capitalization rules are applied correctly on normal text, i.e. only proper nouns are capitalized and technical terms are not capitalized.</li><li>✅<strong>/</strong>❌ Capitalization rules are applied correctly on titles, i.e., section and subsection headings, in accordace to <a href="https://capitalizemytitle.com/">Title Capitalization Tool</a>.</li></ul><h4>Report Content</h4><p>This relates a lot to the standards defined here: <br><a href="https://medium.com/@jhagerer/about-proper-outlines-for-student-reports-and-theses-15710154af7f">How to Structure Student Theses and Reports | by Dr. Johann Hagerer | Medium</a></p><ul><li>✅<strong>/</strong>❌ The introduction introduces the topic for the informed non-expert reader.</li><li>✅<strong>/</strong>❌ The introduction motivates the topic, i.e., makes the reader curious.</li><li>✅<strong>/</strong>❌ The introduction formulates meaningful research questions.</li><li>✅<strong>/</strong>❌ The introduction contains an outline description.</li><li>✅<strong>/</strong>❌ The introduction contains a description of the contributions.</li><li>✅<strong>/</strong>❌ The related work section is comprehensive.</li><li>✅<strong>/</strong>❌ The related work section convincingly discovers research gaps.</li><li>✅<strong>/</strong>❌ The related work section is well structured.</li><li>✅<strong>/</strong>❌ The related work follows a golden thread.</li><li>✅<strong>/</strong>❌ The methodology section describes the methods to be evaluated.</li><li>✅<strong>/</strong>❌ The methodology section does not mention implementation details.</li><li>✅<strong>/</strong>❌ The data section describes the data distributions.</li><li>✅<strong>/</strong>❌ The data section describes the data generation process.</li><li>✅<strong>/</strong>❌ The data section describes the data generation process.</li><li>✅<strong>/</strong>❌ The report contains a pipeline/system overview diagram illustrating the data flow and experimental stages. It may be part of methodology, data, or experiments.</li><li>✅<strong>/</strong>❌ The experiments section contains the description of all experiments.</li><li>✅<strong>/</strong>❌ The experiments section contains all implementation details and parameters.</li><li>✅<strong>/</strong>❌ The experiments section describes which of the previously described data has been used.</li><li>✅<strong>/</strong>❌ The experiments section refers to the metrics used and why.</li><li>✅<strong>/</strong>❌ The results section shows results for all experiments.</li><li>✅<strong>/</strong>❌ The results section describes the results for all experiments.</li><li>✅<strong>/</strong>❌ The findings sections answers all research questions sufficiently.</li><li>✅<strong>/</strong>❌ The findings section refers to the results.</li><li>✅<strong>/</strong>❌ The conclusion contains a summary of the findings section.</li><li>✅<strong>/</strong>❌ The conclusion contains a future work paragraph.</li><li>✅<strong>/</strong>❌ Each entry in the bibliography contains a URL to the publication.</li><li>✅<strong>/</strong>❌ Each entry in the bibliography follows the same format.</li><li>✅<strong>/</strong>❌ There is a section “AI Usage”, see <a href="https://dev.to/jhagerer/how-should-students-document-ai-usage-in-academic-work-58m1">How Should Students Document AI Usage in Academic Work? — DEV Community</a></li></ul><h4>Code Repository</h4><ul><li>✅<strong>/</strong>❌ A non-empty README.md file exists.</li><li>✅<strong>/</strong>❌ The README.md contains a short project description.</li><li>✅<strong>/</strong>❌ The README.md contains explanations about what is contained in the top-level directories.</li><li>✅<strong>/</strong>❌ The code project is structured reasonably well.</li><li>✅<strong>/</strong>❌ The README.md contains example code how to set up the project, collect the data, and run the experiments.</li><li>✅<strong>/</strong>❌ The project has some kind of standardized setup routines, e.g., at least a requirements.txt or a conda structure, but better something based on poetry or uv.</li><li>✅<strong>/</strong>❌ The example code actually works.</li><li>✅<strong>/</strong>❌ The experiments are reproducible.</li></ul><h4>Poster (e.g. lab course)</h4><ul><li>✅<strong>/</strong>❌ The poster has been submitted on schedule.</li><li>✅<strong>/</strong>❌ The poster is written about the proposed topic.</li><li>✅<strong>/</strong>❌ The poster has been presented at the poster presentation.</li><li>✅<strong>/</strong>❌ The poster layout follows academic best practices.</li><li>✅<strong>/</strong>❌ The citation format follows academic best practices.</li><li>✅<strong>/</strong>❌ The abbreviations follow academic best practices.</li><li>✅<strong>/</strong>❌ All figures are in vector format where possible.</li><li>✅<strong>/</strong>❌ In all diagrams, all axes are labeled and have units.</li><li>✅<strong>/</strong>❌ The poster was readable from behind the desk.</li><li>✅<strong>/</strong>❌ The poster was high level enough.</li><li>✅<strong>/</strong>❌ The poster presentation convinced other supervisors that the students have full understanding of their own labor.</li><li>✅<strong>/</strong>❌ All questions from the supervisors could be answered in a sufficient manner.</li></ul><h4>Defense Presentation (theses)</h4><ul><li>✅<strong>/</strong>❌<strong> </strong>The defense presentation took place as planned.</li><li>✅<strong>/</strong>❌<strong> </strong>The defense presentation was successful.</li><li>✅<strong>/</strong>❌<strong> </strong>The duration of the defense presentation was correct (15 minutes presentation)</li><li>✅<strong>/</strong>❌<strong> </strong>The slides were well prepared.</li><li>✅<strong>/</strong>❌<strong> </strong>The slides were concise, not too full, and not too many.</li><li>✅<strong>/</strong>❌<strong> </strong>The talk was well understandable.</li><li>✅<strong>/</strong>❌<strong> </strong>The audience waz engaged in discussions.</li><li>✅<strong>/</strong>❌<strong> </strong>Backup slides existed.</li><li>✅<strong>/</strong>❌<strong> </strong>All figures and tables had a caption.</li><li>✅<strong>/</strong>❌<strong> </strong>All diagrams had the axes labeled properly.</li></ul><h4>Effort</h4><ul><li>✅<strong>/</strong>❌ The proposed problem statement has been understood.</li><li>✅<strong>/</strong>❌<strong> </strong>The proposed solution from the topic definition has been implemented as far as possible.</li><li>✅<strong>/</strong>❌<strong> </strong>The proposed solution has been evaluated successfully.</li><li>✅<strong>/</strong>❌<strong> </strong>An effort was made to ask questions and understand the problem.</li><li>✅<strong>/</strong>❌<strong> </strong>New problems have been identified indepently and proactively.</li><li>✅<strong>/</strong>❌<strong> </strong>Innovative solutions have been found and proposed indepently and proactively.</li><li>✅<strong>/</strong>❌<strong> </strong>Innovative solutions have been implemented indepently and proactively.</li><li>✅<strong>/</strong>❌<strong> </strong>Innovative solutions have been evaluated successfully and proactively.</li><li>✅<strong>/</strong>❌<strong> </strong>The student(s) kept surprising with own original ideas.</li><li>✅<strong>/</strong>❌<strong> </strong>The student(s) has proudly achieved competence in the domain.</li><li>✅<strong>/</strong>❌<strong> </strong>The student was able to identify with the topic.</li><li>✅<strong>/</strong>❌<strong> </strong>If applicable: The student(s) were confronted with particular difficulties which is taken into consideration.</li><li><em>The following points are only relevant for master thesis students:</em></li><li>✅<strong>/</strong>❌<strong> </strong>The insights generated by the student help the team moving forward.</li><li>✅<strong>/</strong>❌<strong> </strong>The implementation from the student is either already integrated or provided such that it can and will be used by the team.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c468ef1f262" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dos and Don’ts for Student Theses (and Papers in General)]]></title>
            <link>https://medium.com/@jhagerer/dos-and-donts-for-student-theses-and-papers-in-general-1b41fcf3ef10?source=rss-1004faad4c7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b41fcf3ef10</guid>
            <category><![CDATA[studying]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[scientific-writing]]></category>
            <dc:creator><![CDATA[Johann Hagerer]]></dc:creator>
            <pubDate>Sat, 11 Jan 2025 21:31:31 GMT</pubDate>
            <atom:updated>2026-10-22T09:28:15.733Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*XdHOKpDi8gAeFUabMtj_BA.png" /></figure><h3>Capitalization</h3><p>You capitalize <strong>only </strong>proper nouns:</p><blockquote>A proper noun is the name of a particular person, place, organization, or thing. (Source: <a href="https://www.collinsdictionary.com/dictionary/english/proper-noun#:~:text=A%20proper%20noun%20is%20the,Compare%20common%20noun.">Collin’s Dictionary</a>)</blockquote><p>So, rivers, cities, persons, and companies are proper nouns. Neural network is NOT a proper noun as well as deep learning, at least as long as you do not call your own child like that. What about highly specific scientific terms which you abbreviate? Latent Dirichlet allocation (LDA) for instance? Dirichlet is the name of a scientist, thus you capitalize it. Latent and allocation is not a name of any kind, thus you do not capitalize it. So, you write it as “latent Dirichlet allocation”, because it is a technical term and no proper noun. The same, by the way, holds true for Siamese neural networks. Siamese refers to a country name, i.e., Thailand.</p><p>But what if you find a paper which capitalizes these terms anyway? It is typically people who do not speak English as their mother tongue who make this kind of mistake. And even though it is wrong spelling, it normally does not justify to reject a paper only for these mistakes.</p><h3>Abbreviations and Glossary</h3><p>tl;dr: Please use the Latex glossary package as described on the <a href="https://www.overleaf.com/learn/latex/Glossaries">Overleaf documentation</a>.</p><p>For abbreviations, you write them out with the abbreviation in brackets the first time you mention the term, e.g., “latent Dirichlet allocation (LDA)”. Consecutively, you only use the abbreviation itself to refer to that term, e.g., “LDA”.</p><p>The scope of a abbreviation definition can typically vary between the whole document and for each section. This means you can write out the abbreviation either on first mention in the document, or you start over at each new section. Especially when you choose the latter option, the Latex glossary package does the job automatically for you.</p><p>As a bonus, you might also want to check out the glossary feature, which defines terms which are not abbreviated.</p><h3>Tables and Figures</h3><p>Their placement is very simple: You always put tables and figures and the top of a page. Either you put two per page side by side or one that spans the whole page width. Ideally you put them symmetrically, such that on the left hand side and on the right hand side the tables or figures take equally much space.</p><p>It is discouraged to have several consecutive pages completely filled with tables and illustrations. If you end up having even one page fully filled with one, you might want to question if that is an absolute necessity, or if you cannot split up the contents, e.g., for several subsections anyway. Ideally you have floating text and tables mixed generally. If unavoidable, then one fully covering table or figure is OK, but not on consecutive pages.</p><p>Each table and figure must have a caption. And each must be referenced from the running text of the document at hand. You might want to use the autoref function from Latex to make that automatically for you.</p><h3>Citation Format</h3><p>Generally speaking, there are two citation formats: Indirect citations and direct citations. Indirect citations go in brackets, direct citations go without brackets. Indirect citations are not a grammatical part of a sentence, whereas direct citations are.</p><p>Direct citation example: <em>Hagerer et al. (2021) showed that natural language processing (NLP) is a helpful technology.</em></p><p>Indirect citation example: <em>It has been shown that natural language processing (NLP) is a helpful technology (Hagerer et al., 2021).</em></p><p>In case you have multiple indirect citations in consecutive sentences our you are generally referring to the same paper multiple times, you give on time an indirect reference to that paper at the end of the paragraph. If you need to do the same thing for a while subsection, you mention that the explanations of the following subsection is based on that paper at the beginning of this subsection.</p><p>For theses, you avoid numbered citations and use citations with the first author name plus the publication year. In publications, however, you use the citation format which is proposed in the guidelines provided by the regarding conference or journal.</p><p>In LaTeX source code, you would perform it as follows:</p><ul><li><strong>\citet{key}</strong> (<strong>Textual</strong> / Narrative citation): Puts the author&#39;s name in the text and only the year in parentheses (e.g., <em>Jones et al. (1990)</em>). Use this when the author&#39;s name is part of the sentence (e.g., <em>&quot;As shown by </em><strong><em>Jones et al. (1990)</em></strong><em>, this method works.&quot;</em>). [<a href="https://www.reddit.com/r/LaTeX/comments/5g9kn1/whats_the_difference_between_cite_citep_and_citep/">1</a>, <a href="https://letx.app/learn/problems/citep-vs-citet/">2</a>]</li><li><strong>\citep{key}</strong> (<strong>Parenthetical</strong> citation): Puts both the author&#39;s name and the year inside parentheses (e.g., <em>(Jones et al., 1990)</em>). Use this when the whole citation sits in parentheses or at the end of a claim (e.g., <em>&quot;...this method works </em><strong><em>(Jones et al., 1990)</em></strong><em>.&quot;</em>). [<a href="https://www.reddit.com/r/LaTeX/comments/5g9kn1/whats_the_difference_between_cite_citep_and_citep/">1</a>, <a href="https://letx.app/learn/problems/citep-vs-citet/">2</a>]</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b41fcf3ef10" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Structure Student Reports and Theses]]></title>
            <link>https://medium.com/@jhagerer/about-proper-outlines-for-student-reports-and-theses-15710154af7f?source=rss-1004faad4c7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/15710154af7f</guid>
            <category><![CDATA[scientific-writing]]></category>
            <category><![CDATA[studying]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[academic-writing]]></category>
            <dc:creator><![CDATA[Johann Hagerer]]></dc:creator>
            <pubDate>Sat, 24 Feb 2024 09:14:03 GMT</pubDate>
            <atom:updated>2025-08-31T15:42:50.367Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Structure Student Theses and Reports</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1cwE4IuZ_Tl-NdzZ0Y1iSA.jpeg" /><figcaption>That’s how the outline of my most recent paper looks like.</figcaption></figure><h3>Table of Contents</h3><ol><li><a href="https://medium.com/@jhagerer/about-proper-outlines-for-student-reports-and-theses-15710154af7f#503a">Motivation</a></li><li><a href="https://medium.com/@jhagerer/about-proper-outlines-for-student-reports-and-theses-15710154af7f#de32">Example Outline</a></li><li><a href="https://medium.com/@jhagerer/about-proper-outlines-for-student-reports-and-theses-15710154af7f#54dd">Introduction</a></li><li><a href="https://medium.com/@jhagerer/about-proper-outlines-for-student-reports-and-theses-15710154af7f#15d9">Related Work</a></li><li><a href="https://medium.com/@jhagerer/about-proper-outlines-for-student-reports-and-theses-15710154af7f#4ee3">Methodology</a></li><li><a href="https://medium.com/@jhagerer/about-proper-outlines-for-student-reports-and-theses-15710154af7f#df3e">Findings</a></li></ol><h3>Motivation</h3><p>Since I started doing my PhD at TU Munich in 2018 (and even before that), I started supervising students in the area of machine learning, natural language processing, and affective computing. My goal generally is to support students with their university projects, such that their outcome would ideally lead to something publishable, i.e., ready to be submitted for an academic peer review at a scientific journal or conference.</p><p>Even though the reality shows that all student essays, may it be master or bachelor theses or reports from other kinds of projects, need a lot of brush-up and post-processing before being submitted, the goal of being “submission ready” is absolutely worth to keep in the back of your head while conducting the labour. Putting things “out there” and getting credits for that is an awesome feeling, especially when you have invested a lot of your energy and time on it.</p><p>Therefore it is good to understand which are the scientific writing standards necessary to achieve this goal. After the experiments are finished, the writing process starts. Many students wonder what is the best way to write up all the results. The first step to structure your thoughts and data is to come up with an outline. Most of the time, I tend to give the same outline, which I am going to present here, such that all of my students and hopefully many others will be able to gain inspiration from it.</p><h3>Example Outline</h3><p>The following gives the general template of an outline that I use:</p><ol><li>Introduction<br>1.1 Motivation<br>1.2 Problem Statement<br>1.2 Research Questions (RQs)<br>1.3 Contributions<br>1.4 Outline</li><li>Related Work (RL)<br>2.1 Datasets<br>2.2 Methods</li><li>Methodology</li><li>Data</li><li>Experiment(s)<br>- if more than one experiment, one subsection for each</li><li>Results<br>- if more than one experiment, one subsection for each</li><li>Findings<br>- RQ Answers (one paragraph per RQ)<br>- Limitations</li><li>Conclusion<br>- Summary of Findings section<br>- Future Work</li></ol><p>In this article, I explain how to write everything from introduction till methodology. The rest I will cover in a separate article at a later point in time.</p><h3>Introduction</h3><p>If possible, start the <strong>motivation </strong>with a statement everybody can relate to or is affected by. If your topic is too specific or too technical, then start with a problem which everybody in your domain frequently encounters.</p><p>Generic example:</p><blockquote>Social media data is abundant nowadays, and still it is a challenge for domain experts to get a representative overview of the mindset of the masses.</blockquote><p>Specific example:</p><blockquote>Document classification is a task relevant across many domains, e.g., sentiment analysis for market research or topic classification of reports.</blockquote><p>During writing, you end up motivating and defining the actual problem you aim to solve, i.e., the <strong>problem statement</strong>.</p><p>Example:</p><blockquote>We implement experiments for topic on social media texts from a specific domain X, which — to the best of our knowledge — has not been analysed in this depth and level of details. Features such as sentiment, social relations and sophisticated visualizations yield a new way how to understand this data.</blockquote><p>Optionally, you could ellaborate on the most important related work to highlight the importance of your interest. After that, you can give a list of research questions:</p><blockquote>RQ1: How do social media commenters form clusters regarding what they write?<br>RQ2: How do social media commenters form clusters regarding how they are connected with each other?<br>RQ3: How are both types of clusters related with one another? And how to measure that?</blockquote><p>Then you write down your main contributions. These are your key findings. This is the main value of your research which you add on top of the research listed later in the related work. You can write this as bullet list (not more than four items) or as a paragraph.</p><p>Eventually, it is common to give an outline of your work. This should be written as one paragraph:</p><blockquote>In this report, we provide the following contributions: In section 2, we give an overview of social media analysis of domain X and the the state-of-the-art in topic modelling and social graph clustering. In section 3, our novel methodology of combining topic modelling with social network clustering is described. In section 4, a description and statistical overview of the dataset is given. […]</blockquote><h3>Related Work</h3><p>The related work section further motivates the research problem at hand by giving a summary of the related literature in the field. You generally want that other authors already made a rather similar research compared to your own. If that is the case, you can point out the very little details in how your research is different to the already existing. This will give the reader the impression that your own research is particular and interesting.</p><p>My suggested approach to writing the related work section is comprised of the following steps:</p><ol><li>Before you conduct your literature review, you should divide the related work into subsections.</li><li>You perform data collection, which means that you are looking up and summarizing papers.</li><li>You write the actual related work section.</li></ol><h4><strong>Dividing related work into subsections</strong></h4><p>Oftentimes you have a data and a method domain, which already splits your related work into at least two subsections: method and data. For example, when your thesis is about chatbots for dietary advice, you can divide the related work section into one subsection about the method, i.e. chatbots, and one about the data domain, i.e. dietary advice.</p><p>When your thesis is mere method research, i.e., you are only researching about one method in particular, you might find the data domain missing. However, you can still list several relevant benchmark datasets for that particular method. This can be a replacement for the part about the data domain.</p><p>For example, one of my students is writing about hallucination detection for generative large language models. You can point out that this particular problem is relevant for a collection of natural language processing (NLP) tasks, such as, summarization, question answering, natural language inference, translation, and so on. For each NLP task, you can state exemplary datasets and tell how hallucination could be a problem in that domain. Then, you can list benchmark datasets, e.g., with real and hallucinated summaries and gold annotations as to how much it was hallucinated. Last but not least, you can state in the method part of the related work how hallucination has been addressed technically.</p><p>Here is how the subsections of the related work could look like:</p><pre>2. Related Work<br>   2.1 Relevant NLP Tasks<br>       2.1.1 Summarization<br>       2.1.2 Question Answering<br>   2.2 Benchmark Datasets<br>   2.3 Method Overview</pre><h4><strong>Data Collection</strong></h4><p>For each subsection of related work, you come up with a list of referenced papers. You create a table, where in each row you have one paper and in each column you have the following:</p><ul><li>Authors</li><li>Title</li><li>Keywords (used for search or keyword which are relevant)</li><li><strong>Pro</strong></li><li><strong>Con</strong></li></ul><p>Pro tells in one sentence which problem has been adressed and how. Con tells in one sentence, which problem has <strong>NOT</strong> been addressed by that paper but ideally by your own work!</p><p>How to sort your related work, i.e., which is the right sequence of related work items? You want to have all references in such order that once you start writing your related work, you write them down in exactly that order given by the data collection. So, the reading flow of the related work items must be meaningful for the reader, i.e., there must be a golden thread. You could sort from dissimilar to similar, i.e., the papers that do not have much in common with your own work come first, whereas the most similar ones come last. This way it gets more and more clear while reading what your paper is about. Another way could be to go historically, i.e., oldest papers first, youngest papers last.</p><h4>Writing</h4><p>When you write up, you basically concatenate all the pros and cons from all the papers in the given sequence, for example: “First et al. (2022) achieved this. However, they did not perform that. Second et al. (2023) addressed that, while showing their data was insufficient for the given use case. […]”.</p><p>This you perform for each related work subsection on its own. Optionally, you can add a conclusion of the related work at the end. The conclusion of the related work is that your work addresses the net sum of all pros and cons. For example, you method might have been carried out some more data compared to other works. Or the way how you altered an existing method addresses a particular problem of one data domain, which has not yet been quantified. Your work shall particularly address at least some of the cons which are yet left open.</p><h3>Methodology</h3><p>In this section, you lay the foundation for the method-related terminology, which will be used in the experiments section. This means when you describe your experiments later, you will have to refer to the methods you use. The reader then has to know which methods you refer to. This is decribed in the methods section.</p><p>Often it is tricky for students to figure out <strong>what is the difference between methodology and related work. In related work, you use between half a sentence and two sentences to describe each paper. In the methods section, you might use even several pages to explain one paper, e.g., to describe its method which you are using for your experiments</strong>. Related work motivates your research problem by summarizing a plethora of related publications, which is a superficial objective if you will. Methodology explains one method or very few methods in technical depth.</p><p>How is methodology different compared to the experiments section? Methodology contains no implementation details, such as, parameters or frameworks used, source code examples, data pipelines, or any data description at all. All of that information you would find in experiments. You only describe your method in a detailed but abstract way, with as least domain specific details as possible.</p><p>Imagine you are a student and you want to prove to your supervisor that you understand the method that you used. You did not just rely on a given implementation of the method. You understand it also. The methodology section proves that to your supervisor.</p><h3>Data</h3><p>The data section is relevant for your experiments and thus should be placed directly before the experiment section. Alternatively, you can put the data section inside of the experiments section. The latter makes sense when you did not collect the data yourself but you just used an already existing third party dataset, e.g., a publicly available academic benchmark dataset. However, when you scrapped the data by yourself or when you performed an involved annotation procedure, this should be described in a separate data section.</p><p>You should make sure that you describe the following aspects of each dataset clearly and separately: the data source, the tasks, and the annotations. The data source explains aspects, such as, the URL or domains or platforms crawled, who are the data creators, how do the data generation processes work. The tasks are machine learning or natural language processing tasks you perform on this dataset, such as, sentiment analysis, document classification, entailment, or single-label single-class vs. multi-label-multi-class or whatever else you perform on this data. The annotations are closely related to the tasks. For instance, sentiment can be given in two, three or more ordinary ranked classes, so you can give more details in that case.</p><p>It is generally expected that you provide overviews and descriptive statistics, e.g., tables or figures, about your dataset(s), e.g., containing the number of samples per class, which classes you have, how many samples overall, a list of data sources; further a general overview of all used datasets listing which task is being solved on which dataset, et cetera. You also want to show at least one example data point per class per dataset so that the reader knows what you are talking about.</p><h3>[…]</h3><p>[tbc]</p><h3>Findings</h3><p>The findings sections answers each research question from the introduction. You do so by explicitly repeating each research question in full length and then answering it.</p><blockquote><strong>RQ1: How do social media commenters form clusters regarding what they write?<br></strong>Lorem ipsum …</blockquote><blockquote><strong>RQ2: How do social media commenters form clusters regarding how they are connected with each other?</strong><br>Lorem ipsum …</blockquote><blockquote><strong>RQ3: How are both types of clusters related with one another? And how to measure that?</strong><br>Lorem ipsum …</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15710154af7f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>