<?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 Jennifer D&#39;Souza, Ph.D. on Medium]]></title>
        <description><![CDATA[Stories by Jennifer D&#39;Souza, Ph.D. on Medium]]></description>
        <link>https://medium.com/@jenlindadsouza?source=rss-30a9dfd80bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_qkb7BYsIykXYZTSQvwNjw.jpeg</url>
            <title>Stories by Jennifer D&amp;#39;Souza, Ph.D. on Medium</title>
            <link>https://medium.com/@jenlindadsouza?source=rss-30a9dfd80bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 13:26:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jenlindadsouza/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[A Manifesto for Humane and Responsible Science]]></title>
            <link>https://medium.com/@jenlindadsouza/a-manifesto-for-humane-and-responsible-science-a340844a45e0?source=rss-30a9dfd80bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a340844a45e0</guid>
            <category><![CDATA[human-dignity]]></category>
            <category><![CDATA[ethical-science]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[human-rights]]></category>
            <dc:creator><![CDATA[Jennifer D'Souza, Ph.D.]]></dc:creator>
            <pubDate>Tue, 06 Oct 2026 09:57:40 GMT</pubDate>
            <atom:updated>2026-10-06T09:57:40.342Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>How we do science matters as much as what we discover.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LXXFtzGmsrraKR_QxdF3zA.png" /></figure><h3>Ten principles for research, mentorship, and the people behind scientific discovery.</h3><p>Science is a human endeavor. Behind every publication, dataset, discovery, and technological advance are people who think, question, create, struggle, collaborate, and grow.</p><p>I believe that the pursuit of scientific excellence must go hand in hand with intellectual integrity, human dignity, fairness, and mutual respect. A successful research environment should not be measured solely by what it produces, but also by how it treats the people who make those achievements possible.</p><p>The following ten principles express the values I seek to uphold in my group’s research, collaborations, and professional relationships.</p><h3>1. People Before Metrics</h3><p>Researchers are human beings before they are authors, employees, students, or measures of institutional productivity. Their worth cannot be reduced to publication counts, citation metrics, grants, or performance indicators. Scientific achievement matters, but never at the expense of human dignity.</p><h3>2. Scientific Integrity Above All</h3><p>We pursue knowledge with honesty, rigor, curiosity, and intellectual humility. We value reproducibility, transparency, responsible research practices, and the courage to acknowledge uncertainty or correct mistakes. Scientific integrity must never be compromised for prestige, recognition, or competitive advantage.</p><h3>3. Mentorship Is a Shared Commitment</h3><p>Good mentorship requires time, patience, intellectual generosity, honest feedback, and genuine investment in another person’s development. It also requires initiative, responsibility, openness, and mutual respect from those being mentored. Mentorship is neither unquestioning authority nor unconditional accommodation. It is a professional relationship in which everyone has responsibilities, even when those responsibilities differ.</p><h3>4. Respect Must Extend in Every Direction</h3><p>Respect is not a privilege attached to seniority, status, or institutional position. Students, doctoral researchers, postdoctoral researchers, supervisors, professors, technical staff, and administrators all deserve dignity and a fair hearing. Differences in authority must never justify intimidation, exploitation, humiliation, discrimination, or retaliation. Equally, professional expertise, judgment, and legitimate responsibilities deserve recognition and respect.</p><h3>5. Accountability Without Scapegoating</h3><p>Difficulties, disagreements, and unsuccessful working relationships are part of human collaboration. They should be addressed seriously, fairly, and constructively, with attention to evidence, context, power differences, and the perspectives of everyone involved. Accountability must not become a search for someone to blame, nor should isolated difficulties erase a broader record of meaningful contributions. We believe in learning, proportionality, and fair processes rather than automatic assumptions of guilt or fault.</p><h3>6. Recognition for Visible and Invisible Work</h3><p>Scientific success is rarely the achievement of one individual. Behind research outputs are countless hours of mentoring, reviewing, debugging, coordinating, supporting, encouraging, and building the conditions in which others can succeed. We believe that intellectual contributions, emotional labour, technical expertise, and sustained mentorship deserve fair acknowledgment. Recognition should reflect contributions, not merely visibility, hierarchy, or the ability to advocate for oneself.</p><h3>7. The Freedom to Question, Disagree, and Grow</h3><p>Science advances through questioning accepted ideas, challenging assumptions, and exploring unfamiliar directions. We value constructive disagreement and intellectual independence. Researchers must be able to express reasoned concerns, challenge scientific arguments, admit mistakes, and pursue new ideas without fear of humiliation or retaliation. We expect rigorous criticism of ideas without attacks on the people expressing them.</p><h3>8. Sustainable Science Requires Humane Working Conditions</h3><p>Dedication to science should not require sacrificing physical health, mental well-being, personal relationships, or life outside work. We reject the glorification of overwork, chronic exhaustion, and unnecessary urgency as measures of commitment. We support realistic expectations, transparent responsibilities, reasonable boundaries, and the right to rest. Sustainable working conditions are essential to sustainable scientific excellence.</p><h3>9. Fairness, Inclusion, and Equal Opportunity Require Action</h3><p>Talent, ambition, and scientific potential exist across genders, cultures, backgrounds, identities, and career stages. Yet opportunities, recognition, and credibility are not always distributed equally. We commit to recognizing structural inequalities, questioning unconscious biases, and promoting fair access to opportunities and advancement. No one should have to diminish their achievements, repeatedly apologize for exercising professional judgment, or remain silent to be accepted.</p><h3>10. Science Should Help People Flourish</h3><p>The ultimate purpose of research is not simply to generate knowledge, secure funding, or advance careers. It is to contribute meaningfully to our understanding of the world and, wherever possible, improve it. We strive to create an environment in which people can become better scientists without losing their humanity, where ambition coexists with kindness, and where individual achievement strengthens collective progress.</p><h3>Our guiding conviction …</h3><p><em>Excellence without integrity is hollow. Achievement without fairness is incomplete. Leadership without respect is unsustainable. And science without humanity loses sight of why it matters.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a340844a45e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[In this Age of Generative AI, we still need High-Quality, Domain-expert Annotated Datasets!]]></title>
            <link>https://medium.com/@jenlindadsouza/in-this-age-of-generative-ai-we-still-need-high-quality-domain-expert-annotated-datasets-8ece5620020a?source=rss-30a9dfd80bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ece5620020a</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[vision-language-model]]></category>
            <category><![CDATA[scientific-research]]></category>
            <dc:creator><![CDATA[Jennifer D'Souza, Ph.D.]]></dc:creator>
            <pubDate>Wed, 05 Aug 2026 11:58:38 GMT</pubDate>
            <atom:updated>2026-08-05T13:14:52.918Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Synthetic data can multiply examples, but it cannot decide what a scientific figure means…</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1d0slyHH5WSKoMKQAHJmA.png" /><figcaption>AI Dream — Image by Author, generated using ChatGPT.</figcaption></figure><p>The internet feels exhausted.</p><p>Researchers scrape it, clean it, filter it, deduplicate it, translate it, paraphrase it, ask one model to generate questions for another model, ask another model to judge the answers, then call the resulting pile a new dataset.</p><p>Sometimes it works.</p><p>Sometimes the model learns something.</p><p>Sometimes it learns only the habits of another model.</p><p>Synthetic data is cheap, fast, obedient, tireless, available at 3 o’clock in the morning, never asks for a contract, never needs a clarification meeting, never says that the figure is ambiguous, never admits that the axis label is unreadable, never pauses over a spectrum and wonders whether the apparent peak shift is chemically meaningful or merely an artifact of normalization.</p><p>That is precisely the problem.</p><p>As researchers turn increasingly toward synthetic training data, this post reflects on why expert-annotated scientific data still matters: because its value lies not only in what is collected, but in the meaning patiently recognized, checked and shaped by those who understand the domain from within. In other words, by domain experts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_72UClE19c8YHllq6kY_4Q.png" /><figcaption>Human expertise and insight will, and should, always count — Image by Author, generated using ChatGPT.</figcaption></figure><h3>A figure is not merely an image</h3><p>A scientific figure in a research paper rarely looks simple. Even from a distance, it can appear dense, compressed, overlaid with curves, symbols, markers, panels, legends, axes, insets and labels that assume the reader already knows the scientific language in which the figure is speaking.</p><p>But to a researcher, that density is not merely visual complexity. It is often where the paper’s argument becomes more concrete, where a general claim begins to acquire conditions, comparisons, measurements and limits.</p><p>The text may say that performance improved.</p><p>The figure says when, by how much, under which conditions, compared with what, with which uncertainty, and sometimes where the trend begins to fail.</p><p>This is particularly true in scientific domains such as materials science, where spectra, phase diagrams, band diagrams, reaction schemes, process diagrams and multiaxis plots can encode relationships that are not always restated completely in the surrounding prose.</p><p>A line is not always just a line.</p><p>It may be a growth-per-cycle curve, a saturation response, a compositional trend, a temperature window, or an indication that a surface reaction has reached completion.</p><p>A peak is not always just a peak.</p><p>Its position, intensity, width and relationship to other peaks may suggest nucleation, bonding, oxidation state, composition or structural change.</p><p>A model can detect the pixels.</p><p>A domain expert knows what would make the interpretation scientifically defensible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ex_7I5UjZIrvM2D-KVU7fw.jpeg" /><figcaption>Domain-Expert Data Annotation Illustrative Visual — Image by Author, generated using ChatGPT.</figcaption></figure><h3>What we built</h3><blockquote>The <a href="https://sciknoworg.github.io/ALD-E-ImageMiner/"><strong>ALD/E-ImageMiner </strong>benchmark</a> was established to create gold-standard annotations for scientific-figure classification, structured data extraction, summarization and visual question answering. The corpus is organized around atomic layer deposition (ALD) and atomic layer etching (ALE) publications and further distinguishes experimental from simulation-based work. The <a href="https://github.com/sciknoworg/ALD-E-ImageMiner">dataset repository</a> uniquely presents structured document representations with domain-expert annotations of scientific images with their scientific provenance.</blockquote><p>The resulting benchmark contains <strong>205 scientific publications and 1,951 figures</strong>, divided into training, development and test sets across ALD and ALE experimental and simulation studies.</p><p>The four expert-annotated signals resemble stages of understanding.</p><p>First, what am I looking at (figure classification), then, what information does it contain (structured data extraction), then, what does that information say (figure content summarization), then, what scientific questions does it present (visual question answering)?</p><p>The movement from classification to reasoning is the movement from seeing a scientific object to understanding why it matters.</p><h3>Ten experts, not ten anonymous clicks</h3><p>Given our annotation budget, we recruited ten annotators with materials-science backgrounds and direct experience related to ALD or ALE.</p><p>They included MSc-level researchers, doctoral researchers, postdoctoral researchers and associate professors, recruited from universities and research environments across the United Kingdom, Finland, the Netherlands, Pakistan and India, together with an independent contractor holding an MSc. Their backgrounds included experimental ALD/E, simulation-based research, physics and computational materials science.</p><p>They were selected through a prescreening task conducted on a scientific paper, from a pool of strong applicants, and the candidates producing the highest-quality work were hired.</p><p>Each annotator received 25 papers, enough to establish familiarity, not enough to turn the work into a factory shift — intentional to avoid, five papers were deliberately shared by all annotators, assignments were balanced across deposition and etching, experiments and simulations, because fatigue creates mistakes, repetition creates blindness, and a dataset remembers every shortcut taken during its construction.</p><p>The process combined machine assistance with human responsibility. A vision-language model produced preliminary annotations for classification, data extraction and summarization, but the experts reviewed and refined the material, while the visual-question-answering task was reserved for manual expert annotation. Automated validation scripts were run every two weeks, inconsistencies were returned to annotators, annotations were revised and finally consolidated into a distributable structure.</p><h3>Expertise changes the questions</h3><p>Almost anyone can look at a chart and ask:</p><blockquote><em>What color is the line?</em></blockquote><p>A domain expert asks:</p><blockquote><em>How does the Ti–O–Si peak intensity change with the number of ALD cycles, and what does this indicate about film formation?</em></blockquote><p>Almost anyone can ask:</p><blockquote><em>Is one point higher than another?</em></blockquote><p>A domain expert asks:</p><blockquote><em>How does the temperature required for the modification step compare with that required for the etching step, and what does this imply for controlling the process window?</em></blockquote><p>The difference is not simply in the wording of the question. It comes from years of looking at such figures, knowing what matters, and knowing what would make an answer scientifically meaningful. The difference is that the second kind of question tests whether a system can connect visual evidence to a scientific process, a material property, a mechanism, an experimental condition or an application-level consequence.</p><p>For the benchmark, experts produced Q&amp;A pairs at the subfigure level, guided by categories including <strong>process-oriented reasoning</strong>, <strong>comparative or trend reasoning</strong>, <strong>structure–property relationships</strong>, and <strong>application or performance reasoning</strong>. Answers were represented as yes/no, factoid, list or paragraph responses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*tSHPrYj4FleOBQSOMFnOGA.png" /><figcaption>Examples of challenging scientific figures in ALD/E-ImageMiner, illustrating how visual question answering requires domain-grounded interpretation rather than surface-level image recognition.</figcaption></figure><p>The figure above helps make this distinction more concrete. These examples are not only about identifying what is visible in the image, but about interpreting the figure in relation to the underlying scientific context. A polar chart may involve reasoning about why a measurement was taken at a particular angle. A multi-spectra chart may require understanding alignment to a reference peak. A 3D plot may ask how surface roughness changes after annealing, while a contour heatmap may involve interpreting plasma-density patterns under specific process assumptions.</p><p>In each case, the question is not only <strong>what is shown?</strong> but also <strong>how should this visual evidence be interpreted?</strong> That is where domain-expert annotation becomes valuable: it connects the visible elements of the figure to the scientific context in which they matter.</p><p>Without that expertise, the questions might become easier, cleaner, more generic, and more visually obvious. They might also become less useful.</p><blockquote>A benchmark can scale and still fail to ask the questions that matter.</blockquote><h3>Domain experts protect the boundary between plausible and correct</h3><p>Generative models are excellent producers of plausibility.</p><p>They know how an answer should sound.</p><p>They know the rhythm of an explanation, the shape of a table, the tone of certainty, the words commonly found near words such as <em>deposition</em>, <em>etching</em>, <em>surface</em>, <em>film</em> and <em>temperature</em>.</p><p>But scientific correctness often lives in details that language fluency can conceal: a unit copied incorrectly, a logarithmic axis treated as linear, two curves associated with the wrong legend entries, a peak attributed to the wrong chemical species, an experimental observation presented as a causal mechanism, a simulation result confused with a measured value, a trend summarized correctly in direction but incorrectly in magnitude, a conclusion inferred from the caption although the plotted evidence does not support it.</p><p>A fluent non-expert may not notice these errors. A model may explain them beautifully. A domain expert is more likely to stop.</p><h3>The competition tested the data as much as the models</h3><p>The ALD/E-ImageMiner benchmark was subsequently released as an <a href="https://icdar2026.org/index.php/competitions/">ICDAR 2026 competition</a> called <a href="https://sites.google.com/view/sci-imageminer/">Sci-ImageMiner</a>. It attracted <strong>68 active participants and 1,263 public and private submissions</strong> across the four tasks.</p><p>The results were revealing.</p><blockquote>Current multimodal systems performed comparatively well on classification and summarization, but data extraction and visual question answering remained difficult. The winning classification system reached an F1 score of 0.81, while the best weighted VQA score was only 0.31. Even sophisticated systems using fine-tuning, retrieval, context injection, task-specific prompting, multistage pipelines and model alignment continued to struggle with precise extraction and scientific reasoning.</blockquote><p>To me, this is one of the more interesting outcomes of the benchmark. The results suggest that scientific figure understanding is not a single capability that improves uniformly once a model becomes stronger. A system may learn to recognize the type of a figure, or produce a plausible summary, while still struggling when it has to recover structure precisely or connect visual evidence to domain-specific reasoning. The benchmark therefore helps separate different layers of understanding that are often treated as one in the guise of scientific figure comprehension.</p><h3>Synthetic data still has a place</h3><p>This is not an argument for returning to a world in which every example is created manually.</p><p>We will need synthetic data… because expert time is limited, expert annotation can be prohibitively expensive, especially for small research groups and less well-resourced labs, scientific domains are vast, rare figure types are difficult to collect, distributions are uneven, new models consume more examples than any annotation team can reasonably produce.</p><p>Synthetic data can expand a taxonomy. It can balance classes. It can create controlled perturbations. It can generate practice examples. It can support curriculum learning, preference optimization and robustness testing.</p><p>Indeed, the winning approaches in the competition used synthetic augmentation and other model-assisted strategies effectively, particularly for structured data extraction.</p><p>But synthetic data needs an anchor.</p><p>It needs examples whose meaning did not originate in the same model family that will later be trained or evaluated on them.</p><p>It needs expert-created seeds, expert-defined categories, expert-checked outputs, authentic scientific documents and test sets that remain outside the loop of machine self-confirmation.</p><p>Otherwise the model <em>generates the lesson, studies the lesson, writes the examination and awards itself the grade</em>.</p><h3>An annotated dataset is encoded scientific judgement</h3><p>We often describe datasets using nouns of quantity: papers, figures, classes, questions, tokens, gigabytes.</p><p>Yet the most valuable content is not entirely countable.</p><p>It is the decision that two visually similar plots represent different scientific objects. It is the choice to ask about mechanism instead of color. It is the recognition that a caption does not fully explain a curve. It is the correction of an extracted value. It is the insistence that an answer distinguish observation from inference.</p><p>It is the knowledge that a figure from an experimental ALD study should not be interpreted as though it came from a simulation, although both may contain the same axes and nearly the same lines.</p><p>This is why domain-expert annotation should not be treated as low-level data preparation performed before the interesting AI research begins.</p><p>It is knowledge engineering.</p><p>It is scientific modeling.</p><p>It is the construction of the concepts, distinctions, questions and evidential standards by which the AI system will later be judged.</p><p>The dataset is not merely fuel placed into a model.</p><p>It is a record of what a community considered meaningful enough to name, difficult enough to test and important enough to preserve.</p><h3>The internet may be tired, but science is not finished</h3><p>There will be larger models.</p><p>There will be longer context windows, more agents, better retrieval, faster synthetic-data factories, systems able to produce a million plausible scientific examples before breakfast.</p><p>Still, someone must decide what is true.</p><p>Someone must know why two curves that look almost identical imply different process behavior. Someone must notice that an answer is elegant and wrong. Someone must formulate the difficult question before the model can learn to answer it.</p><p>In this age of generative AI, high-quality, domain-expert annotated datasets are not obsolete remnants of an earlier machine-learning era.</p><p>They are the ground beneath the new one. The machines may generate the sentences. <em>Experts still give them something worth saying.</em></p><blockquote>✨ <strong>In the age of generative AI, perhaps the question is not only how much data we can create, but how much meaning we can preserve.</strong></blockquote><h3>Resources</h3><p>🌐<strong>Explore the ALD/E-ImageMiner project page</strong> for the dataset, competition links, evaluation scripts and related resources:<br> <a href="https://sciknoworg.github.io/ALD-E-ImageMiner/">https://sciknoworg.github.io/ALD-E-ImageMiner/</a></p><p>🏆<strong>Read the competition scientific report preprint: </strong><a href="https://arxiv.org/abs/2607.26848"><em>ICDAR 2026 Competition on Information Extraction from Atomic Layer Deposition/Etching (ALD/E) Scientific Figures</em></a><strong> </strong>| Fahad Ahmed, Sören Auer, Jennifer D’Souza</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ece5620020a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bending Musical Time with a Fictional DJ — Field Notes from the Build Small AI Hackathon]]></title>
            <link>https://medium.com/@jenlindadsouza/bending-musical-time-with-a-fictional-dj-field-notes-from-the-build-small-hackathon-71f10680ca0e?source=rss-30a9dfd80bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/71f10680ca0e</guid>
            <category><![CDATA[openai-codex]]></category>
            <category><![CDATA[music-technology]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <dc:creator><![CDATA[Jennifer D'Souza, Ph.D.]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 19:57:40 GMT</pubDate>
            <atom:updated>2026-06-15T21:56:59.989Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KukS78oUqCcd0IFDcR5osA.png" /><figcaption>Banner for the “Turntable Time Machine” gradio APP. Checkout the APP here: <a href="https://huggingface.co/spaces/build-small-hackathon/turntable-time-machine">https://huggingface.co/spaces/build-small-hackathon/turntable-time-machine</a></figcaption></figure><p>At some point during the Build Small Hackathon, I found myself asking a question that felt both ridiculous and irresistible:</p><blockquote><em>What would happen if 1960s folk pop accidentally fell through a wormhole and woke up inside a 2000s indie-rock radio station?</em></blockquote><p>It sounded like a joke at first, but it turned out to be a good hackathon challenge: can a small AI app make music generation feel like a tiny radio experience?</p><p>The result was <strong>Turntable Time Machine</strong>, a <a href="https://www.gradio.app/"><strong>Gradio</strong></a> app built for the <a href="https://huggingface.co/build-small-hackathon"><strong>Hugging Face × Gradio Build Small Hackathon</strong></a>. The app lets users choose a source era, a remix era, a fictional DJ persona, a language, a mood, an audio texture, and a vocal mode. Then, with a multilingual text layer supported by <a href="https://huggingface.co/CohereLabs/tiny-aya-global"><strong>CohereLabs/tiny-aya-global</strong></a>, it generates a short original “radio postcard” from a musical timeline that never existed.</p><p>The app is not a famous-song remix machine. It does not make covers, imitate artists, clone voices, or reproduce melodies. Instead, it works with broad musical vocabularies: 1960s soul, 1970s disco, 1980s synth-pop, 1990s trip-hop, 2000s indie rock, 2010s festival EDM, 2020s lo-fi, and so on.</p><p>The core idea is simple:</p><blockquote><strong><em>Pick two musical eras. Bend one through the other. Let a fictional DJ announce the impossible timeline.</em></strong></blockquote><p>That DJ voice became the feature that made the app feel less like a prompt form and more like a tiny radio object.</p><h3>What the User Controls</h3><p>The interface is structured around a few playful choices:</p><ul><li><strong>Source era:</strong> the musical vocabulary to start from</li><li><strong>Source genre:</strong> for example folk pop, disco, synth-pop, trip-hop, garage, lo-fi</li><li><strong>Remix era:</strong> the time period that transforms the source</li><li><strong>Remix genre:</strong> the production lens</li><li><strong>Fictional DJ persona:</strong> the voice of the broadcast</li><li><strong>Broadcast language:</strong> English, German, French, or Spanish</li><li><strong>Prompt language mode:</strong> English, selected language, or bilingual</li><li><strong>Vocal mode:</strong> instrumental only, wordless vocal texture, or original micro-lyrics</li><li><strong>Audio texture:</strong> vinyl crackle, cassette warmth, FM radio, mono radio, club PA, VHS glow, early MP3 compression, or clean digital master</li><li><strong>Mood:</strong> nostalgic, dreamy, energetic, futuristic, intimate, and so on</li></ul><p>This combination gives the user enough control to feel creative, but not so much control that the app becomes a studio dashboard.</p><p>That balance mattered. The Build Small Hackathon encouraged compact, focused, playful apps. So I wanted the app to feel like a toy with real structure underneath.</p><h3>The Timeline Engine</h3><p>Under the hood, the app is not just a single prompt box. It runs a lightweight <strong>Timeline Engine</strong>.</p><p>The process looks like this:</p><pre>User selections<br>→ source era / genre lookup<br>→ remix era / genre lookup<br>→ fictional DJ persona selection<br>→ language and prompt-mode routing<br>→ BPM selection from genre ranges<br>→ optional Tiny Aya micro-lyrics<br>→ safety-aware music prompt<br>→ optional spoken DJ narration<br>→ music generation or fallback synth audio<br>→ nostalgia texture processing<br>→ final broadcast and mixtape card</pre><h3>The Core Build</h3><p>The app works like a little time-bending machine.</p><p>The user might choose:</p><pre>Source: 1960s folk pop<br>Remix: 2000s indie rock<br>Mood: nostalgic<br>Texture: FM radio<br>DJ: The Midnight Radio Curator<br>Language: German<br>Vocal mode: original micro-lyrics</pre><p>The app then builds a structured prompt for the audio model, optionally generates short original micro-lyrics, creates a DJ intro, and combines everything into a final broadcast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uDmKLA-j1ZLZDa30q4uHgA.png" /><figcaption><strong>Conceptual illustration of the Turntable Time Machine APP.</strong> User choices travel through a timeline engine, Tiny Aya text layer, DJ intro, music prompt, audio texture, and finally become a fictional radio broadcast... Image generated by the author using ChatGPT.</figcaption></figure><p>A simplified version of the prompt-building logic looks like this:</p><pre>def build_music_prompt(source, remix, mood, texture, bpm, lyrics=None):<br>    prompt = (<br>        f&quot;Create an original music clip. &quot;<br>        f&quot;Start from {source} and transform it into {remix}. &quot;<br>        f&quot;Mood: {mood}. Texture: {texture}. BPM: {bpm}. &quot;<br>    )<br>    if lyrics:<br>            prompt += f&quot;Use only these original micro-lyrics:\n{lyrics}&quot;<br>        else:<br>            prompt += &quot;No vocals. No lyrics.&quot;<br>        prompt += (<br>            &quot; Do not imitate any artist, song, melody, hook, riff, &quot;<br>            &quot;voice, sample, or copyrighted lyric.&quot;<br>        )<br>        return prompt</pre><p>This was one of the main lessons of the build: small AI apps benefit from structure. The app is not just one giant prompt. It has curated era metadata, genre vocabulary, DJ personas, texture settings, language options, and safety constraints.</p><p>The model does not have to invent the whole world. The app gives it a world to work inside.</p><h3>The DJ Voice Changed Everything</h3><p>Originally, I thought the app would mainly be about music generation. But the DJ voice became the feature that made the output feel alive.</p><p>The fictional DJ might say something like:</p><pre>Good evening, time travelers. Tonight we are taking 1960s folk pop<br>and sending it through the glow of 2000s indie rock.<br>Let the record spin from another timeline.</pre><p>This turns the output into a small performance. The user is not just waiting for a file. They are listening to a broadcast.</p><p>That was my favorite lesson from this build: <strong>sound modality is not only instrumental output</strong>. In audio-first apps, human voice can be part of the interface. A spoken intro, a pause, and then the music can create expectation and atmosphere.</p><p>The final assembly can be as simple as:</p><pre>broadcast = []<br><br>if dj_intro_audio:<br>    broadcast.append(dj_intro_audio)<br>    broadcast.append(short_pause())<br>    broadcast.append(generated_music)<br>    final_audio = concatenate_audio(broadcast)</pre><p>The pause matters. It makes the transition feel intentional, like a real radio moment.</p><h3>Where Tiny Aya Global Fits In</h3><p>The app uses <strong>CohereLabs/tiny-aya-global</strong> as the multilingual text layer.</p><p>In the current version, its main role is to generate short, original micro-lyrics when the user selects a vocal mode. The prompt is intentionally small and bounded: two lines, original wording, selected language, selected mood, and no references to real songs or artists.</p><p>For example:</p><pre>lyrics_prompt = (<br>    f&quot;Write 2 short original lyric lines in {language}. &quot;<br>    f&quot;Mood: {mood}. &quot;<br>    f&quot;Style: {source_genre} transformed into {remix_genre}. &quot;<br>    &quot;No famous lyrics, no artist names, no song titles.&quot;<br>)</pre><p>This is a good role for a small multilingual model. Tiny Aya does not need to control the whole app. It contributes a compact creative layer inside a larger pipeline.</p><p>But it could be integrated much more deeply.</p><p>In future versions, Tiny Aya could generate multilingual DJ intros, mixtape liner notes, short explanations of the genre transformation, or persona-specific lyrical fragments. It could also adapt the broadcast more naturally across languages instead of simply filling a template.</p><p>For example, the app could ask Tiny Aya to write:</p><pre>A two-sentence DJ intro in French, in the voice of a warm late-night<br>radio host, introducing 1980s synth-pop transformed into 2020s lo-fi.</pre><p>That would make the app feel less templated and more like a living multilingual radio station.</p><h3>What I Learned</h3><p>This build taught me three things.</p><p>First, sound-based apps should think beyond “generate audio.” Voice, texture, timing, and transitions are also design materials.</p><p>Second, small models become more useful when they are given precise jobs. Tiny Aya is not asked to write a whole song. It writes tiny original lyric fragments. The audio model is not asked to imitate music history. It receives a constrained, safety-aware transformation prompt.</p><p>Third, fallbacks are not failure. For a hackathon app, models may load slowly, hardware may vary, and deployment may behave differently from local testing. A good small app should degrade gracefully: text instead of voice, fallback lyrics instead of model-generated ones, simple synth audio instead of full music generation when needed.</p><p>A playful app should still be robust.</p><h3>Future Extensions</h3><p>I would love to extend Turntable Time Machine into a fuller fictional radio experience.</p><p>Future versions could support three-track mini radio episodes, more languages, stronger DJ voice control, richer musical geographies, and user-provided memories that become safe, original audio postcards.</p><p>The concept also transfers beyond music.</p><p>In education, a “time machine” interface could explain concepts across historical periods or communication styles. In science communication, papers could become audio briefings, museum-guide explanations, or multilingual summaries. In digital humanities, archives could become narrated listening experiences with careful provenance and ethical boundaries.</p><p>The serious idea behind the playful app is this:</p><blockquote><em>Structured transformation plus multimodal narration can make information feel alive.</em></blockquote><p>Turntable Time Machine just applies that idea to music.</p><p>Pick an era. Bend the genre. Let the fictional DJ open the portal.</p><h3>Resources</h3><ul><li>🤗 <strong>Live Space:</strong> <a href="https://huggingface.co/spaces/build-small-hackathon/turntable-time-machine">https://huggingface.co/spaces/build-small-hackathon/turntable-time-machine</a></li><li>💻 <strong>GitHub repo:</strong> <a href="https://github.com/jd-coderepos/turntable-time-machine">https://github.com/jd-coderepos/turntable-time-machine</a></li><li>🎬 <strong>Demo video:</strong> <a href="https://www.youtube.com/watch?v=EKCwTK88pUE">https://www.youtube.com/watch?v=EKCwTK88pUE</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71f10680ca0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making Great Thinkers Funny with Tiny Models — Field Notes from the Build Small Hackathon]]></title>
            <link>https://medium.com/@jenlindadsouza/making-great-thinkers-funny-with-tiny-models-field-notes-from-the-build-small-hackathon-578269f386e9?source=rss-30a9dfd80bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/578269f386e9</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[hugging-face]]></category>
            <category><![CDATA[gradio]]></category>
            <category><![CDATA[hackathons]]></category>
            <dc:creator><![CDATA[Jennifer D'Souza, Ph.D.]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 11:40:52 GMT</pubDate>
            <atom:updated>2026-06-15T11:44:37.117Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BnIInN1czH2GvJqYfOt9yg.png" /><figcaption>Banner for the “Council of Chuckles” gradio APP. Checkout the APP here: <a href="https://huggingface.co/spaces/build-small-hackathon/council-of-chuckles">https://huggingface.co/spaces/build-small-hackathon/council-of-chuckles</a></figcaption></figure><p>For the <a href="https://huggingface.co/">Hugging Face</a> × <a href="https://www.gradio.app/">Gradio</a> <a href="https://huggingface.co/build-small-hackathon">Build Small Hackathon</a>, I built <a href="https://huggingface.co/spaces/build-small-hackathon/council-of-chuckles">Council of Chuckles</a>, a small-model Gradio app that lets users bring a messy everyday question to a council of historical and literary-inspired advisors. The user can type a question, or speak it aloud, choose a group of advisors, and receive a playful response in the form of advisor cards or a short “Campfire Council” dialogue.</p><p>The app was built for the <strong>Thousand Token Wood</strong> track, so the spirit was not to use the largest possible model, but to ask: how much interaction, personality, multilinguality, and structure can we build around small models?</p><p>The core idea was simple. Instead of asking a language model for generic advice, I wanted the app to stage a small reflective encounter. The council can include figures such as <a href="https://en.wikipedia.org/wiki/Confucius">Confucius</a>, <a href="https://en.wikipedia.org/wiki/Socrates">Socrates</a>, <a href="https://en.wikipedia.org/wiki/Rumi">Rumi</a>, <a href="https://brenebrown.com/">Brené Brown</a>, <a href="https://en.wikipedia.org/wiki/Carl_Jung">Carl Jung</a>, or other thinkers. But the goal is not solemn wisdom. It is perspective-shifting with a wink. 😉</p><h3>What I Built</h3><p>Council of Chuckles has three main interaction layers. First, the user asks a question in text or voice. Second, they assemble a council from 100 advisor profiles. Third, the app runs a lightweight “Council Engine” that analyzes the question, selects suitable voices, builds a prompt, generates a response, and optionally produces a final verdict called <strong>The Gavel Falls</strong>.</p><p>The working logic looks roughly like this:</p><pre>User input<br>→ safety routing<br>→ topic / emotion / need analysis<br>→ advisor matching<br>→ active speaker selection<br>→ dialogue planning<br>→ prompt construction<br>→ small-model generation or fallback<br>→ final verdict</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eVEGXqUXxacgx7aAxri_ZA.png" /><figcaption><strong>Illustration of the Council of Chuckles app logic. </strong>Image generated by the author using ChatGPT</figcaption></figure><p>What I liked about this architecture is that the model is only one part of the system. Much of the behavior comes from structured profiles, routing, prompt design, safety checks, and interface choices. That was one of my main lessons from the hackathon: small models become much more useful when the application around them gives them a clear stage to perform on.</p><h3>Main Technologies Used</h3><p>The app is built with <a href="https://www.gradio.app/"><strong>Gradio</strong></a>, <a href="https://huggingface.co/docs/transformers/index"><strong>Hugging Face Transformers</strong></a>, <a href="https://huggingface.co/CohereLabs/tiny-aya-water"><strong>Tiny Aya Water</strong></a>, <a href="https://huggingface.co/openai/whisper-small"><strong>Whisper small</strong></a>, and <a href="https://huggingface.co/docs/hub/en/spaces"><strong>Hugging Face Spaces</strong></a> / <a href="https://huggingface.co/docs/hub/en/spaces-zerogpu"><strong>ZeroGPU</strong></a>.</p><p><a href="https://www.gradio.app/">Gradio</a> was one of my biggest practical learnings. It is a <a href="https://www.gradio.app/guides/quickstart">Python framework</a> that lets you turn Python functions into <a href="https://www.gradio.app/guides/creating-a-chatbot-fast">interactive web apps</a> quickly. You define UI components such as <a href="https://www.gradio.app/docs/gradio/textbox">text boxes</a>, <a href="https://www.gradio.app/docs/gradio/audio">audio inputs</a>, <a href="https://www.gradio.app/docs/gradio/dropdown">dropdowns</a>, <a href="https://www.gradio.app/docs/gradio/button">buttons</a>, and <a href="https://www.gradio.app/docs/gradio/html">HTML panels</a>, then connect them to Python functions.</p><p>A simplified version of the app structure looks like this:</p><pre>import gradio as gr<br><br><br>with gr.Blocks(title=&quot;Council of Chuckles&quot;) as demo:<br>    audio = gr.Audio(<br>        label=&quot;Record or upload your question&quot;,<br>        sources=[&quot;microphone&quot;, &quot;upload&quot;],<br>        type=&quot;filepath&quot;,<br>    )<br>    transcript = gr.Textbox(label=&quot;Editable transcript&quot;)<br>    question = gr.Textbox(label=&quot;Your question&quot;)<br>    transcribe_btn = gr.Button(&quot;Transcribe&quot;)<br>    generate_btn = gr.Button(&quot;Generate council response&quot;)<br>    transcribe_btn.click(<br>        transcribe,<br>        [audio, spoken_language],<br>        [transcript, voice_status],<br>    )<br>    generate_btn.click(<br>        generate,<br>        [...],<br>        [stage_display, session_state],<br>    )<br>demo.launch(css=CSS)</pre><p>This pattern made the app feel manageable: build the interface, define the state, then bind events to functions.</p><p>For multilingual text generation, the app uses <a href="https://huggingface.co/CohereLabs/tiny-aya-water">CohereLabs/tiny-aya-water</a>, a small multilingual model with <strong>3.35B parameters</strong> and broad coverage across <strong>70+ languages</strong>. In the app, this supports text interaction in languages such as English, German, French, Spanish, Italian, Portuguese, Polish, Greek, Hindi, Tamil, Vietnamese, Mandarin Chinese, Japanese, Korean, Swahili, Arabic, and more. The model is loaded lazily so that the <a href="https://www.gradio.app/">Gradio</a> interface can appear before the full <a href="https://huggingface.co/docs/transformers/index">Hugging Face Transformers</a> model pipeline is ready:</p><pre>from functools import lru_cache<br>from transformers import AutoModelForCausalLM, AutoTokenizer<br><br><br>TEXT_MODEL_ID = &quot;CohereLabs/tiny-aya-water&quot;<br>@lru_cache(maxsize=2)<br>def load_text_model(model_id=TEXT_MODEL_ID):<br>    tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)<br>    model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)<br>    return tokenizer, model</pre><p>For voice input, I used <a href="https://huggingface.co/openai/whisper-small">openai/whisper-small</a>, a <strong>244M-parameter</strong> speech recognition model, through the <a href="https://huggingface.co/docs/transformers/index">Hugging Face Transformers</a> <a href="https://huggingface.co/docs/transformers/tasks/asr">automatic speech recognition (ASR) pipeline</a>. This was another important learning point: voice models need more than just “load model and run.” The app has to handle audio duration, silence, language selection, sampling rate, and graceful failure. In the app, voice input is supported through a curated language selector for English, German, Hindi, French, Spanish, Italian, Portuguese, Dutch, Polish, Greek, Arabic, Vietnamese, Mandarin Chinese, Japanese, and Korean.</p><p>A simplified version of the voice flow is:</p><pre>from transformers import pipeline<br><br><br>ASR_MODEL_ID = &quot;openai/whisper-small&quot;<br>@lru_cache(maxsize=1)<br>def load_asr_pipeline():<br>    return pipeline(&quot;automatic-speech-recognition&quot;, model=ASR_MODEL_ID)<br>def transcribe_audio(audio, language_code):<br>    asr = load_asr_pipeline()<br>    result = asr(<br>        audio,<br>        generate_kwargs={<br>            &quot;language&quot;: language_code,<br>            &quot;task&quot;: &quot;transcribe&quot;,<br>        },<br>    )<br>    return result[&quot;text&quot;]</pre><p>The final piece is the advisor layer. Each advisor has structured metadata in <a href="https://github.com/jd-coderepos/council-of-chuckles/blob/main/data/advisors.json">data/advisors.json</a>: role, core_wisdom, signature_style, mastermind_voice, jokester_voice, catchphrase, best_for, and avoid. This made the app less like a single prompt and more like a tiny orchestrated NLP system.</p><h3>The NLP Themes Inside the App</h3><p>Although <strong>Council of Chuckles</strong> is playful, it touches several core NLP themes:</p><ul><li><strong>Multilingual text generation:</strong> Users can type questions in different languages and receive responses in their chosen language.</li><li><strong>Automatic speech recognition:</strong> Spoken questions are transcribed before they enter the council engine.</li><li><strong>Text classification and lightweight semantic routing:</strong> The app detects themes, emotions, and user needs before choosing suitable advisors.</li><li><strong>Persona-conditioned generation:</strong> Each advisor has a distinct reasoning style, tone, and perspective.</li><li><strong>Dialogue planning:</strong> In Campfire Council mode, the app stages a short multi-voice exchange rather than producing a single generic answer.</li><li><strong>Prompt engineering and controlled generation:</strong> The prompts guide the model toward playful, structured, and advisor-specific responses.</li><li><strong>Safety routing:</strong> The app keeps the humor bounded so responses remain playful without becoming cruel, dismissive, or inappropriate.</li></ul><blockquote>For me, this was the most interesting part of this hackathon build. The app is light-hearted on the surface, but underneath it is about structured interaction design for small language models. It asks how far we can go with <strong>model orchestration, transparent routing, and carefully designed roles</strong> before reaching for heavier infrastructure.</blockquote><h3>What I Learnt</h3><p>I learnt that building with small models is not mainly about accepting limitations. It is about designing around them. A small model may not always produce perfect long-form reasoning, but it can do surprisingly well when the task is bounded, the style is clear, the output format is constrained, and the application provides scaffolding.</p><p>I also learnt that Gradio is a very approachable way to ship an AI idea as an actual app. The distance between “I have a Python function” and “someone can try this in a browser” is very short. For a hackathon, that matters.</p><p>Finally, working with voice input made the app feel more alive. Typing a frustration is one thing; saying it aloud and watching it become a question for a tiny council of philosophers is another. It adds a theatrical quality that fits the project.</p><p>The idea is simple: when life gets dramatic, call in the great thinkers — but make them funny. Each advisor applies their own style of reasoning, yet the app nudges the tone away from solemn advice and toward playful perspective-shifting.</p><h3>Extensions</h3><p>Council of Chuckles is a toy example, but the underlying pattern is more general. One obvious extension is to make the advisor profiles richer. Instead of only historical and literary-inspired figures, the same structure could support domain experts, learning companions, research mentors, writing coaches, or debate partners. The important part is not the name of the persona, but the structured profile behind it: what perspective it brings, what tone it should use, what kinds of problems it is good for, and what boundaries it should respect.</p><p>The same idea could also be used beyond playful reflection. A similar council-style interface could support education, brainstorming, writing feedback, research planning, or decision exploration. For example, a student could ask for feedback from a “clarity coach,” a “critical reviewer,” and a “friendly explainer.” A researcher could use a council of methodological perspectives to examine a project idea. A writer could test whether an argument sounds convincing, confusing, or too dramatic.</p><p>Another natural extension is sound. The current app supports voice input, but the council could become even more theatrical if each advisor had an optional spoken voice. A Campfire Council mode with audio output would turn the interaction from a written response into a small staged performance. That would also raise new design questions: how should voices differ, how long should the dialogue be, and how can audio remain fun without becoming distracting?</p><p>For me, this is where the hackathon idea becomes especially interesting. The project began as a playful app about tiny AI advisors with jokes, but it points toward a broader design pattern: small models, structured personas, transparent routing, and multimodal interaction can be combined to create experiences that feel more intentional than a single chatbot reply.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=578269f386e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[schema-miner^pro — Human-in-the-loop and Agentic Pipeline for Scientific Schema Mining]]></title>
            <link>https://medium.com/@jenlindadsouza/schema-miner-pro-human-in-the-loop-and-agentic-pipeline-for-scientific-schema-mining-9b2874ab7407?source=rss-30a9dfd80bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b2874ab7407</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[schema]]></category>
            <category><![CDATA[ontology]]></category>
            <dc:creator><![CDATA[Jennifer D'Souza, Ph.D.]]></dc:creator>
            <pubDate>Sat, 02 May 2026 13:11:03 GMT</pubDate>
            <atom:updated>2026-05-02T15:10:53.820Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gQs07k6y6vLJPPR5plB2LQ.png" /><figcaption>Engineering meaning from structure — Image generated by the author using ChatGPT.</figcaption></figure><blockquote>Agent-based workflows introduce a transformative capability to Semantic Web technologies by embedding autonomy, memory, and modular reasoning into information extraction and grounding tasks. — <a href="https://doi.org/10.1177/22104968261431521">schema-miner^pro</a></blockquote><p>This is the central idea behind our recent work on <em>schema-miner^pro: Agentic AI for Ontology Grounding Over LLM-Discovered Scientific Schemas in a Human-in-the-Loop Workflow </em>(DOI: <a href="https://journals.sagepub.com/doi/10.1177/22104968261431521">10.1177/22104968261431521</a>).</p><p>But let’s step back for a moment.</p><h3>🌿 Schemas Have Been Around Longer Than We Think</h3><p>Schemas are not new.</p><p>They’ve quietly lived in the background of computing for decades — from database design to knowledge representation, from XML to RDF. At their core, they are simple: they describe what exists and how things relate.</p><p>But science has always been different.</p><p>Scientific knowledge is rarely born structured. It emerges in prose — carefully written, context-heavy, and often difficult to compare across papers. A temperature here, a rate there, a parameter described differently depending on the experiment. Across a corpus, even basic concepts begin to drift.</p><p>And so, while schemas shaped the digital world, <strong><em>scientific schemas have remained elusive.</em></strong></p><p>Large language models changed the starting point.</p><p>With <strong>schema-miner</strong> (our earlier work on <em>LLMs4SchemaDiscovery, </em>DOI: <a href="https://link.springer.com/chapter/10.1007/978-3-031-94578-6_14">10.1007/978–3–031–94578–6_14</a>), we showed that LLMs can move beyond entity extraction and begin to <strong>induce schemas directly from scientific text</strong>.</p><p>In practice, the workflow is iterative but intuitive. You begin with a process description, from which the LLM proposes an initial schema — properties, types, relationships. This draft is then refined using a small, high-quality set of papers, and later generalized across a broader corpus. At each stage, domain experts step in — sometimes by editing the schema directly, sometimes by providing structured feedback — which is fed back into the model.</p><p>Over time, this loop transforms a rough output into something that is structurally consistent, semantically meaningful, and grounded in real scientific practice.</p><p>But even at this stage, a key limitation remains.</p><h3>🌐 Why Semantic Interoperability Matters</h3><p>A schema alone is not enough.</p><p>If two schemas describe the same concept differently — or use incompatible units — they cannot be meaningfully combined. This is the core challenge of <strong>semantic interoperability</strong>.</p><p>Without grounding in shared ontologies:</p><ul><li>schemas remain local</li><li>comparisons remain fragile</li><li>integration becomes manual</li></ul><p>In other words, we extract structure — but we still lack shared meaning.</p><h3>schema-miner^pro: Introducing the Agent 🤖</h3><p><em>schema-miner^pro</em> addresses this by adding an <strong>agentic ontology grounding stage</strong>.</p><p>Instead of relying on a single LLM prompt to align schema elements to an ontology, the system introduces a <strong>LangChain-based agent</strong> (<a href="https://reference.langchain.com/python/langchain/overview">https://reference.langchain.com/python/langchain/overview</a>) that performs this alignment step-by-step.</p><p>This is the key shift.</p><p>The problem is no longer treated as a one-shot generation task, but as a <strong>reasoning process with tool use</strong>.</p><h3>⚙️ A Practical View: How It Works</h3><p>Once you have a refined schema, the agent takes over.</p><p>It is given:</p><ul><li>the schema</li><li>a short domain description (for context)</li><li>a target ontology (e.g., QUDT <a href="https://www.qudt.org/">https://www.qudt.org/</a> for quantities and units)</li></ul><p>From there, grounding happens property by property.</p><p>For straightforward cases like <em>temperature</em> or <em>pressure</em>, the agent uses <strong>direct lexical matching</strong> against ontology terms.</p><p>When no clear match exists, it switches strategy.</p><p>The ontology is split into smaller chunks, embedded into vector representations, and indexed using FAISS (Facebook AI Similarity Search, <a href="https://github.com/facebookresearch/faiss">https://github.com/facebookresearch/faiss</a>), a library designed for efficient nearest-neighbor search in high-dimensional vector spaces. This enables semantic retrieval — where the agent finds conceptually similar ontology fragments rather than relying on exact string matches — before passing them to the LLM for final selection.</p><p>This hybrid approach — heuristics first, retrieval second — keeps the process both efficient and precise.</p><p>Just as importantly, the agent is allowed to return an empty result when a property does not correspond to a valid ontology concept. This avoids forcing incorrect mappings, a common failure mode in prompt-only approaches.</p><h3>🧩 From Schema to Semantically Grounded Knowledge</h3><p>Once a match is found, the agent integrates ontology metadata back into the schema using a template.</p><p>A simple field like <em>temperature</em> is no longer just a label. It becomes a structured quantity — linked to a unit, associated with a defined type, and connected to a canonical ontology identifier.</p><p>The schema, at this point, is no longer just structured — it is <strong>semantically grounded</strong>. It becomes machine-readable, interoperable, and ready for integration into knowledge graphs or downstream analysis pipelines.</p><h3>👩‍🔬 The Role of the Human</h3><p>Despite the automation, the final step remains essential: expert validation.</p><p>Domain experts review the grounded schema and correct subtle issues — often around unit choice or contextual interpretation. These refinements are fed back into the workflow, improving future grounding decisions.</p><p>This is not a limitation. It is what makes the system reliable in real scientific settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0cvAv4-VZLKODwJf4tuTuw.png" /></figure><h3>✨ Why This Shift Matters</h3><p>What <em>schema-miner^pro</em> represents is a subtle but important shift.</p><p>We are moving from:</p><p>→ extracting structure<br> to<br> → <strong>engineering meaning</strong></p><p>And we are doing so not with static pipelines, but with <strong><em>agentic systems that reason, adapt, and collaborate</em></strong><em>.</em></p><p>In the broader vision of AI for science, this matters.</p><p>Because scientific progress depends not just on data, but on our ability to <strong>connect, interpret, and reuse knowledge across domains</strong>.</p><h3>🔗 Resources</h3><p>📄 Paper: schema-miner^pro (DOI: <a href="https://journals.sagepub.com/doi/10.1177/22104968261431521">10.1177/22104968261431521</a>)<br> 💻 Software: <a href="https://github.com/sciknoworg/schema-miner">https://github.com/sciknoworg/schema-miner</a><br> 📦 Pip: <a href="https://pypi.org/project/schema-miner">https://pypi.org/project/schema-miner</a><br> 📚 Docs: <a href="https://schema-miner.readthedocs.io/en/latest">https://schema-miner.readthedocs.io/en/latest</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b2874ab7407" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DeepResearch: AI Agents on a Literature Treasure Hunt]]></title>
            <link>https://medium.com/@jenlindadsouza/deepresearch-ai-agents-on-a-literature-treasure-hunt-c590de681258?source=rss-30a9dfd80bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c590de681258</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[agentic-workflow]]></category>
            <category><![CDATA[scientific-research]]></category>
            <category><![CDATA[llm-agent]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Jennifer D'Souza, Ph.D.]]></dc:creator>
            <pubDate>Wed, 03 Sep 2025 18:31:42 GMT</pubDate>
            <atom:updated>2025-09-03T18:31:42.741Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>An agent that uses reasoning to synthesize large amounts of online information and complete multi-step research tasks for you. — OpenAI, Deep Research [1]</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WgY1JgY9d7pM0ZOXo6bn3A.png" /><figcaption>AI Agents helping with Research specifically with Search, Browse, and re-Search (visual interpretation 1). Image by Author, generated using ChatGPT.</figcaption></figure><p>On February 2nd 2025, OpenAI released its Deep Research feature [1]. Much of it was pretty much a blackbox for a few months. Then came David Zhang’s X/Twitter post about his <a href="https://github.com/dzhng/deep-research">Deep Research</a> implementation, which gave the community a peek under the hood. That post sparked curiosity and open-source spin-offs, including Python reimplementations (like <a href="https://github.com/sciknoworg/deep-research">mine</a>!) designed to make this workflow more transparent, tunable, and useful for scientific research.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*vhmKLDw88bzMjh_wBwTZew.png" /></figure><p>Ever felt lost in a jungle of scientific papers, unsure which path will lead to the answers you seek? What if you could send a team of tireless AI agents into that <strong>literature jungle</strong> to scout for insights while you sip your coffee? Enter <strong>DeepResearch</strong> — a novel AI system that turns complex scientific Q&amp;A into a recursive treasure hunt through research literature. Developed for <strong>ecological research</strong> (but useful far beyond), DeepResearch is like having a squad of super-smart robot interns comb through papers day and night. The result? A thorough, multifaceted report on your question, complete with citations and a dash of <strong>expert-level analysis</strong>. And the best part: you control how <em>deep</em> and how <em>broad</em> the hunt goes, dialing the scope up or down like a research DJ.</p><p>In this post, we’ll explore how DeepResearch works (in plain English, with fun analogies), highlight a new <strong>Python reimplementation</strong> of the system (based on David Zhang’s original TypeScript code), and show why this approach is a game-changer for ecologists and AI researchers tackling <strong>big, knotty questions</strong>. We’ll keep it casual and witty — imagine we’re chatting over coffee about this cool AI tool that acts like Indiana Jones in the Library of Science. Grab your fedora (or lab coat), and let’s dive in!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yGtSpYSWRbaRXUkMfXzLAQ.png" /><figcaption>AI Agents on a Literature Treasure Hunt. Image by Author, generated using ChatGPT.</figcaption></figure><p>At its heart, DeepResearch sends AI “agents” on a <strong>literature treasure hunt</strong>. Instead of one-pass searching, these agents work recursively — searching, reading, learning, and then <strong>asking better follow-up questions</strong>. It’s like an iterative brainstorm with the entire internet and scientific databases at their disposal. The original DeepResearchEco paper describes it as an <em>“agentic LLM-based system for automated scientific synthesis”</em> that uses a <em>“recursive, depth- and breadth-controlled exploration”</em> of research questions. In non-academese: <strong>the system searches far and wide (breadth) and drills deep (depth)</strong>, doing multiple rounds of search-and-summarize to gather a <strong>high-throughput integration of evidence</strong>. This leads to answers that aren’t just surface-level — they’re enriched with nuggets from many sources (one evaluation showed a <strong>21-fold increase in sources integrated</strong> into answers when using DeepResearch!). High depth/breadth runs produced <em>“expert-level analytical depth and contextual diversity,”</em> essentially matching domain experts in thoroughness. Not too shabby for an AI agent on autopilot!</p><h3>How DeepResearch Works (The AI Treasure Hunt Workflow)</h3><p>So how does DeepResearch actually pull off this feat? Let’s break down the <strong>recursive agent workflow</strong> in relatable terms. Imagine you’ve got a crack team of AI agents, each with a special role, tackling your question <em>“What are the impacts of climate change on grassland biodiversity?”</em> (one of those juicy, complex ecological questions). Here’s how the <strong>adventure</strong> unfolds:</p><p><strong>1. The Scout (Query Generation Agent):</strong> This agent takes your broad research question and comes up with specific search queries — like drawing treasure maps. For our example, it might generate queries like <em>“climate change effects on grassland plant diversity”</em> or <em>“grassland biodiversity temperature rainfall interaction.”</em> It also sets a <strong>“research goal”</strong> for each query — a hint of what we’re looking for. Essentially, the scout is figuring out <em>where</em> to dig first. (In DeepResearch, this corresponds to the <em>generate SERP queries</em> sub-agent, which turns the question into search-engine-friendly queries.)</p><p><strong>2. The Explorer (Search Agent):</strong> Now the queries go to the explorer agent, which actually ventures out to find information. DeepResearch can use two different explorers — think of them as two search modes. The first is <a href="https://www.firecrawl.dev/"><strong>Firecrawl</strong></a>, a web-scale search API that fetches full web pages (it’s like sending an explorer to scour blogs, articles, even PDFs and bring back the raw text). The second is <a href="https://ask.orkg.org/"><strong>ORKG Ask</strong></a> (from the Open Research Knowledge Graph), which searches a huge scholarly index (80+ million publications!) and returns structured results — titles, abstracts, and links. Firecrawl is our wide-net, general-purpose explorer (covering everything from news to scientific papers), while ORKG Ask is the specialist, focused on academic literature. You can choose either or even <em>use both</em> in tandem — dual providers mean you won’t miss treasure whether it’s hidden in a journal or on a website. The explorer agent executes each query and brings back the top results (usually the top 10 docs per query). It works in parallel too, so no time wasted.</p><p><strong>3. The Scribe (Summarize-and-Learn Agent):</strong> Now we have piles of content — what next? The scribe agent steps in to read the retrieved documents and jot down the important bits. It merges all the text (be it full web content from Firecrawl or abstracts from ORKG) and asks the LLM to summarize key <strong>“learnings.”</strong> Think of this as your AI research assistant reading a stack of papers and highlighting the juicy findings. The scribe produces concise bullet-point insights (usually up to 3 per query) capturing the essence of what was found. But that’s not all — it also brainstorms <strong>follow-up questions</strong> based on those findings. These follow-ups are like clues on a treasure hunt map: if the initial query found something interesting, the agent asks, <em>“Hmm, they mentioned invasive species — should we explore how invasives factor into climate impacts on grasslands?”</em> This gives fresh leads for the next round. In short, the scribe agent is extracting knowledge gems and deciding where to dig deeper next.</p><p><strong>4. The Editor-in-Chief (Report Synthesis Agent):</strong> Finally, after several rounds of the above loop (we’ll talk about how many rounds in a second), DeepResearch has a trove of insights. The <strong>generate report</strong> agent acts as the editor-in-chief, taking <strong>all accumulated learnings</strong> and composing the final narrative — a structured Markdown report that directly answers the original question. It’s not just a brain dump; it writes a cohesive synthesis, complete with citations for each fact (all those URLs from the search are kept for transparency). The result is something you could honestly mistake for a thorough literature review written by a human (and a diligent one at that). It might start with an overview, then discuss various angles (each potentially coming from different sources), and end with a conclusion — all <strong>grounded in the references</strong> that were found along the way.</p><p>This whole process isn’t a one-shot affair — it <strong>iterates recursively</strong>. After the scribe agent generates follow-up questions, the scout agent takes those and turns them into new queries for the explorer, which fetches more info, which the scribe reads, and so on. It’s a <strong>feedback loop</strong>, refining the search as it goes deeper, very much like a detective chasing down leads. The loop continues until it reaches a predefined <strong>depth</strong> (more on that next). At that point, the editor compiles everything and voila — you have a detailed answer with multiple sources and angles.</p><p>To put it in a fun way: DeepResearch is like sending a bunch of AI treasure hunters into the library. One maps out where to look, another grabs the books, another reads and scribbles notes, and the last one compiles the final <strong>“treasure report”</strong>. The coolest part is that the system makes its reasoning <strong>transparent</strong> — you can see the intermediate queries it used and the notes (“learnings”) it took. It’s not a black box; it’s more of a guided tour through the literature, where you can see how the answer was built step by step.</p><h3>Depth and Breadth: Tuning Your AI Expedition</h3><p>Every good treasure hunt needs a plan. In DeepResearch, the plan is guided by two key parameters: <strong>depth</strong> and <strong>breadth</strong>. These are essentially dials you (the user) set to control <em>how far</em> and <em>how wide</em> the AI should explore. They turn a one-size-fits-all search into a customizable adventure. Let’s demystify these with a bit of analogy:</p><ul><li><strong>Breadth</strong> (b): Think of breadth as the number of <strong>parallel paths</strong> the agents will explore at each step. A higher breadth means casting a wide net — pursuing more sub-questions or leads in each round. In our treasure hunt analogy, if breadth = 5, our scout agent draws five different treasure maps at the start, and the explorer splits into five teams to gather info on all of them. You’ll cover a lot of ground (ensuring you don’t miss major areas of the literature). The default in the paper was 3, but you can set it higher for more expansive searching. There’s a twist: as the recursion goes deeper, the number of queries can <strong>halve each round</strong> (breadth // 2 each level). So the search naturally narrows focus the deeper you go — it’s like a funnel. Early on, you explore broadly (many leads); later, you focus on the most promising leads in detail.</li><li><strong>Depth</strong> (d): Depth is how many <strong>layers of recursion</strong> the system will do — basically how many rounds of the search-summarize loop before it stops and compiles the report. Depth is like how many levels deep into the cave our treasure hunters will venture. Depth = 1 would be just one round (shallow survey and done). Depth = 4 (as used in the paper’s high setting) means the system will do initial search, then 3 rounds of follow-up searching based on the leads (so 4 cycles total counting the first). With each layer, it’s digging deeper into the topic. In ecology terms, depth might mean you start with general climate-biodiversity papers, then drill down into specific mechanisms like <em>“climate x land-use interaction effects on grassland insects vs plants”</em>, then even deeper into <em>“case studies from particular regions”</em>, and so on. A higher depth yields a more <strong>nuanced and detailed answer</strong>, as the system uncovers finer-grained insights that a shallow search would miss. In the DeepResearchEco experiments, the high-depth (d=4) answers captured subtle details — <em>“cross-regional evidence, mechanistic pathways, system feedbacks,”</em> as the paper notes, compared to a shallow d=1 answer that stayed generic.</li></ul><p>The beauty of having depth and breadth controls is <strong>you decide the strategy</strong>. For a broad exploratory question, you might set a moderate depth but high breadth to capture diverse perspectives. For a very specific question, maybe high depth and lower breadth to focus on deep analysis of a particular aspect. DeepResearch’s creators emphasize balancing <em>“breadth (covering many sources) versus depth (deeply analyzing each source)”</em> to produce high-quality synthesis. And indeed, finding that balance can make the difference between a superficial answer and an exhaustive one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*Ms07sKOtoMI4Q1adnefWtg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*iG4zagxgBmUUD5IQJiZiSw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*iXPrBWiX_bR0l90xrBG-Kg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*dAz3vpA94MfH_wz6H7BkWg.png" /></figure><p>What’s the impact of cranking these dials to the max? In my tests on 49 ecology questions, the highest setting (d=4, b=4) yielded the most <strong>comprehensive answers</strong>, integrating far more sources and details than low settings. They measured things like domain specificity, rigor, novelty, and information density of the answers. High depth/breadth scored better across the board — basically approaching <em>“expert-level synthesis”</em> of the topic. One striking stat: information density (how much info packed in per word) went up nearly <strong>15-fold</strong> from the lowest to highest setting. So not only do you get more sources, you get more insight per paragraph. Of course, cranking it up also means more computation (the agents will read a ton more content). But if you’ve got a beast of a question, it’s nice to have the option to truly <strong>throw the kitchen sink at it</strong> in a controlled way.</p><h3>From TypeScript to Python: A New Flavor of DeepResearch</h3><p>The original DeepResearch (as described in the paper and initial code release) was implemented in TypeScript by David Zhang and collaborators. TypeScript is great, but let’s face it — many AI researchers and scientists live in the world of Python. That’s where the user (hi, that’s me! 👋) decided to <strong>reimplement DeepResearch in Python</strong>, staying true to the original algorithm but making it more accessible and extensible for the community.</p><p>So what’s new in this Python reimplementation? Firstly, it’s built to be <strong>developer-friendly</strong>: if you know Python and have a hankering to tweak AI agents, you can dive right in. I’ve kept the core workflow the same (the scout, explorer, scribe, editor agents doing their thing recursively), but also included some <strong>extensions and improvements</strong>:</p><ul><li><strong>Dual Search Providers Out of the Box:</strong> The reimplementation makes it easy to switch between or combine Firecrawl and ORKG Ask for the search step. You can configure which one to use, or even use both in sequence to get both web content and scholarly abstracts for the same query (maximizing coverage). The original design supported both, but now you have a simple interface to toggle them. If you’re running a search on a general topic, you might lean on Firecrawl; if it’s super academic, ORKG Ask might be your go-to — or why not both? The Python version lets you treat it like a <strong>choose-your-own-adventure</strong> for search.</li><li><strong>Parameter Tweaks and Customization:</strong> Depth and breadth are of course adjustable, but in Python it’s trivial to change defaults, set per-query settings, or even try dynamic strategies (like maybe you want to adjust breadth halving behavior or how many learnings to extract per document — go for it!). It’s your playground. Because it’s Python, integrating with other tools (maybe you want to plug in a different LLM or a custom search API) is straightforward.</li><li><strong>Transparency and Logging:</strong> When I built this, I made sure you can see what’s happening at each step — the queries generated, which results came back, what learnings were extracted, etc. This transparency was a big selling point in the paper (they highlight the <em>“transparent and traceable knowledge workflow”</em>), and as a user, it’s both educational and reassuring to watch your AI agent think. In code, this means logging or printing out intermediate steps, and a nicely formatted final Markdown output.</li></ul><p>Now, I won’t pretend I did this all alone — credit goes to the original creators for the blueprint. My role was like taking a fantastic concept car and rebuilding the engine in a more familiar chassis (Python) so more folks can take it for a spin. And guess what — <strong>you can take it for a spin too</strong>. The code is open source on GitHub, under the friendly MIT license. In fact, the official paper even links to the GitHub repo (yep, they really want people to use it). We’ll link it below and encourage you to check it out.</p><h3>Why AI-Powered Deep Research Matters (Especially in Ecology)</h3><p>By now you might be thinking, “This sounds cool, but does it actually <em>matter</em> for my work?” For anyone doing research that requires synthesizing information from many sources — <strong>yes, it matters a ton</strong>. And if you’re in ecology or environmental science, buckle up, because the case is particularly strong.</p><p>Ecology questions are famously complex. They often span multiple scales (genes to ecosystems, local to global), involve many variables (climate, land use, species interactions, oh my!), and have huge bodies of literature scattered across sub-disciplines. Answering something like <em>“How do invasive species impact grassland biodiversity under climate change?”</em> could mean reading dozens of papers on climate effects, invasive species biology, soil health, etc., then piecing them together. That’s a <strong>Herculean task</strong> for a human, especially under time constraints.</p><p>DeepResearch shines here by doing the heavy lifting of gathering and distilling information from across the spectrum. It doesn’t get tired or bored combing through 50 papers — it will dutifully find and summarize them, and even highlight conflicting findings or knowledge gaps if they appear. This means as a researcher, you get to see a more <strong>comprehensive picture</strong>. For example, the DeepResearchEco evaluation found that high breadth settings pulled in a lot more content related to conservation and climate policy aspects (things that a narrow focus might miss). In one case, the broad search picked up cross-regional evidence that enriched the answer with context from different continents. Depth, on the other hand, allowed the system to unpack mechanistic details — e.g., <em>why</em> biodiversity drops, what the common effects of fertilization are on plants over long term, etc., which only surfaced after digging through several layers of follow-up. The end result is akin to an <strong>expert narrative</strong>: covering broad trends <em>and</em> detailed mechanisms, all supported by citations.</p><p>For ecologists, this approach can accelerate <strong>literature reviews, policy briefs, or research ideation</strong>. Instead of spending weeks gathering references, an ecologist could use DeepResearch to draft a baseline synthesis in hours, then refine it with their own expertise. It’s not about replacing the scientist (no robo-ecologist is stealing your job, promise!); it’s about augmenting your ability to <strong>see the forest and the trees</strong> in a massive forest of publications. In fact, I’ve found that using it often surfaces papers or insights I might have overlooked — a nice antidote to our human confirmation biases or just the sheer overwhelm of information out there.</p><p>Moreover, because the system keeps track of sources, you can directly follow the <strong>paper trail</strong>. If DeepResearch says “study X found that increased rainfall mitigates some negative effects of warming on grasslands,” it’ll cite that study — you can click the link, read the original, and verify or dive deeper. This makes the AI’s output a starting point for deeper exploration, not a final black-box answer. It’s almost like having an assistant professor who writes your related work section, with all references neatly cited.</p><h3>Try It Yourself — Open Source and Ready to Explore</h3><p>Enough talk — I bet you’re curious to play with this toy. Good news: <strong>DeepResearch is open-source and ready for you to clone and run!</strong> The GitHub repo is <a href="https://github.com/sciknoworg/deep-research"><strong>sciknoworg/deep-research</strong></a>, and it includes instructions to get started. Whether you’re an AI researcher interested in agent architectures or an ecologist wanting to turbocharge your literature reviews, you’re invited to give it a whirl.</p><p>Here are some fun things you can try once you have it running:</p><ul><li><strong>Swap Search Engines:</strong> Test out both Firecrawl and ORKG Ask. Try a question with the general web vs. the scholarly index. For example, “What are the latest trends in reforestation techniques?” might yield different flavors of info from web blogs vs academic papers. You can compare the outputs or even combine them for maximum info.</li><li><strong>Tweak Depth and Breadth:</strong> Start with a modest setting (say d=1, b=2) and see what the answer looks like. Then crank it up (d=3, b=4) and observe the difference. You’ll notice the report gets way richer and longer with more depth/breadth — more sources, more angles. It’s actually pretty fun to watch the agent “think” through each round if you have logging on. Find the combo that best suits your question — there’s no one-size-fits-all, which is the beauty of it.</li><li><strong>Ask a Hard Question:</strong> Pose some complex, open-ended question in ecology (or any field you like). Something you genuinely want to know but haven’t had time to dig into. Let DeepResearch do its thing, then read the report. Did it find useful info? Any surprises? Use it as a jumping-off point to guide further research. It’s like having a knowledgeable colleague give you a briefing.</li><li><strong>Contribute or Customize:</strong> Since this is a community project, you’re welcome to contribute. Spot an issue or have an idea for improvement? Open an issue or pull request on GitHub. Maybe you want to add a new search provider (ArXiv API, anyone?), or improve the prompt engineering for generating follow-up questions — go for it! The Python code is meant to be hackable. Even changing how the “learnings” are extracted (maybe you want more or fewer, or to include quotes) is relatively easy. I’d <em>love</em> to see folks extend this in directions we haven’t thought of.</li></ul><p>For AI research folks, DeepResearch is also an interesting <strong>testbed for agentic AI</strong> in a real-world task. The idea of AI agents autonomously doing research is exciting, and here’s a concrete implementation you can study and build upon. How does it break, where does it excel, how to make it better — plenty of research questions right there!</p><p>And if you run into any questions or just want to chat about recursive research agents, I’m all ears. Seriously, <strong>feel free to contact me</strong> — drop an issue on GitHub, or connect via email/Twitter (my contact info is on the repo). I’m eager to hear about your experiences, ideas, or use cases. Collaboration or even just swapping war stories about AI literature reviews is very welcome.</p><h3>Rethinking Scientific Synthesis in the Age of Recursive AI Agents</h3><p>We’re at an inflection point where AI moves from just <em>answering</em> questions to actually <strong>researching</strong> questions. DeepResearch is a glimpse into that future — one where we can task an AI with “Tell me everything about X, and make it good,” and it will literally go on a multi-hop knowledge expedition to do so. For fields like ecology, where the challenges are complex and interdisciplinary, this could transform how we gather insights. Instead of being limited by how much one person (or a small team) can read, we leverage these tireless agents to gather and summarize evidence at scale, <strong>without sacrificing detail or rigor</strong>.</p><p>Is it perfect? Of course not. It can only be as good as the sources it finds and the guidance we give (via prompts and parameters). It might miss something, or misinterpret a nuance — that’s where human experts remain crucial. But it augments our capabilities tremendously. It’s like having an army of grad students who never sleep, each an expert speed-reader, coordinated by a thoughtful synthesizer. If that doesn’t get you a bit excited about the future of research, I don’t know what will!</p><p>So, to all the AI enthusiasts and ecologists (and anyone else who made it this far): I invite you to <strong>rethink scientific synthesis</strong> with me. What new questions could we tackle if we aren’t afraid of information overload? How might our approaches to literature reviews, policy analysis, or even education change when AI agents can do the first pass of knowledge gathering? DeepResearch is one early example, and I suspect many more will follow in various domains.</p><p>Give the repo a look, try out the system, and imagine the possibilities. And if you’re as intrigued as I am, let’s talk! This is an open journey, and I’d love more companions on the road. Together, we can push the boundaries of how knowledge is collected and synthesized in the 21st century. It’s an exciting time — let’s embrace these AI co-explorers and see where the adventure leads. 🌱🤖🎓</p><p><em>Happy researching, and may your treasure hunts yield rich knowledge!</em> 🚀</p><p>And just for fun, I want to close with another cartoonish ChatGPT-generated image on the theme of this post! :) In the meantime, happy hacking scientific AI assistance!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DcjsNTrb-ekcXaPRU0DAJg.png" /><figcaption>AI Agents helping with Research specifically with Search, Browse, and re-Search (visual interpretation 2). Image by Author, generated using ChatGPT.</figcaption></figure><h3><strong>References</strong></h3><ol><li><a href="https://openai.com/index/introducing-deep-research/">https://openai.com/index/introducing-deep-research/</a></li><li>David Zhang’s TypeScript Implementation <a href="https://github.com/dzhng/deep-research/">https://github.com/dzhng/deep-research/</a></li><li>My Python Implementation <a href="https://github.com/sciknoworg/deep-research">https://github.com/sciknoworg/deep-research</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c590de681258" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PsychKG — How to build a minimal Knowledge Graph for Psychology?]]></title>
            <link>https://medium.com/@jenlindadsouza/psychkg-how-to-build-a-minimal-knowledge-graph-for-psychology-fac0c76800ac?source=rss-30a9dfd80bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/fac0c76800ac</guid>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[structured-data]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[openai]]></category>
            <dc:creator><![CDATA[Jennifer D'Souza, Ph.D.]]></dc:creator>
            <pubDate>Thu, 03 Jul 2025 10:52:09 GMT</pubDate>
            <atom:updated>2025-07-09T06:38:55.464Z</atom:updated>
            <content:encoded><![CDATA[<h3>PsychKG — How to build a minimal Knowledge Graph for Psychology?</h3><h4>From Raw LLM Text Outputs to Validated Structured Information</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DyOPDwEWXt-l4kKiwcp-QQ.png" /><figcaption><strong>Cartoon illustration contrasting two research workflows:</strong> the cognitive overload of manually browsing thousands of papers versus the computational assistance enabled by structured, machine-actionable representations of key research elements stored in a Knowledge Graph — ultimately supporting <a href="https://www.nature.com/articles/sdata201618">FAIR</a> scientific knowledge. | Image by Author, generated using ChatGPT-o3.</figcaption></figure><p>As psychology research expands in complexity and volume, so does the need for structured, machine-readable access to its knowledge. While academic papers remain the main vehicle of scientific communication, they are notoriously hard to search, compare, and integrate — especially across constructs, measures, and methodologies. This post introduces a practical pipeline that transforms unstructured psychology papers into structured knowledge triples using OpenAI’s function calling capability for <a href="https://platform.openai.com/docs/guides/structured-outputs">structured outputs</a>.</p><p>The goal: extract <em>psychological constructs</em> and their associated <em>measurement instruments</em>, producing clean, machine-readable outputs that can populate a <strong>lightweight knowledge graph</strong>.</p><p>To make this work, we use <a href="https://docs.pydantic.dev/latest/"><strong>Pydantic</strong></a> and <strong>OpenAI Function Calling</strong> — a streamlined way to define and parse structured outputs directly on the client side. It’s a practical example of how to use OpenAI’s native function calling feature together with Pydantic to generate and validate structured data from research text.</p><p>👉 <strong>The full code is available on GitHub:</strong><br>🔗 <a href="https://github.com/sciknoworg/psychKG-pilot">sciknoworg/psychKG-pilot</a><br>🔗 You might also find useful: my related post on generating structured outputs from Hugging Face models (which don’t natively support Pydantic) for data validation. Check it out: <em>“</em><a href="https://medium.com/@jenlindadsouza/how-i-get-llms-on-hugging-face-to-speak-structured-data-1fb34bf15792"><em>How I Get LLMs on Hugging Face to Speak Structured Data? The Two-Library Magic (Instructor + Pydantic)</em></a><em>”</em></p><p>Now, back to this post…</p><h3>🧩 The Problem: Constructs and Their Measures Are Buried in Text</h3><p>Psychology research is rich in conceptual structures — constructs like <em>self-esteem</em>, <em>working memory</em>, <em>procrastination</em>,<em> anxiety, rumination, etc. </em>— that are empirically studied via validated measurement scales. However, this construct-measurement relationship is usually embedded in narrative form, making it difficult to reuse for semantic search or meta-analysis.</p><p>We want to go from this:</p><blockquote><em>“</em>The paper introduces and utilizes the Extinction Gambling Task (EGT) for studying decision making under extinction risk, providing a structured experimental paradigm to assess<em>…”</em></blockquote><p>To this:</p><pre>{<br>  &quot;construct&quot;: &quot;decision making under extinction risk&quot;,<br>  &quot;measured_by&quot;: &quot;extinction gambling task (egt)&quot;,<br>  &quot;justification&quot;: &quot;The paper introduces and utilizes the Extinction Gambling Task (EGT) for studying decision making under extinction risk, providing a structured experimental paradigm to assess participants&#39; choices in scenarios reflecting varying definitions of extinction risks (Keep, Lose, Reset).&quot;<br>}</pre><h3>🛠️ The Solution: A Minimal Pipeline Using OpenAI + Pydantic</h3><p>This pipeline has been applied across thousands of full-text psychology papers, enabling the extraction of construct–measurement instrument relationships at scale — unlocking structured insights previously buried in text.</p><p>Our approach involves four components:</p><ol><li><strong>Defining structured output schemas</strong></li><li><strong>Prompting the LLM to extract structured triples</strong></li><li><strong>Parsing TEI XML full-text articles as input</strong></li><li><strong>Validating and structuring model output using Pydantic</strong></li></ol><p>Let’s walk through the Python code that brings this pipeline to life.</p><h3>📄 Step 1: Define the Structured Output Format</h3><p>We begin by specifying the structure of the extracted knowledge using simple Python data models. These models capture the key elements we want to extract from each paper.</p><pre>class PsychTriple(BaseModel):<br>    construct: str<br>    measured_by: str<br>    justification: str<br><br>class PsychTripleList(BaseModel):<br>    extractions: List[PsychTriple]</pre><p>Each PsychTriple represents a semantic unit in the knowledge graph—linking psychological constructs to their measurement instruments, with justifications.<br>The PsychTripleList wraps these triples into a list, representing all extractions from a single research paper.</p><h3>🤖 Step 2: Prompting the Model for Structured Extraction</h3><p>We define a clear, role-based system prompt to guide the model. The prompt tells the LLM it’s acting as an expert in psychology and knowledge representation, and that it should return a list of construct–measured_by pairs with short justifications.</p><pre>SYSTEM_PROMPT = &#39;&#39;&#39;<br>You are an expert in psychology and computational knowledge representation. Your task is to extract key scientific information from psychology research articles to build a structured knowledge graph. <br><br>The knowledge graph aims to represent the relationships between psychological **topics or constructs** and their associated **measurement instruments or scales**. Specifically, for each article, you will extract information of the form:<br><br>1) &quot;Construct&quot;<br>2) [Property: &quot;measured by&quot;] -&gt; [Value: &quot;Measure&quot;]<br><br>Each article may contain multiple such records. These extractions help build a machine-readable semantic network that connects psychological concepts with their empirical operationalizations.<br><br>For each extraction, provide a short justification from the text (1-3 sentences) that supports why this construct was measured by the identified measure.<br><br>As far as possible, extract meaningful **phrases** (rather than whole sentences or vague descriptions) as **entities** suitable for inclusion in a knowledge graph for both `construct` and `measured_by` fields.<br><br>However, not all articles are relevant to this task. If the article does not discuss psychological constructs and how they are measured (e.g., does not mention constructs, measurement techniques, or instruments), return an empty list `[]`.<br>&#39;&#39;&#39;</pre><p>We then call the OpenAI API using responses.parse with PsychTripleList as the output format. Here I have used the o3 model which you could replace with your OpenAI model of choice.</p><pre>response = client.responses.parse(<br>    model=&quot;o3&quot;,<br>    input=[<br>        {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: SYSTEM_PROMPT},<br>        {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: f&quot;Extract the constructs and their measures from the following article:\n{article_text}&quot;},<br>    ],<br>    text_format=PsychTripleList<br>)</pre><p>This ensures the output is a well-formed, strongly-typed list of triples.</p><h3>🧼 Step 3: TEI XML Parsing</h3><p>We assume full-text articles are stored in TEI XML (e.g., output from <a href="https://github.com/kermitt2/grobid">GROBID</a>). The extract_text_from_tei() function handles text cleanup and formatting:</p><pre>def extract_text_from_tei(tei_path):<br>    with open(tei_path, &#39;r&#39;, encoding=&#39;utf-8&#39;) as file:<br>        soup = BeautifulSoup(file, &#39;lxml-xml&#39;)<br>        body = soup.find(&#39;text&#39;)<br>        return body.get_text(separator=&#39;\n&#39;) if body else &#39;&#39;</pre><h3>🧩 Step 4: Structuring and Validating Output with Pydantic</h3><p>While the OpenAI model generates text, we need to ensure that this text follows a strict, machine-readable structure suitable for downstream applications like knowledge graph population or semantic search. This is where <strong>Pydantic</strong> comes in.</p><p>Pydantic provides the data models (PsychTriple and PsychTripleList) that define the <strong>expected structure</strong> of the LLM output. When paired with the responses.parse method from the OpenAI Python client, it allows us to automatically validate and convert the raw LLM output into strongly typed Python objects.</p><p>Here’s how that looks in code:</p><pre>from pydantic import BaseModel<br>from typing import List<br><br>class PsychTriple(BaseModel):<br>    construct: str<br>    measured_by: str<br>    justification: str<br><br>class PsychTripleList(BaseModel):<br>    extractions: List[PsychTriple]</pre><p>Then, during inference:</p><pre>response = client.responses.parse(<br>    model=&quot;o3&quot;,<br>    input=[<br>        {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: SYSTEM_PROMPT},<br>        {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: f&quot;Extract the constructs and their measures from the following article:\n{article_text}&quot;},<br>    ],<br>    text_format=PsychTripleList  # Pydantic schema used here<br>)</pre><p>This ensures the returned data conforms to the specified schema: a list of structured triples where each entry is validated for presence and type. If the model’s output deviates from the expected format, the validation will fail — helping catch inconsistencies early and allowing for robust error handling or retry mechanisms.</p><p>By enforcing structured output at the schema level, Pydantic acts as a <strong>contract between the LLM and downstream consumers</strong>, ensuring that what you get is predictable, reliable, and immediately usable for building knowledge graphs or JSON exports.</p><h3>✅ Example Output</h3><p>Here’s what a structured extraction might look like:</p><pre>[<br>  {<br>    &quot;construct&quot;: &quot;decision making under extinction risk&quot;,<br>    &quot;measured_by&quot;: &quot;extinction gambling task (egt)&quot;,<br>    &quot;justification&quot;: &quot;The paper introduces and utilizes the Extinction Gambling Task (EGT) for studying decision making under extinction risk, providing a structured experimental paradigm to assess participants&#39; choices in scenarios reflecting varying definitions of extinction risks (Keep, Lose, Reset).&quot;<br>  },<br>  {<br>    &quot;construct&quot;: [&quot;risk aversion and risk seeking&quot;],<br>    &quot;measured_by&quot;: [&quot;choice patterns in keep, lose, and reset conditions&quot;],<br>    &quot;justification&quot;: &quot;Participant choice patterns across the Keep, Lose, and Reset conditions were indicative of risk aversion or risk-seeking behaviors, with patterns reflecting considerations like potential gains, losses, and the nature of the extinction event.&quot;<br>  },<br>  {<br>    &quot;construct&quot;: [&quot;opportunity cost neglect&quot;],<br>    &quot;measured_by&quot;: [&quot;computational modeling analysis&quot;],<br>    &quot;justification&quot;: &quot;Computational modeling was employed to analyze participants&#39; choice strategies, revealing differences between conditions reflecting opportunity cost neglect, as participants were more aligned with the optimal strategy when their endowment was at stake compared to the opportunity to continue playing.&quot;<br>  }<br>]</pre><h3>📊 Summary: What You Get</h3><ul><li><strong>Input</strong>: Full-text TEI XML files from psychology papers</li><li><strong>Output</strong>: JSON files with construct-measurement triples + justification</li><li><strong>Applications</strong>: Lightweight knowledge graphs, semantic search, instrument discovery, QA systems</li></ul><h3>🕸️ Publishing the PsychKG Subgraph on the ORKG</h3><p>Now let’s turn to publishing the extracted and validated JSON data as a subgraph on the <a href="https://orkg.org/">Open Research Knowledge Graph (ORKG)</a> platform.</p><p>The process involves the following steps.</p><h3>1️⃣ Define the Template</h3><p>In ORKG, a <strong>template</strong> represents a semantic schema — a structured model of properties that can be consistently applied to research papers for describing their contributions in a machine-readable way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VLtF4LhCx7w8iAyu61tw9g.png" /><figcaption><strong>“Psychology Constructs and Measurements” template on the ORKG</strong> (<a href="https://orkg.org/templates/R1411854">https://orkg.org/templates/R1411854</a>). Subfigure (a) displays the form-based input view, while subfigure (b) presents a UMLS-style class diagram of the underlying schema.</figcaption></figure><h3>2️⃣ Bulk Data Upload: One PsychTripleList Item + One Paper at a Time</h3><p>Each extracted PsychTripleList corresponds to one paper’s structured contributions. The upload script reads each item and maps it to the ORKG template, linking the extracted constructs, measurements, and justifications to their respective paper metadata.</p><p>To do this programmatically we will use relevant functions from the ORKG Python Client <a href="https://orkg.readthedocs.io/en/latest/index.html">https://orkg.readthedocs.io/en/latest/index.html</a></p><p>The complete workflow is in the script <a href="https://github.com/sciknoworg/psychKG-pilot/blob/main/src/orkg-import/upload-to-orkg.py">upload-to-orkg.py</a>. Let’s unpack the details.</p><ol><li><strong>Connect to ORKG and authenticate</strong></li></ol><p>To begin, connect to the ORKG API and authenticate using your credentials. You’ll be prompted for the host URL, email, and password:</p><pre>from orkg import ORKG<br>from getpass import getpass<br><br>host = input(&quot;Enter ORKG host URL (e.g., https://www.orkg.org/): &quot;).strip()<br>email = input(&quot;Enter your ORKG email: &quot;).strip()<br>password = getpass(&quot;Enter your ORKG password: &quot;).strip()<br><br>print(&quot;🔗 Connecting to ORKG...&quot;)<br>orkg = ORKG(host=host, creds=(email, password))<br>print(&quot;✅ Connected.&quot;)</pre><p>📌 <strong>Tip:</strong> ORKG provides three hosted environments for different purposes:</p><ul><li>🧪 <strong>Sandbox</strong>: <a href="https://sandbox.orkg.org/">https://sandbox.orkg.org/</a> — for testing data upload workflows</li><li>🚧 <strong>Incubating</strong>: <a href="https://incubating.orkg.org/">https://incubating.orkg.org/</a> — for experimenting with platform features under development</li><li>🚀 <strong>Live</strong>: <a href="https://orkg.org/">https://orkg.org/</a> — the production environment where validated data and stable features are published</li></ul><p>Use the <strong>sandbox</strong> for safe trial runs, and the <strong>live system</strong> only when your data is final and reviewed.</p><p><strong>2. Load a Pydantic-validated JSON file (i.e., </strong><strong>PsychTripleList)</strong></p><p>Each JSON file represents the extracted knowledge for one paper. This is read and parsed:</p><pre>with open(json_path, &#39;r&#39;, encoding=&#39;utf-8&#39;) as f:<br>    data = json.load(f)<br><br>for entry in entries:<br>    c = entry[&quot;construct&quot;].strip().lower()<br>    meas = entry[&quot;measured_by&quot;].strip().lower()<br>    just = entry[&quot;justification&quot;].strip()</pre><p><strong>3. Match to the ORKG Template</strong></p><p>Each contribution is created using the <a href="https://orkg.org/templates/R1411854">Psychology Constructs and Measurements template</a>, identified by its template ID (e.g., R1411854). The script calls the materialize_template() function (<a href="https://orkg.readthedocs.io/en/latest/client/templates.html">https://orkg.readthedocs.io/en/latest/client/templates.html</a>) to fill in this schema programmatically:</p><pre>template_id = input(&quot;Enter the ORKG template ID to use (e.g., R1411854): &quot;).strip()<br>orkg.templates.materialize_template(template_id)<br>tp = orkg.templates</pre><p><strong>4. Create the Contribution for Each PsychTriple</strong></p><p>The script loops through each triple and creates resources for the construct and measurement (if they don’t already exist), then fills in the justification field. For example:</p><pre><br>for entry in entries:<br>    c = entry[&quot;construct&quot;].strip().lower()<br>    meas = entry[&quot;measured_by&quot;].strip().lower()<br>    just = entry[&quot;justification&quot;].strip()<br><br>    for label in [c, meas]:<br>        if label and label not in resource_cache:<br>            try:<br>                response = orkg.resources.find_or_add(label=label)<br>                resource_id = response.content[&quot;id&quot;]<br>                resource_cache[label] = resource_id<br>                print(f&quot;✅ Added/Found: &#39;{label}&#39; → {resource_id}&quot;)<br>                save_resource_cache(resource_cache, cache_path)<br>            except Exception as e:<br>                print(f&quot;❌ Failed to create/find resource for &#39;{label}&#39;: {e}&quot;)<br><br>    c_id = resource_cache.get(c)<br>    meas_id = resource_cache.get(meas)<br><br>    if not c_id or not meas_id:<br>        print(f&quot;⚠️ Missing resource for &#39;{c}&#39; or &#39;{meas}&#39;&quot;)<br>        continue<br><br>    c = tp.psychology_constructs_and_measurements(<br>        label=f&quot;contribution {counter}&quot;,<br>        topic_or_construct=OID(toc_id),<br>        measured_by=OID(meas_id),<br>        justification=just<br>    )<br>    contributions.append(c)<br><br>    resource_entries.append({<br>        &quot;topic_or_construct&quot;: toc_id,<br>        &quot;measured_by&quot;: meas_id,<br>        &quot;justification&quot;: just<br>    })<br><br>    print(f&quot;✅ Created contribution {counter}&quot;)<br>    counter += 1</pre><p><strong>5. Link to the Paper Metadata</strong></p><p>The script links each contribution to the corresponding paper resource in ORKG. The user is prompted (or a mapping is provided) for the paper’s title, DOI, or existing ORKG resource ID.</p><pre>paper = {<br>    &quot;predicates&quot;: [],<br>    &quot;paper&quot;: {<br>        &quot;title&quot;: metadata[&quot;title&quot;],<br>        &quot;doi&quot;: metadata[&quot;doi&quot;],<br>        &quot;authors&quot;: metadata[&quot;authors&quot;],<br>        &quot;publicationMonth&quot;: metadata[&quot;publicationMonth&quot;],<br>        &quot;publicationYear&quot;: metadata[&quot;publicationYear&quot;],<br>        &quot;publishedIn&quot;: metadata[&quot;publishedIn&quot;],<br>        &quot;researchField&quot;: &quot;R343&quot;, #resource id for the research field Psychology on the ORKG https://orkg.org/fields/R343/Psychology<br>        &quot;contributions&quot;: [c.template_dict[&#39;resource&#39;] for c in contributions]<br>    }<br>}<br><br>try:<br>    response = orkg.papers.add(params=paper)<br>    paper_id = response.content[&quot;id&quot;]<br>    log_uploaded_paper_detailed(paper_log_detailed_path, metadata[&quot;title&quot;], paper_id)<br>    append_structured_log(structured_log_path, paper_id, resource_entries)<br>    print(f&quot;📄 Paper uploaded: {metadata[&#39;title&#39;]} → {paper_id}&quot;)<br>except Exception as e:<br>    print(f&quot;❌ Failed to upload paper: {e}&quot;)</pre><p><strong>6. Repeat for Each Paper</strong></p><p>The script processes each JSON file in the directory — each representing one paper — uploading all its extracted triples as a single contribution.</p><p>This approach ensures each extraction becomes a searchable, semantically structured entry in the ORKG. Over time, these micro-contributions accumulate into a rich, navigable knowledge graph of psychological constructs and their empirical operationalizations.</p><p>Below are some example snapshots of instances of the PsychKG subgraph on the ORKG.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qLh6mbxDR3tZ-dCJ8l59Lw.png" /><figcaption><strong>ORKG Paper View</strong> for automatically extracted information for the paper titled “Disentangling Components of Suboptimal Risky Decision Making in Affective Distress” <a href="https://osf.io/preprints/psyarxiv/zwg7d_v1">https://osf.io/preprints/psyarxiv/zwg7d_v1</a>.</figcaption></figure><p>The ORKG offers curation interfaces. So for instance, for all the papers added to the ORKG from our dataset, the extraction_method has been set to automatic. With this the fronted renders a blue box around the contribution with a cautionary note to the reader that the data is automatically extracted. Given this, an expert can via the edit mode verify this information which resets the extraction_method flag to manual and then resets the frontend interface to the usual display without the warning as shown in the paper view below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zMF_RpbhrgGtWbacBNt0Vg.png" /><figcaption><strong>ORKG Paper View</strong> for manually curated information.</figcaption></figure><p>Returning back to PsychKG. Another feature of the ORKG platform is comparisons of structured research.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bltsgkv0hAKwP4gdiiSpSw.png" /><figcaption><strong>ORKG Comparison View </strong>of Structured Contributions from Three Research Papers. Note that each paper may have multiple structured contributions. The full comparison is available at <a href="https://doi.org/10.48366/R1431211">https://doi.org/10.48366/R1431211</a>.</figcaption></figure><p>This end-to-end workflow — from full-text parsing to validated triple extraction and knowledge graph publication — not only demonstrates technical feasibility, but also showcases how general-purpose LLMs can be adapted for domain-specific, structured scientific metadata generation at scale. By publishing this data as FAIR, semantically linked contributions in the ORKG, we make psychological research more searchable, comparable, and reusable — paving the way for more systematic reviews, instrument discovery, and large-scale meta-analyses.</p><h3>🧠 Why It Matters</h3><p>This workflow lowers the barrier to building domain-specific knowledge graphs. Instead of training a custom NLP pipeline or building a rule-based system, we delegate the task to a general-purpose LLM guided by a schema and expert prompt.</p><p>In doing so, we make empirical psychological knowledge — once locked in prose — available for structured reasoning and reuse.</p><h3>🚀🧵 Next Steps</h3><p>Here are a few recommendations to build on this work:</p><ul><li>Add support for gold-standard metadata extraction (authors, title, abstract)</li><li>Enrich the schema with additional properties with a tool like schema-miner <a href="https://github.com/sciknoworg/schema-miner">https://github.com/sciknoworg/schema-miner</a> over a large-scale collection of the publications</li><li>Explore integration with LLM-powered interfaces (e.g., chat-based exploration or semantic QA) to make the knowledge graph more accessible to non-expert users</li><li>Develop autonomous agents that continuously monitor new psychology publications, extract structured triples, and suggest updates to the graph</li><li>Implement agent workflows for validation (e.g., human-in-the-loop curation) and refinement (e.g., schema expansion, relation alignment)</li><li>Investigate multi-agent collaboration setups where one agent extracts, another verifies, and a third links entries to external ontologies like UMLS or MeSH</li></ul><p><strong>💡 Want to try it yourself?</strong><br> Grab the code here 👉 <a href="https://github.com/sciknoworg/psychKG-pilot">sciknoworg/psychKG-pilot</a><br> Curious about structured extraction with Hugging Face models? Check out my related post:<br> 👉 <a href="https://medium.com/@jenlindadsouza/how-i-get-llms-on-hugging-face-to-speak-structured-data-1fb34bf15792"><em>How I Get LLMs on Hugging Face to Speak Structured Data</em></a></p><p>Let me know how you’re using structured extraction in your own research projects!</p><p>This is pilot is part of a collaborative project with <a href="https://bsky.app/profile/dirkwulff.bsky.social"><strong>Dirk Wulff</strong></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fac0c76800ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Get LLMs on Hugging Face to Speak Structured Data?]]></title>
            <link>https://medium.com/@jenlindadsouza/how-i-get-llms-on-hugging-face-to-speak-structured-data-1fb34bf15792?source=rss-30a9dfd80bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fb34bf15792</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[hugging-face]]></category>
            <category><![CDATA[structured-data]]></category>
            <category><![CDATA[information-extraction]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <dc:creator><![CDATA[Jennifer D'Souza, Ph.D.]]></dc:creator>
            <pubDate>Thu, 03 Jul 2025 09:56:06 GMT</pubDate>
            <atom:updated>2025-07-03T10:53:59.267Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Get LLMs on Hugging Face to Speak Structured Data? The Two-Library Magic (Instructor + Pydantic)</h3><h4>Building MVP Knowledge Graphs from Research Articles</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mm5GGOVjgZsgylhMhj13cQ.png" /><figcaption>The flow from unstructured text through a Hugging Face LLM to structured output via the Instructor library and Pydantic validation | Image by Author, generated using ChatGPT-o3.</figcaption></figure><h3>📍 The Problem: LLMs Speak Text. I Want Structure.</h3><p>I work a lot with research papers. And when I use large language models (LLMs) to extract knowledge from them — whether it’s entities, relationships, or claims — I don’t want free-form text. I want <strong>clean, structured data</strong> I can plug into a knowledge graph, a database, or an analysis pipeline.</p><p>But LLMs, especially open-weights ones on Hugging Face, don’t natively speak JSON. And when they <em>try</em>, it’s often wrong: missing commas, wrong fields, stray quotes, invalid arrays. This makes downstream parsing brittle and painful.</p><p>🤔 So what’s the fix?</p><h3>1. 🧭 Instructor</h3><p><a href="https://github.com/jxnl/instructor">Instructor</a> transforms <strong>any Hugging Face text generation model</strong> into a <strong>structured output generator</strong>. With just one line:</p><pre>results = llm(prompt, output_type=List[PsychTriple])</pre><p>Instructor:</p><ul><li>📜 Formats the prompt to include JSON schema hints</li><li>✅ Parses and validates the model output</li><li>🔁 Retries automatically if the output is malformed or incomplete</li></ul><p>It turns a generic language model into something that behaves more like an <strong>API client for structured responses</strong>.</p><h3>2. 🧱 Pydantic</h3><p><a href="https://docs.pydantic.dev/latest/">Pydantic</a> is a Python library for <strong>defining and validating structured data</strong> with types and constraints. Think of it as JSON Schema, but in Pythonic form.</p><p>Here’s the schema I use for extracting psychological triples:</p><pre>class PsychTriple(BaseModel):<br>    topic_or_construct: str<br>    measured_by: str<br>    justification: str</pre><p>This gives me:</p><ul><li>⚖️ Type validation</li><li>✅ Auto-parsing from model output</li><li>🔍 Clear error messages when something goes wrong</li></ul><p>And because Instructor directly integrates with Pydantic, I can just say:</p><pre>output_type=List[PsychTriple]</pre><p>…and the LLM is bound to that schema. No post-processing needed.</p><h3>3. 🔮 The Magic Duo: Instructor + Pydantic</h3><p>Together, these libraries let you build <strong>a typed interface on top of open-source language models</strong>.</p><p>You get:</p><ul><li>The openness and flexibility of Hugging Face models</li><li>The structure enforcement of Pydantic</li><li>The automation and retry logic of Instructor</li></ul><p>Result: A modular, robust pipeline for <strong>structured information extraction</strong> from unstructured text.</p><h3>4. 🔍 Use Case: Extracting Knowledge Triples from Psychology Papers</h3><p>Let’s walk through the full script I use to extract structured information from .xml psychology articles encoded in the TEI format. The goal is to populate a lightweight knowledge graph with the relationships between <strong>psychological constructs</strong> and their <strong>measurement instruments</strong>, along with a justification from the paper.</p><p>🔧 Start off with a small set of import statements for the relevant libraries</p><pre>import os<br>import json<br>from pathlib import Path<br>from typing import List<br>from bs4 import BeautifulSoup<br><br>from pydantic import BaseModel, ValidationError<br>from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline<br>from instructor import Instructor, patch_instructor<br>from tqdm import tqdm<br>import torch</pre><p>🧱 Step 1: Define the schema</p><pre>class PsychTriple(BaseModel):<br>    topic_or_construct: str<br>    measured_by: str<br>    justification: str</pre><p>📄 Step 2: Extract text from TEI XML</p><pre>def extract_text_from_tei_xml(tei_path: str) -&gt; str:<br>    try:<br>        with open(tei_path, &#39;r&#39;, encoding=&#39;utf-8&#39;) as file:<br>            soup = BeautifulSoup(file, &#39;lxml-xml&#39;)<br>            body = soup.find(&#39;text&#39;)<br>            return body.get_text(separator=&#39;\n&#39;) if body else &#39;&#39;<br>    except Exception as e:<br>        print(f&quot;Error parsing {tei_path}: {e}&quot;)<br>        return &quot;&quot;</pre><p>✍️ Step 3: Build the prompt with domain-specific instructions</p><pre>def build_prompt(text: str) -&gt; str:<br>    return f&quot;&quot;&quot;<br>You are an expert in psychology and computational knowledge representation. Your task is to extract key scientific information from psychology research articles to build a structured knowledge graph.<br><br>The knowledge graph aims to represent the relationships between psychological **topics or constructs** and their associated **measurement instruments or scales**. Specifically, for each article, extract information in the form of triples that capture:<br><br>1) The psychological topic or construct being studied  <br>2) The measurement instrument or scale used to assess it  <br>3) A brief justification (1–3 sentences) from the article text supporting this measurement link<br><br>Guidelines:<br>- Extract meaningful **phrases** (not full sentences or vague descriptions) for both `topic_or_construct` and `measured_by`, suitable for inclusion in a knowledge graph.<br>- Include a short justification for each extraction that clearly supports the connection.<br>- If the article does not discuss psychological constructs and how they are measured (e.g., no mention of constructs, instruments, or scales), return an empty list `[]`.<br><br>Input Paper:<br>\&quot;\&quot;\&quot;{text}\&quot;\&quot;\&quot;<br><br>Output: Provide your response as a JSON list in the following format:<br><br>[<br>  {{<br>    &quot;topic_or_construct&quot;: &quot;...&quot;,<br>    &quot;measured_by&quot;: &quot;...&quot;,<br>    &quot;justification&quot;: &quot;...&quot;<br>  }},<br>  ...<br>]<br>&quot;&quot;&quot;.strip()</pre><p>This prompt guides the LLM to extract structured triples — only if the article contains relevant content.</p><p>📤 Step 4: Process each file using Instructor</p><pre>def process_file(file_path: str, prompt_dir: str, output_dir: str, llm: Instructor) -&gt; bool:<br>    text = extract_text_from_tei_xml(file_path)<br>    if not text:<br>        print(f&quot;⚠️ Skipping empty or malformed text in {file_path}&quot;)<br>        return False<br><br>    prompt = build_prompt(text[:100000])<br>    prompt_path = Path(prompt_dir) / (Path(file_path).stem + &quot;.prompt.txt&quot;)<br>    output_path = Path(output_dir) / (Path(file_path).stem + &quot;.json&quot;)<br><br>    with open(prompt_path, &quot;w&quot;, encoding=&quot;utf-8&quot;) as f:<br>        f.write(prompt)<br><br>    try:<br>        results = llm(prompt, output_type=List[PsychTriple])<br>        if not results:<br>            print(f&quot;✅ {file_path} | Extracted 0 triples&quot;)<br>            return False<br><br>        with open(output_path, &quot;w&quot;, encoding=&quot;utf-8&quot;) as f:<br>            json.dump([r.model_dump() for r in results], f, indent=2)<br>        print(f&quot;✅ {file_path} | Extracted {len(results)} triples&quot;)<br>        return True<br>    except ValidationError as ve:<br>        print(f&quot;❌ Validation failed for {file_path}:\n{ve}&quot;)<br>    except Exception as e:<br>        print(f&quot;❌ Failed to process {file_path}: {e}&quot;)<br>    return False</pre><p>Prompts and structured outputs are saved per file, and invalid or irrelevant files are gracefully skipped.</p><p>🚀 Step 5: Run the pipeline with an LLM on Hugging Face</p><pre>def main():<br>    input_dir = input(&quot;Enter input directory with .xml files: &quot;).strip()<br>    prompt_dir = input(&quot;Enter directory to save prompts: &quot;).strip()<br>    output_dir = input(&quot;Enter directory to save JSON outputs: &quot;).strip()<br>    model_name = input(&quot;Enter Hugging Face model name (e.g., Qwen/Qwen2.5-72B-Instruct): &quot;).strip()<br><br>    for d in [input_dir, prompt_dir, output_dir]:<br>        os.makedirs(d, exist_ok=True)<br><br>    tokenizer = AutoTokenizer.from_pretrained(model_name)<br>    model = AutoModelForCausalLM.from_pretrained(<br>        model_name,<br>        device_map=&quot;auto&quot;,<br>        torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32<br>    )<br><br>    text_gen_pipeline = pipeline(<br>        &quot;text-generation&quot;,<br>        model=model,<br>        tokenizer=tokenizer,<br>        max_new_tokens=8000,<br>        return_full_text=False<br>    )<br><br>    llm = Instructor(text_gen_pipeline)<br><br>    files = list(Path(input_dir).glob(&quot;*.xml&quot;))<br>    if not files:<br>        print(f&quot;⚠️ No .xml files found in {input_dir}&quot;)<br>        return<br><br>    total_articles = 0<br>    satisfied_articles = 0<br><br>    for xml_file in tqdm(files, desc=&quot;Processing TEI XML files&quot;):<br>        total_articles += 1<br>        success = process_file(str(xml_file), prompt_dir, output_dir, llm)<br>        if success:<br>            satisfied_articles += 1<br><br>    print(&quot;\n=== Extraction Summary ===&quot;)<br>    print(f&quot;Total articles processed: {total_articles}&quot;)<br>    print(f&quot;Articles with extracted constructs and measures: {satisfied_articles}&quot;)<br>    print(f&quot;Articles without relevant content: {total_articles - satisfied_articles}&quot;)</pre><h3>🪷 But Wait — What Is Instructor Actually Doing?</h3><p>You might wonder: <em>Couldn’t I do this with just a prompt, a </em><em>for loop, and some </em><em>json.loads() calls?</em></p><p>Here’s what Instructor is really doing for you behind the scenes:</p><h4>1. Prompt Engineering with Schema Injection</h4><p>It takes your Pydantic model (e.g., List[PsychTriple]) and:</p><ul><li>Converts it into a schema hint</li><li>Embeds this schema into the prompt automatically</li><li>Encourages the LLM to emit structured output that matches</li></ul><h4>2. Parsing + Validation</h4><p>Once the LLM responds, Instructor:</p><ul><li>Parses the output into JSON</li><li>Validates every record against your schema using Pydantic</li><li>If it doesn’t match (e.g., wrong types, missing fields), it raises errors</li></ul><h4>3. Automatic Retries</h4><p>If the model output is malformed or doesn’t pass validation, Instructor:</p><ul><li>Automatically re-prompts the model</li><li>Optionally adds error hints (if using patch_instructor)</li><li>Retries multiple times until a valid response is received or the retry limit is reached</li></ul><h4>4. Clean, Typed Output</h4><p>Rather than raw strings or loose dictionaries, Instructor returns <strong>Pythonic structured objects</strong>, ready for downstream use:</p><h3>🏁 Finally… What I Got</h3><p>After running the pipeline:</p><ul><li>🗂️ Clean, validated JSON outputs per article</li><li>⚙️ Consistent, typed data ready for ingestion into a knowledge graph</li><li>🧾 Full traceability (saved prompts per input file)</li><li>✅ Zero parsing bugs</li></ul><h3>🧩 Summary</h3><p><strong>Instructor + Pydantic + Hugging Face = Structured Generation Made Easy</strong><br>If you work with messy scientific text and want to turn it into something structured, this trio is a game-changer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*_E88G-rv4ehlPS3JAEtUCQ.png" /></figure><h3>🚀 Bonus: Want to Go Further?</h3><ul><li>🧪 Add unit tests with mockLLM responses</li><li>📊 Analyze extraction patterns across corpora</li><li>🕸️ Build a Streamlit app to browse your structured results</li></ul><h3>🧠 Final Thought</h3><p>LLMs don’t have to speak in riddles. With the right tools, they can speak structured data fluently.</p><p><strong>Instructor and Pydantic bring that into reach — today, and fully open-source.</strong></p><p>How do <em>you</em> handle structured data with LLMs?<br>Do you use parsing tricks, few-shot prompting, function calling, or something else entirely?<br>I’d love to hear your workflows, hacks, or questions in the comments or replies.</p><p>Until then — <strong>may your JSONs be valid and your triples meaningful.</strong> ✨</p><h3>🔗 Resources</h3><ul><li>📦 <strong>Code repository: </strong><a href="https://github.com/sciknoworg/psychKG-pilot/">https://github.com/sciknoworg/psychKG-pilot/</a></li><li>✍️ <strong>Related post:</strong> <a href="https://medium.com/@jenlindadsouza/psychkg-how-to-build-a-minimal-knowledge-graph-for-psychology-fac0c76800ac">How I Use Instructor + Pydantic with OpenAI for Structured Outputs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fb34bf15792" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Prompt an LLM to Generate a Research Knowledge Graph (KG) for Complex Scientific Domains]]></title>
            <link>https://medium.com/@jenlindadsouza/how-to-prompt-an-llm-to-generate-a-research-knowledge-graph-kg-for-complex-scientific-domains-2447fe8ff081?source=rss-30a9dfd80bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2447fe8ff081</guid>
            <category><![CDATA[science-communication]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <category><![CDATA[atomic-layer-deposition]]></category>
            <dc:creator><![CDATA[Jennifer D'Souza, Ph.D.]]></dc:creator>
            <pubDate>Sat, 21 Sep 2024 14:34:14 GMT</pubDate>
            <atom:updated>2024-09-23T13:57:32.383Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>A Case Study on Atomic Layer Deposition (ALD) in Materials Science and Engineering</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PpT0t-CjwCCTV92Dqd72_A.jpeg" /><figcaption>Atomic Layer Deposition Research + Knowledge Graphs + LLMs — Image by Author, generated using ChatGPT.</figcaption></figure><p>Atomic Layer Deposition (ALD) [1] is a technique used to coat materials with extremely thin layers, one atomic layer at a time. This process allows for very precise control over the thickness and composition of the coating, making it ideal for applications where such precision is crucial, like in electronics and nanotechnology. Essentially, it’s like painting with atoms, using a method that builds up layers step-by-step to get the desired finish.</p><p>In ALD, the “process material” and “process reactants” are pivotal elements. The process material, which is the substrate on which atomic layers are deposited, significantly influences the adherence and quality of the film due to its chemical composition, surface structure, and temperature. Meanwhile, process reactants are the chemicals used to build these layers. ALD involves the sequential exposure of the substrate to these reactants, each interacting with the surface in a self-limiting manner to deposit a single atomic layer per cycle. This precise interaction dictates the film’s final composition. For instance, creating a thin film of alumina (Al₂O₃) might involve using trimethylaluminum and water as reactants. Such meticulous control is crucial for applications in electronics, optics, and other fields, ensuring uniformity and exactness in film thickness and composition.</p><p>With this in mind, in this post, I introduce and discuss a novel way to report ALD processes in knowledge graphs (KGs), specifically the Open Research Knowledge Graph (<a href="https://orkg.org/">ORKG</a>) [2], such that the resulting data is AI-ready. I also discuss a lightweight, yet effective, approach to leverage LLMs to retrospectively extract information from existing research articles to populate an AI-ready ORKG focused on ALD process information.</p><p>Utilizing Semantic Web [3] tools such KGs to create AI-ready ALD databases transforms traditional ALD process reporting, enhancing discoverability, interoperability, and semantic richness of data. These structured databases allow for more dynamic updates and collaborations, enabling automated reasoning to infer new knowledge and make predictions about ALD processes. Knowledge graphs make ALD data more AI-ready by structuring it in a way that is directly usable by machine learning models, which can predict new material properties or optimize process parameters more efficiently than traditional statistical approaches. By making ALD data more accessible and actionable, KGs empower researchers to harness advanced analytical and predictive capabilities, pushing the boundaries of what’s possible in the field.</p><p>Knowledge graphs are used to store interconnected descriptions of entities — objects, events, or concepts — with data that is interlinked and semantically understandable both by human operators and machines. They leverage Semantic Web technologies like <a href="https://en.wikipedia.org/wiki/Ontology_(information_science)">ontologies</a>, <a href="https://en.wikipedia.org/wiki/Resource_Description_Framework">RDF</a> (Resource Description Framework), and <a href="https://en.wikipedia.org/wiki/SPARQL">SPARQL</a> to link data across domains and enable better data integration, querying, and reasoning. By doing so, KGs play a key role in making data interoperable and accessible for AI and machine learning applications.</p><p>The first step to creating a ALD-process-related KG is having a schema, i.e. a set of properties that capture the salient ALD process information. Such a schema is shown in the 41 lines JSON file below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*fwQRK_b_jQhVpR697mCBFQ.jpeg" /><figcaption>Figure 1. An Atomic Layer Deposition (ALD) schema for reporting ALD processes in a KG</figcaption></figure><p>While this schema presents various opportunities for refinement w.r.t. “Linking temperature and pressure units to standard unit ontologies (<a href="https://qudt.org/">QUDT ontology</a>) or materials science ontologies (<a href="https://emmo-repo.github.io/">EMMO</a>, <a href="https://matportal.org/ontologies/MATONTO?p=classes">MatOnto</a>)” [4], it offers a good starting point for additional details to document ALD processes in structured way. Now since the end goal of this exercise is to create a AI-ready database in the ORKG, I went ahead and defined this schema as a template in the ORKG. Here is a link to the template <a href="https://orkg.org/template/R733029">https://orkg.org/template/R733029</a>. A UML-like class diagram illustration is offered in Figure 2 below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*X9zn25pRw7FcMQ2Mz4SMxA.png" /><figcaption>Figure 2. UML-like class diagram representation of the ALD structured process description template <a href="https://orkg.org/template/R733029">https://orkg.org/template/R733029</a> from the ORKG.</figcaption></figure><p>Then, one needs to compile a list of ALD research papers to extract structured ALD process descriptions from based on the schema. I harnessed the AtomicLimits ALD database — an esteemed resource meticulously curated by experts in the field. You can explore it <a href="https://www.atomiclimits.com/alddatabase/">here</a>. It addresses the explosive growth in ALD processes, catering to an ever-expanding array of materials, and thereby improving the findability of relevant research. Given the development of a huge number of ALD processes for a very large set — and still growing number — of materials, researchers at <a href="https://research.tue.nl/en/">Eindhoven University of Technology</a> led by <a href="https://research.tue.nl/en/persons/wmm-erwin-kessels">Prof. Erwin Kessels</a> created an online database where the expert community could submit the research materials and reactants linked to research papers. <a href="https://www.atomiclimits.com/2019/03/20/and-here-it-is-the-online-ald-database-a-website-where-you-can-easily-search-browse-and-add-ald-processes/">Here</a> is the post that introduced this database to the community. Moreover, the database has been creatively visualized as an ALD periodic table, making it not only a practical tool but also a visually engaging one for users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f54telmZz2TVI_90BjgZgQ.png" /><figcaption>Figure 3. The Atomic Limits ALD Database (<a href="https://www.atomiclimits.com/alddatabase/">https://www.atomiclimits.com/alddatabase/</a>) capturing ALD process-related materials and reactants researched visualized as an ALD periodic table.</figcaption></figure><p>After compiling the list of papers from the ALD database as well as carrying out supporting task for knowledge extraction, i.e. getting the full text of the papers to mine the knowledge using the <a href="https://api.ask.orkg.org/docs">ORKG Ask API</a>, I shifted focus to the LLM and, specifically, to defining the knowledge extraction prompt. The OpenAI GPT models is a relatively easy-to-setup starting point since once can directly use their API to query the models without being concerned about GPU resources to host an LLM in-house. Here I then decided to use the recent <a href="https://openai.com/index/hello-gpt-4o/">GPT-4o</a> LLM and leveraged the <a href="https://platform.openai.com/docs/assistants/overview">Assistants API</a>. I went ahead and defined the system prompt. A system prompt defines the GPT assistant role to align its behavior (“persona”) to the end task. On the other hand, as another class of prompts, user prompts are then used to interact with this role-aligned GPT assistant providing queries or statements or input text from which one wants to extract data expecting it to perform a task successfully. In keeping with the in-context learning paradigm first introduced in the <a href="https://papers.nips.cc/paper/2020/hash/1457c0d6bfcb4967418bfb8ac142f64a-Abstract.html">GPT-3 paper</a> by Brown et al., the user prompt can also contain few-shot examples that demonstrate the successful task completion. Anyway, going back to the system prompt definition for the ALD process structured information extraction, Figure 3 below illustrates the final prompt used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GLDHS-JKrDvX9muE0FvVlQ.png" /><figcaption>Figure 3: Prompt defined as a system message for a GPT assistant with specific instructions about how to handle the knowledge extraction task related to Atomic Layer Deposition (ALD) processes.</figcaption></figure><p>Here’s an exercise you can try: as a quick enhancement to the above workflow, modify the code with <a href="https://github.com/jxnl/instructor">Instructor</a> python library that makes it easy to work with structured outputs from LLMs. Another one: replace the OpenAI API with <a href="https://github.com/BerriAI/litellm">LiteLLM</a> instead that makes it easier to query various other LLMs.</p><p>Summing things up, yes, the post so far has covered several aspects of establishing an end-to-end workflow to compile research knowledge in a complex scientific domain using an LLM. It began by introducing the ALD domain and outlining the schema for knowledge extraction that would shape the research knowledge graph. It then explored the main tool in question, the LLM, which, with its vast parameter space equipping it with generative AI capabilities, could be applied as a potent tool for the knowledge extraction task in this complex domain and is expected to handle it with reasonable accuracy. I will leave out the specific topic of evaluating the LLM output and defining knowledge curation workflows for another post.</p><p>Equipped with the structured knowledge, the last step was storing it in the ORKG as an AI-ready database. For this, various modules of the <a href="https://orkg.readthedocs.io/en/latest/index.html">ORKG Python Package</a> can employed to programmatically upload the structured data, aligning it with the <a href="https://orkg.org/template/R733029">Comprehensive ALD Profile</a> ORKG semantic template. And, voila, we have compiled a research knowledge graph for a complex scientific domain using an LLM!</p><h3>Outcomes and Impact</h3><p><strong>Sample ORKG Paper: </strong>View an example of an imported ORKG paper, titled “Atomic Layer Deposition of CsI and CsPbI3”, which includes structured ALD process descriptions for the two materials CsI and CsPbI3, respectively, as detailed, machine-actionable data.</p><ul><li>CsI Contribution: <a href="https://orkg.org/paper/R732976/R739356">https://orkg.org/paper/R732976/R739356</a></li><li>CsPbI3 Contribution: <a href="https://orkg.org/paper/R732976/R739360">https://orkg.org/paper/R732976/R739360</a></li></ul><p><strong>ORKG Comparison as a ALD Process Research Overview: </strong>Explore a comparative overview of 167 contributions on ALD processes illustrated as a snapshot in Figure 4 below. This comparison provides a structured summary, facilitating a quick review of research findings and methodologies on ALD processes.</p><ul><li>View Comparison: <a href="https://orkg.org/comparison/R739481">https://orkg.org/comparison/R739481</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XVx-PWr5A49arv5yEjifQw.png" /><figcaption>Figure 4: An ORKG Comparison Overview of Structured ALD Process Description Summaries over hundreds of Scientific Articles. The full comparison can be visited here <a href="https://orkg.org/comparison/R739481">https://orkg.org/comparison/R739481</a>.</figcaption></figure><p>The workflow in this post is defined in the context “AI-Aware Pathways to Sustainable Semiconductor Process and Manufacturing Technologies (<a href="https://www.chemanager-online.com/en/news/german-merck-and-intel-ai-research-project">AWASES</a>)” research project funded by <a href="https://www.merckgroup.com/en">Merck</a> and <a href="https://www.intel.de/content/www/de/de/homepage.html">Intel</a> co-operations. Collaborating together with researchers from <a href="https://www.tue.nl/en/">Eindhoven University</a>, <a href="https://www.l3s.de/">L3S Research Center,</a> and <a href="https://warwick.ac.uk/">University of Warwick</a>, one of our aims is to develop AI-ready databases by extracting and integrating knowledge from ALD/E (Atomic Layer Deposition/Etching) processes. We build on existing crowdsourced databases, such as the one launched by <a href="https://www.tue.nl/en/">TU/e</a> in 2019 (<a href="https://www.atomiclimits.com/alddatabase/">TU/e Atomic Limits ALD Database</a>, DOI: <a href="https://doi.org/10.6100/alddatabase">10.6100/alddatabase</a>). Our goal is to make these databases ready for AI applications, fostering innovations in materials design, autonomous experimentation, and AI-driven process development [5]. As a step toward this, with the structured ALD process data imported in the ORKG, users can navigate through the ORKG platform to access papers or comparisons. Specifically the relevant papers can be found in our <a href="https://orkg.org/observatory/AIAware_Pathways_to_Sustainable_Semiconductor_Process_and_Manufacturing_Technologies">AWASES project observatory</a>. This integration supports enhanced discovery and research analytics capabilities, promoting a deeper understanding and further research in ALD technology.</p><p>Finally, I’ve made the scripts to reproduce the workflow of this post publicly available on Github <a href="https://github.com/jd-coderepos/awases-ald/">https://github.com/jd-coderepos/awases-ald/</a>.</p><p>🌟 <em>~ Until next time, keep exploring and stay curious! Cheers! ~</em> 🌟</p><p>As parting words, I’d like to leave you with some recommendations that I’ve found particularly relevant and effective for handling text data mining tasks, especially when working with scientific articles…</p><h4><strong>Additional Resources for Text Data Mining — </strong>A Small Tool List (cf: I couldn’t recommend enough this excellent resource for additional tools <a href="https://matextract.pub/index.html">https://matextract.pub/index.html</a> [4])</h4><ol><li><a href="https://github.com/fabiobatalha/crossrefapi">crossrefapi</a> — pythonic library to get metadata of relevant scientific articles from various sources via crossref. Usage example: 100 sources including metadata on the topic ‘buchwald-hartwig coupling’ are extracted and saved into a JSON file <a href="https://matextract.pub/content/obtaining_data/crossref_search.html">https://matextract.pub/content/obtaining_data/crossref_search.html</a></li><li><a href="https://github.com/petermr/pygetpapers">pygetpapers</a> — articles from open-access databases can be collected using this library with support for multiple open access APIs including eupmc, crossref, arXiv, bioRxiv, medRxiv, rxivist-bio, rxivist-med</li><li><a href="https://github.com/jannisborn/paperscraper">paperscraper</a> — a python package for scraping publication metadata or full PDF files from PubMed or preprint servers such as arXiv, medRxiv, bioRxiv and chemRxiv. Usage example: download full-text articles from ChemRxiv on the topic of ‘buchwald-hartwig coupling’ <a href="https://matextract.pub/content/obtaining_data/data_mining.html">https://matextract.pub/content/obtaining_data/data_mining.html</a></li><li><a href="https://github.com/VikParuchuri/marker">marker</a> — a python library to convert PDF to markdown quickly with high accuracy; has been <a href="https://github.com/VikParuchuri/marker/blob/master/data/images/overall.png">compared</a> to <a href="https://github.com/facebookresearch/nougat">nougat</a>.</li><li><a href="https://github.com/mindee/doctr">docTR</a> (Document Text Recognition) — a seamless, high-performing &amp; accessible library for OCR-related tasks powered by Deep Learning. Documents can be interpreted from PDF or images.</li></ol><h3><strong>References</strong></h3><ol><li>Steven M. George (2010). <strong>Atomic layer deposition: an overview.</strong> <em>Chemical reviews</em>, <em>110</em>(1), 111–131.</li><li>Sören Auer, Allard Oelen, Muhammad Haris, Markus Stocker, Jennifer D’Souza, Kheir Eddine Farfar, Lars Vogt, Manuel Prinz, Vitalis Wiens, and Mohamad Yaser Jaradeh (2020). <strong>Improving Access to Scientific Literature with Knowledge Graphs</strong>. <em>Bibliothek Forschung und Praxis</em>, vol. 44, no. 3, pp. 516–529 <a href="https://doi.org/10.1515/bfp-2020-2042">https://doi.org/10.1515/bfp-2020-2042</a></li><li>Tim Berners-Lee, James Hendler, and Ora Lassila (2023). <strong>The Semantic Web: A new form of Web content that is meaningful to computers will unleash a revolution of new possibilities.</strong> In <em>Linking the World’s Information: Essays on Tim Berners-Lee’s Invention of the World Wide Web</em>, pp. 91–103 <a href="https://doi.org/10.1145/3591366.3591376">https://doi.org/10.1145/3591366.3591376</a></li><li>Mara Schilling-Wilhelmi, Martiño Ríos-García, Sherjeel Shabih, María Victoria Gil, Santiago Miret, Christoph T. Koch, José A. Márquez, and Kevin Maik Jablonka (2024). <strong>From Text to Insight: Large Language Models for Materials Science Data Extraction.</strong> <em>arXiv preprint arXiv:2407.16867</em>.</li><li>Adrie Mackus, Bart Macco, Bora Karasulu, Jennifer D’Souza, Sören Auer, &amp; Erwin Kessels. <strong>Turning Online ALD and ALE Databases Into AI-Ready Tools for Development of New Sustainable Materials and Fabrication Processes. </strong>Poster presented at AVS 24th Int. Conf. on Atomic Layer Deposition (ALD 2024). <a href="https://ald2024.avs.org/wp-content/uploads/2024/04/Abstract-Book.pdf">View Poster</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2447fe8ff081" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evaluating LLMs for Structured Science Summarization — A Multifaceted Approach]]></title>
            <link>https://medium.com/@jenlindadsouza/evaluating-llms-for-structured-science-summarization-e9fae7f3fd9a?source=rss-30a9dfd80bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9fae7f3fd9a</guid>
            <category><![CDATA[orkg]]></category>
            <category><![CDATA[evaluation-metric]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[evaluation]]></category>
            <dc:creator><![CDATA[Jennifer D'Souza, Ph.D.]]></dc:creator>
            <pubDate>Mon, 09 Sep 2024 16:15:30 GMT</pubDate>
            <atom:updated>2024-09-14T09:54:03.879Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Harnessing AI for Science</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KdHTmA2HAYY8JAQ0maUoQQ.jpeg" /><figcaption>Evaluating Structured Science Summaries as KGs — Image by Author, generated using ChatGPT.</figcaption></figure><p>So, you’ve read up on the latest <a href="https://en.wikipedia.org/wiki/Large_language_model">Large Language Models</a> (LLMs) like <a href="https://openai.com/index/gpt-4-research/">GPT</a>, <a href="https://www.llama.com/">Llama</a>, and <a href="https://mistral.ai/news/announcing-mistral-7b/">Mistral</a>, and you’re intrigued by their potential. <em>But how do they really perform when tasked with the heavy lifting of structured science summarization within the Open Research Knowledge Graph (ORKG)? And more importantly, how can their performance be accurately evaluated?</em> You’re not alone in asking these questions.</p><p>In this post, I’ll walk you through a comprehensive study that not only tests these LLMs in the realm of “structured science summarization” but also details the multifaceted evaluation approach to assessing their effectiveness. From semantic alignment to expert evaluations, we’ll explore how these models have the potential to transform the landscape of scientific literature summarization. Whether you’re developing your own application or simply curious about the future of AI in academia, understanding these evaluation strategies will provide crucial insights into the capabilities and current limitations of LLMs.</p><p>So, <em>what are structured science summaries?</em> One notable initiative aimed at publishing structured representations of scientific papers is the Open Research Knowledge Graph (ORKG, <a href="https://orkg.org/">https://orkg.org/</a> accessed on 9 September 2024) [1]. The ORKG endeavors to describe papers as structured summaries in a KG in terms of salient properties of the research. Furthermore, a distinguishing characteristic of the properties is that they are also generically applicable across various contributions on the same problem, thus making the structured paper descriptions comparable. For instance, properties like ‘model name’, ‘model family’, ‘pretraining architecture’, ‘number of parameters’, and ‘hardware used’ — illustrated in Figure 1 — effectively create structured, machine-actionable summaries of research on ‘transformer models’ within Computer Science.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DmiTlJNr1ZdRlHrMEF9Ybw.png" /><figcaption>Figure 1. ORKG Comparison — Catalog of Transformer Models. This view is a snapshot of the full<br>comparison published here <a href="https://orkg.org/comparison/R656113">https://orkg.org/comparison/R656113</a><a href="https://orkg.org/comparison/R656113/,">,</a> accessed on 9 September 2024.</figcaption></figure><p>As another example, papers with the research problem ‘DNA sequencing techniques’ in the domain of Biology can be described as structured summaries based on the following properties: ‘sequencing platform’, ‘read length in base pairs’, ‘reagents cost’, and ‘runtime in days’ (Figure 2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XiNZknt6gWkLw0LS6hq56A.png" /><figcaption>Figure 2. ORKG Comparison — Survey of sequencing techniques. This view is a snapshot of the full<br>comparison published here <a href="https://orkg.org/comparison/R44668/,">https://orkg.org/comparison/R44668/,</a> accessed on 9 September 2024.</figcaption></figure><p>Such comparisons aggregate structured summaries based on common research themes, simplifying how researchers keep up with advancements through targeted, strategic reading over large volumes of papers. The ORKG aims to revolutionize the summarization and comparison of scientific papers by structuring them into an interconnected knowledge graph. Traditionally, this process has been manual, time-consuming, and prone to inconsistency. The introduction of LLMs promises to automate and standardize this process, potentially transforming the landscape of scientific research documentation. In a recent work [2], we applied 3 LLMs, viz. GPT, Llama, and Mistral, on a multidiscplinary corpus (publicly accessible here <a href="https://doi.org/10.25835/6oyn9d1n">https://doi.org/10.25835/6oyn9d1n</a>) of various research themes and their paper collections compiled from the ORKG prompting the LLMs to generate their structured properties. Note human-annotated structured descriptions were also obtained from the ORKG as a reference for evaluating the LLM performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hz_iny5nAIr40M4tGUQY3g.png" /><figcaption>Figure 3. Our multidisciplinary corpus research field distribution of structured science summaries compiled from the Open Research Knowledge Graph (ORKG).</figcaption></figure><p>Turning then to the central question of the study… “<em>How good are LLMs in performing structured science summarization? Can they replace humans</em>?” This is where I now emphasize the comprehensive and multifaceted evaluation approach of the LLM performance from this study. This is outlined by the acronym <strong>SMES.</strong></p><p><em>Semantic alignment </em>measurement of the LLM-generated properties vs. human annotations. In this context, semantic alignment refers to the degree to which the two sets of properties share similar meanings. GPT-3.5 was applied as the evaluator and was prompted to produce an alignment rating on a scale from 1 to 5. Conversely, <em>semantic deviation </em>was also tested.</p><p><em>Mappings</em> counted between the LLM-generated properties vs. human annotations. This approach diverges from the previous semantic alignment and deviation evaluations, which considered the lists as a whole. This approach used GPT-3.5 to count the number of overlapping properties. A snapshot of the prompt is shown in Figure 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iFjfK3TapVA_QBdeYUr-Mw.png" /><figcaption>Figure 4. A snapshot of the prompt to the LLM evaluator to count the number of overlapping properties between two lists.</figcaption></figure><p>Embedding-based approach to compute semantic distances between LLM-generated and human-annotated properties. Specifically,<br>a scientific language model, like SciNCL, can be applied to generate vector embeddings for both the ORKG properties and the LLM-generated research dimensions. The embeddings can then be compared using cosine similarity as a measure of distance.</p><p>Survey soliciting opinions from human participants was designed to solicit the impressions of domain experts when shown their original annotated properties versus the research dimensions generated by the LLM. The survey questionnaire is shown in Figure 5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wcpmksbU7CVZ8jiwKDhyZQ.png" /><figcaption>Figure 5: Survey questionnaire soliciting human feedback on LLM-generated properties compared to their own annotations.</figcaption></figure><p>With <strong>SMES</strong>, the reader is drawn to the observation that evaluating the performance of LLMs is more often than not — multifaceted!</p><p>And there you have it! The journey through the capabilities of LLMs in structured science summarization reveals both their potential and limitations. While LLMs like GPT, Llama, and Mistral have demonstrated impressive strides towards understanding and structuring scientific knowledge, the study underscores the need for more tuning and targeted training. The multifaceted evaluation SMES strategy — ranging from semantic alignment to expert surveys — highlight that while LLMs can significantly aid the research process, they aren’t quite ready to replace human expertise. Instead, they serve as robust tools, augmenting human efforts to manage and navigate the burgeoning landscape of scientific literature.</p><p>So, as we continue pushing the boundaries of what these AI models can achieve, let’s remain both critical and optimistic. The future of AI in science is not just about replacing the old with the new but enhancing our capabilities and reaching new heights of innovation and efficiency. Stay tuned, and keep experimenting, because the next breakthrough in AI-powered research could be just around the corner!</p><h3><strong>References</strong></h3><p>[1] Sören Auer, Allard Oelen, Muhammad Haris, Markus Stocker, Jennifer D’Souza, Kheir Eddine Farfar, Lars Vogt, Manuel Prinz, Vitalis Wiens, and Mohamad Yaser Jaradeh (2020). <strong>Improving Access to Scientific Literature with Knowledge Graphs</strong>. <em>Bibliothek Forschung und Praxis</em>, vol. 44, no. 3, pp. 516–529 <a href="https://doi.org/10.1515/bfp-2020-2042">https://doi.org/10.1515/bfp-2020-2042</a></p><p>[2] Vladyslav Nechakhin, Jennifer D’Souza, and Steffen Eger (2024). Evaluating Large Language Models for Structured Science Summarization in the Open Research Knowledge Graph. Information 2024, 15, 328. <a href="https://doi.org/10.3390/info15060328">https://doi.org/10.3390/info15060328</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9fae7f3fd9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>